]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - bfd/ChangeLog
a2342588e80888a3ef643d990c29e526083add05
[thirdparty/binutils-gdb.git] / bfd / ChangeLog
1 2020-08-12 Jon Turney <jon.turney@dronecode.org.uk>
2
3 * elf.c (elfcore_grok_win32pstatus): Use unsigned int for
4 win32pstatus note type to avoid signedness comparison warning.
5
6 2020-07-21 Jon Turney <jon.turney@dronecode.org.uk>
7
8 * elf.c (elfcore_grok_win32pstatus): Warn on malformed
9 win32pstatus notes, and return TRUE so we continue rather than
10 stopping as if it was an error.
11
12 2020-07-01 Jon Turney <jon.turney@dronecode.org.uk>
13
14 * elf.c (elfcore_grok_win32pstatus): Handle NOTE_INFO_MODULE64.
15
16 2020-07-11 Jon Turney <jon.turney@dronecode.org.uk>
17
18 * elf.c (elfcore_grok_win32pstatus): Don't apply size constraint
19 for NOTE_INFO_THREAD to all win32pstatus ELF notes, instead apply
20 appropriate size constraint for each win32pstatus note type.
21
22 2020-07-01 Jon Turney <jon.turney@dronecode.org.uk>
23
24 * elf.c (elfcore_grok_win32pstatus): Don't hardcode the size of
25 the Win32 API thread CONTEXT type read from a NOTE_INFO_THREAD
26 win32pstatus note.
27
28 2020-07-11 Jon Turney <jon.turney@dronecode.org.uk>
29
30 * elf.c (NOTE_INFO{_PROCESS,_THREAD,_MODULE}): Define.
31 (elfcore_grok_win32pstatus): Use.
32
33 2020-07-01 Jon Turney <jon.turney@dronecode.org.uk>
34
35 * elf.c (elfcore_grok_win32pstatus): Fix the offset used to read
36 the tid from a win32pstatus NOTE_INFO_THREAD ELF note. Fix
37 offsets used to read NOTE_INFO_PROCESS.
38
39 2020-08-12 Nick Clifton <nickc@redhat.com>
40
41 * po/ru.po: Updated Russian translation.
42 * po/sr.po: Updated Serbian translation.
43
44 2020-08-07 David Faust <david.faust@oracle.com>
45
46 * elf64-bpf.c (bpf_elf_relocate_section): Ensure signed division for
47 DISP16 and DISP32 relocations.
48
49 2020-08-05 David Faust <david.faust@oracle.com>
50
51 * elf64-bpf.c (bpf_elf_generic_reloc): New function.
52 (bpf_elf_howto_table): Use it here.
53 (bpf_elf_relocate_section): Use addends recorded in input_bfd for
54 instruction and data relocations.
55
56 2020-08-03 Alan Modra <amodra@gmail.com>
57
58 * vms-lib.c (vms_traverse_index): Sanity check size remaining
59 before accessing vms_idx or vms_elfidx.
60
61 2020-08-03 Alan Modra <amodra@gmail.com>
62
63 PR 26330
64 * elf.c (_bfd_elf_get_symtab_upper_bound): Sanity check symbol table
65 size against file size. Correct LONG_MAX limit check.
66 (_bfd_elf_get_dynamic_symtab_upper_bound): Likewise.
67 (_bfd_elf_get_reloc_upper_bound): Don't check file size if writing.
68 (_bfd_elf_get_dynamic_reloc_upper_bound): Likewise.
69 * elf64-x86-64-.c (elf_x86_64_get_synthetic_symtab): Use
70 bfd_malloc_and_get_section.
71
72 2020-07-31 Alan Modra <amodra@gmail.com>
73
74 PR 26314
75 * elflink.c (bfd_elf_link_record_dynamic_symbol): Don't allow
76 IR symbols to become dynamic.
77 (elf_link_add_object_symbols): Don't exclude IR symbols when
78 deciding whether an as-needed shared library is needed.
79
80 2020-07-30 Szabolcs Nagy <szabolcs.nagy@arm.com>
81
82 PR ld/26312
83 * elfnn-aarch64.c (elfNN_aarch64_init_small_plt0_entry): Set sh_entsize
84 to 0.
85 (elfNN_aarch64_finish_dynamic_sections): Remove sh_entsize setting.
86
87 2020-07-30 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
88
89 * bfd.m4 (BFD_SYS_PROCFS_H): New macro.
90 (BFD_HAVE_SYS_PROCFS_TYPE): Require BFD_SYS_PROCFS_H.
91 Don't define _STRUCTURED_PROC.
92 (BFD_HAVE_SYS_PROCFS_TYPE_MEMBER): Likewise.
93 * elf.c [HAVE_SYS_PROCFS_H] (_STRUCTURED_PROC): Don't define.
94 * configure.ac: Use BFD_SYS_PROCFS_H to check for <sys/procfs.h>.
95 * configure, config.in: Regenerate.
96 * Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS.
97 * Makefile.in, doc/Makefile.in: Regenerate.
98
99 2020-07-30 H.J. Lu <hongjiu.lu@intel.com>
100
101 * elf-bfd.h (sym_cache): Moved before elf_link_hash_table.
102 (elf_link_hash_table): Add sym_cache.
103 * elf32-arm.c (elf32_arm_link_hash_table): Remove sym_cache.
104 (elf32_arm_check_relocs): Updated.
105 (elf32_arm_size_dynamic_sections): Likewise.
106 * elf32-bfin.c (bfin_link_hash_table): Removed.
107 (bfin_link_hash_newfunc): Updated.
108 (bfin_hash_table): Removed.
109 * elf32-csky.c (csky_elf_link_hash_table): Remove sym_cache.
110 (csky_elf_check_relocs): Updated.
111 * elf32-hppa.c (elf32_hppa_link_hash_table): Remove sym_cache.
112 (elf32_hppa_check_relocs): Updated.
113 * elf32-i386.c (elf_i386_tls_transition): Updated.
114 (elf_i386_convert_load_reloc): Likewise.
115 (elf_i386_check_relocs): Likewise.
116 * elf32-m32r.c (elf_m32r_link_hash_table): Removed.
117 (m32r_elf_hash_table): Updated.
118 (m32r_elf_link_hash_table_create): Likewise.
119 (m32r_elf_create_dynamic_sections): Likewise.
120 (m32r_elf_adjust_dynamic_symbol): Likewise.
121 (allocate_dynrelocs): Likewise.
122 (m32r_elf_size_dynamic_sections): Likewise.
123 (m32r_elf_relocate_section): Likewise.
124 (m32r_elf_finish_dynamic_symbol): Likewise.
125 (m32r_elf_check_relocs): Likewise.
126 * elf32-m68hc1x.h (m68hc11_elf_link_hash_table): Remove
127 sym_cache.
128 * elf32-m68k.c (elf_m68k_link_hash_table): Likewise.
129 (elf_m68k_check_relocs): Updated.
130 * elf32-metag.c (elf_metag_link_hash_table): Remove sym_cache.
131 (elf_metag_check_relocs): Updated.
132 * elf32-microblaze.c (elf32_mb_link_hash_table): Remove sym_sec.
133 (microblaze_elf_check_relocs): Updated.
134 * elf32-nds32.c (nds32_elf_link_hash_table_create): Likewise.
135 (nds32_elf_create_dynamic_sections): Likewise.
136 (nds32_elf_adjust_dynamic_symbol): Likewise.
137 (nds32_elf_check_relocs): Likewise.
138 * elf32-nds32.h (elf_nds32_link_hash_table): Remove sdynbss,
139 srelbss and aym_cache.
140 * elf32-nios2.c (elf32_nios2_link_hash_table): Remove sym_cache.
141 (nios2_elf32_check_relocs): Updated.
142 * elf32-or1k.c (elf_or1k_link_hash_table): Remove sym_sec.
143 (or1k_elf_check_relocs): Updated.
144 * elf32-ppc.c (ppc_elf_check_relocs): Remove sym_cache.
145 (ppc_elf_check_relocs): Updated.
146 * elf32-s390.c (elf_s390_link_hash_table): Remove sym_cache.
147 (elf_s390_check_relocs): Updated.
148 (elf_s390_finish_dynamic_sections): Likewise.
149 * elf32-sh.c (elf_sh_link_hash_table): Remove sdynbss, srelbss
150 and aym_cache.
151 (sh_elf_create_dynamic_sections): Updated.
152 (sh_elf_adjust_dynamic_symbol): Likewise.
153 (sh_elf_size_dynamic_sections): Likewise.
154 (sh_elf_check_relocs): Likewise.
155 * elf32-tic6x.c (elf32_tic6x_link_hash_table): Remove sym_cache.
156 (elf32_tic6x_check_relocs): Updated.
157 * elf32-tilepro.c (tilepro_elf_link_hash_table): Removed.
158 (tilepro_elf_hash_table): Updated.
159 (tilepro_elf_link_hash_table_create): Likewise.
160 (tilepro_elf_check_relocs): Likewise.
161 (tilepro_elf_adjust_dynamic_symbol): Likewise.
162 (allocate_dynrelocs): Likewise.
163 (tilepro_elf_size_dynamic_sections): Likewise.
164 (tilepro_elf_relocate_section): Likewise.
165 (tilepro_elf_finish_dynamic_symbol): Likewise.
166 (tilepro_finish_dyn): Likewise.
167 (tilepro_elf_finish_dynamic_sections): Likewise.
168 * elf64-ppc.c (ppc_link_hash_table): Remove sym_cache.
169 (ppc64_elf_before_check_relocs): Updated.
170 (ppc64_elf_check_relocs): Likewise.
171 * elf64-s390.c (elf_s390_link_hash_table): Remove sym_cache.
172 (elf_s390_check_relocs): Updated.
173 (elf_s390_relocate_section): Likewise.
174 (elf_s390_finish_dynamic_sections): Likewise.
175 * elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
176 (elf_x86_64_check_relocs): Likewise.
177 * elfnn-aarch64.c (elf_aarch64_link_hash_table): Remove
178 sym_cache.
179 (elfNN_aarch64_check_relocs): Updated.
180 * elfnn-riscv.c (riscv_elf_link_hash_table): Remove sym_cache.
181 (riscv_elf_check_relocs): Updated.
182 * elfxx-mips.c (mips_elf_link_hash_table): Remove sym_cache.
183 (mips_elf_resolve_got_page_ref): Updated.
184 * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
185 * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Remove
186 sym_cache.
187 * elfxx-tilegx.c (tilegx_elf_link_hash_table): Likewise.
188 (tilegx_elf_check_relocs): Updated.
189 * elfxx-x86.h (elf_x86_link_hash_table): Remove sym_cache.
190
191 2020-07-29 Maciej W. Rozycki <macro@linux-mips.org>
192
193 * elflink.c (bfd_elf_final_link): Give local symbols a name if
194 so requested.
195 * elfxx-mips.c (_bfd_mips_elf_name_local_section_symbols): Only
196 return TRUE if making ET_REL output.
197
198 2020-07-29 Maciej W. Rozycki <macro@linux-mips.org>
199
200 * elf-bfd.h (elf_backend_data): Add
201 `elf_backend_elfsym_local_is_section' member.
202 * elfxx-target.h (elf_backend_elfsym_local_is_section): New
203 macro.
204 (elfNN_bed): Add `elf_backend_elfsym_local_is_section' member.
205 * elflink.c (bfd_elf_final_link): Use it to determine whether
206 set the `.symtab' section's `sh_info' value to the index of the
207 first non-local or non-section symbol.
208 * elf32-mips.c (mips_elf32_elfsym_local_is_section): New
209 function.
210 (elf_backend_elfsym_local_is_section): New macro.
211 * elfn32-mips.c (mips_elf_n32_elfsym_local_is_section): New
212 function.
213 (elf_backend_elfsym_local_is_section): New macro.
214
215 2020-07-29 Alan Modra <amodra@gmail.com>
216
217 * elflink.c (bfd_elf_final_link): Don't segfault on local dynsyms
218 defined in excluded sections.
219
220 2020-07-28 Alan Modra <amodra@gmail.com>
221
222 * elf.c (assign_section_numbers): Comment. Don't segfault on
223 discarded sections when setting linked-to section for generic
224 ELF linker.
225 * elflink.c (bfd_elf_match_symbols_in_sections): Allow NULL info.
226
227 2020-07-27 Alan Modra <amodra@gmail.com>
228
229 * xcofflink.c (xcoff_need_ldrel_p): Accept --just-symbols symbols and
230 similar as absolute.
231 (bfd_xcoff_import_symbol): Don't fuss over absolute symbol
232 redefinitions here.
233
234 2020-07-24 Nick Clifton <nickc@redhat.com>
235
236 * config.bfd: Move xc16x target to the obsolete list.
237
238 2020-07-22 Kevin Buettner <kevinb@redhat.com>
239
240 * binary.c (binary_get_section_contents): Seek using offset
241 from section's file position.
242
243 2020-07-22 Kevin Buettner <kevinb@redhat.com>
244
245 * elf.c (_bfd_elf_make_section_from_phdr): Remove hack for GDB.
246
247 2020-07-22 Max Filippov <jcmvbkbc@gmail.com>
248
249 PR 26246
250 * elf32-xtensa.c (removed_literal_compare): Use correct pointer
251 type for the first function argument. Rename pointers to reflect
252 that they have distinct types.
253
254 2020-07-20 Alan Modra <amodra@gmail.com>
255
256 * elflink.c (_bfd_elf_gc_keep): Use bfd_is_const_section.
257
258 2020-07-19 Alan Modra <amodra@gmail.com>
259
260 * elf64-ppc.c (struct ppc_link_hash_table): Add has_power10_relocs.
261 (select_alt_stub): New function.
262 (ppc_get_stub_entry): Use it here.
263 (ppc64_elf_check_relocs): Set had_power10_relocs rather than
264 power10_stubs.
265 (ppc64_elf_size_stubs): Clear power10_stubs here instead. Don't
266 merge notoc stubs with other varieties when power10_stubs is "auto".
267 Instead dup the stub hash table entry.
268 (plt_stub_size, ppc_build_one_stub, ppc_size_one_stub): Adjust
269 tests of power10_stubs.
270
271 2020-07-15 Alan Modra <amodra@gmail.com>
272
273 PR 26239
274 * coffgen.c (_bfd_coff_close_and_cleanup): Free dwarf2 info.
275
276 2020-07-15 Nick Clifton <nickc@redhat.com>
277
278 PR26240
279 * coffgen.c (coff_get_normalized_symtab): Fix off-by-one error in
280 check for aux entries that overflow the buufer.
281
282 2020-07-15 Hans-Peter Nilsson <hp@bitrange.com>
283
284 * elf64-mmix.c (mmix_elf_relax_section): Improve accounting for
285 R_MMIX_PUSHJ_STUBBABLE relocs against undefined symbols.
286
287 2020-07-15 Markus Böck <markus.boeck02@gmail.com>
288 Alan Modra <amodra@gmail.com>
289
290 PR 26198
291 * coffgen.c (_bfd_coff_section_already_linked): Allow for plugin
292 objects both before and after normal object files.
293 * elflink.c (_bfd_elf_section_already_linked): Likewise.
294
295 2020-07-10 Alan Modra <amodra@gmail.com>
296
297 * elf64-ppc.h (struct ppc64_elf_params): Add power10_stubs.
298 * elf64-ppc.c (struct ppc_link_hash_table): Delete
299 power10_stubs.
300 (ppc64_elf_check_relocs): Adjust setting of power10_stubs.
301 (plt_stub_size, ppc_build_one_stub, ppc_size_one_stub): Adjust
302 uses of power10_stubs.
303
304 2020-07-09 Alan Modra <amodra@gmail.com>
305
306 * coff-ppc.c: Delete.
307 * pe-ppc.c: Delete.
308 * pei-ppc.c: Delete.
309 * Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Remove PE PPC.
310 * coffcode.h (coff_set_arch_mach_hook, coff_set_flags): Remove
311 PPCMAGIC code.
312 (coff_write_object_contents): Remove PPC_PE code.
313 * config.bfd: Move powerpcle-pe to removed targets.
314 * configure.ac: Remove powerpc PE entries.
315 * libcoff-in.h (ppc_allocate_toc_section): Delete.
316 (ppc_process_before_allocation): Delete.
317 * peXXigen.c: Remove POWERPC_LE_PE code and comments.
318 * targets.c: Remove powerpc PE vectors.
319 * po/SRC-POTFILES.in: Regenerate.
320 * libcoff.h: Regenerate.
321 * Makefile.in: Regenerate.
322 * configure: Regenerate.
323
324 2020-07-09 Nick Clifton <nickc@redhat.com>
325
326 * po/fr.po: Updated French translation.
327
328 2020-07-07 Alan Modra <amodra@gmail.com>
329
330 * xcofflink.c (xcoff_mark): Don't mark const sections.
331 (bfd_xcoff_record_link_assignment): Add FIXME.
332 (_bfd_xcoff_bfd_final_link): Don't segfault on assorted magic
333 sections being discarded by linker script.
334
335 2020-07-07 Alan Modra <amodra@gmail.com>
336
337 * coff-rs6000.c (xcoff_write_archive_contents_old): Set default
338 time, uid, gid and mode for deterministic archive.
339 (xcoff_write_archive_contents_big): Likewise.
340
341 2020-07-07 Alan Modra <amodra@gmail.com>
342
343 * coffcode.h (coff_classify_symbol): Handle C_HIDEXT and
344 C_AIX_WEAKEXT.
345
346 2020-07-06 Nick Clifton <nickc@redhat.com>
347
348 * po/pt.po: Updated Portuguese translation.
349 * po/uk.po: Updated Ukranian translation.
350
351 2020-07-04 Nick Clifton <nickc@redhat.com>
352
353 * version.m4: Set version to 2.35.50.
354 * configure: Regenerate.
355 * po/bbfd.pot: Regenerate.
356
357 2020-07-04 Nick Clifton <nickc@redhat.com>
358
359 Binutils 2.35 branch created.
360
361 2020-07-01 Alan Modra <amodra@gmail.com>
362
363 PR 26188
364 * coffgen.c (coff_find_nearest_line_with_names): Sanity check
365 raw syment index before dereferencing.
366
367 2020-07-01 Alan Modra <amodra@gmail.com>
368
369 * elf32-i386.c (elf_backend_object_p): Undef for vxworks.
370
371 2020-07-01 Alan Modra <amodra@gmail.com>
372
373 * config.bfd: Obsolete xc16x.
374
375 2020-06-30 H.J. Lu <hongjiu.lu@intel.com>
376
377 * archures.c (bfd_mach_i386_nacl): Removed.
378 (bfd_mach_i386_i386_nacl): Likewise.
379 (bfd_mach_x86_64_nacl): Likewise.
380 (bfd_mach_x64_32_nacl): Likewise.
381 * config.bfd: Remove *-*-nacl* targets.
382 * configure.ac: Remove x86 NaCl target vectors.
383 * cpu-i386.c (bfd_arch_i386_onebyte_nop_fill): Removed.
384 (bfd_x64_32_nacl_arch): Likewise.
385 (bfd_x86_64_nacl_arch): Likewise.
386 (bfd_i386_nacl_arch): Likewise.
387 (bfd_x64_32_arch_intel_syntax): Updated.
388 * elf32-i386.c: Don't include "elf-nacl.h".
389 (elf_i386_nacl_plt): Removed.
390 (elf_i386_nacl_plt0_entry): Likewise.
391 (elf_i386_nacl_plt_entry): Likewise.
392 (elf_i386_nacl_pic_plt0_entry): Likewise.
393 (elf_i386_nacl_pic_plt_entry): Likewise.
394 (elf_i386_nacl_eh_frame_plt): Likewise.
395 (elf_i386_nacl_plt): Likewise.
396 (elf32_i386_nacl_elf_object_p): Likewise.
397 (elf_i386_get_synthetic_symtab): Updated.
398 (elf_i386_link_setup_gnu_properties): Likewise.
399 * elf64-x86-64.c: Don't include "elf-nacl.h".
400 (elf_x86_64_nacl_plt): Removed.
401 (elf64_x86_64_nacl_elf_object_p): Likewise.
402 (elf_x86_64_nacl_plt0_entry): Likewise.
403 (elf_x86_64_nacl_plt_entry): Likewise.
404 (elf_x86_64_nacl_eh_frame_plt): Likewise.
405 (elf_x86_64_nacl_plt): Likewise.
406 (elf32_x86_64_nacl_elf_object_p): Likewise.
407 (elf_x86_64_get_synthetic_symtab): Updated.
408 (elf_x86_64_link_setup_gnu_properties): Likewise.
409 * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Likewise.
410 * targets.c: Remove x86 NaCl target vectors.
411 * bfd-in2.h: Regenerated.
412 * configure: Likewise.
413
414 2020-06-29 H.J. Lu <hongjiu.lu@intel.com>
415
416 * elf32-tic6x.c (elf32_tic6x_size_dynamic_sections): Call
417 _bfd_elf_add_dynamic_tags.
418
419 2020-06-29 Alan Modra <amodra@gmail.com>
420
421 * peXXigen.c (_bfd_XXi_slurp_codeview_record): Properly check
422 return value of bfd_bread. Don't read more than requested length.
423 Sanity check length. Properly terminate file name.
424
425 2020-06-29 Alan Modra <amodra@gmail.com>
426
427 * arc-got.h: Use C style comments.
428 * coff-z80.c: Likewise.
429 * elf32-csky.c: Likewise.
430 * peXXigen.c: Likewise.
431 * elf32-m32c.c (m32c_elf_relax_delete_bytes): Remove commented out
432 code.
433
434 2020-06-26 Pat Bernardi <bernardi@adacore.com>
435
436 * elf32-m68k.c (m68k_elf_merge_obj_attributes): New function.
437 (elf32_m68k_merge_private_bfd_data): Merge GNU attributes.
438
439 2020-06-26 Alan Modra <amodra@gmail.com>
440
441 * elfxx-riscv.c (struct priv_spec_t, priv_specs),
442 (riscv_get_priv_spec_class, riscv_get_priv_spec_class_from_numbers),
443 (riscv_get_priv_spec_name): Move to..
444 * cpu-riscv.c: ..here.
445 (riscv_get_priv_spec_class_from_numbers): Don't xmalloc temp buffer.
446 Use %u to print unsigned numbers.
447
448 2020-06-24 Andrew Burgess <andrew.burgess@embecosm.com>
449
450 * cpu-riscv.c (riscv_scan): Don't allow shorter matches using the
451 default architecture.
452
453 2020-06-24 H.J. Lu <hongjiu.lu@intel.com>
454
455 PR ld/26083
456 * elf32-csky.c (csky_elf_size_dynamic_sections): Call
457 _bfd_elf_add_dynamic_tags.
458
459 2020-06-24 H.J. Lu <hongjiu.lu@intel.com>
460
461 PR ld/26083
462 * elf32-cris.c (elf_cris_size_dynamic_sections): Call
463 _bfd_elf_add_dynamic_tags.
464
465 2020-06-24 Alan Modra <amodra@gmail.com>
466
467 * vms-alpha.c (_bfd_vms_slurp_etir <ETIR__C_OPR_ASH>): Implement
468 shifts without undefined behaviour.
469
470 2020-06-23 H.J. Lu <hongjiu.lu@intel.com>
471
472 * elf-bfd.h (elf_link_hash_table): Add dt_pltgot_required and
473 dt_jmprel_required.
474 (_bfd_elf_add_dynamic_tags): New.
475 * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Call
476 _bfd_elf_add_dynamic_tags.
477 * elf32-arc.c (elf_arc_size_dynamic_sections): Likewise.
478 * elf32-bfin.c (elf32_bfinfdpic_size_dynamic_sections): Likewise.
479 * elf32-cr16.c (_bfd_cr16_elf_size_dynamic_sections): Likewise.
480 * elf32-frv.c (elf32_frvfdpic_size_dynamic_sections): Likewise.
481 * elf32-lm32.c (lm32_elf_size_dynamic_sections): Likewise.
482 * elf32-m32r.c (m32r_elf_size_dynamic_sections): Likewise.
483 * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
484 * elf32-microblaze.c (microblaze_elf_size_dynamic_sections):
485 Likewise.
486 * elf32-nds32.c (nds32_elf_size_dynamic_sections): Likewise.
487 * elf32-nios2.c (nios2_elf32_size_dynamic_sections): Likewise.
488 * elf32-or1k.c (or1k_elf_size_dynamic_sections): Likewise.
489 * elf32-s390.c (elf_s390_size_dynamic_sections): Likewise.
490 * elf32-tilepro.c (tilepro_elf_size_dynamic_sections): Likewise.
491 * elf32-vax.c (elf_vax_size_dynamic_sections): Likewise.
492 * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
493 * elf64-s390.c (elf_s390_size_dynamic_sections): Likewise.
494 * elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections):
495 Likewise.
496 * elfnn-riscv.c (riscv_elf_size_dynamic_sections): Likewise.
497 * elfxx-tilegx.c (tilegx_elf_size_dynamic_sections): Likewise.
498 * elf32-arm.c (elf32_arm_size_dynamic_sections): Call
499 _bfd_elf_maybe_vxworks_add_dynamic_tags.
500 * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
501 * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections):
502 Likewise.
503 * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Likewise.
504 (_bfd_x86_elf_size_dynamic_sections): Likewise.
505 * elfxx-x86.h (elf_x86_link_hash_table): Remove dt_reloc,
506 dt_reloc_sz and dt_reloc_ent.
507 * elf-vxworks.c (_bfd_elf_maybe_vxworks_add_dynamic_tags): New.
508 * elf-vxworks.h (_bfd_elf_maybe_vxworks_add_dynamic_tags):
509 Likewise.
510 * elf32-hppa.c (elf32_hppa_link_hash_table_create): Set
511 etab.dt_pltgot_required.
512 (elf32_hppa_size_dynamic_sections): Call
513 _bfd_elf_add_dynamic_tags.
514 * elf32-metag.c (elf_metag_link_hash_table_create): Set
515 etab.dt_pltgot_required.
516 (elf_metag_size_dynamic_sections): Call _bfd_elf_add_dynamic_tags.
517 * elf32-sh.c (sh_elf_link_hash_table_create): Set
518 root.dt_pltgot_required for FDPIC output.
519 (sh_elf_size_dynamic_sections): Call
520 _bfd_elf_maybe_vxworks_add_dynamic_tags.
521 * elf32-xtensa.c (elf_xtensa_link_hash_table_create): Set
522 elf.dt_pltgot_required.
523 (elf_xtensa_size_dynamic_sections): Call
524 _bfd_elf_add_dynamic_tags.
525 * elf64-hppa.c (elf64_hppa_hash_table_create): Set
526 root.dt_pltgot_required.
527 (elf64_hppa_size_dynamic_sections): Call
528 _bfd_elf_add_dynamic_tags.
529 * elfnn-ia64.c (elfNN_ia64_hash_table_create): Set
530 root.dt_pltgot_required.
531 (elfNN_ia64_size_dynamic_sections): Set root.dt_jmprel_required
532 for rel_pltoff_sec. Call _bfd_elf_add_dynamic_tags.
533 * elflink.c (_bfd_elf_add_dynamic_tags): New.
534
535 2020-06-22 Saagar Jha <saagar@saagarjha.com>
536
537 * mach-o.c: Support the new load commands by reading a linkedit
538 data command for them.
539
540 2020-06-22 Nelson Chu <nelson.chu@sifive.com>
541
542 * elfxx-riscv.c (struct priv_spec_t priv_specs[]): Move them from
543 opcodes/riscv-opc.c to bfd/elfxx-riscv.c, since we need it in linker.
544 (riscv_get_priv_spec_class): Likewise.
545 (riscv_get_priv_spec_name): Likewise.
546 (riscv_get_priv_spec_class_from_numbers): New function, convert
547 the version numbers into string, then call riscv_get_priv_spec_class
548 to get the priv spec class.
549 * elfxx-riscv.h (riscv_get_priv_spec_class): Move forward declaration
550 from include/opcode/riscv.h to bfd/elfxx-riscv.h.
551 (riscv_get_priv_spec_name): Likewise.
552 (riscv_get_priv_spec_class_from_numbers): New forward declaration.
553 (opcode/riscv.h): Include it in the header rather than elfxx-riscv.c.
554 * elfnn-riscv.c (riscv_merge_attributes): Get the priv spec classes
555 of input and output objects form their priv spec attributes by
556 riscv_get_priv_spec_class_from_numbers. Report warning rather than
557 errors when linking objects with differnet priv spec versions. We do
558 know v1.9.1 may have conflicts to other versions, so report the
559 warning, too. After that, update the output priv spec version to the
560 newest one so far.
561
562 2020-06-22 Nelson Chu <nelson.chu@sifive.com>
563
564 * elfnn-riscv.c (riscv_merge_attributes): Once we meet one of the
565 priv attributes, we will check the conflicts for all of them (major,
566 minor and revision), and then set the priv_attrs_merged to TRUE to
567 indicate that we have handled all of the priv attributes. Remove
568 the unused boolean priv_may_conflict, in_priv_zero and out_priv_zero.
569
570 2020-06-21 Alan Modra <amodra@gmail.com>
571
572 PR 26132
573 * configure.ac: Disable plugins by default for some targets.
574 * plugin.c: Comment typo fix.
575 * configure: Regenerate.
576
577 2020-06-19 Nick Clifton <nickc@redhat.com>
578
579 * plugin.c (try_load_plugin): Suppress the error message about
580 being unable to open a plugin if creating a list of viable
581 plugins.
582
583 2020-06-16 Alan Modra <amodra@gmail.com>
584
585 * aout-tic30.c: Delete file.
586 * Makefile.am (BFD32_BACKENDS): Remove aout-tic30.lo.
587 (BFD32_BACKENDS_CFILES): Remove aout-tic30.c.
588 * config.bfd (c30-*-*aout*, tic30-*-*aout*): Remove entry.
589 (xc16x-*-elf): Sort properly.
590 * configure.ac: Remove tic30_aout_vec.
591 * targets.c: Likewise.
592 * Makefile.in: Regenerate.
593 * configure: Regenerate.
594 * po/SRC-POTFILES.in: Regenerate.
595
596 2020-06-15 Max Filippov <jcmvbkbc@gmail.com>
597
598 * elf32-xtensa.c (XSHAL_ABI, XTHAL_ABI_UNDEFINED)
599 (XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): New macros.
600 (elf32xtensa_abi): New global variable.
601 (xtensa_abi_choice): New function.
602 (elf_xtensa_create_plt_entry): Use xtensa_abi_choice instead of
603 XSHAL_ABI to select PLT code.
604
605 2020-06-15 Roland McGrath <mcgrathr@google.com>
606
607 * elflink.c (bfd_elf_define_start_stop): Use start_stop_visibility
608 field of bfd_link_info.
609
610 2020-06-15 Alan Modra <amodra@gmail.com>
611
612 * config.bfd: Obsolete powerpcle-*-pe targets.
613
614 2020-06-15 Alan Modra <amodra@gmail.com>
615
616 PR 26103
617 * elflink.c (elf_link_add_archive_symbols): Exclude undefined
618 symbols that were defined in discarded sections.
619 * cofflink.c (coff_link_check_archive_element): Likewise.
620 (coff_link_add_symbols): Set indx to -3 for symbols defined in
621 discarded sections.
622 (_bfd_coff_write_global_sym): Don't emit such symbols.
623 libcoff-in.h (struct coff_link_hash_entry): Update indx comment.
624 libcoff.h: Regenerate.
625
626 2020-06-11 Alan Modra <amodra@gmail.com>
627
628 PR 26107
629 * pdp11.c (is_stab): Replace legacy "index" function with "strchr".
630
631 2020-06-10 H.J. Lu <hongjiu.lu@intel.com>
632
633 * elfnn-ia64.c (elfNN_ia64_link_hash_table): Remove reltext.
634 (allocate_dynrel_entries): Set DF_TEXTREL instead of reltext.
635 (elfNN_ia64_size_dynamic_sections): Check DF_TEXTREL instead
636 of reltext.
637
638 2020-06-10 H.J. Lu <hongjiu.lu@intel.com>
639
640 PR ld/26094
641 * elflink.c (bfd_elf_define_start_stop): Handle common symbols.
642 Clear verinfo.verdef.
643
644 2020-06-09 H.J. Lu <hongjiu.lu@intel.com>
645
646 PR ld/18801
647 * elf-bfd.h (elf_link_hash_table): Add ifunc_resolvers.
648 (_bfd_elf_allocate_ifunc_dyn_relocs): Remove the
649 bfd_boolean * argument. Set ifunc_resolvers if there are IFUNC
650 resolvers.
651 * elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Updated.
652 Set ifunc_resolvers if there are FUNC resolvers.
653 * elf64-ppc.c (ppc_link_hash_table): Remove local_ifunc_resolver.
654 (build_global_entry_stubs_and_plt): Replace local_ifunc_resolver
655 with elf.ifunc_resolvers.
656 (write_plt_relocs_for_local_syms): Likewise.
657 (ppc64_elf_relocate_section): Likewise.
658 (ppc64_elf_finish_dynamic_sections): Likewise.
659 * elfnn-aarch64.c (elfNN_aarch64_allocate_ifunc_dynrelocs):
660 Updated.
661 * elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise.
662 (_bfd_x86_elf_size_dynamic_sections): Check elf.ifunc_resolvers
663 instead of readonly_dynrelocs_against_ifunc.
664 * elfxx-x86.h (elf_x86_link_hash_table): Remove
665 readonly_dynrelocs_against_ifunc.
666
667 2020-06-09 Alan Modra <amodra@gmail.com>
668
669 * elf64-ppc.c (struct ppc_link_hash_table): Delete
670 maybe_local_ifunc_resolver field.
671 (build_global_entry_stubs_and_plt): Set local_ifunc_resolver in
672 cases where maybe_local_ifunc_resolver was set.
673 (ppc64_elf_relocate_section): Likewise.
674 (ppc64_elf_finish_dynamic_sections): Downgrade ifunc with textrel
675 error to a warning.
676
677 2020-06-08 H.J. Lu <hongjiu.lu@intel.com>
678
679 * elf-bfd.h (elf_link_hash_entry): Add tlsdesc_plt and
680 tlsdesc_got.
681 * elf32-arm.c (elf32_arm_link_hash_table): Remove tlsdesc_plt
682 and dt_tlsdesc_got.
683 (elf32_arm_size_dynamic_sections): Updated. Clear
684 root.tlsdesc_plt for DF_BIND_NOW.
685 (elf32_arm_finish_dynamic_sections): Updated.
686 (elf32_arm_output_arch_local_syms): Likewise.
687 * elf32-nds32.c (nds32_elf_size_dynamic_sections): Updated.
688 Clear root.tlsdesc_plt for DF_BIND_NOW.
689 (nds32_elf_finish_dynamic_sections): Updated.
690 * elf32-nds32.h (elf_nds32_link_hash_table): Remove
691 dt_tlsdesc_plt and dt_tlsdesc_got.
692 * elf64-x86-64.c (elf_x86_64_finish_dynamic_sections): Updated.
693 * elfnn-aarch64.c (elf_aarch64_link_hash_table): Remove
694 tlsdesc_plt and dt_tlsdesc_got.
695 (elfNN_aarch64_allocate_dynrelocs): Updated.
696 (elfNN_aarch64_finish_dynamic_sections): Likewise.
697 (elfNN_aarch64_size_dynamic_sections): Updated. Clear
698 root.tlsdesc_plt for DF_BIND_NOW. Don't check DF_BIND_NOW
699 twice.
700 * elfxx-x86.c (elf_x86_allocate_dynrelocs): Updated.
701 (_bfd_x86_elf_size_dynamic_sections): Likewise.
702 (_bfd_x86_elf_finish_dynamic_sections): Likewise.
703 * elfxx-x86.h (elf_x86_link_hash_table): Remove tlsdesc_plt and
704 tlsdesc_got.
705
706 2020-06-07 H.J. Lu <hongjiu.lu@intel.com>
707
708 * elf32-tic6x.c (elf32_bed): Defined the default to
709 elf32_tic6x_bed.
710
711 2020-06-07 H.J. Lu <hongjiu.lu@intel.com>
712
713 * elf64-hppa.c (elf64_hppa_link_hash_table): Remove plt_sec and
714 plt_rel_sec.
715 (elf64_hppa_check_relocs): Replace plt_sec/plt_rel_sec with
716 root.splt/root.srelplt.
717 (elf64_hppa_create_dynamic_sections): Likewise.
718 (elf64_hppa_size_dynamic_sections): Likewise.
719 (elf64_hppa_finish_dynamic_symbol): Likewise.
720 (elf_hppa_final_link): Likewise.
721 (elf_hppa_final_link_relocate): Likewise.
722
723 2020-06-06 H.J. Lu <hongjiu.lu@intel.com>
724
725 * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Updated.
726 * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Remove
727 is_vxworks.
728
729 2020-06-06 H.J. Lu <hongjiu.lu@intel.com>
730
731 * elf-bfd.h (elf_target_os): New.
732 (elf_link_hash_table): Add target_os.
733 (elf_backend_data): Add target_os.
734 * elf32-arm.c (elf32_arm_link_hash_table): Remove vxworks_p,
735 symbian_p and nacl_p.
736 (create_got_section): Updated.
737 (elf32_arm_create_dynamic_sections): Likewise.
738 (arm_type_of_stub): Likewise.
739 (elf32_arm_create_or_find_stub_sec): Likewise.
740 (elf32_arm_allocate_plt_entry): Likewise.
741 (elf32_arm_populate_plt_entry): Likewise.
742 (elf32_arm_final_link_relocate): Likewise.
743 (elf32_arm_check_relocs): Likewise.
744 (allocate_dynrelocs_for_symbol): Likewise.
745 (elf32_arm_finish_dynamic_symbol): Likewise.
746 (elf32_arm_finish_dynamic_sections): Likewise.
747 (elf32_arm_output_plt_map_1): Likewise.
748 (elf32_arm_output_arch_local_syms): Likewise.
749 (elf32_arm_add_symbol_hook): Likewise.
750 (elf32_arm_nacl_link_hash_table_create): Likewise.
751 (elf32_arm_vxworks_link_hash_table_create): Likewise.
752 (elf32_arm_symbian_link_hash_table_create): Likewise.
753 (ELF_TARGET_OS): New.
754 * elf32-i386.c (elf_i386_arch_bed): Removed.
755 (elf_backend_arch_data): Likewise.
756 (elf_i386_solaris_arch_bed): Likewise.
757 (elf_i386_nacl_arch_bed): Likewise.
758 (elf_i386_vxworks_arch_bed): Likewise.
759 (elf_i386_relocate_section): Updated.
760 (elf_i386_finish_dynamic_sections): Likewise.
761 (elf_i386_get_synthetic_symtab): Likewise.
762 (elf_i386_link_setup_gnu_properties): Likewise.
763 (ELF_TARGET_OS): New.
764 * elf32-mips.c (ELF_TARGET_OS): New.
765 * elf32-ppc.c (ppc_elf_link_hash_table): Remove is_vxworks.
766 (ppc_elf_create_got): Updated.
767 (ppc_elf_create_dynamic_sections): Likewise.
768 (ppc_elf_check_relocs): Likewise.
769 (ppc_elf_adjust_dynamic_symbol): Likewise.
770 (ppc_elf_size_dynamic_sections): Likewise.
771 (ppc_elf_relocate_section): Likewise.
772 (ppc_elf_finish_dynamic_sections): Likewise.
773 (ppc_elf_vxworks_link_hash_table_create): Likewise.
774 (ELF_TARGET_OS): New.
775 * elf32-sh.c (elf_sh_link_hash_table): Remove vxworks_p.
776 (sh_elf_link_hash_table_create): Updated.
777 (sh_elf_create_dynamic_sections): Likewise.
778 (allocate_dynrelocs): Likewise.
779 (sh_elf_size_dynamic_sections): Likewise.
780 (sh_elf_relocate_section): Likewise.
781 (sh_elf_finish_dynamic_symbol): Likewise.
782 (sh_elf_finish_dynamic_sections): Likewise.
783 (ELF_TARGET_OS): New.
784 * elf32-sparc.c (elf32_sparc_vxworks_link_hash_table_create):
785 Removed.
786 (bfd_elf32_bfd_link_hash_table_create): Likewise.
787 (ELF_TARGET_OS): New.
788 * elf64-x86-64.c (elf_x86_64_arch_bed): Removed.
789 (elf_x86_64_solaris_arch_bed): Likewise.
790 (elf_x86_64_nacl_arch_bed): Likewise.
791 (elf_x86_64_finish_dynamic_sections): Updated.
792 (elf_x86_64_get_synthetic_symtab): Likewise.
793 (elf_x86_64_link_setup_gnu_properties): Likewise.
794 (ELF_TARGET_OS): New.
795 * elflink.c (_bfd_elf_link_hash_table_init): Initialize
796 target_o.
797 * elfxx-mips.c (mips_elf_link_hash_table): Remove is_vxworks.
798 (MIPS_ELF_REL_DYN_NAME): Updated.
799 (ELF_MIPS_GP_OFFSET): Likewise.
800 (mips_elf_create_local_got_entry): Likewise.
801 (mips_elf_allocate_dynamic_relocations): Likewise.
802 (mips_elf_count_got_symbols): Likewise.
803 (is_gott_symbol): Likewise.
804 (mips_elf_calculate_relocation): Likewise.
805 (mips_elf_create_dynamic_relocation): Likewise.
806 (_bfd_mips_elf_check_relocs): Likewise.
807 (allocate_dynrelocs): Likewise.
808 (_bfd_mips_elf_adjust_dynamic_symbol): Likewise.
809 (mips_elf_lay_out_got): Likewise.
810 (mips_elf_set_plt_sym_value): Likewise.
811 (_bfd_mips_elf_size_dynamic_sections): Likewise.
812 (_bfd_mips_elf_finish_dynamic_symbol): Likewise.
813 (_bfd_mips_elf_finish_dynamic_sections): Likewise.
814 (_bfd_mips_elf_final_link): Likewise.
815 (_bfd_mips_init_file_header): Likewise.
816 * elfxx-sparc.c (_bfd_sparc_elf_create_dynamic_sections):
817 Likewise.
818 (allocate_dynrelocs): Likewise.
819 (_bfd_sparc_elf_size_dynamic_sections): Likewise.
820 (_bfd_sparc_elf_relocate_section): Likewise.
821 (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
822 (sparc_finish_dyn): Likewise.
823 (_bfd_sparc_elf_finish_dynamic_sections): Likewise.
824 * elfxx-target.h (ELF_TARGET_OS): New.
825 (elfNN_bed): Add ELF_TARGET_OS.
826 * elfxx-x86.c (elf_x86_allocate_dynrelocs): Updated.
827 (_bfd_x86_elf_link_hash_table_create): Likewise.
828 (_bfd_x86_elf_size_dynamic_sections): Likewise.
829 (_bfd_x86_elf_finish_dynamic_sections): Likewise.
830 (_bfd_x86_elf_adjust_dynamic_symbol): Likewise.
831 (_bfd_x86_elf_link_setup_gnu_properties): Likewise.
832 * elfxx-x86.h (elf_x86_target_os): Removed.
833 (elf_x86_backend_data): Likewise.
834 (get_elf_x86_backend_data): Likewise.
835 (elf_x86_link_hash_table): Remove target_os.
836
837 2020-06-06 Alan Modra <amodra@gmail.com>
838
839 * reloc.c: Rename
840 BFD_RELOC_PPC64_GOT_TLSGD34 to BFD_RELOC_PPC64_GOT_TLSGD_PCREL34,
841 BFD_RELOC_PPC64_GOT_TLSLD34 to BFD_RELOC_PPC64_GOT_TLSLD_PCREL34,
842 BFD_RELOC_PPC64_GOT_TPREL34 to BFD_RELOC_PPC64_GOT_TPREL_PCREL34,
843 BFD_RELOC_PPC64_GOT_DTPREL34 to BFD_RELOC_PPC64_GOT_DTPREL_PCREL34.
844 * elf64-ppc.c: Update throughout for reloc renaming.
845 (ppc64_elf_reloc_name_lookup): Handle old reloc names.
846 * libbfd.h: Regenerate.
847 * bfd-in2.h: Regenerate.
848
849 2020-06-05 H.J. Lu <hongjiu.lu@intel.com>
850
851 PR ld/26080
852 * elf32-bfin.c (bfinfdpic_relocate_section): Skip non SEC_ALLOC
853 section.
854
855 2020-06-05 Nick Clifton <nickc@redhat.com>
856
857 * pdp11.c (aout_link_add_symbols): Fix use before initialisation
858 bug.
859
860 2020-06-05 Nelson Chu <nelson.chu@sifive.com>
861
862 * elfnn-riscv.c (riscv_merge_attributes): Add new boolean
863 priv_may_conflict, in_priv_zero and out_priv_zero to decide
864 whether the object can be linked according to it's priv
865 attributes. The object without any priv spec attributes can
866 be linked with others. If the first input object doesn't contain
867 any priv attributes, then we need to copy the setting from the
868 next input one. Also report more detailed error messages to user.
869
870 2020-06-04 Stephen Casner <casner@acm.org>
871
872 Extend pdp11-aout symbol table format to accommodate .stab
873 symbols and implement correct handling of them.
874
875 * pdp11.c (pdp11_external_nlist): Repurposed e_unused to e_desc.
876 (N_STAB, is_stab): Needed new function is_stab to disambiguate
877 normal vs. .stab symbol table type values, replacing N_STAB mask.
878 (translate_from_native_sym_flags): Determine correct section for
879 different .stab types.
880 (translate_to_native_sym_flags): Leave .stab types intact.
881 (translate_symbol_table): Error if symbol indicates overlay;
882 store desc field from .stab symbols.
883 (write_syms): Output desc field with symbol.
884 (aout_link_check_ar_symbols): Skip .stab symbols.
885 (aout_link_add_symbols): Correctly distinguish .stab symbols.
886 (aout_link_write_other_symbol): Write 0 for desk and ovly fields.
887 (aout_link_write_symbols): Write 0 for desk and ovly fields;
888 correctly distinguish .stab symbols and select calculate their
889 section and value; and copy desc and ovly fields from input symbol
890 to output symbol.
891
892 2020-06-04 Stephen Casner <casner@acm.org>
893
894 * aoutx.h (translate_symbol_table): Comment had external and
895 internal swapped.
896 * pdp11.c (translate_symbol_table): Likewise.
897
898 2020-06-04 H.J. Lu <hongjiu.lu@intel.com>
899
900 * elfxx-x86.h (elf_x86_link_hash_table): Remove target_id.
901 (is_x86_elf): Check elf.hash_table_id instead of target_id.
902 * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Updated.
903
904 2020-06-04 H.J. Lu <hongjiu.lu@intel.com>
905
906 PR ld/26080
907 * elf-m10300.c (mn10300_elf_relocate_section): Resolve relocation
908 in debug section against symbol defined in shared library to 0.
909 * elf32-i386.c (elf_i386_check_relocs): Remove SEC_ALLOC check.
910 * elf32-lm32.c (lm32_elf_check_relocs): Likewise.
911 * elf32-m32r.c (m32r_elf_check_relocs): Likewise.
912 * elf32-nds32.c (nds32_elf_check_relocs): Likewise.
913 * elf32-nios2.c (nios2_elf32_check_relocs): Likewise.
914 * elf32-or1k.c (or1k_elf_check_relocs): Likewise.
915 * elf32-ppc.c (ppc_elf_check_relocs): Likewise.
916 * elf32-sh.c (sh_elf_check_relocs): Likewise.
917 * elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
918 * elf64-alpha.c (elf64_alpha_check_relocs): Likewise.
919 * elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
920 * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
921 * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
922 * elf32-vax.c (elf_vax_check_relocs): Set non_got_ref for non-GOT
923 reference.
924 (elf_vax_adjust_dynamic_symbol): Generate a copy reloc only if
925 there is non-GOT reference.
926 * elflink.c (_bfd_elf_link_check_relocs): Skip non-loaded,
927 non-alloced sections.
928
929 2020-06-03 Stephen Casner <casner@acm.org>
930
931 Copy several years of fixes from bfd/aoutx.h to bfd/pdp11.c.
932
933 * pdp11.c (some_aout_object_p): 4c1534c7a2a - Don't set EXEC_P for
934 files with relocs.
935 (aout_get_external_symbols): 6b8f0fd579d - Return if count is zero.
936 0301ce1486b PR 22306 - Handle stringsize of zero, and error for any
937 other size that doesn't qcover the header word.
938 bf82069dce1 PR 23056 - Allocate an extra byte at the end of the
939 string table, and zero it.
940 (translate_symbol_table): 0d329c0a83a PR 22887 - Print an error
941 message and set bfd_error on finding an invalid name string offset.
942 (add_to_stringtab): INLINE -> inline
943 (pdp11_aout_swap_reloc_in): 116acb2c268 PR 22887 - Correct r_index
944 bound check.
945 (squirt_out_relocs): e2996cc315d PR 20921 - Check for and report
946 any relocs that could not be recognised.
947 92744f05809 PR 20929 - Check for relocs without an associated symbol.
948 (find_nearest_line): 808346fcfcf PR 23055 - Check that the symbol
949 name exists and is long enough, before attempting to see if it is
950 for a .o file.
951 c3864421222 - Correct case for N_SO being the last symbol.
952 50455f1ab29 PR 20891 - Handle the case where the main file name
953 and the directory name are both empty.
954 e82ab856bb4 PR 20892 - Handle the case where function name is empty.
955 (aout_link_add_symbols): e517df3dbf7 PR 19629 - Check for out of
956 range string table offsets.
957 531336e3a0b PR 20909 - Fix off-by-one error in check for an
958 illegal string offset.
959 (aout_link_includes_newfunc): Add comment.
960 (pdp11_aout_link_input_section): ad756e3f9e6 - Return with an error
961 on unexpected relocation type rather than ASSERT.
962
963 2020-06-03 H.J. Lu <hongjiu.lu@intel.com>
964
965 PR ld/26066
966 * elf32-nios2.c (nios2_elf32_size_dynamic_sections): Call
967 _bfd_elf_maybe_set_textrel to set DF_TEXTREL.
968
969 2020-06-03 H.J. Lu <hongjiu.lu@intel.com>
970
971 PR ld/26066
972 * elf32-nios2.c (nios2_elf32_check_relocs): Skip non-loaded,
973 non-alloced sections.
974
975 2020-06-03 H.J. Lu <hongjiu.lu@intel.com>
976
977 * elf32-frv.c (elf32_frv_relocate_section): Don't generate
978 dynamic relocations for non SEC_ALLOC sections.
979
980 2020-06-03 Gunther Nikl <gnikl@justmail.de>
981
982 * aout64.c (BMAGIC, QMAGIC): Do not define.
983 * aoutx.h (N_IS_BMAGIC, N_SET_QMAGIC): New defines.
984 (NAME (aout, some_aout_object_p)): Use N_IS_QMAGIC and N_IS_BMAGIC
985 to check the file format.
986 (adjust_z_magic): Use N_SET_QMAGIC to set file format.
987 * i386aout.c (NO_WRITE_HEADER_KLUDGE): Delete define.
988 * libaout.h (NO_WRITE_HEADER_KLUDGE): Do not define.
989
990 2020-06-03 H.J. Lu <hongjiu.lu@intel.com>
991
992 * elf32-arc.c (elf_arc_relocate_section): Don't generate dynamic
993 relocations for non SEC_ALLOC sections.
994
995 2020-06-03 H.J. Lu <hongjiu.lu@intel.com>
996
997 * elf-bfd.h (_bfd_elf_maybe_set_textrel): New
998 * elf32-arm.c (maybe_set_textrel): Removed.
999 (elf32_arm_size_dynamic_sections): Replace maybe_set_textrel
1000 with _bfd_elf_maybe_set_textrel.
1001 * elf32-csky.c (maybe_set_textrel): Removed.
1002 (csky_elf_size_dynamic_sections): Replace maybe_set_textrel
1003 with _bfd_elf_maybe_set_textrel.
1004 * elf32-hppa.c (maybe_set_textrel): Removed.
1005 (elf32_hppa_size_dynamic_sections): Replace maybe_set_textrel
1006 with _bfd_elf_maybe_set_textrel.
1007 * elf32-lm32.c (maybe_set_textrel): Removed.
1008 (lm32_elf_size_dynamic_sections): Replace maybe_set_textrel
1009 with _bfd_elf_maybe_set_textrel.
1010 * elf32-m32r.c (maybe_set_textrel): Removed.
1011 (m32r_elf_size_dynamic_sections): Replace maybe_set_textrel
1012 with _bfd_elf_maybe_set_textrel.
1013 * elf32-metag.c (maybe_set_textrel): Removed.
1014 (elf_metag_size_dynamic_sections): Replace maybe_set_textrel
1015 with _bfd_elf_maybe_set_textrel.
1016 * elf32-nds32.c (maybe_set_textrel): Removed.
1017 (nds32_elf_size_dynamic_sections): Replace maybe_set_textrel
1018 with _bfd_elf_maybe_set_textrel.
1019 * elf32-or1k.c (maybe_set_textrel): Removed.
1020 (or1k_elf_size_dynamic_sections): Replace maybe_set_textrel
1021 with _bfd_elf_maybe_set_textrel.
1022 * elf32-ppc.c (maybe_set_textrel): Removed.
1023 (ppc_elf_size_dynamic_sections): Replace maybe_set_textrel
1024 with _bfd_elf_maybe_set_textrel.
1025 * elf32-s390.c (maybe_set_textrel): Removed.
1026 (elf_s390_size_dynamic_sections): Replace maybe_set_textrel
1027 with _bfd_elf_maybe_set_textrel.
1028 * elf32-sh.c (maybe_set_textrel): Removed.
1029 (sh_elf_size_dynamic_sections): Replace maybe_set_textrel
1030 with _bfd_elf_maybe_set_textrel.
1031 * elf32-tic6x.c (maybe_set_textrel): Removed.
1032 (elf32_tic6x_size_dynamic_sections): Replace maybe_set_textrel
1033 with _bfd_elf_maybe_set_textrel.
1034 * elf32-tilepro.c (maybe_set_textrel): Removed.
1035 (tilepro_elf_size_dynamic_sections): Replace maybe_set_textrel
1036 with _bfd_elf_maybe_set_textrel.
1037 * elf64-ppc.c (maybe_set_textrel): Removed.
1038 (ppc64_elf_size_dynamic_sections): Replace maybe_set_textrel
1039 with _bfd_elf_maybe_set_textrel.
1040 * elf64-s390.c (maybe_set_textrel): Removed.
1041 (elf_s390_size_dynamic_sections): Replace maybe_set_textrel
1042 with _bfd_elf_maybe_set_textrel.
1043 * elfnn-aarch64.c (maybe_set_textrel): Removed.
1044 (elfNN_aarch64_size_dynamic_sections): Replace maybe_set_textrel
1045 with _bfd_elf_maybe_set_textrel.
1046 * elfnn-riscv.c (maybe_set_textrel): Removed.
1047 (riscv_elf_size_dynamic_sections): Replace maybe_set_textrel
1048 with _bfd_elf_maybe_set_textrel.
1049 * elfxx-sparc.c (maybe_set_textrel): Removed.
1050 (_bfd_sparc_elf_size_dynamic_sections): Replace maybe_set_textrel
1051 with _bfd_elf_maybe_set_textrel.
1052 * elfxx-tilegx.c (maybe_set_textrel): Removed.
1053 (tilegx_elf_size_dynamic_sections): Replace maybe_set_textrel
1054 with _bfd_elf_maybe_set_textrel.
1055 * elfxx-x86.c (maybe_set_textrel): Removed.
1056 (_bfd_x86_elf_size_dynamic_sections): Replace maybe_set_textrel
1057 with _bfd_elf_maybe_set_textrel.
1058 * elflink.c (_bfd_elf_maybe_set_textrel): New.
1059
1060 2020-06-03 H.J. Lu <hongjiu.lu@intel.com>
1061
1062 PR ld/26067
1063 * elf32-arm.c (elf32_arm_copy_indirect_symbol): Don't copy
1064 dyn_relocs.
1065 * elf32-csky.c (csky_elf_copy_indirect_symbol): Likewise.
1066 * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Likewise.
1067 * elf32-metag.c (elf_metag_copy_indirect_symbol): Likewise.
1068 * elf32-microblaze.c (microblaze_elf_copy_indirect_symbol):
1069 Likewise.
1070 * elf32-nds32.c (nds32_elf_copy_indirect_symbol): Likewise.
1071 * elf32-nios2.c (nios2_elf32_copy_indirect_symbol): Likewise.
1072 * elf32-or1k.c (or1k_elf_copy_indirect_symbol): Likewise.
1073 * elf32-s390.c (elf_s390_copy_indirect_symbol): Likewise.
1074 * elf32-sh.c (sh_elf_copy_indirect_symbol): Likewise.
1075 * elf32-tilepro.c (tilepro_elf_copy_indirect_symbol): Likewise.
1076 * elf64-s390.c (elf_s390_copy_indirect_symbol): Likewise.
1077 * elfnn-aarch64.c (elfNN_aarch64_copy_indirect_symbol): Likewise.
1078 * elfnn-riscv.c (riscv_elf_copy_indirect_symbol): Likewise.
1079 * elfxx-sparc.c (_bfd_sparc_elf_copy_indirect_symbol): Likewise.
1080 * elfxx-tilegx.c (tilegx_elf_copy_indirect_symbol): Likewise.
1081 * elfxx-x86.c (_bfd_x86_elf_copy_indirect_symbol): Likewise.
1082 * elf32-lm32.c (lm32_elf_copy_indirect_symbol): Removed.
1083 (elf_backend_copy_indirect_symbol): Likewise.
1084 * elf32-m32r.c (m32r_elf_copy_indirect_symbol): Removed.
1085 (elf_backend_copy_indirect_symbol): Likewise.
1086 * elflink.c (_bfd_elf_link_hash_copy_indirect): Copy dyn_relocs.
1087
1088 2020-06-03 H.J. Lu <hongjiu.lu@intel.com>
1089
1090 PR ld/26067
1091 * elf-bfd.h (_bfd_elf_readonly_dynrelocs): New.
1092 * elf32-arm.c (readonly_dynrelocs): Removed.
1093 (maybe_set_textrel): Replace readonly_dynrelocs with
1094 _bfd_elf_readonly_dynrelocs.
1095 * elf32-csky.c (readonly_dynrelocs): Removed.
1096 (maybe_set_textrel): Replace readonly_dynrelocs with
1097 _bfd_elf_readonly_dynrelocs.
1098 * elf32-hppa.c(readonly_dynrelocs): Removed.
1099 (alias_readonly_dynrelocs): Replace readonly_dynrelocs with
1100 _bfd_elf_readonly_dynrelocs.
1101 (maybe_set_textrel): Likewise.
1102 * elf32-lm32.c (readonly_dynrelocs): Removed.
1103 (lm32_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1104 with _bfd_elf_readonly_dynrelocs.
1105 (maybe_set_textrel): Likewise.
1106 * elf32-m32r.c (readonly_dynrelocs): Removed.
1107 (m32r_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1108 with _bfd_elf_readonly_dynrelocs.
1109 (maybe_set_textrel): Likewise.
1110 * elf32-metag.c (readonly_dynrelocs): Removed.
1111 (elf_metag_adjust_dynamic_symbol): Replace readonly_dynrelocs
1112 with _bfd_elf_readonly_dynrelocs.
1113 (maybe_set_textrel): Likewise.
1114 * elf32-microblaze.c (readonly_dynrelocs): Removed.
1115 (microblaze_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1116 with _bfd_elf_readonly_dynrelocs.
1117 * elf32-nds32.c (readonly_dynrelocs): Removed.
1118 (nds32_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1119 with _bfd_elf_readonly_dynrelocs.
1120 (maybe_set_textrel): Likewise.
1121 * elf32-or1k.c (readonly_dynrelocs): Removed.
1122 (or1k_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1123 with _bfd_elf_readonly_dynrelocs.
1124 * elf32-ppc.c (readonly_dynrelocs): Removed.
1125 (alias_readonly_dynrelocs): Replace readonly_dynrelocs with
1126 _bfd_elf_readonly_dynrelocs.
1127 (ppc_elf_adjust_dynamic_symbol): Likewise.
1128 (maybe_set_textrel): Likewise.
1129 * elf32-s390.c (readonly_dynrelocs): Removed.
1130 (elf_s390_adjust_dynamic_symbol): Replace readonly_dynrelocs
1131 with _bfd_elf_readonly_dynrelocs.
1132 (maybe_set_textrel): Likewise.
1133 * elf32-sh.c (readonly_dynrelocs): Removed.
1134 (sh_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs with
1135 _bfd_elf_readonly_dynrelocs.
1136 (maybe_set_textrel): Likewise.
1137 * elf32-tic6x.c (readonly_dynrelocs): Removed.
1138 (maybe_set_textrel): Replace readonly_dynrelocs with
1139 _bfd_elf_readonly_dynrelocs.
1140 * elf32-tilepro.c (readonly_dynrelocs): Removed.
1141 (tilepro_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1142 with _bfd_elf_readonly_dynrelocs.
1143 (maybe_set_textrel): Likewise.
1144 * elf64-ppc.c (readonly_dynrelocs): Removed.
1145 (alias_readonly_dynrelocs): Replace readonly_dynrelocs with
1146 _bfd_elf_readonly_dynrelocs.
1147 (ppc64_elf_adjust_dynamic_symbol): Likewise.
1148 (maybe_set_textrel): Likewise.
1149 * elf64-s390.c (readonly_dynrelocs): Removed.
1150 (elf_s390_adjust_dynamic_symbol): Replace readonly_dynrelocs
1151 with _bfd_elf_readonly_dynrelocs.
1152 (maybe_set_textrel): Likewise.
1153 * elflink.c (_bfd_elf_readonly_dynrelocs): New.
1154 * elfnn-aarch64.c (readonly_dynrelocs): Removed.
1155 (maybe_set_textrel): Replace readonly_dynrelocs with
1156 _bfd_elf_readonly_dynrelocs.
1157 * elfnn-riscv.c (readonly_dynrelocs): Removed.
1158 (riscv_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1159 with _bfd_elf_readonly_dynrelocs.
1160 (maybe_set_textrel): Likewise.
1161 * elfxx-sparc.c (readonly_dynrelocs): Removed.
1162 (_bfd_sparc_elf_adjust_dynamic_symbol): Replace
1163 readonly_dynrelocs with _bfd_elf_readonly_dynrelocs.
1164 (maybe_set_textrel): Likewise.
1165 * elfxx-tilegx.c (readonly_dynrelocs): Removed.
1166 (tilegx_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1167 with _bfd_elf_readonly_dynrelocs.
1168 (maybe_set_textrel): Likewise.
1169 * elfxx-x86.c (readonly_dynrelocs): Removed.
1170 (maybe_set_textrel): Replace readonly_dynrelocs with
1171 _bfd_elf_readonly_dynrelocs.
1172 (_bfd_x86_elf_adjust_dynamic_symbol): Likewise.
1173
1174 2020-06-03 H.J. Lu <hongjiu.lu@intel.com>
1175
1176 * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Silence
1177 -fsanitize=undefined.
1178
1179 2020-06-03 Alan Modra <amodra@gmail.com>
1180
1181 PR 26069
1182 PR 18758
1183 * peicode.h (pe_ILF_make_a_section): Align data for compilers
1184 other than gcc.
1185 (pe_ILF_build_a_bfd): Likewise.
1186
1187 2020-06-03 Alan Modra <amodra@gmail.com>
1188
1189 PR 26069
1190 * elf.c (_bfd_elf_close_and_cleanup): Free elf_shstrtab for
1191 core files as well as objects.
1192
1193 2020-06-01 H.J. Lu <hongjiu.lu@intel.com>
1194
1195 PR ld/26067
1196 * elf-bfd.h (elf_link_hash_entry): Add dyn_relocs after size.
1197 * elf-s390-common.c (s390_elf_allocate_ifunc_dyn_relocs):
1198 Updated.
1199 * elf32-arc.c (elf_arc_link_hash_entry): Remove dyn_relocs.
1200 (elf_arc_link_hash_newfunc): Updated.
1201 * elf32-arm.c (elf32_arm_link_hash_entry): Remove dyn_relocs.
1202 (elf32_arm_link_hash_newfunc): Updated.
1203 (elf32_arm_copy_indirect_symbol): Likewise.
1204 (elf32_arm_check_relocs): Likewise.
1205 (readonly_dynrelocs): Likewise.
1206 (allocate_dynrelocs_for_symbol): Likewise.
1207 * elf32-csky.c (csky_elf_link_hash_entry): Remove dyn_relocs.
1208 (csky_elf_link_hash_newfunc): Updated.
1209 (csky_allocate_dynrelocs): Likewise.
1210 (readonly_dynrelocs): Likewise.
1211 (csky_elf_copy_indirect_symbol): Likewise.
1212 * elf32-hppa.c (elf32_hppa_link_hash_entry): Remove dyn_relocs.
1213 (hppa_link_hash_newfunc): Updated.
1214 (elf32_hppa_copy_indirect_symbol): Likewise.
1215 (elf32_hppa_hide_symbol): Likewise.
1216 (elf32_hppa_adjust_dynamic_symbol): Likewise.
1217 (allocate_dynrelocs): Likewise.
1218 (elf32_hppa_relocate_section): Likewise.
1219 * elf32-i386.c (elf_i386_check_relocs): Likewise.
1220 * elf32-lm32.c (elf_lm32_link_hash_entry): Removed.
1221 (lm32_elf_link_hash_newfunc): Likewise.
1222 (lm32_elf_link_hash_table_create): Updated.
1223 (readonly_dynrelocs): Likewise.
1224 (allocate_dynrelocs): Likewise.
1225 (lm32_elf_copy_indirect_symbol): Likewise.
1226 * elf32-m32r.c (elf_m32r_link_hash_entry): Removed.
1227 (m32r_elf_link_hash_newfunc): Likewise.
1228 (m32r_elf_link_hash_table_create): Updated.
1229 (m32r_elf_copy_indirect_symbol): Likewise.
1230 (allocate_dynrelocs): Likewise.
1231 * elf32-metag.c (elf_metag_link_hash_entry): Remove dyn_relocs.
1232 (metag_link_hash_newfunc): Updated.
1233 (elf_metag_copy_indirect_symbol): Likewise.
1234 (readonly_dynrelocs): Likewise.
1235 (allocate_dynrelocs): Likewise.
1236 * elf32-microblaze.c (elf32_mb_link_hash_entry): Remove
1237 dyn_relocs.
1238 (link_hash_newfunc): Updated.
1239 (microblaze_elf_check_relocs): Likewise.
1240 (microblaze_elf_copy_indirect_symbol): Likewise.
1241 (readonly_dynrelocs): Likewise.
1242 (allocate_dynrelocs): Likewise.
1243 * elf32-nds32.c (elf_nds32_link_hash_entry): Remove dyn_relocs.
1244 (nds32_elf_link_hash_newfunc): Updated.
1245 (nds32_elf_copy_indirect_symbol): Likewise.
1246 (readonly_dynrelocs): Likewise.
1247 (allocate_dynrelocs): Likewise.
1248 (nds32_elf_check_relocs): Likewise.
1249 * elf32-nios2.c (elf32_nios2_link_hash_entry): Remove dyn_relocs.
1250 (link_hash_newfunc): Updated.
1251 (nios2_elf32_copy_indirect_symbol): Likewise.
1252 (nios2_elf32_check_relocs): Likewise.
1253 (allocate_dynrelocs): Likewise.
1254 * elf32-or1k.c (elf_or1k_link_hash_entry): Remove dyn_relocs.
1255 (or1k_elf_link_hash_newfunc): Updated.
1256 (readonly_dynrelocs): Likewise.
1257 (allocate_dynrelocs): Likewise.
1258 (or1k_elf_copy_indirect_symbol): Likewise.
1259 * elf32-ppc.c (ppc_elf_link_hash_entry): Remove dyn_relocs.
1260 (ppc_elf_link_hash_newfunc): Updated.
1261 (ppc_elf_copy_indirect_symbol): Likewise.
1262 (ppc_elf_check_relocs): Likewise.
1263 (readonly_dynrelocs): Likewise.
1264 (ppc_elf_adjust_dynamic_symbol): Likewise.
1265 (allocate_dynrelocs): Likewise.
1266 (ppc_elf_relocate_section): Likewise.
1267 * elf32-s390.c (elf_s390_link_hash_entry): Remove dyn_relocs.
1268 (link_hash_newfunc): Updated.
1269 (elf_s390_copy_indirect_symbol): Likewise.
1270 (readonly_dynrelocs): Likewise.
1271 (elf_s390_adjust_dynamic_symbol): Likewise.
1272 (allocate_dynrelocs): Likewise.
1273 * elf32-sh.c (elf_sh_link_hash_entry): Remove dyn_relocs.
1274 (sh_elf_link_hash_newfunc): Updated.
1275 (readonly_dynrelocs): Likewise.
1276 (allocate_dynrelocs): Likewise.
1277 (sh_elf_copy_indirect_symbol): Likewise.
1278 (sh_elf_check_relocs): Likewise.
1279 * elf32-tic6x.c (elf32_tic6x_link_hash_entry): Removed.
1280 (elf32_tic6x_link_hash_newfunc): Likewise.
1281 (elf32_tic6x_link_hash_table_create): Updated.
1282 (readonly_dynrelocs): Likewise.
1283 (elf32_tic6x_check_relocs): Likewise.
1284 (elf32_tic6x_allocate_dynrelocs): Likewise.
1285 * elf32-tilepro.c (tilepro_elf_link_hash_entry): Remove
1286 dyn_relocs.
1287 (link_hash_newfunc): Updated.
1288 (tilepro_elf_copy_indirect_symbol): Likewise.
1289 (tilepro_elf_check_relocs): Likewise.
1290 (allocate_dynrelocs): Likewise.
1291 * elf64-ppc.c (ppc_link_hash_entry): Remove dyn_relocs.
1292 (ppc64_elf_copy_indirect_symbol): Updated.
1293 (ppc64_elf_check_relocs): Likewise.
1294 (readonly_dynrelocs): Likewise.
1295 (ppc64_elf_adjust_dynamic_symbol): Likewise.
1296 (dec_dynrel_count): Likewise.
1297 (allocate_dynrelocs): Likewise.
1298 (ppc64_elf_relocate_section): Likewise.
1299 * elf64-s390.c (elf_s390_link_hash_entry): Remove dyn_relocs.
1300 (link_hash_newfunc): Updated.
1301 (elf_s390_copy_indirect_symbol): Likewise.
1302 (readonly_dynrelocs): Likewise.
1303 (allocate_dynrelocs): Likewise.
1304 * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
1305 * elfnn-aarch64.c (elf_aarch64_link_hash_entry): Remove
1306 dyn_relocs.
1307 (elfNN_aarch64_link_hash_newfunc): Updated.
1308 (elfNN_aarch64_copy_indirect_symbol): Likewise.
1309 (readonly_dynrelocs): Likewise.
1310 (need_copy_relocation_p): Likewise.
1311 (elfNN_aarch64_allocate_dynrelocs): Likewise.
1312 (elfNN_aarch64_allocate_ifunc_dynrelocs): Likewise.
1313 * elfnn-riscv.c (riscv_elf_link_hash_entry): Remove dyn_relocs.
1314 (link_hash_newfunc): Updated.
1315 (riscv_elf_copy_indirect_symbol): Likewise.
1316 (riscv_elf_check_relocs): Likewise.
1317 (readonly_dynrelocs): Likewise.
1318 (allocate_dynrelocs): Likewise.
1319 * elfxx-sparc.c (_bfd_sparc_elf_link_hash_entry): Remove
1320 dyn_relocs.
1321 (link_hash_newfunc): Updated.
1322 (_bfd_sparc_elf_copy_indirect_symbol): Likewise.
1323 (_bfd_sparc_elf_check_relocs): Likewise.
1324 (readonly_dynrelocs): Likewise.
1325 (allocate_dynrelocs): Likewise.
1326 * elfxx-tilegx.c (tilegx_elf_link_hash_entry): Remove dyn_relocs.
1327 (link_hash_newfunc): Updated.
1328 (tilegx_elf_copy_indirect_symbol): Likewise.
1329 (tilegx_elf_check_relocs): Likewise.
1330 (readonly_dynrelocs): Likewise.
1331 (allocate_dynrelocs): Likewise.
1332 * elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise.
1333 (readonly_dynrelocs): Likewise.
1334 (_bfd_x86_elf_copy_indirect_symbol): Likewise.
1335 * elfxx-x86.h (elf_x86_link_hash_entry): Remove dyn_relocs.
1336
1337 2020-06-01 Alan Modra <amodra@gmail.com>
1338
1339 * vms-alpha.c (_bfd_vms_slurp_etir): Check bound for the current
1340 command against cmd_length, not the end of record. For
1341 ETIR__C_STO_IMMR check size against cmd_length, mask repeat count
1342 to 32-bits and break out on zero size. Add ETIR__C_STC_LP_PSB
1343 cmd_length test.
1344
1345 2020-05-28 David Faust <david.faust@oracle.com>
1346
1347 * elf64-bpf.c (bpf_elf_relocate_section): Fix handling of
1348 R_BPF_INSN_{32,64} relocations.
1349
1350 2020-05-28 Stephen Casner <casner@acm.org>
1351
1352 * pdp11.c: Implement BRD_RELOC_32 to relocate the low 16 bits of
1353 addreses in .long (used in testsuites) and .stab values.
1354
1355 2020-05-27 H.J. Lu <hongjiu.lu@intel.com>
1356
1357 PR ld/22909
1358 * elflink.c (bfd_elf_final_link): Use bfd_link_textrel_check.
1359 Check bfd_link_dll when issue a DT_TEXTREL warning.
1360 * elfxx-x86.c (maybe_set_textrel): Likewise.
1361 (_bfd_x86_elf_size_dynamic_sections): Likewise.
1362
1363 2020-05-26 Nick Clifton <nickc@redhat.com>
1364
1365 * plugin.c (try_load_plugin): Extend error message when a plugin
1366 fails to open.
1367
1368 2020-05-23 Alan Modra <amodra@gmail.com>
1369
1370 * bfdio.c (bfd_get_file_size): Don't segfault on NULL arch_header.
1371
1372 2020-05-22 Alan Modra <amodra@gmail.com>
1373
1374 PR 25882
1375 * elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Don't init FP
1376 attributes from shared libraries, and do not return an error if
1377 they don't match.
1378
1379 2020-05-21 Alan Modra <amodra@gmail.com>
1380
1381 PR 25993
1382 * opncls.c (_bfd_free_cached_info): Keep a copy of the bfd
1383 filename.
1384 (_bfd_delete_bfd): Free the copy.
1385 (_bfd_new_bfd): Free nbfd->memory on error.
1386
1387 2020-05-21 Alan Modra <amodra@gmail.com>
1388
1389 * aoutx.h: Replace "if (x) free (x)" with "free (x)" throughout.
1390 * archive.c, * bfd.c, * bfdio.c, * coff-alpha.c, * coff-ppc.c,
1391 * coff-sh.c, * coff-stgo32.c, * coffcode.h, * coffgen.c,
1392 * cofflink.c, * cpu-arm.c, * doc/chew.c, * dwarf2.c, * ecoff.c,
1393 * ecofflink.c, * elf-eh-frame.c, * elf-m10200.c, * elf-m10300.c,
1394 * elf-strtab.c, * elf.c, * elf32-arc.c, * elf32-arm.c,
1395 * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-crx.c,
1396 * elf32-epiphany.c, * elf32-ft32.c, * elf32-h8300.c,
1397 * elf32-ip2k.c, * elf32-m32c.c, * elf32-m68hc11.c,
1398 * elf32-m68k.c, * elf32-microblaze.c, * elf32-msp430.c,
1399 * elf32-nds32.c, * elf32-nios2.c, * elf32-ppc.c, * elf32-pru.c,
1400 * elf32-rl78.c, * elf32-rx.c, * elf32-sh.c, * elf32-spu.c,
1401 * elf32-v850.c, * elf32-xtensa.c, * elf64-alpha.c,
1402 * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c
1403 * elf64-mmix.c, * elf64-ppc.c, * elf64-sparc.c, * elfcode.h,
1404 * elflink.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-mips.c,
1405 * elfxx-x86.c, * format.c, * ihex.c, * libbfd.c, * linker.c,
1406 * mmo.c, * opncls.c, * pdp11.c, * peXXigen.c, * pef.c,
1407 * peicode.h, * simple.c, * som.c, * srec.c, * stabs.c, * syms.c,
1408 * targets.c, * vms-lib.c, * xcofflink.c, * xtensa-isa.c: Likewise.
1409
1410 2020-05-20 Nelson Chu <nelson.chu@sifive.com>
1411
1412 * elfxx-riscv.h (riscv_parse_subset_t): Add new callback function
1413 get_default_version. It is used to find the default version for
1414 the specific extension.
1415 * elfxx-riscv.c (riscv_parsing_subset_version): Remove the parameters
1416 default_major_version and default_minor_version. Add new bfd_boolean
1417 parameter *use_default_version. Set it to TRUE if we need to call
1418 the callback rps->get_default_version to find the default version.
1419 (riscv_parse_std_ext): Call rps->get_default_version if we fail to find
1420 the default version in riscv_parsing_subset_version, and then call
1421 riscv_add_subset to add the subset into subset list.
1422 (riscv_parse_prefixed_ext): Likewise.
1423 (riscv_std_z_ext_strtab): Support Zicsr extensions.
1424 * elfnn-riscv.c (riscv_merge_std_ext): Use strcasecmp to compare the
1425 strings rather than characters.
1426 riscv_merge_arch_attr_info): The callback function get_default_version
1427 is only needed for assembler, so set it to NULL int the linker.
1428 * elfxx-riscv.c (riscv_estimate_digit): Remove the static.
1429 * elfxx-riscv.h: Updated.
1430
1431 2020-05-20 Alan Modra <amodra@gmail.com>
1432
1433 PR 25993
1434 * archive.c (_bfd_get_elt_at_filepos): Don't strdup filename,
1435 use bfd_set_filename.
1436 * elfcode.h (_bfd_elf_bfd_from_remote_memory): Likewise.
1437 * mach-o.c (bfd_mach_o_fat_member_init): Likewise.
1438 * opncls.c (bfd_fopen, bfd_openstreamr, bfd_openr_iovec, bfd_openw),
1439 (bfd_create): Likewise.
1440 (_bfd_delete_bfd): Don't free filename.
1441 (bfd_set_filename): Copy filename param to bfd_alloc'd memory,
1442 return pointer to the copy or NULL on alloc fail.
1443 * vms-lib.c (_bfd_vms_lib_get_module): Free newname and test
1444 result of bfd_set_filename.
1445 * bfd-in2.h: Regenerate.
1446
1447 2020-05-20 Alan Modra <amodra@gmail.com>
1448
1449 PR 26011
1450 * elf.c (_bfd_elf_get_reloc_upper_bound): Sanity check reloc
1451 section size against file size.
1452 (_bfd_elf_get_dynamic_reloc_upper_bound): Likewise.
1453
1454 2020-05-19 Gunther Nikl <gnikl@justmail.de>
1455
1456 PR 26005
1457 * elf.c (bfd_section_from_shdr): Replace bfd_zmalloc with bfd_malloc
1458 and memset when allocating memory for the sections_being_created
1459 array.
1460
1461 2020-05-19 Stafford Horne <shorne@gmail.com>
1462
1463 * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Rename srela
1464 to relgot.
1465 (or1k_elf_relocate_section): Access srelgot via
1466 htab->root.srelgot. Add assertions for srelgot->contents.
1467 Introduce local variable for srelgot to not reuse global
1468 sreloc.
1469 (or1k_elf_relocate_section): Fixup dynamic symbol detection.
1470 (or1k_set_got_and_rela_sizes): New function.
1471 (or1k_initial_exec_offset): New function.
1472 (TLS_GD, TLS_IE, TLS_LD, TLS_LE): Redefine macros as masks.
1473 (or1k_elf_relocate_section): Allow for TLS to handle multiple
1474 model access.
1475 (or1k_elf_check_relocs): Use OR to set TLS access.
1476 (allocate_dynrelocs): Use or1k_set_got_and_rela_sizes to set
1477 sizes.
1478 (or1k_elf_size_dynamic_sections): Use
1479 or1k_set_got_and_rela_sizes to set sizes.
1480 (or1k_elf_relocate_section): Fixup PCREL relocation calculation.
1481 (TCB_SIZE): New macro.
1482 (tpoff): Use TCB_SIZE and alignment to calculate offset.
1483 (allocate_dynrelocs, readonly_dynrelocs, or1k_elf_check_relocs)
1484 (or1k_elf_size_dynamic_sections): Rename p to sec_relocs.
1485 (allocate_dynrelocs): Rename s to splt or sgot based on usage.
1486 (tpoff): Add dynamic boolean argument.
1487 (or1k_elf_relocate_section): Pass dynamic flag to tpoff.
1488
1489 2020-05-19 Siddhesh Poyarekar <siddesh.poyarekar@arm.com>
1490
1491 * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Club
1492 BFD_RELOC_AARCH64_BRANCH19 and BFD_RELOC_AARCH64_TSTBR14
1493 cases with BFD_RELOC_AARCH64_JUMP26.
1494 (elfNN_aarch64_check_relocs): Likewise.
1495
1496 2020-05-19 Alan Modra <amodra@gmail.com>
1497
1498 * aix5ppc-core.c (xcoff64_core_file_matches_executable_p): Use
1499 bfd_get_filename rather than accessing bfd->filename directly.
1500 * aout-target.h (MY (object_p)): Likewise.
1501 * aoutx.h (aout_find_nearest_line, aout_link_write_symbols): Likewise.
1502 * archive.c (find_nested_archive, _bfd_generic_read_ar_hdr_mag),
1503 (_bfd_construct_extended_name_table, _bfd_bsd44_write_ar_hdr),
1504 (_bfd_archive_bsd44_construct_extended_name_table),
1505 (_bfd_write_archive_contents, _bfd_compute_and_write_armap),
1506 (_bfd_bsd_write_armap): Likewise.
1507 * bfd.c (bfd_errmsg, _bfd_doprnt): Likewise.
1508 * cache.c (bfd_open_file): Likewise.
1509 * ecoff.c (_bfd_ecoff_write_armap): Likewise.
1510 * ecofflink.c (bfd_ecoff_debug_accumulate_other): Likewise.
1511 * elf32-bfin.c (bfinfdpic_relocate_section): Likewise.
1512 * elf32-frv.c (elf32_frv_relocate_section): Likewise.
1513 * elf32-hppa.c (elf32_hppa_final_link): Likewise.
1514 * elf32-nds32.c (nds32_elf_output_symbol_hook),
1515 (patch_tls_desc_to_ie): Likewise.
1516 * elf32-spu.c (sort_bfds, print_one_overlay_section),
1517 (spu_elf_auto_overlay): Likewise.
1518 * elf64-hppa.c (elf_hppa_final_link): Likewise.
1519 * elf64-ia64-vms.c (elf64_ia64_size_dynamic_sections): Likewise.
1520 * elfcore.h (elf_core_file_matches_executable_p): Likewise.
1521 * elflink.c (bfd_elf_size_dynamic_sections),
1522 (elf_link_input_bfd): Likewise.
1523 * linker.c (_bfd_generic_link_output_symbols): Likewise.
1524 * mach-o.c (bfd_mach_o_follow_dsym),
1525 (bfd_mach_o_close_and_cleanup): Likewise.
1526 * opncls.c (_bfd_delete_bfd, _maybe_make_executable),
1527 (find_separate_debug_file, get_build_id_name): Likewise.
1528 * pdp11.c (aout_find_nearest_line, aout_link_write_symbols): Likewise.
1529 * plugin.c (bfd_plugin_open_input): Likewise.
1530 * rs6000-core.c (rs6000coff_core_file_matches_executable_p): Likewise.
1531 * som.c (som_write_armap): Likewise.
1532 * srec.c (srec_write_record, srec_write_symbols): Likewise.
1533 * vms-lib.c (_bfd_vms_lib_get_imagelib_file),
1534 (_bfd_vms_lib_write_archive_contents): Likewise.
1535 * xcofflink.c (xcoff_link_add_dynamic_symbols): Likewise.
1536
1537 2020-05-19 Alan Modra <amodra@gmail.com>
1538
1539 PR 25713
1540 * bfdio.c (_bfd_real_fopen): Typo fix.
1541
1542 2020-05-18 Nick Clifton <nickc@redhat.com>
1543
1544 PR 26005
1545 * elf.c (bfd_section_from_shdr): Use bfd_malloc to allocate memory
1546 for the sections_being_created array.
1547
1548 2020-05-18 Alan Modra <amodra@gmail.com>
1549
1550 * ecoff.c (ecoff_slurp_reloc_table): Malloc external_relocs so
1551 they can be freed without also freeing internal_relocs.
1552
1553 2020-05-18 Jaydeep Chauhan <jaydeepchauhan1494@gmail.com>
1554
1555 PR 25713
1556 * bfdio.c (_bfd_real_fopen): Convert UNIX style sirectory
1557 separators into DOS style when creating a WIN32 fullpath.
1558
1559 2020-05-14 Nelson Chu <nelson.chu@sifive.com>
1560
1561 * elfnn-riscv.c (elfNN_riscv_mkobject): New function. We need this
1562 to initialize RISC-V tdata.
1563
1564 2020-05-12 Gunther Nikl <gnikl@justmail.de>
1565
1566 * aoutx.h (NAME (aout, swap_std_reloc_out)): Reject an unsupported
1567 relocation size.
1568
1569 2020-05-11 Alan Modra <amodra@gmail.com>
1570
1571 * elf64-ppc.c (xlate_pcrel_opt): Handle lxvp and stxvp.
1572
1573 2020-05-11 Alan Modra <amodra@gmail.com>
1574
1575 * elf64-ppc.c: Rename powerxx to power10 throughout.
1576
1577 2020-05-11 Alan Modra <amodra@gmail.com>
1578
1579 PR 25961
1580 * coffgen.c (coff_get_normalized_symtab): Check that buffer
1581 contains required number of auxents before processing any auxent.
1582 * coffswap.h (coff_swap_aux_in <C_FILE>): Only swap in extended
1583 file name from auxents for PE.
1584
1585 2020-05-04 Gunther Nikl <gnikl@justmail.de>
1586
1587 * aout-cris.c (DEFAULT_ARCH): Delete define.
1588 (MY_set_arch_mach): Likewise.
1589 (SET_ARCH_MACH): Use bfd_set_arch_mach with an explicit architecture
1590 of bfd_arch_cris.
1591 (swap_ext_reloc_in): Add casts to r_index extraction. Mask valid bits
1592 of r_type before the shift.
1593
1594 2020-05-04 Wilco Dijkstra <wdijkstr@arm.com>
1595
1596 PR ld/25665
1597 * elfnn-aarch64.c (group_sections): Copy implementation from
1598 elf32-arm.c.
1599
1600 2020-05-01 Alan Modra <amodra@gmail.com>
1601
1602 PR 25900
1603 * elfnn-riscv.c (_bfd_riscv_relax_section): Check root.type before
1604 accessing root.u.def of symbols. Also check root.u.def.section
1605 is non-NULL. Reverse tests so as to make the logic positive.
1606
1607 2020-05-01 Alan Modra <amodra@gmail.com>
1608
1609 PR 25882
1610 * elf32-tic6x.c (elf32_tic6x_merge_attributes): Don't transfer
1611 Tag_ABI_PIC or Tag_ABI_PID from dynamic objects to the output.
1612
1613 2020-05-01 Alan Modra <amodra@gmail.com>
1614
1615 PR 25882
1616 * elf32-bfin.c (elf32_bfin_merge_private_bfd_data): Add FIXME.
1617 * elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
1618 * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Likewise.
1619 * elf32-nds32.c (nds32_elf_merge_private_bfd_data): Likewise.
1620 * elf32-score.c (s3_elf32_score_merge_private_bfd_data): Likewise.
1621 * elf32-score7.c (s7_elf32_score_merge_private_bfd_data): Likewise.
1622 * elf32-sh.c (sh_elf_merge_private_data): Likewise.
1623 * elf32-tic6x.c (elf32_tic6x_merge_attributes): Likewise.
1624 * elf64-ia64-vms.c (elf64_ia64_merge_private_bfd_data): Likewise.
1625 * elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): Likewise.
1626
1627 2020-05-01 Alan Modra <amodra@gmail.com>
1628
1629 PR 25882
1630 * elf32-ppc.c (ppc_elf_merge_private_bfd_data): Ignore e_flags
1631 from shared libraries.
1632
1633 2020-04-29 Max Filippov <jcmvbkbc@gmail.com>
1634
1635 * elf32-xtensa.c (relax_section): Don't negate diff_value for
1636 XTENSA_NDIFF relocations. Don't add sign bits whe diff_value
1637 equals 0. Report overflow when the result has negative sign but
1638 all significant bits are zero.
1639
1640 2020-04-29 Gunther Nikl <gnikl@justmail.de>
1641
1642 * aoutx.h (swap_std_reloc_out): Special case 64 bit relocations.
1643 (aout_link_reloc_link_order): Likewise. Make r_length an unsigned.
1644
1645 2020-04-28 Alan Modra <amodra@gmail.com>
1646
1647 * vms-alpha.c (_bfd_vms_slurp_etir): Correct divide by zero check.
1648 Emit warning message.
1649
1650 2020-04-27 Tamar Christina <tamar.christina@arm.com>
1651
1652 * coff-i386.c (COFF_WITH_PE_BIGOBJ): New.
1653 * coff-x86_64.c (COFF_WITH_PE_BIGOBJ): New.
1654 * config.bfd (targ_selvecs): Rename x86_64_pe_be_vec
1655 to x86_64_pe_big_vec as it not a big-endian format.
1656 (vec i386_pe_big_vec): New.
1657 * configure.ac: Likewise.
1658 * targets.c: Likewise.
1659 * configure: Regenerate.
1660 * pe-i386.c (TARGET_SYM_BIG, TARGET_NAME_BIG,
1661 COFF_WITH_PE_BIGOBJ): New.
1662 * pe-x86_64.c (TARGET_SYM_BIG, TARGET_NAME_BIG):
1663 New.
1664 (x86_64_pe_be_vec): Moved.
1665
1666 2020-04-23 Anton Kolesov <anton.kolesov@synopsys.com>
1667
1668 * elf-bfd.h (elfcore_write_arc_v2): Add prototype.
1669 * elf.c (elfcore_grok_arc_v2): New function.
1670 (elfcore_grok_note): Call the new function to handle the corresponding
1671 note.
1672 (elfcore_write_arc_v2): New function.
1673 (elfcore_write_register_note): Call the new function to handle the
1674 corresponding pseudo-sections.
1675
1676 2020-04-22 Max Filippov <jcmvbkbc@gmail.com>
1677
1678 PR ld/25861
1679 * bfd-in2.h: Regenerated.
1680 * elf32-xtensa.c (elf_howto_table): New entries for
1681 R_XTENSA_PDIFF{8,16,32} and R_XTENSA_NDIFF{8,16,32}.
1682 (elf_xtensa_reloc_type_lookup, elf_xtensa_do_reloc)
1683 (relax_section): Add cases for R_XTENSA_PDIFF{8,16,32} and
1684 R_XTENSA_NDIFF{8,16,32}.
1685 * libbfd.h (bfd_reloc_code_real_names): Add names for
1686 BFD_RELOC_XTENSA_PDIFF{8,16,32} and
1687 BFD_RELOC_XTENSA_NDIFF{8,16,32}.
1688 * reloc.c: Add documentation for BFD_RELOC_XTENSA_PDIFF{8,16,32}
1689 and BFD_RELOC_XTENSA_NDIFF{8,16,32}.
1690
1691 2020-04-21 Tamar Christina <tamar.christina@arm.com>
1692
1693 PR binutils/24753
1694 * compress.c (bfd_get_full_section_contents): Exclude sections with no
1695 content.
1696
1697 2020-04-21 H.J. Lu <hongjiu.lu@intel.com>
1698
1699 PR ld/25849
1700 * elf-bfd.h (elf_backend_data): Add
1701 elf_backend_strip_zero_sized_dynamic_sections.
1702 (_bfd_elf_strip_zero_sized_dynamic_sections): New prototype.
1703 * elf64-alpha.c (elf_backend_strip_zero_sized_dynamic_sections):
1704 New macro.
1705 * elflink.c (_bfd_elf_strip_zero_sized_dynamic_sections): New
1706 function.
1707 * elfxx-target.h (elf_backend_strip_zero_sized_dynamic_sections):
1708 New macro.
1709 (elfNN_bed): Add elf_backend_strip_zero_sized_dynamic_sections.
1710
1711 2020-04-21 H.J. Lu <hongjiu.lu@intel.com>
1712
1713 * elf64-alpha.c (alpha_elf_reloc_entry): Replace reltext with
1714 sec.
1715 (elf64_alpha_check_relocs): Set sec instead of reltext. Warn
1716 DT_TEXTREL with -M.
1717 (elf64_alpha_calc_dynrel_sizes): Warn DT_TEXTREL with -M.
1718
1719 2020-04-21 Nick Clifton <nickc@redhat.com>
1720
1721 * po/sr.po: Updated Serbian translation.
1722
1723 2020-04-21 Alan Modra <amodra@gmail.com>
1724
1725 * elf32-sh.c (sh_elf_relocate_section): Remove STO_SH5_ISA32
1726 processing.
1727
1728 2020-04-20 Stephen Casner <casner@acm.org>
1729
1730 * pdp11.c (N_STAB): Modify value to avoid conflict with N_EXT
1731 causing globals from linker script to be treated as debug symbols.
1732 (translate_symbol_table): Don't sign-extend symbol values from 16
1733 to 64 bits in nm output.
1734
1735 2020-04-20 Alan Modra <amodra@gmail.com>
1736
1737 * elf64-ppc.c (ppc64_elf_size_stubs): Strip relbrlt too.
1738
1739 2020-04-18 Alan Modra <amodra@gmail.com>
1740
1741 * section.c (bfd_is_const_section): Correct test for special
1742 sections.
1743 * bfd-in2.h: Regenerate.
1744
1745 2020-04-17 Alan Modra <amodra@gmail.com>
1746
1747 PR 25842
1748 * elf.c (_bfd_elf_get_symbol_version_string): Don't segfault on
1749 NULL nodename.
1750
1751 2020-04-16 Nick Clifton <nickc@redhat.com>
1752
1753 PR 25803
1754 * elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Replace an
1755 abort with a more helpful error message.
1756
1757 2020-04-16 Alan Modra <amodra@gmail.com>
1758
1759 PR 25827
1760 * dwarf2.c (scan_unit_for_symbols): Wrap overlong lines. Don't
1761 strdup(0).
1762
1763 2020-04-15 Fangrui Song <maskray@google.com>
1764
1765 PR binutils/24613
1766 * coff-rs6000.c (xcoff_ppc_relocate_section): Change RM_GENERATE_ERROR
1767 to RM_DIAGNOSE plus a check of warn_unresolved_syms.
1768 * coff64-rs6000.c (xcoff_ppc_relocate_section): Likewise.
1769 * elf-bfd.h (_bfd_elf_large_com_section): Likewise.
1770 * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
1771 * elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise.
1772 * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
1773 * elf32-sh.c (sh_elf_relocate_section): Likewise.
1774 * elf32-spu.c (spu_elf_relocate_section): Likewise.
1775 * elf64-hppa.c (elf64_hppa_relocate_section): Likewise.
1776 * elflink.c (elf_link_output_extsym): Likewise.
1777 * elfxx-mips.c (mips_elf_calculate_relocation): Likewise.
1778
1779 2020-04-15 Alan Modra <amodra@gmail.com>
1780
1781 PR 25823
1782 * peXXigen.c (_bfd_XXi_swap_sym_in <C_SECTION>): Don't use a
1783 pointer into strings that may be freed for section name, always
1784 allocate a new string.
1785
1786 2020-04-14 Juan Manuel Guerrero <juan.guerrero@gmx.de>
1787 Jan W. Jagersma <jwjagersma@gmail.com>
1788
1789 * coff-go32.c (COFF_GO32, IMAGE_SCN_LNK_NRELOC_OVFL)
1790 (coff_SWAP_scnhdr_in, coff_SWAP_scnhdr_out): Define.
1791 (_bfd_go32_swap_scnhdr_in, _bfd_go32_swap_scnhdr_out)
1792 (_bfd_go32_mkobject): New functions.
1793 * coff-stgo32.c (IMAGE_SCN_LNK_NRELOC_OVFL)
1794 (coff_SWAP_scnhdr_in, coff_SWAP_scnhdr_out): Define.
1795 (go32exe_mkobject): Call _bfd_go32_mkobject.
1796 * coffcode.h (COFF_WITH_EXTENDED_RELOC_COUNTER): Define.
1797 (coff_set_alignment_hook): Define function for COFF_GO32_EXE
1798 and COFF_GO32.
1799 (coff_write_relocs): Enable extended reloc counter code if
1800 COFF_WITH_EXTENDED_RELOC_COUNTER is defined. Test for obj_go32.
1801 (coff_write_object_contents): Likewise. Pad section headers
1802 for COFF_GO32 and COFF_GO32EXE. Use bfd_coff_swap_scnhdr_out
1803 instead of coff_swap_scnhdr_out.
1804 * cofflink.c (_bfd_coff_final_link): Test also for obj_go32 to
1805 enable extended reloc counter.
1806 * coffswap.h: (coff_swap_scnhdr_in, coff_swap_scnhdr_out):
1807 Declare with ATTRIBUTE_UNUSED.
1808 * libcoff-in.h: (struct coff_tdata): New field go32.
1809 (obj_go32): Define.
1810 * libcoff.h: Regenerate.
1811
1812 2020-04-14 Fangrui Song <maskray@google.com>
1813
1814 PR gas/25768
1815 * elf.c (assign_section_numbers): Always set .stab sh_entsize to
1816 12.
1817
1818 2020-04-14 Stephen Casner <casner@acm.org>
1819
1820 PR ld/25677
1821 * pdp11.c: Add implementation of --imagic option.
1822 (adjust_o_magic): Fix objcopy --extract-symbol test.
1823 * libaout.h (enum aout_magic): Add i_magic.
1824
1825 2020-04-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
1826 Nick Clifton <nickc@redhat.com>
1827
1828 * elf32-sparc.c (sparc_final_write_processing): Fix whitespace.
1829 <0>: Ignore.
1830 <default>: Error rather than abort.
1831
1832 2020-04-03 H.J. Lu <hongjiu.lu@intel.com>
1833
1834 PR ld/25767
1835 * elf.c (_bfd_elf_fixup_group_sections): Remove zero-sized
1836 relocation section from section group.
1837
1838 2020-04-02 Jan W. Jagersma <jwjagersma@gmail.com>
1839
1840 * bfdio.c (bfd_bread, bfd_tell, bfd_seek, bfd_mmap): Always add
1841 bfd->origin to file offset.
1842 * bfdwin.c (bfd_get_file_window): Likewise.
1843 * bfd.c: Clarify the use of the bfd->origin field.
1844 * bfd-in2.h: Regenerate.
1845 * coff-i386.c: Don't include go32exe.h. Allow overriding
1846 coff_write_object_contents via COFF_WRITE_CONTENTS.
1847 * coff-stgo32.c (go32exe_cleanup, go32exe_mkobject)
1848 (go32exe_write_object_contents): New functions.
1849 (go32exe_temp_stub, go32exe_temp_stub_size): New static globals.
1850 (COFF_WRITE_CONTENTS, GO32EXE_DEFAULT_STUB_SIZE): Define.
1851 (create_go32_stub): Remove check for 2k size limit. Read stub
1852 from go32exe_temp_stub if present.
1853 (go32_stubbed_coff_bfd_copy_private_bfd_data): Allocate and
1854 copy variable-length stub.
1855 (go32_check_format): Read stub to go32exe_temp_stub, set
1856 origin, return go32exe_cleanup.
1857 (adjust_filehdr_in_post, adjust_filehdr_out_pre)
1858 (adjust_filehdr_out_post, adjust_scnhdr_in_post)
1859 (adjust_scnhdr_out_pre, adjust_scnhdr_out_post)
1860 (adjust_aux_in_post, adjust_aux_out_pre, adjust_aux_out_post):
1861 Remove functions and their associated #defines.
1862 * coffcode.h (coff_mkobject_hook): Remove stub copying code.
1863 * libcoff-in.h: (struct coff_tdata): New field stub_size.
1864 Rename field go32stub to stub.
1865 * libcoff.h: Regenerate.
1866 * coff-stgo32.c (go32_check_format): Rename to...
1867 (go32exe_check_format): ...this.
1868 (go32_stubbed_coff_bfd_copy_private_bfd_data): Rename to...
1869 (go32exe_copy_private_bfd_data): ...this.
1870 (stub_bytes): Rename to...
1871 (go32exe_default_stub): ...this.
1872 (create_go32_stub): Rename to...
1873 (go32exe_create_stub): ...this.
1874 * coff-stgo32.c (go32exe_copy_private_bfd_data): Avoid realloc
1875 when possible.
1876
1877 2020-04-01 H.J. Lu <hongjiu.lu@intel.com>
1878
1879 PR ld/25749
1880 PR ld/25754
1881 * elf32-i386.c (elf_i386_convert_load_reloc): Convert load
1882 relocation to R_386_32 for relocation against non-preemptible
1883 absolute symbol.
1884 (elf_i386_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Don't
1885 allocate dynamic relocation for non-preemptible absolute symbol.
1886 (elf_i386_relocate_section): Pass sec to
1887 GENERATE_DYNAMIC_RELOCATION_P.
1888 * elf64-x86-64.c (R_X86_64_converted_reloc_bit): Moved.
1889 (elf_x86_64_convert_load_reloc): Covert load relocation to
1890 R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible
1891 absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32
1892 for non-preemptible absolute symbol if they overflow.
1893 (elf_x86_64_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Set
1894 tls_type for GOT slot to GOT_ABS for non-preemptible absolute
1895 symbol. Don't allocate dynamic relocation for non-preemptible
1896 absolute symbol.
1897 (elf_x86_64_relocate_section): Don't generate relative relocation
1898 for GOTPCREL relocations aganst local absolute symbol. Pass sec
1899 to GENERATE_DYNAMIC_RELOCATION_P.
1900 * elfxx-x86.c (elf_x86_allocate_dynrelocs): No dynamic relocation
1901 against non-preemptible absolute symbol.
1902 (_bfd_elf_x86_valid_reloc_p): New function.
1903 (_bfd_x86_elf_size_dynamic_sections): No dynamic relocation for
1904 GOT_ABS GOT slot.
1905 * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Add an SEC
1906 argument. Don't generate dynamic relocation against
1907 non-preemptible absolute symbol.
1908 (ABS_SYMBOL_P): New.
1909 (GENERATE_RELATIVE_RELOC_P): Don't generate relative relocation
1910 against non-preemptible absolute symbol.
1911 (GOT_ABS): New.
1912 (R_X86_64_converted_reloc_bit): New. Moved from elf64-x86-64.c.
1913 (_bfd_elf_x86_valid_reloc_p): New.
1914
1915 2020-04-01 Tamar Christina <tamar.christina@arm.com>
1916
1917 PR ld/16017
1918 * elf32-arm.c (elf32_arm_populate_plt_entry): Set LSB of the PLT0
1919 address in the GOT if in thumb only mode.
1920
1921 2020-04-01 Tamar Christina <tamar.christina@arm.com>
1922
1923 * elf32-arm.c (elf32_thumb2_plt_entry): Fix PC-rel offset.
1924
1925 2020-04-01 Hans-Peter Nilsson <hp@bitrange.com>
1926
1927 * mmo.c (mmo_scan): Create .text section only when needed, not
1928 from the start.
1929
1930 2020-03-31 Alan Modra <amodra@gmail.com>
1931
1932 * coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Correct bfd_bread
1933 return value check.
1934
1935 2020-03-31 Alan Modra <amodra@gmail.com>
1936
1937 * vms-alpha.c (image_write): Check bounds for sections without
1938 contents too. Error on non-zero write to section without
1939 contents.
1940 (_bfd_vms_slurp_etir): Check return of image_write* functions.
1941
1942 2020-03-31 Alan Modra <amodra@gmail.com>
1943
1944 * tekhex.c (pass_over): Check is_eof before reading buffer.
1945
1946 2020-03-30 Nick Clifton <nickc@redhat.com>
1947
1948 PR binutils/pr25662
1949 * libcoff-in.h (struct pe_tdata): Rename the insert_timestamp
1950 field to timestamp and make it an integer.
1951 * libcoff.h: Regenerate.
1952 * peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Test the timestamp
1953 field in the pe_data structure rather than the insert_timestamp
1954 field.
1955
1956 2020-03-30 Alan Modra <amodra@gmail.com>
1957
1958 PR 25745
1959 * elf64-ppc.c (ppc64_elf_build_stubs): Use asprintf to form
1960 statistics message.
1961
1962 2020-03-26 Nick Clifton <nickc@redhat.com>
1963
1964 * cofflink.c (bfd_coff_get_internal_extra_pe_aouthdr): Delete.
1965 * libbfd-in.h (bfd_coff_get_internal_extra_pe_aouthdr): Remove
1966 prototype.
1967 * libbfd.h: Regenerate.
1968
1969 2020-03-26 Alan Modra <amodra@gmail.com>
1970
1971 * i386msdos.c (msdos_object_p): Catch -1 return from bfd_bread.
1972
1973 2020-03-26 Alan Modra <amodra@gmail.com>
1974
1975 * vms-alpha.c (dst_define_location): Limit size of dst_ptr_offsets
1976 array.
1977 (_bfd_vms_slurp_object_records): Rename "err" to "ok".
1978
1979 2020-03-25 Nick Clifton <nickc@redhat.com>
1980
1981 * cofflink.c (bfd_coff_get_internal_extra_pe_aouthdr): New
1982 function.
1983 * libbfd-in.h (bfd_coff_get_internal_extra_pe_aouthdr): Prototype.
1984 * libbfd.h: Regenerate.
1985
1986 2020-03-25 Shahab Vahedi <shahab@synopsys.com>
1987
1988 * elf32-arc.c (PRINT_DEBUG_RELOC_INFO_BEFORE): Use the
1989 correct field name in the output string.
1990
1991 2020-03-25 Alan Modra <amodra@gmail.com>
1992
1993 PR 25662
1994 * elf.c (assign_file_positions_for_load_sections): Adjust offset
1995 for SHT_NOBITS section if first in segment.
1996
1997 2020-03-24 H.J. Lu <hongjiu.lu@intel.com>
1998
1999 PR binutils/25708
2000 * elf-bfd.h (_bfd_elf_get_symbol_version_name): Renamed to ...
2001 (_bfd_elf_get_symbol_version_string): This.
2002 * elf.c (_bfd_elf_get_symbol_version_name): Renamed to ...
2003 (_bfd_elf_get_symbol_version_string): This.
2004 (bfd_elf_print_symbol): Pass TRUE to
2005 _bfd_elf_get_symbol_version_string.
2006 * libbfd-in.h (_bfd_nosymbols_get_symbol_version_string): Add a
2007 bfd_boolean argument.
2008 * syms.c (_bfd_nosymbols_get_symbol_version_string): Likewise.
2009 * targets.c (_bfd_get_symbol_version_string): Likewise.
2010 (bfd_get_symbol_version_string): Likewise.
2011 * bfd-in2.h: Regenerated.
2012
2013 2020-03-24 Nick Clifton <nickc@redhat.com>
2014 Jaydeep Chauhan <jaydeepchauhan1494@gmail.com>
2015
2016 PR 25713
2017 * bfdio.c (_bfd_real_fopen): Add code to handle long filenames on
2018 Win32 systems.
2019
2020 2020-03-24 Nick Clifton <nickc@redhat.com>
2021
2022 PR 25681
2023 * elf.c (_bfd_elf_map_sections_to_segments): When looking for a
2024 segment to use for PT_GNU_RELRO, ignore empty sections in a
2025 segment's current list.
2026
2027 2020-03-24 H.J. Lu <hongjiu.lu@intel.com>
2028
2029 PR binutils/25717
2030 * elf-bfd.h (elf_obj_tdata): Change num_group to unsigned int.
2031
2032 2020-03-24 H.J. Lu <hongjiu.lu@intel.com>
2033
2034 PR binutils/25708
2035 * elf-bfd.h (_bfd_elf_get_symbol_version_name): New.
2036 * elf.c (_bfd_elf_get_symbol_version_name): New function. Based
2037 on the previous _bfd_elf_get_symbol_version_string.
2038 (_bfd_elf_get_symbol_version_string): Use it.
2039
2040 2020-03-24 Alan Modra <amodra@gmail.com>
2041
2042 * archive.c (_bfd_generic_read_ar_hdr_mag): Sanity check extended
2043 name size. Use bfd_malloc rather than bfd_zmalloc, clearing just
2044 struct areltdata.
2045
2046 2020-03-23 Sebastian Huber <sebastian.huber@embedded-brains.de>
2047
2048 * elflink.c (_bfd_elf_tls_setup): Mention .tdata in comment.
2049
2050 2020-03-23 Alan Modra <amodra@gmail.com>
2051
2052 * ecoff.c (_bfd_ecoff_slurp_armap): Sanity check parsed_size and
2053 symbol count. Allocate an extra byte to ensure name strings
2054 are terminated. Sanity check name offsets. Release memory on
2055 error return.
2056
2057 2020-03-23 Alan Modra <amodra@gmail.com>
2058
2059 * i386msdos.c (msdos_object_p): Don't access e_lfanew when that
2060 field hasn't been read. Remove unnecessary casts.
2061
2062 2020-03-22 Alan Modra <amodra@gmail.com>
2063
2064 * coff64-rs6000.c (xcoff64_slurp_armap): Ensure size is large
2065 enough to read number of symbols.
2066
2067 2020-03-20 H.J. Lu <hongjiu.lu@intel.com>
2068
2069 * configure.ac (HAVE_EXECUTABLE_SUFFIX): Removed.
2070 (EXECUTABLE_SUFFIX): Likewise.
2071 * config.in: Regenerated.
2072 * configure: Likewise.
2073 * plugin.c (bfd_plugin_close_and_cleanup): Defined as
2074 _bfd_generic_close_and_cleanup.
2075 (plugin_list_entry): Remove resolution_file, resolution_option,
2076 real_bfd, real_nsyms, real_syms, lto_nsyms, lto_syms, gcc,
2077 lto_wrapper, gcc_env and initialized,
2078 (need_lto_wrapper_p): Removed.
2079 (get_lto_wrapper): Likewise.
2080 (setup_lto_wrapper_env): Likewise.
2081 (register_all_symbols_read): Likewise.
2082 (egister_cleanup): Likewise.
2083 (get_symbols): Likewise.
2084 (add_input_file): Likewise.
2085 (bfd_plugin_set_program_name): Remove need_lto_wrapper.
2086 (add_symbols): Updated.
2087 (try_claim): Likewise.
2088 (try_load_plugin): Likewise.
2089 (bfd_plugin_canonicalize_symtab): Likewise.
2090 * plugin.h (bfd_plugin_set_program_name): Remove int argument.
2091 (plugin_data_struct): Remove real_bfd, real_nsyms and real_syms.
2092
2093 2020-03-19 H.J. Lu <hongjiu.lu@intel.com>
2094
2095 PR binutils/25640
2096 * plugin.c (plugin_list_entry): Add has_symbol_type.
2097 (add_symbols_v2): New function.
2098 (bfd_plugin_open_input): Don't invoke LTO wrapper if LTO plugin
2099 provides symbol type.
2100 (try_load_plugin): Add LDPT_ADD_SYMBOLS_V2.
2101 (bfd_plugin_canonicalize_symtab): Use LTO plugin symbol type if
2102 available.
2103
2104 2020-03-20 Alan Modra <amodra@gmail.com>
2105
2106 * coff-rs6000.c (_bfd_xcoff_slurp_armap): Ensure size is large
2107 enough to read number of symbols.
2108
2109 2020-03-20 Alan Modra <amodra@gmail.com>
2110
2111 * elf.c (_bfd_elf_setup_sections): Don't test known non-NULL
2112 backend functions for NULL before calling.
2113 (copy_special_section_fields, _bfd_elf_copy_private_bfd_data),
2114 (bfd_section_from_shdr, assign_section_numbers): Likewise.
2115 * elfcode.h (elf_write_relocs, elf_slurp_reloc_table): Likewise.
2116 * elfnn-ia64.c (ignore_errors): New function.
2117 (elf_backend_link_order_error_handler): Redefine as ignore_errors.
2118
2119 2020-03-19 Nick Clifton <nickc@redhat.com>
2120
2121 PR 25676
2122 * dwarf2.c (struct varinfo): Add unit_offset field to record the
2123 location of the varinfo in the unit's debug info data. Change the
2124 type of the stack field to a boolean.
2125 (lookup_var_by_offset): New function. Returns the varinfo
2126 structure for the variable described at the given offset in the
2127 unit's debug info.
2128 (scan_unit_for_symbols): Add support for variables which have the
2129 DW_AT_specification attribute.
2130
2131 2020-03-19 Nick Clifton <nickc@redhat.com>
2132
2133 PR 25699
2134 * elf.c (bfd_elf_set_group_contents): Replace assertion with an
2135 error return.
2136
2137 2020-03-19 Sebastian Huber <sebastian.huber@embedded-brains.de>
2138
2139 * elfxx-riscv.c (riscv_parse_subset): Don't use C99.
2140
2141 2020-03-18 Nick Clifton <nickc@redhat.com>
2142
2143 PR 25673
2144 * elf.c (_bfd_elf_write_secondary_reloc_section): Fix illegal
2145 memory access when processing a corrupt secondary reloc section.
2146
2147 2020-03-18 Christophe Lyon <christophe.lyon@linaro.org>
2148
2149 * elf32-arm.c (arm_build_one_stub): Emit a fatal error message
2150 instead of calling abort.
2151 * elf32-csky.c (csky_build_one_stub): Likewise.
2152 * elf32-hppa.c (hppa_build_one_stub): Likewise.
2153 * elf32-m68hc11.c (m68hc11_elf_build_one_stub): Likewise.
2154 * elf32-m68hc12.c (m68hc12_elf_build_one_stub): Likewise.
2155 * elf32-metag.c (metag_build_one_stub): Likewise.
2156 * elf32-nios2.c (nios2_build_one_stub): Likewise.
2157 * elf64-ppc.c (ppc_build_one_stub): Likewise.
2158 (ppc_size_one_stub): Likewise.
2159 * elfnn-aarch64.c (aarch64_build_one_stub): Likewise.
2160
2161 2020-03-17 Nick Clifton <nickc@redhat.com>
2162
2163 PR 25688
2164 * elf.c (_bfd_elf_copy_special_section_fields): Replace assertions
2165 with error messages.
2166
2167 2020-03-17 Nick Clifton <nickc@redhat.com>
2168
2169 PR 25687
2170 * elf.c (_bfd_elf_slurp_secondary_reloc_section): Remove redundant
2171 free. Add free on another failure path.
2172
2173 2020-03-16 Alan Modra <amodra@gmail.com>
2174
2175 PR 25675
2176 * elf.c (elf_sort_segments): Don't call bfd_octets_per_byte unless
2177 we have a non-zero section count. Do lma comparison in octets.
2178
2179 2020-03-16 Alan Modra <amodra@gmail.com>
2180
2181 * vms-alpha.c (dst_restore_location): Validate index into
2182 dst_ptr_offsets array before accessing. Return status.
2183 (dst_retrieve_location): Similarly, making "loc" parameter a
2184 pointer to return value.
2185 (_bfd_vms_slurp_etir): Update calls to above functions.
2186
2187 2020-03-14 Kamil Rytarowski <n54@gmx.com>
2188
2189 * configure.ac: Include netbsd-core.lo for all NetBSD arm and mips
2190 targets.
2191 * configure: Regenerated.
2192
2193 2020-03-14 Alan Modra <amodra@gmail.com>
2194
2195 * section.c (BFD_FAKE_SECTIONS): Formatting.
2196 * bfd-in2.h: Regenerate.
2197
2198 2020-03-13 Kamil Rytarowski <n54@gmx.com>
2199
2200 * elf.c (elfcore_grok_netbsd_note): Add support for
2201 NT_NETBSDCORE_LWPSTATUS notes.
2202
2203 2020-03-13 Christophe Lyon <christophe.lyon@linaro.org>
2204
2205 * bfd-in2.h: Regenerate.
2206 * section.c (asection): Add already_assigned field.
2207 (BFD_FAKE_SECTION): Add default initializer for it.
2208 * ecoff.c (bfd_debug_section): Initialize already_assigned field.
2209 * elf32-arm.c (arm_build_one_stub): Add support for
2210 non_contiguous_regions.
2211 * elf32-csky.c (csky_build_one_stub): Likewise.
2212 * elf32-hppa.c (hppa_build_one_stub): Likewise.
2213 * elf32-m68hc11.c (m68hc11_elf_build_one_stub): Likewise.
2214 * elf32-m68hc12.c (m68hc12_elf_build_one_stub): Likewise.
2215 * elf32-metag.c (metag_build_one_stub): Likewise.
2216 * elf32-nios2.c (nios2_build_one_stub): Likewise.
2217 * elf64-ppc.c (ppc_build_one_stub): Likewise.
2218 (ppc_size_one_stub): Likewise.
2219 * elfnn-aarch64.c (aarch64_build_one_stub): Likewise.
2220 * elflink.c (elf_link_input_bfd): Likewise.
2221
2222 2020-03-13 H.J. Lu <hongjiu.lu@intel.com>
2223
2224 PR ld/24920
2225 * elf-linker-x86.h (elf_linker_x86_params): Add
2226 static_before_all_inputs and has_dynamic_linker.
2227 * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Report
2228 dynamic input objects if -static is passed at command-line
2229 before all input files without --dynamic-linker unless
2230 --no-dynamic-linker is used.
2231
2232 2020-03-13 Kamil Rytarowski <n54@gmx.com>
2233
2234 * elf.c (elfcore_grok_netbsd_note): Add support for aarch64.
2235
2236 2020-03-13 Christian Eggers <ceggers@gmx.de>
2237
2238 * bfd.c (bfd_record_phdr): New local "opb". Fix assignment of
2239 "p_paddr" from "at".
2240 * elfcode.h (bfd_from_remote_memory): Add units to several
2241 parameters. New local "opb". Fix usage of p_align. Fix
2242 calculation of "localbase" from "ehdr_vma" and "p_vaddr". Fix
2243 call of target_read_memory.
2244 * elflink.c (elf_fixup_link_order): Fix scope of "s" local. Fix
2245 calculation of "offset" and "output_offset".
2246 (bfd_elf_final_link): New local "opb". Fix calculation of "size"
2247 from "offset" and fix calculation of "end" from "vma+size". Fix
2248 comparison between "sh_addr" and "vma"/"output_offset".
2249 (bfd_elf_discard_info): Fix calculation of "eh_alignment".
2250 * elf-bfd.h (struct elf_link_hash_table): Add unit to tls_size
2251 member.
2252 * elf.c (_bfd_elf_map_sections_to_segments): Add unit (bytes/
2253 octets) to "wrap_to2 and "phdr_size" locals. Fix calculation of
2254 "wrap_to" value. Add unit (bytes) to phdr_lma variable. Fix
2255 assignment of p_paddr from phdr_lma. Fix comparison between
2256 "lma+size" and "next->lma".
2257 (elf_sort_segments): Fix assignment from p_paddr to lma.
2258 (assign_file_positions_for_load_sections): Add unit (bytes) to
2259 local "align". Fix calculation of local "off_adjust". Fix
2260 calculation of local "filehdr_vaddr".
2261 (assign_file_positions_for_non_load_sections): New local "opb".
2262 Fix calculation of "end" from "p_size". Fix comparison between
2263 "vma+SECTION_SIZE" and "start". Fix calculation of "p_memsz"
2264 from "end" and "p_vaddr".
2265 (rewrite_elf_program_header): Fix comparison between p_vaddr and
2266 vma. Fix assignment to p_paddr from lma. Fix comparison between
2267 p_paddr and lma. Fix assignment to p_paddr from lma.
2268 * merge.c (sec_merge_emit): New local "opb". Convert
2269 "alignment_power" to octets.
2270 (_bfd_add_merge_section): New locals "alignment_power" and
2271 "opb". Fix comparison between "alignment_power" and
2272 "sizeof(align)".
2273 (_bfd_merge_sections): New local "opb". Divide size by opb
2274 before checking align mask.
2275
2276 2020-03-13 Christian Eggers <ceggers@gmx.de>
2277
2278 * elf.c (_bfd_elf_make_section_from_shdr): Introduce new temp
2279 opb. Divide Elf_Internal_Shdr::sh_addr by opb when setting
2280 section LMA/VMA.
2281 (_bfd_elf_make_section_from_phdr): Similarly.
2282 (elf_fake_sections): Fix calculation of
2283 Elf_Internal_shdr::sh_addr from section VMA.
2284 (_bfd_elf_map_sections_to_segments): Fix mixup between octets
2285 and bytes.
2286 (assign_file_positions_for_load_sections): Fix calculations of
2287 Elf_Internal_shdr::p_vaddr and p_paddr from section LMA/VMA. Fix
2288 comparison between program header address and section LMA.
2289 (assign_file_positions_for_non_load_sections): Likewise.
2290 (rewrite_elf_program_header): Likewise. Introduce new temp opb.
2291 (IS_CONTAINED_BY_VMA): Add parameter opb.
2292 (IS_CONTAINED_BY_LMA,IS_SECTION_IN_INPUT_SEGMENT,
2293 INCLUDE_SECTION_IN_SEGMENT): Likewise.
2294 (copy_elf_program_header): Update call to ELF_SECTION_IN_SEGMENT.
2295 Fix calculations of p_addr_valid and p_vaddr_offset.
2296 * elflink.c (elf_link_add_object_symbols): Multiply section VMA
2297 with octets per byte when comparing against p_vaddr.
2298
2299 2020-03-11 Alan Modra <amodra@gmail.com>
2300
2301 * som.c (setup_sections): Sanity check subspace.name.
2302
2303 2020-03-11 Alan Modra <amodra@gmail.com>
2304
2305 * elf64-ppc.c (ppc64_elf_inline_plt): Do increment rel in for loop.
2306
2307 2020-03-10 Alan Modra <amodra@gmail.com>
2308
2309 PR 25648
2310 * ihex.c (ihex_write_object_contents): Don't assume ordering of
2311 addresses here.
2312
2313 2020-03-09 Alan Modra <amodra@gmail.com>
2314
2315 * wasm-module.c (wasm_scan): Sanity check file name length
2316 before allocating memory. Move common section setup code. Do
2317 without bfd_tell to calculate section size.
2318
2319 2020-03-06 Nick Clifton <nickc@redhat.com>
2320
2321 * elf.c (_bfd_elf_set_section_contents): Replace call to abort
2322 with error messages and failure return values.
2323
2324 2020-03-05 Max Filippov <jcmvbkbc@gmail.com>
2325
2326 * elf32-xtensa.c (shrink_dynamic_reloc_sections): Shrink dynamic
2327 relocation sections for any removed reference to a dynamic symbol.
2328
2329 2020-03-05 Nick Clifton <nickc@redhat.com>
2330
2331 * elf-bfd.h (struct elf_backend_data): Add new fields:
2332 init_secondary_reloc_section, slurp_secondary_reloc_section,
2333 write_secondary_reloc_section.
2334 (_bfd_elf_init_secondary_reloc_section): Prototype.
2335 (_bfd_elf_slurp_secondary_reloc_section): Prototype.
2336 (_bfd_elf_write_secondary_reloc_section): Prototype.
2337 * elf.c ( bfd_section_from_shdr): Invoke the new
2338 init_secondary_reloc_section backend function, if defined, when a
2339 second reloc section is encountered.
2340 (swap_out_syms): Invoke the new symbol_section_index function, if
2341 defined, when computing the section index of an OS/PROC specific
2342 symbol.
2343 (_bfd_elf_init_secondary_reloc_section): New function.
2344 (_bfd_elf_slurp_secondary_reloc_section): New function.
2345 (_bfd_elf_write_secondary_reloc_section): New function.
2346 (_bfd_elf_copy_special_section_fields): New function.
2347 * elfcode.h (elf_write_relocs): Invoke the new
2348 write_secondary_relocs function, if defined, in order to emit
2349 secondary relocs.
2350 (elf_slurp_reloc_table): Invoke the new slurp_secondary_relocs
2351 function, if defined, in order to read in secondary relocs.
2352 * elfxx-target.h (elf_backend_copy_special_section_fields):
2353 Provide a non-NULL default definition.
2354 (elf_backend_init_secondary_reloc_section): Likewise.
2355 (elf_backend_slurp_secondary_reloc_section): Likewise.
2356 (elf_backend_write_secondary_reloc_section): Likewise.
2357 (struct elf_backend_data elfNN_bed): Add initialisers for the new
2358 fields.
2359 * configure.ac (score_elf32_[bl]e_vec): Add elf64.lo
2360 * configure: Regenerate.
2361
2362 2020-03-05 Alan Modra <amodra@gmail.com>
2363
2364 * archive64.c (_bfd_archive_64_bit_slurp_armap): Check parsed_size
2365 against file size before allocating memory. Use bfd_alloc rather
2366 than bfd_zalloc for carsym/strings memory.
2367
2368 2020-03-04 Alan Modra <amodra@gmail.com>
2369
2370 * elf.c (elf_fake_sections): Ensure sh_addralign is such that
2371 sh_addr mod sh_addalign is zero.
2372
2373 2020-03-04 Alan Modra <amodra@gmail.com>
2374
2375 * format.c (bfd_check_format_matches): Call cleanup on error exit.
2376
2377 2020-03-03 Alan Modra <amodra@gmail.com>
2378
2379 * format.c (struct bfd_preserve): Add cleanup field.
2380 (bfd_preserve_save): Add cleanup param and save.
2381 (bfd_preserve_restore): Return cleanup.
2382 (bfd_preserve_finish): Call the cleanup for the discarded match.
2383 (bfd_check_format_matches): Pass cleanup to bfd_preserve_save,
2384 and clear when preserving a match. Restore cleanup too when
2385 restoring that match.
2386
2387 2020-03-02 Alan Modra <amodra@gmail.com>
2388
2389 * cisco-core.c (cisco_core_file_p): Return bfd_cleanup.
2390 * hpux-core.c (hpux_core_core_file_p): Update prototype.
2391 * sco5-core.c (sco5_core_file_p): Return bfd_cleanup.
2392 (core_sco5_vec): Correct initialisers.
2393
2394 2020-03-02 Alan Modra <amodra@gmail.com>
2395
2396 * aix386-core.c (aix386_core_file_p): Return bfd_cleanup.
2397 * aix5ppc-core.c (xcoff64_core_p): Likewise.
2398 * cisco-core.c (cisco_core_file_validate): Likewise.
2399 * hppabsd-core.c (hppabsd_core_core_file_p): Likewise.
2400 * hpux-core.c (hpux_core_core_file_p): Likewise.
2401 * irix-core.c (irix_core_core_file_p): Likewise.
2402 * lynx-core.c (lynx_core_file_p): Likewise.
2403 * netbsd-core.c (netbsd_core_file_p): Likewise.
2404 * osf-core.c (osf_core_core_file_p): Likewise.
2405 * ptrace-core.c (ptrace_unix_core_file_p): Likewise.
2406 * sco5-core.c (sco5_core_file_p): Likewise.
2407
2408 2020-03-02 H.J. Lu <hongjiu.lu@intel.com>
2409
2410 * trad-core.c (trad_unix_core_file_p): Return bfd_cleanup.
2411
2412 2020-03-02 Alan Modra <amodra@gmail.com>
2413
2414 * targets.c (bfd_cleanup): New typedef.
2415 (struct bfd <_bfd_check_format>): Return a bfd_cleanup.
2416 * libbfd-in.h (_bfd_no_cleanup): Define.
2417 * format.c (bfd_reinit): Add cleanup parameter, call it.
2418 (bfd_check_format_matches): Set cleanup from _bfd_check_format
2419 call and pass to bfd_reinit. Delete temp, use abfd->xvec instead.
2420 * aout-target.h (callback, object_p): Return bfd_cleanup.
2421 * aout-tic30.c (tic30_aout_callback, tic30_aout_object_p): Likewise.
2422 * archive.c (bfd_generic_archive_p): Likewise.
2423 * binary.c (binary_object_p): Likewise.
2424 * coff-alpha.c (alpha_ecoff_object_p): Likewise.
2425 * coff-ia64.c (ia64coff_object_p): Likewise.
2426 * coff-rs6000.c (_bfd_xcoff_archive_p, rs6000coff_core_p): Likewise.
2427 * coff-sh.c (coff_small_object_p): Likewise.
2428 * coff-stgo32.c (go32_check_format): Likewise.
2429 * coff64-rs6000.c (xcoff64_archive_p, rs6000coff_core_p),
2430 (xcoff64_core_p): Likewise.
2431 * coffgen.c (coff_real_object_p, coff_object_p): Likewise.
2432 * elf-bfd.h (bfd_elf32_object_p, bfd_elf32_core_file_p),
2433 (bfd_elf64_object_p, bfd_elf64_core_file_p): Likewise.
2434 * elfcode.h (elf_object_p): Likewise.
2435 * elfcore.h (elf_core_file_p): Likewise.
2436 * i386msdos.c (msdos_object_p): Likewise.
2437 * ihex.c (ihex_object_p): Likewise.
2438 * libaout.h (some_aout_object_p): Likewise.
2439 * libbfd-in.h (bfd_generic_archive_p, _bfd_dummy_target),
2440 (_bfd_vms_lib_alpha_archive_p, _bfd_vms_lib_ia64_archive_p): Likewise.
2441 * libbfd.c (_bfd_dummy_target): Likewise.
2442 * libcoff-in.h (coff_object_p): Likewise.
2443 * mach-o-aarch64.c (bfd_mach_o_arm64_object_p),
2444 (bfd_mach_o_arm64_core_p): Likewise.
2445 * mach-o-arm.c (bfd_mach_o_arm_object_p),
2446 (bfd_mach_o_arm_core_p): Likewise.
2447 * mach-o-i386.c (bfd_mach_o_i386_object_p),
2448 (bfd_mach_o_i386_core_p): Likewise.
2449 * mach-o-x86-64.c (bfd_mach_o_x86_64_object_p),
2450 (bfd_mach_o_x86_64_core_p): Likewise.
2451 * mach-o.c (bfd_mach_o_header_p, bfd_mach_o_gen_object_p),
2452 (bfd_mach_o_gen_core_p, bfd_mach_o_fat_archive_p): Likewise.
2453 * mach-o.h (bfd_mach_o_object_p, bfd_mach_o_core_p),
2454 (bfd_mach_o_fat_archive_p, bfd_mach_o_header_p): Likewise.
2455 * mmo.c (mmo_object_p): Likewise.
2456 * pef.c (bfd_pef_object_p, bfd_pef_xlib_object_p): Likewise.
2457 * peicode.h (coff_real_object_p, pe_ILF_object_p),
2458 (pe_bfd_object_p): Likewise.
2459 * plugin.c (ld_plugin_object_p, bfd_plugin_object_p): Likewise.
2460 * ppcboot.c (ppcboot_object_p): Likewise.
2461 * rs6000-core.c (rs6000coff_core_p): Likewise.
2462 * som.c (som_object_setup, som_object_p): Likewise.
2463 * srec.c (srec_object_p, symbolsrec_object_p): Likewise.
2464 * tekhex.c (tekhex_object_p): Likewise.
2465 * vms-alpha.c (alpha_vms_object_p): Likewise.
2466 * vms-lib.c (_bfd_vms_lib_archive_p, _bfd_vms_lib_alpha_archive_p),
2467 (_bfd_vms_lib_ia64_archive_p, _bfd_vms_lib_txt_archive_p): Likewise.
2468 * wasm-module.c (wasm_object_p): Likewise.
2469 * xsym.c (bfd_sym_object_p): Likewise.
2470 * xsym.h (bfd_sym_object_p): Likewise.
2471 * aoutx.h (some_aout_object_p): Likewise, and callback parameter
2472 return type.
2473 * pdp11.c (some_aout_object_p): Likewise.
2474 * plugin.c (register_ld_plugin_object_p): Update object_p
2475 parameter type.
2476 * plugin.h (register_ld_plugin_object_p): Likewise.
2477 * bfd-in2.h: Regenerate.
2478 * libbfd.h: Regenerate.
2479 * libcoff.h: Regenerate.
2480
2481 2020-03-02 Alan Modra <amodra@gmail.com>
2482
2483 * coff-alpha.c (alpha_ecoff_le_vec): Add SEC_SMALL_DATA to
2484 applicable section flags.
2485 * coff-mips.c (mips_ecoff_le_vec, mips_ecoff_be_vec): Likewise.
2486 (mips_ecoff_bele_vec): Likewise.
2487 * coffcode.h (sec_to_styp_flags): Set SEC_SMALL_DATA for .sdata
2488 and .sbss sections.
2489 * ecoff.c (_bfd_ecoff_new_section_hook): Likewise.
2490 (_bfd_ecoff_styp_to_sec_flags): Likewise.
2491
2492 2020-03-02 Alan Modra <amodra@gmail.com>
2493
2494 * elf32-m32r.c (m32r_elf_section_flags): New function.
2495 (elf_backend_section_flags): Define.
2496 * elf32-nds32.c (nds32_elf_section_flags): New function.
2497 (elf_backend_section_flags): Define.
2498 * elf32-ppc.c (ppc_elf_section_from_shdr): Set SEC_SMALL_DATA for
2499 .sbss and .sdata sections.
2500 * elf32-v850.c (v850_elf_section_from_shdr): Set SEC_SMALL_DATA
2501 for SHF_V850_GPREL sections.
2502 * elf64-alpha.c (elf64_alpha_section_from_shdr): Delete outdated
2503 FIXME.
2504 * elf64-hppa.c (elf64_hppa_section_from_shdr): Set SEC_SMALL_DATA
2505 for SHF_PARISC_SHORT sections.
2506 * elf64-ppc.c (ppc64_elf_section_flags): New function.
2507 (elf_backend_section_flags): Define.
2508 * elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Set SEC_SMALL_DATA
2509 for SHF_MIPS_GPREL sections. Delete FIXME.
2510
2511 2020-03-02 Alan Modra <amodra@gmail.com>
2512
2513 * elf-bfd.h (elf_backend_section_flags): Remove flagword* param.
2514 * elf.c (_bfd_elf_make_section_from_shdr): Set section flags before
2515 calling elf_backend_section_flags with adjusted params. Use
2516 newsect->flags past that point.
2517 (_bfd_elf_new_section_hook): Always set sh_type and sh_flags for
2518 special sections.
2519 (_bfd_elf_init_private_section_data): Allow normal sh_type sections
2520 to have their type overridden, and all sh_flags but processor and
2521 os specific.
2522 * elf32-arm.c (elf32_arm_section_flags): Adjust for changed params.
2523 * elf32-mep.c (mep_elf_section_flags): Likewise.
2524 * elf32-nios2.c (nios2_elf32_section_flags): Likewise.
2525 * elf64-alpha.c (elf64_alpha_section_flags): Likewise.
2526 * elf64-ia64-vms.c (elf64_ia64_section_flags): Likewise.
2527 * elfnn-ia64.c (elfNN_ia64_section_flags): Likewise.
2528 * elfnn-aarch64.c (elfNN_aarch64_size_stubs): Exclude the linker
2529 stub BFD and non-aarch64 input files when scanning for stubs.
2530
2531 2020-03-02 Alan Modra <amodra@gmail.com>
2532
2533 * coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Provide an upper
2534 limit to decompressed element size.
2535
2536 2020-03-02 Alan Modra <amodra@gmail.com>
2537
2538 * vms-lib.c (vms_traverse_index): Add recur_count param and
2539 update calls. Fail on excessive recursion.
2540
2541 2020-03-02 Alan Modra <amodra@gmail.com>
2542
2543 * vms-alpha.c (vms_get_remaining_object_record): Use
2544 bfd_realloc_or_free rather than bfd_realloc.
2545 (add_symbol_entry, vector_grow1, alpha_vms_slurp_relocs): Likewise.
2546 (dst_define_location, parse_module): Likewise, and check realloc
2547 return status before using memory. Return status from function
2548 adjusting all callers.
2549
2550 2020-02-28 Alan Modra <amodra@gmail.com>
2551
2552 * vms-lib.c (_bfd_vms_lib_archive_p): Free memory on error paths.
2553
2554 2020-02-28 Alan Modra <amodra@gmail.com>
2555
2556 * vms-alpha.c (alpha_vms_object_p): Use _bfd_malloc_and_read.
2557 Remove duplicate undersize check.
2558
2559 2020-02-27 Alan Modra <amodra@gmail.com>
2560
2561 PR 24511
2562 * mmo.c (mmo_scan): Set SEC_DATA for .data.
2563
2564 2020-02-27 Alan Modra <amodra@gmail.com>
2565
2566 PR 24511
2567 * syms.c (stt): Trim off all but 'e', 'i' and 'p' entries.
2568 (coff_section_type): Adjust comment.
2569 (decode_section_type): Likewise. Call coff_section_type before
2570 decode_section_type.
2571 (bfd_decode_symclass): Use 'c' for common sections other than
2572 the standard one.
2573
2574 2020-02-27 Alan Modra <amodra@gmail.com>
2575
2576 * coff-rs6000.c (_bfd_xcoff_read_ar_hdr): Put all data in one
2577 malloc'd block.
2578
2579 2020-02-27 Alan Modra <amodra@gmail.com>
2580
2581 * bfd.c (bfd_stat_arch_elt): Use vector of containing archive,
2582 if file is an archive element.
2583 * bfd-in2.h: Regenerate.
2584
2585 2020-02-26 Alan Modra <amodra@gmail.com>
2586
2587 * archive.c (do_slurp_bsd_armap): Increase minimum parsed_size, and
2588 bfd_set_error on failing test. Don't bother changing bfd_error on
2589 file read error. Check symdef_count is multiple of BSD_SYMDEF_SIZE.
2590 Check sym name is within string buffer. Use size_t for some vars.
2591 (do_slurp_coff_armap): Use size_t for some variables, fix size of
2592 int_buf. Don't change bfd_error on file read error. Use
2593 _bfd_mul_overflow when calculating carsym buffer size. Reorder
2594 calculations to catch overflows before they occur. malloc and
2595 free raw armap rather than using bfd_alloc. Read raw armap before
2596 allocating carsym+strings buffer.
2597 (_bfd_slurp_extended_name_table): Localize variables. Check
2598 name size against file size.
2599
2600 2020-02-26 Alan Modra <amodra@gmail.com>
2601
2602 * vms-lib.c (vms_lib_read_index): Release correct buffer.
2603
2604 2020-02-26 Alan Modra <amodra@gmail.com>
2605
2606 * elf32-rx.c (rx_elf_relocate_section): Use bfd_malloc rather than
2607 malloc. Check for NULL return from bfd_malloc.
2608 (rx_table_find, rx_table_map): Likewise.
2609 (rx_set_section_contents): Check bfd_alloc return.
2610 (rx_dump_symtab): Don't alloc internal_syms or external_syms.
2611
2612 2020-02-26 Alan Modra <amodra@gmail.com>
2613
2614 * aoutx.h: Indent labels correctly. Format error strings.
2615 * archive.c: Likewise.
2616 * archive64.c: Likewise.
2617 * coff-arm.c: Likewise.
2618 * coff-rs6000.c: Likewise.
2619 * coff-stgo32.c: Likewise.
2620 * cpu-arm.c: Likewise.
2621 * dwarf2.c: Likewise.
2622 * elf-ifunc.c: Likewise.
2623 * elf-properties.c: Likewise.
2624 * elf-s390-common.c: Likewise.
2625 * elf-strtab.c: Likewise.
2626 * elf.c: Likewise.
2627 * elf32-arm.c: Likewise.
2628 * elf32-bfin.c: Likewise.
2629 * elf32-cr16.c: Likewise.
2630 * elf32-csky.c: Likewise.
2631 * elf32-i386.c: Likewise.
2632 * elf32-m68k.c: Likewise.
2633 * elf32-msp430.c: Likewise.
2634 * elf32-nds32.c: Likewise.
2635 * elf32-nios2.c: Likewise.
2636 * elf32-pru.c: Likewise.
2637 * elf32-xtensa.c: Likewise.
2638 * elf64-ia64-vms.c: Likewise.
2639 * elf64-x86-64.c: Likewise.
2640 * elfcode.h: Likewise.
2641 * elfcore.h: Likewise.
2642 * elflink.c: Likewise.
2643 * elfnn-aarch64.c: Likewise.
2644 * elfnn-ia64.c: Likewise.
2645 * elfnn-riscv.c: Likewise.
2646 * elfxx-mips.c: Likewise.
2647 * elfxx-sparc.c: Likewise.
2648 * elfxx-x86.c: Likewise.
2649 * i386lynx.c: Likewise.
2650 * merge.c: Likewise.
2651 * pdp11.c: Likewise.
2652 * plugin.c: Likewise.
2653 * reloc.c: Likewise.
2654
2655 2020-02-26 Alan Modra <amodra@gmail.com>
2656
2657 PR 25593
2658 * elf-bfd.h (struct elf_link_hash_table): Rename "loaded" to
2659 "dyn_loaded".
2660 (bfd_elf_add_dt_needed_tag): Declare.
2661 * elf-strtab.c (_bfd_elf_strtab_restore): Handle NULL buf.
2662 * elflink.c (bfd_elf_add_dt_needed_tag): Make global and rename
2663 from elf_add_dt_needed_tag. Remove soname and doit param.
2664 (elf_link_add_object_symbols): Don't use elf_add_dt_needed_tag
2665 to see whether as-needed lib is already loaded, use dyn_loaded
2666 list instead. When saving and restoring around as-needed lib
2667 handle possibility that dynstr has not been initialised. Don't
2668 add DT_NEEDED tags here. Limit dyn_loaded list to dynamic libs.
2669 Mark libs loaded via DT_NEEDED entries of other libs with
2670 DYN_NO_NEEDED if they should not be mentioned in DT_NEEDED of
2671 the output.
2672 (elf_link_check_versioned_symbol): Remove now unneccesary
2673 DYNAMIC check when traversing dyn_loaded list.
2674
2675 2020-02-26 Alan Modra <amodra@gmail.com>
2676
2677 * bfdio.c (bfd_get_file_size): Ignore bogus archive element sizes.
2678
2679 2020-02-25 H.J. Lu <hongjiu.lu@intel.com>
2680
2681 PR binutils/25584
2682 * plugin.c (need_lto_wrapper_p): New.
2683 (bfd_plugin_set_program_name): Add an int argument to set
2684 need_lto_wrapper_p.
2685 (get_lto_wrapper): Return FALSE if need_lto_wrapper_p isn't
2686 set.
2687 * plugin.h (bfd_plugin_set_program_name): Add an int argument.
2688
2689 2020-02-24 Alan Modra <amodra@gmail.com>
2690
2691 * vms-lib.c (_bfd_vms_lib_archive_p): Correct overflow checks.
2692
2693 2020-02-24 Alan Modra <amodra@gmail.com>
2694
2695 * vms-lib.c (struct carsym_mem): Add limit.
2696 (vms_add_index): Heed limit.
2697 (vms_traverse_index): Catch buffer overflows. Remove outdated fixme.
2698 (vms_lib_read_index): Set up limit. Catch 32-bit overflow.
2699 Always return actual number read.
2700 (_bfd_vms_lib_archive_p): Catch buffer overflows. Replace
2701 assertion with error exit.
2702
2703 2020-02-22 Alan Modra <amodra@gmail.com>
2704
2705 PR 25585
2706 * elf.c (assign_file_positions_for_load_sections): Continue linking
2707 on "PHDR segment not covered by LOAD segment" errors.
2708
2709 2020-02-21 Alan Modra <amodra@gmail.com>
2710
2711 * mach-o.c (bfd_mach_o_canonicalize_relocs): Fix ineffective
2712 overflow check.
2713 (bfd_mach_o_canonicalize_reloc): Likewise.
2714 (bfd_mach_o_canonicalize_dynamic_reloc): Likewise. Sanity check
2715 counts and offsets against file size.
2716 (bfd_mach_o_build_dysymtab): Fix ineffective overflow check.
2717 (bfd_mach_o_mangle_sections): Remove unnecessary overflow check.
2718 (bfd_mach_o_read_symtab_symbols): Sanity check count and offset
2719 against file size. Delete symbol table error message.
2720 (bfd_mach_o_read_dysymtab): Sanity check counts and offsets
2721 against file size.
2722 (bfd_mach_o_read_symtab): Likewise.
2723 (bfd_mach_o_read_command): Pass file size.
2724 (bfd_mach_o_scan): Sanity check command count against file size.
2725
2726 2020-02-21 Alan Modra <amodra@gmail.com>
2727
2728 PR 25569
2729 * aoutx.h (adjust_o_magic, adjust_z_magic, adjust_n_magic): Use
2730 "text", "data" and "bss" section pointer vars. Don't update
2731 section size, just exec header sizes.
2732 (adjust_sizes_and_vmas): Don't update text section size. Set
2733 initial exec header a_text. Print exec headers sizes.
2734 * pdp11.c (adjust_o_magic, adjust_z_magic, adjust_n_magic),
2735 (adjust_sizes_and_vmas): Similarly. Formatting.
2736 (final_link): Correct final file extension.
2737
2738 2020-02-20 Nick Clifton <nickc@redhat.com>
2739
2740 * elf-bfd.h (struct elf_backend_data): Add symbol_section_index
2741 callback.
2742 * elfxx-target.h (elf_backend_symbol_section_index): Provide
2743 default definition.
2744 (elfNN_bed): Initialise the symbol_section_index field.
2745 * elf.c (swap_out_syms): Call symbol_section_index, if defined, on
2746 OS and PROC specific section indicies. Warn if converting other
2747 reserved incidies to SHN_ABS.
2748
2749 2020-02-19 Sergey Belyashov <sergey.belyashov@gmail.com>
2750
2751 PR 25537
2752 * cpu-z80.c: Add machine type compatibility checking.
2753
2754 2020-02-19 H.J. Lu <hongjiu.lu@intel.com>
2755
2756 PR binutils/25355
2757 * plugin.c (plugin_list_entry): Remove handle.
2758 (try_load_plugin): Call dlclose before return.
2759
2760 2020-02-19 Alan Modra <amodra@gmail.com>
2761
2762 * libbfd-in.h (_bfd_constant_p): Define.
2763 (_bfd_alloc_and_read, _bfd_malloc_and_read): Check read size against
2764 file size before allocating memory.
2765 * coffgen.c (_bfd_coff_get_external_symbols): Remove file size check.
2766 * elf.c (bfd_elf_get_str_section): Likewise.
2767 (_bfd_elf_slurp_version_tables): Likewise.
2768 * libbfd.h: Regenerate.
2769
2770 2020-02-19 Alan Modra <amodra@gmail.com>
2771
2772 * libbfd-in.h (_bfd_alloc_and_read, _bfd_malloc_and_read): New.
2773 * aoutx.h (aout_get_external_symbols): Replace calls to
2774 bfd_[m]alloc and bfd_bread with call to _bfd_[m]alloc_and_read.
2775 (slurp_reloc_table): Likewise.
2776 * archive.c (do_slurp_bsd_armap): Likewise.
2777 (do_slurp_coff_armap): Likewise.
2778 * archive64.c (_bfd_archive_64_bit_slurp_armap): Likewise.
2779 * coff-rs6000.c (_bfd_xcoff_slurp_armap): Likewise.
2780 * coff64-rs6000.c (xcoff64_slurp_armap): Likewise.
2781 * coffcode.h (coff_set_arch_mach_hook, buy_and_read): Likewise.
2782 * coffgen.c (coff_real_object_p, coff_object_p, build_debug_section),
2783 (_bfd_coff_get_external_symbols): Likewise.
2784 * ecoff.c (ecoff_slurp_symbolic_header),
2785 (_bfd_ecoff_slurp_symbolic_info, ecoff_slurp_reloc_table),
2786 (_bfd_ecoff_slurp_armap, ecoff_link_add_object_symbols, READ),
2787 (ecoff_indirect_link_order): Likewise.
2788 * elf.c (bfd_elf_get_str_section, setup_group, elf_read_notes),
2789 (_bfd_elf_slurp_version_tables): Likewise.
2790 * elf32-m32c.c (m32c_elf_relax_section): Likewise.
2791 * elf32-rl78.c (rl78_elf_relax_section): Likewise.
2792 * elf32-rx.c (elf32_rx_relax_section): Likewise.
2793 * elf64-alpha.c (READ): Likewise.
2794 * elf64-mips.c (mips_elf64_slurp_one_reloc_table): Likewise.
2795 * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Likewise.
2796 * elfcode.h (elf_slurp_symbol_table),
2797 (elf_slurp_reloc_table_from_section): Likewise.
2798 * elflink.c (elf_link_add_object_symbols),
2799 (elf_link_check_versioned_symbol): Likewise.
2800 * elfxx-mips.c (READ): Likewise.
2801 * i386lynx.c (slurp_reloc_table): Likewise.
2802 * lynx-core.c (lynx_core_file_p): Likewise.
2803 * mach-o.c (bfd_mach_o_canonicalize_relocs),
2804 (bfd_mach_o_read_symtab_strtab, bfd_mach_o_alloc_and_read),
2805 (bfd_mach_o_read_prebound_dylib, bfd_mach_o_read_dyld_content
2806 * pdp11.c (aout_get_external_symbols, slurp_reloc_table
2807 * pef.c (bfd_pef_print_loader_section, bfd_pef_scan_start_address),
2808 (bfd_pef_parse_symbols): Likewise.
2809 * peicode.h (pe_ILF_object_p, pe_bfd_object_p
2810 * som.c (setup_sections, som_slurp_string_table),
2811 (som_slurp_reloc_table, som_bfd_count_ar_symbols),
2812 (som_bfd_fill_in_ar_symbols): Likewise.
2813 * vms-alpha.c (module_find_nearest_line, evax_bfd_print_dst),
2814 (evax_bfd_print_image): Likewise.
2815 * vms-lib.c (_bfd_vms_lib_archive_p): Likewise.
2816 * wasm-module.c (wasm_scan): Likewise.
2817 * xcofflink.c (xcoff_link_add_symbols): Likewise.
2818 * xsym.c (bfd_sym_read_name_table),
2819 (bfd_sym_print_type_information_table_entry): Likewise.
2820 * libbfd.h: Regenerate.
2821
2822 2020-02-19 Alan Modra <amodra@gmail.com>
2823
2824 * aoutx.h (slurp_reloc_table): Allocate reloc_cache after
2825 reading external relocs.
2826 * ecoff.c (ecoff_slurp_reloc_table): Likewise.
2827 * archive.c (_bfd_write_archive_contents): Don't twiddle bfd_error
2828 after bfd_bread.
2829 * archive64.c (_bfd_archive_64_bit_slurp_armap): Remove unnecessary
2830 bfd_release.
2831 * elf32-m32c.c (m32c_offset_for_reloc): Make shndx_buf a bfd_byte*.
2832 (m32c_elf_relax_section): Likewise.
2833 * elf32-rl78.c (rl78_offset_for_reloc): Likewise.
2834 (rl78_elf_relax_section): Likewise.
2835 * elf32-rx.c (rx_offset_for_reloc): Likewise.
2836 (elf32_rx_relax_section): Likewise.
2837 * mach-o.c (bfd_mach_o_alloc_and_read): Move earlier with better
2838 parameter types and use..
2839 (bfd_mach_o_read_dylinker, bfd_mach_o_read_dylib),
2840 (bfd_mach_o_read_fvmlib, bfd_mach_o_read_str): ..in these functions.
2841 * peicode.h (pe_bfd_object_p): Don't zero the part of opthdr
2842 being read from file, just the extra.
2843 * som.c (som_slurp_symbol_table): Allocate internal symbol buffer
2844 after reading external syms. Free on failure.
2845
2846 2020-02-19 Alan Modra <amodra@gmail.com>
2847
2848 * coffcode.h (buy_and_read, coff_slurp_line_table),
2849 (coff_slurp_symbol_table, coff_slurp_reloc_table): Replace
2850 bfd_[z][m]alloc2 calls with _bfd_mul_overflow followed by the
2851 corresponding bfd_alloc call. Adjust variables to suit.
2852 * coffgen.c (_bfd_coff_get_external_symbols): Likewise.
2853 * ecoff.c (_bfd_ecoff_slurp_symbolic_info),
2854 (_bfd_ecoff_slurp_symbol_table, READ): Likewise.
2855 * elf.c (bfd_elf_get_elf_syms, setup_group, bfd_section_from_shdr),
2856 (swap_out_syms, _bfd_elf_slurp_version_tables): Likewise.
2857 * elf32-m32c.c (m32c_elf_relax_section): Likewise.
2858 * elf32-rl78.c (rl78_elf_relax_section): Likewise.
2859 * elf32-rx.c (elf32_rx_relax_section): Likewise.
2860 * elf64-alpha.c (READ): Likewise.
2861 * elfcode.h (elf_object_p, elf_write_relocs, elf_write_shdrs_and_ehdr),
2862 (elf_slurp_symbol_table, elf_slurp_reloc_table),
2863 (bfd_from_remote_memory): Likewise.
2864 * elfcore.h (core_find_build_id): Likewise.
2865 * elfxx-mips.c (READ): Likewise.
2866 * mach-o.c (bfd_mach_o_mangle_sections),
2867 (bfd_mach_o_read_symtab_symbols, bfd_mach_o_read_thread),
2868 (bfd_mach_o_read_dysymtab, bfd_mach_o_flatten_sections),
2869 (bfd_mach_o_scan, bfd_mach_o_fat_archive_p): Likewise.
2870 * som.c (setup_sections, som_prep_for_fixups)
2871 (som_build_and_write_symbol_table, som_slurp_symbol_table),
2872 (som_slurp_reloc_table, som_bfd_count_ar_symbols),
2873 (som_bfd_fill_in_ar_symbols, som_slurp_armap),
2874 (som_bfd_ar_write_symbol_stuff): Likewise.
2875 * vms-alpha.c (vector_grow1): Likewise.
2876 * vms-lib.c (vms_add_index): Likewise.
2877 * wasm-module.c (wasm_scan_name_function_section): Likewise.
2878 * libbfd.c (bfd_malloc2, bfd_realloc2, bfd_zmalloc2): Delete.
2879 * opncls.c (bfd_alloc2, bfd_zalloc2): Delete.
2880 * libbfd-in.h (bfd_malloc2, bfd_realloc2, bfd_zmalloc2),
2881 (bfd_alloc2, bfd_zalloc2): Delete.
2882 (_bfd_mul_overflow): Define.
2883 * libbfd.h: Regenerate.
2884
2885 2020-02-19 Alan Modra <amodra@gmail.com>
2886
2887 * elf.c (bfd_section_from_shdr): Use bfd_zalloc rather than
2888 bfd_zalloc2.
2889 (assign_section_numbers): Likewise.
2890 (elf_map_symbols): Likewise, and bfd_alloc rather than bfd_alloc2.
2891 (_bfd_elf_map_sections_to_segments): Use bfd_malloc rather than
2892 bfd_malloc2, size_t amt, and unsigned tls_count.
2893 (rewrite_elf_program_header): Use bfd_malloc and size_t amt.
2894 * elflink.c (elf_create_symbuf): Use bfd_malloc.
2895 (elf_output_implib): Use bfd_alloc.
2896
2897 2020-02-19 Alan Modra <amodra@gmail.com>
2898
2899 * bfd.c (struct bfd): Move format and direction to other
2900 bitfields. Add "size".
2901 * bfdio.c (bfd_get_size): Cache size when not writing file.
2902 * opncls.c (bfd_get_debug_link_info_1): Allow for bfd_get_size
2903 returning zero, ie. unknown.
2904 (bfd_get_alt_debug_link_info): Likewise.
2905 * bfd-in2.h: Regenerate.
2906
2907 2020-02-19 Alan Modra <amodra@gmail.com>
2908
2909 * coffgen.c (_bfd_coff_get_external_symbols): Don't call
2910 bfd_get_file_size twice.
2911 (_bfd_coff_read_string_table): Allow for bfd_get_file_size
2912 zero, ie. unknown, return.
2913 * elf-attrs.c (_bfd_elf_parse_attributes): Likewise.
2914 * elfcode.h (elf_swap_shdr_in): Likewise.
2915 (elf_object_p): Don't call bfd_get_file_size twice and correct
2916 file size check.
2917
2918 2020-02-19 Alan Modra <amodra@gmail.com>
2919
2920 * mach-o.c (bfd_mach_o_flatten_sections): Return a bfd_boolean,
2921 FALSE if memory alloc fails. Adjust calls.
2922 * som.c (som_prep_for_fixups): Likewise.
2923 * vms-alpha.c (alpha_vms_add_fixup_lp, alpha_vms_add_fixup_ca),
2924 (alpha_vms_add_fixup_qr, alpha_vms_add_fixup_lr),
2925 (alpha_vms_add_lw_reloc, alpha_vms_add_qw_reloc): Likewise.
2926 * som.c (som_build_and_write_symbol_table): Return via error_return
2927 on seek failure.
2928 * vms-alpha.c (VEC_APPEND): Adjust for vector_grow1 changes.
2929 (VEC_APPEND_EL): Delete.
2930 (vector_grow1): Return pointer to element. Catch overflow.
2931 Return NULL on memory allocation failure.
2932 (alpha_vms_add_fixup_lp): Replace VEC_APPEND_EL with VEC_APPEND.
2933 (alpha_vms_add_fixup_ca): Likewise.
2934 (alpha_vms_link_add_object_symbols): Check VEC_APPEND result
2935 before using.
2936 * elf.c (bfd_section_from_shdr): Check bfd_zalloc2 result.
2937
2938 2020-02-19 Alan Modra <amodra@gmail.com>
2939
2940 * aix386-core.c (aix386_core_file_p): Use size_t for "amt".
2941 * aout-target.h (object_p): Likewise.
2942 * aout-tic30.c (tic30_aout_object_p): Likewise.
2943 * aoutx.h (some_aout_object_p, mkobject, make_empty_symbol),
2944 (emit_stringtab, write_syms, link_hash_table_create),
2945 (aout_link_write_other_symbol): Likewise.
2946 * archive.c (_bfd_generic_mkarchive, bfd_generic_archive_p),
2947 (bfd_ar_hdr_from_filesystem, _bfd_write_archive_contents),
2948 (_bfd_compute_and_write_armap): Likewise.
2949 * archures.c (bfd_arch_list): Likewise.
2950 * bfd.c (bfd_record_phdr): Likewise.
2951 * binary.c (binary_canonicalize_symtab): Likewise.
2952 * cisco-core.c (cisco_core_file_validate): Likewise.
2953 * coff-arm.c (coff_arm_link_hash_table_create, find_thumb_glue),
2954 (find_arm_glue, record_arm_to_thumb_glue),
2955 (record_thumb_to_arm_glue): Likewise.
2956 * coff-ppc.c (ppc_coff_link_hash_table_create, record_toc),
2957 (ppc_allocate_toc_section): Likewise.
2958 * coff-rs6000.c (_bfd_xcoff_mkobject, _bfd_xcoff_archive_p): Likewise.
2959 * coff-sh.c (sh_relax_section): Likewise.
2960 * coff64-rs6000.c (xcoff64_archive_p): Likewise.
2961 * coffcode.h (handle_COMDAT, coff_new_section_hook),
2962 (coff_set_alignment_hook, coff_mkobject),
2963 (coff_compute_section_file_positions): Likewise.
2964 * coffgen.c (coff_make_empty_symbol, coff_bfd_make_debug_symbol),
2965 (coff_find_nearest_line_with_names),
2966 ( bfd_coff_set_symbol_class): Likewise.
2967 * cofflink.c (_bfd_coff_link_hash_table_create),
2968 (_bfd_coff_link_input_bfd): Likewise.
2969 * dwarf1.c (alloc_dwarf1_unit, alloc_dwarf1_func): Likewise.
2970 * dwarf2.c (read_abbrevs, read_attribute_value, add_line_info),
2971 (build_line_info_table, sort_line_sequences),
2972 (line_info_add_include_dir, line_info_add_file_name),
2973 (decode_line_info, scan_unit_for_symbols, parse_comp_unit),
2974 (place_sections, _bfd_dwarf2_slurp_debug_info): Likewise.
2975 * ecoff.c (_bfd_ecoff_mkobject, _bfd_ecoff_make_empty_symbol),
2976 (_bfd_ecoff_find_nearest_line),
2977 (_bfd_ecoff_bfd_link_hash_table_create): Likewise.
2978 * ecofflink.c (bfd_ecoff_debug_init): Likewise.
2979 * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Likewise.
2980 * elf-m10300.c (mn10300_elf_relax_section),
2981 (elf32_mn10300_link_hash_table_create): Likewise.
2982 * elf-strtab.c (_bfd_elf_strtab_init): Likewise.
2983 * elf.c (make_mapping, copy_elf_program_header): Likewise.
2984 * elf32-arm.c (elf32_arm_link_hash_table_create),
2985 (elf32_arm_setup_section_lists, elf32_arm_check_relocs),
2986 (elf32_arm_new_section_hook): Likewise.
2987 * elf32-avr.c (elf_avr_new_section_hook),
2988 (elf32_avr_link_hash_table_create, get_local_syms),
2989 (elf32_avr_setup_section_lists): Likewise.
2990 * elf32-bfin.c (bfinfdpic_elf_link_hash_table_create),
2991 (bfin_link_hash_table_create): Likewise.
2992 * elf32-cr16.c (elf32_cr16_link_hash_table_create): Likewise.
2993 * elf32-cris.c (elf_cris_link_hash_table_create): Likewise.
2994 * elf32-csky.c (csky_elf_link_hash_table_create),
2995 (csky_elf_check_relocs, elf32_csky_setup_section_lists): Likewise.
2996 * elf32-frv.c (frvfdpic_elf_link_hash_table_create): Likewise.
2997 * elf32-hppa.c (elf32_hppa_link_hash_table_create),
2998 (elf32_hppa_setup_section_lists, get_local_syms): Likewise.
2999 * elf32-i386.c (elf_i386_check_relocs): Likewise.
3000 * elf32-lm32.c (lm32_elf_link_hash_table_create): Likewise.
3001 * elf32-m32r.c (m32r_elf_link_hash_table_create),
3002 (m32r_elf_check_relocs): Likewise.
3003 * elf32-m68hc1x.c (m68hc11_elf_hash_table_create),
3004 (elf32_m68hc11_setup_section_lists),
3005 (elf32_m68hc11_size_stubs): Likewise.
3006 * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise.
3007 * elf32-metag.c (elf_metag_link_hash_table_create),
3008 (elf_metag_setup_section_lists): Likewise.
3009 * elf32-microblaze.c (microblaze_elf_link_hash_table_create),
3010 (microblaze_elf_check_relocs): Likewise.
3011 * elf32-nds32.c (nds32_elf_link_hash_table_create),
3012 (nds32_elf_check_relocs): Likewise.
3013 * elf32-nios2.c (nios2_elf32_setup_section_lists),
3014 (get_local_syms, nios2_elf32_check_relocs),
3015 (nios2_elf32_link_hash_table_create): Likewise.
3016 * elf32-or1k.c (or1k_elf_link_hash_table_create),
3017 (or1k_elf_check_relocs): Likewise.
3018 * elf32-ppc.c (ppc_elf_modify_segment_map, update_plt_info): Likewise.
3019 * elf32-pru.c (pru_elf32_link_hash_table_create): Likewise.
3020 * elf32-s390.c (elf_s390_link_hash_table_create),
3021 (elf_s390_check_relocs): Likewise.
3022 * elf32-score.c (score_elf_create_got_section),
3023 (s3_elf32_score_new_section_hook),
3024 (elf32_score_link_hash_table_create): Likewise.
3025 * elf32-score7.c (score_elf_create_got_section),
3026 (s7_elf32_score_new_section_hook): Likewise.
3027 * elf32-sh.c (sh_elf_link_hash_table_create),
3028 (sh_elf_check_relocs): Likewise.
3029 * elf32-tic6x.c (elf32_tic6x_link_hash_table_create),
3030 (elf32_tic6x_new_section_hook, elf32_tic6x_check_relocs): Likewise.
3031 * elf32-tilepro.c (tilepro_elf_link_hash_table_create),
3032 (tilepro_elf_check_relocs): Likewise.
3033 * elf32-v850.c (remember_hi16s_reloc): Likewise.
3034 * elf32-vax.c (elf_vax_link_hash_table_create): Likewise.
3035 * elf32-xtensa.c (elf_xtensa_link_hash_table_create),
3036 (elf_xtensa_new_section_hook): Likewise.
3037 * elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create),
3038 (get_got_entry, elf64_alpha_check_relocs): Likewise.
3039 * elf64-hppa.c (elf64_hppa_hash_table_create): Likewise.
3040 * elf64-ia64-vms.c (elf64_ia64_object_p): Likewise.
3041 * elf64-mmix.c (mmix_elf_new_section_hook): Likewise.
3042 * elf64-ppc.c (ppc64_elf_new_section_hook),
3043 (ppc64_elf_link_hash_table_create, update_local_sym_info),
3044 (update_plt_info, ppc64_elf_check_relocs): Likewise.
3045 * elf64-s390.c (elf_s390_link_hash_table_create),
3046 (elf_s390_check_relocs): Likewise.
3047 * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
3048 * elflink.c (bfd_elf_link_record_local_dynamic_symbol),
3049 (_bfd_elf_link_find_version_dependencies, elf_link_add_object_symbols),
3050 (elf_link_add_archive_symbols, compute_bucket_count),
3051 (bfd_elf_size_dynsym_hash_dynstr, _bfd_elf_link_hash_table_create),
3052 (bfd_elf_get_bfd_needed_list, elf_link_swap_symbols_out),
3053 (bfd_elf_final_link): Likewise.
3054 * elfnn-aarch64.c (elfNN_aarch64_link_hash_table_create),
3055 (elfNN_aarch64_setup_section_lists, elfNN_aarch64_check_relocs),
3056 (elfNN_aarch64_new_section_hook): Likewise.
3057 * elfnn-ia64.c (elfNN_ia64_object_p): Likewise.
3058 * elfnn-riscv.c (riscv_elf_link_hash_table_create),
3059 (riscv_elf_check_relocs): Likewise.
3060 * elfxx-mips.c (_bfd_mips_elf_new_section_hook),
3061 (_bfd_mips_elf_add_symbol_hook, _bfd_mips_elf_check_relocs),
3062 (_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_set_section_contents),
3063 (_bfd_mips_elf_link_hash_table_create): Likewise.
3064 * elfxx-sparc.c (_bfd_sparc_elf_link_hash_table_create),
3065 (_bfd_sparc_elf_check_relocs),
3066 (_bfd_sparc_elf_new_section_hook): Likewise.
3067 * elfxx-tilegx.c (tilegx_elf_link_hash_table_create),
3068 (tilegx_elf_check_relocs): Likewise.
3069 * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Likewise.
3070 * format.c (bfd_check_format_matches): Likewise.
3071 * hash.c (_bfd_stringtab_init): Likewise.
3072 * ihex.c (ihex_scan): Likewise.
3073 * irix-core.c (irix_core_core_file_p): Likewise.
3074 * linker.c (bfd_wrapped_link_hash_lookup),
3075 (_bfd_generic_link_hash_table_create),
3076 (_bfd_generic_reloc_link_order): Likewise.
3077 * lynx-core.c (lynx_core_file_p): Likewise.
3078 * netbsd-core.c (netbsd_core_file_p): Likewise.
3079 * osf-core.c (osf_core_core_file_p): Likewise.
3080 * pdp11.c (some_aout_object_p, mkobject, make_empty_symbol),
3081 (link_hash_table_create, aout_link_write_other_symbol): Likewise.
3082 * peXXigen.c (_bfd_XX_bfd_copy_private_section_data): Likewise.
3083 * peicode.h (pe_mkobject): Likewise.
3084 * ppcboot.c (ppcboot_mkobject, ppcboot_canonicalize_symtab): Likewise.
3085 * ptrace-core.c (ptrace_unix_core_file_p): Likewise.
3086 * sco5-core.c (read_uarea): Likewise.
3087 * som.c (hppa_som_gen_reloc_type, som_object_p, som_prep_headers),
3088 (som_write_fixups, som_write_space_strings, som_write_symbol_strings),
3089 (som_finish_writing, som_canonicalize_symtab, som_new_section_hook),
3090 (som_bfd_copy_private_section_data, bfd_som_set_section_attributes),
3091 (bfd_som_attach_aux_hdr, som_write_armap): Likewise.
3092 * srec.c (srec_scan): Likewise.
3093 * syms.c (_bfd_generic_make_empty_symbol): Likewise.
3094 * targets.c (bfd_target_list): Likewise.
3095 * tekhex.c (first_phase, tekhex_sizeof_headers): Likewise.
3096 * trad-core.c (trad_unix_core_file_p): Likewise.
3097 * vms-alpha.c (vms_initialize, alpha_vms_bfd_link_hash_table_create),
3098 (vms_new_section_hook): Likewise.
3099 * wasm-module.c (wasm_make_empty_symbol): Likewise.
3100 * xcofflink.c (xcoff_get_section_contents),
3101 (_bfd_xcoff_bfd_link_hash_table_create, xcoff_set_import_path),
3102 (xcoff_find_function, bfd_xcoff_link_record_set, xcoff_build_ldsym),
3103 (bfd_xcoff_size_dynamic_sections, xcoff_link_input_bfd): Likewise.
3104
3105 2020-02-19 Alan Modra <amodra@gmail.com>
3106
3107 * elfxx-riscv.c (riscv_multi_letter_ext_valid_p): Don't use C99.
3108
3109 2020-02-13 H.J. Lu <hongjiu.lu@intel.com>
3110
3111 * plugin.c (try_load_plugin): Make plugin_list_iter an argument
3112 and use it if it isn't NULL. Remove has_plugin_p argument. Add
3113 a build_list_p argument. Don't search plugin_list. Short circuit
3114 when building the plugin list.
3115 (has_plugin): Renamed to has_plugin_list.
3116 (bfd_plugin_set_plugin): Don't set has_plugin.
3117 (bfd_plugin_specified_p): Check plugin_list instead.
3118 (build_plugin_list): New function.
3119 (load_plugin): Call build_plugin_list and use plugin_list.
3120
3121 2020-02-11 H.J. Lu <hongjiu.lu@intel.com>
3122
3123 PR binutils/25355
3124 * plugin.c (try_claim): Always clean up for LTO wrapper.
3125 (try_load_plugin): Treat each object as independent. Create a
3126 copy for plugin name.
3127
3128 2020-02-11 Nick Clifton <nickc@redhat.com>
3129
3130 * elf32-msp430.c (msp430_final_link_relocate): Always use longs
3131 for addresses in print statements.
3132 (msp430_elf_relax_delete_bytes): Likewise.
3133 (msp430_elf_relax_add_words): Likewise.
3134 (msp430_elf_relax_section): Likewise.
3135
3136 2020-02-11 H.J. Lu <hongjiu.lu@intel.com>
3137
3138 * plugin.c (add_symbols): Clear plugin_data memory.
3139
3140 2020-02-10 H.J. Lu <hongjiu.lu@intel.com>
3141
3142 PR binutils/25355
3143 * configure.ac (HAVE_EXECUTABLE_SUFFIX): New AC_DEFINE.
3144 (EXECUTABLE_SUFFIX): Likewise.
3145 * config.in: Regenerated.
3146 * configure: Likewise.
3147 * plugin.c (bfd_plugin_close_and_cleanup): Removed.
3148 (plugin_list_entry): Add all_symbols_read, cleanup_handler,
3149 gcc, lto_wrapper, resolution_file, resolution_option, gcc_env,
3150 real_bfd, real_nsyms, real_syms, lto_nsyms and lto_syms.
3151 (get_lto_wrapper): New.
3152 (setup_lto_wrapper_env): Likewise.
3153 (current_plugin): Likewise.
3154 (register_all_symbols_read): Likewise.
3155 (register_cleanup): Likewise.
3156 (get_symbols): Likewise.
3157 (add_input_file): Likewise.
3158 (bfd_plugin_close_and_cleanup): Likewise.
3159 (claim_file): Removed.
3160 (register_claim_file): Set current_plugin->claim_file.
3161 (add_symbols): Make a copy of LTO symbols. Set lto_nsyms and
3162 lto_syms in current_plugin.
3163 (try_claim): Use current_plugin->claim_file. Call LTO plugin
3164 all_symbols_read handler. Copy real symbols to plugin_data.
3165 Call LTO plugin cleanup handler. Clean up for LTO wrapper.
3166 (try_load_plugin): Don't reuse the previous plugin for LTO
3167 wrapper. Set up GCC LTO wrapper if possible. Don't set
3168 plugin_list_iter->claim_file.
3169 (bfd_plugin_canonicalize_symtab): Use real LTO symbols if
3170 possible.
3171 * plugin.h (plugin_data_struct): Add real_bfd, real_nsyms and
3172 real_syms.
3173
3174 2020-02-10 Jozef Lawrynowicz <jozef.l@mittosystems.com>
3175
3176 * elf32-msp430.c (msp430_elf_relax_section): Before relaxing a branch,
3177 check if previous instruction matches a conditional jump inserted
3178 earlier. Invert conditional jump and delete branch in this case.
3179
3180 2020-02-10 Jozef Lawrynowicz <jozef.l@mittosystems.com>
3181
3182 * elf32-msp430.c (msp430_elf_relax_add_two_words): Rename to
3183 msp430_elf_relax_add_words. Support insertion of either one or two
3184 words.
3185 (msp430_elf_relax_section): Catch opcode of 0x3c00 when relocation
3186 needs to be grown. Handle insertion of branch instruction to replace
3187 jump.
3188
3189 2020-02-10 Jozef Lawrynowicz <jozef.l@mittosystems.com>
3190
3191 * elf32-msp430.c (msp430_final_link_relocate): Add printf statements for
3192 debugging relocations.
3193 (msp430_elf_relax_delete_bytes): Likewise.
3194 (msp430_elf_relax_add_two_words): Likewise.
3195 (msp430_elf_relax_section): Likewise.
3196
3197 2020-02-10 Alan Modra <amodra@gmail.com>
3198
3199 * archures.c: Wrap overlong z80 comments.
3200 * bfd-in2.h: Regenerate.
3201
3202 2020-02-07 Sergey Belyashov <sergey.belyashov@gmail.com>
3203
3204 PR 25469
3205 * archures.c: Add GBZ80 and Z80N machine values.
3206 * reloc.c: Add BFD_RELOC_Z80_16_BE.
3207 * coff-z80.c: Add support for new reloc.
3208 * coffcode.h: Add support for new machine values.
3209 * cpu-z80.c: Add support for new machine names.
3210 * elf32-z80.c: Add support for new reloc.
3211 * bfd-in2.h: Regenerate.
3212 * libbfd.h: Regenerate.
3213
3214 2020-02-07 Nick Clifton <nickc@redhat.com>
3215
3216 PR 23932
3217 * elf.c (rewrite_elf_program_header): Do not complain if no
3218 sections are mapped to a segment.
3219
3220 2020-02-06 H.J. Lu <hongjiu.lu@intel.com>
3221
3222 PR ld/25490
3223 * elflink.c (_bfd_elf_gc_mark_extra_sections): Issue an error
3224 for garbage collection on __patchable_function_entries section
3225 without linked-to section.
3226
3227 2020-02-06 H.J. Lu <hongjiu.lu@intel.com>
3228
3229 PR gas/25381
3230 * bfd-in2.h: Regenerated.
3231 * elflink.c (_bfd_elf_gc_mark_extra_sections): Call mark_hook
3232 on section if gc_mark of any of its linked-to sections is set
3233 and don't set gc_mark again.
3234 * section.c (asection): Add linked_to_symbol_name to map_head
3235 union.
3236
3237 2020-02-06 Maciej W. Rozycki <macro@wdc.com>
3238
3239 * elf32-v850.c (v850_elf_relax_section): Fix the index used for
3240 reporting an unrecognized instruction with R_V850_LONGJUMP.
3241
3242 2020-02-05 Alan Modra <amodra@gmail.com>
3243
3244 * elf64-ppc.c (ppc_stub_plt_branch): Match comment with reality.
3245
3246 2020-02-04 Alan Modra <amodra@gmail.com>
3247
3248 * elf32-ppc.c (ppc_elf_relocate_section): After applying
3249 R_PPC_VLE_ADDR20, goto copy_reloc.
3250
3251 2020-02-02 H.J. Lu <hongjiu.lu@intel.com>
3252
3253 * bfd-in2.h: Regenerated.
3254 * section.c (SEC_ASSEMBLER_SECTION_ID): Fix a typo in comments.
3255
3256 2020-02-02 H.J. Lu <hongjiu.lu@intel.com>
3257
3258 PR gas/25380
3259 * bfd-in2.h: Regenerated.
3260 * ecoff.c (bfd_debug_section): Add section_id.
3261 * section.c (bfd_section): Add section_id.
3262 (SEC_ASSEMBLER_SECTION_ID): New.
3263 (BFD_FAKE_SECTION): Add section_id.
3264
3265 2020-02-01 Nick Clifton <nickc@redhat.com>
3266
3267 * config.bfd: Move the c30-aout and tic30-aout targets onto the
3268 obsolete list.
3269
3270 2020-01-31 Sandra Loosemore <sandra@codesourcery.com>
3271
3272 * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): DW_EH_PE_datarel
3273 encodings are relative to the GOT on nios2, too.
3274
3275 2020-01-31 Alan Modra <amodra@gmail.com>
3276
3277 * Makefile.am (elf32-target.h, elf64-target.h): Don't use a temp
3278 file. Use $< and $@ in rules.
3279 (elf32-aarch64.c, elf64-aarch64.c): Likewise.
3280 (elf32-ia64.c, elf64-ia64.c): Likewise.
3281 (elf32-riscv.c, elf64-riscv.c): Likewise.
3282 (peigen.c, pepigen.c, pex64igen.c): Likewise.
3283 (elf32-aarch64.c, elf64-aarch64.c): Don't emit $srcdir on #line.
3284 (elf32-riscv.c, elf64-riscv.c): Likewise, and use $(SED).
3285 (elf32-ia64.c, elf64-ia64.c): Do emit #line.
3286 (peigen.c, pepigen.c, pex64igen.c): Likewise.
3287 * Makefile.in: Regenerate.
3288
3289 2020-01-31 Alan Modra <amodra@gmail.com>
3290
3291 PR 4110
3292 * elf.c (setup_group): Don't clear entire section contents,
3293 just the padding after group flags. Release alloc'd memory
3294 after a seek or read failure.
3295
3296 2020-01-16 Jon Turney <jon.turney@dronecode.org.uk>
3297
3298 * peXXigen.c (pe_is_repro): New function.
3299 (_bfd_XX_print_private_bfd_data_common): Note timestamp is
3300 actually a build hash if PE_IMAGE_DEBUG_TYPE_REPRO is present.
3301
3302 2020-01-16 Jon Turney <jon.turney@dronecode.org.uk>
3303
3304 * peXXigen.c (debug_type_names): Add names for new debug data type
3305 values.
3306
3307 2020-01-16 Jon Turney <jon.turney@dronecode.org.uk>
3308
3309 * peXXigen.c (pe_print_debugdata): Fix the iteration variable for
3310 inner loop. Fix a memory leak.
3311
3312 2020-01-30 Alan Modra <amodra@gmail.com>
3313
3314 * coffgen.c (coff_real_object_p): Don't clear obj_coff_keep_syms
3315 or obj_coff_keep_strings here.
3316 (coff_get_normalized_symtab): Free external syms directly.
3317 * xcofflink.c (xcoff_link_input_bfd): Restore obj_coff_keep_syms
3318 on error exit path.
3319
3320 2020-01-27 Jim Wilson <jimw@sifive.com>
3321
3322 * cpu-riscv.c (riscv_scan): New.
3323 (N): Change bfd_default_scan to riscv_scan.
3324
3325 2020-01-27 Andreas Schwab <schwab@suse.de>
3326
3327 * Makefile.am (ALL_MACHINES): Remove cpu-plugin.lo.
3328 (ALL_MACHINES_CFILES): Remove cpu-plugin.c.
3329 * Makefile.in: Regenerate.
3330 * cpu-plugin.c: Remove.
3331 * archures.c (enum bfd_architecture): Remove bfd_arch_plugin.
3332 (bfd_plugin_arch): Remove declaration.
3333 * bfd-in2.h: Regenerate.
3334 * po/SRC-POTFILES.in: Regenerate.
3335
3336 2020-01-27 H.J. Lu <hongjiu.lu@intel.com>
3337 Alan Modra <amodra@gmail.com>
3338
3339 PR ld/25458
3340 * elflink.c (_bfd_elf_gc_mark_rsec): Mark all weak aliases.
3341
3342 2020-01-24 Jim Wilson <jimw@sifive.com>
3343
3344 * elfxx-riscv.c (riscv_get_prefix_class): Format s case like others.
3345 (riscv_parse_prefixed_ext): Fix s extension comment and reword to
3346 avoid over long line.
3347
3348 2020-01-24 Nick Clifton <nickc@redhat.com>
3349
3350 PR 25447
3351 * coffgen.c (_bfd_coff_close_and_cleanup): Do not clear the keep
3352 syms and keep strings flags as these may have been set in order to
3353 prevent a bogus call to free.
3354
3355 2020-01-23 Nick Clifton <nickc@redhat.com>
3356
3357 * po/fr.po: Updated French translation.
3358
3359 2020-01-23 Alan Modra <amodra@gmail.com>
3360
3361 PR 25444
3362 * elf.c (assign_file_positions_for_load_sections): Avoid divide
3363 by zero when p_align is zero.
3364
3365 2020-01-22 Maxim Blinov <maxim.blinov@embecosm.com>
3366
3367 * bfd/elfnn-riscv.c (riscv_skip_prefix): New.
3368 (riscv_prefix_cmp): Likewise.
3369 (riscv_non_std_ext_p): Deleted.
3370 (riscv_std_sv_ext_p): Likewise.
3371 (riscv_non_std_sv_ext_p): Likewise.
3372 (riscv_merge_non_std_and_sv_ext): Rename to...
3373 (riscv_merge_multi_letter_ext): and modified to use riscv_prefix_cmp.
3374 (riscv_merge_arch_attr_info): Replace 3 calls to
3375 riscv_merge_non_std_and_sv_ext with single call to
3376 riscv_merge_multi_letter_ext.
3377 * bfd/elfxx-riscv.c (riscv_parse_std_ext): Break if we
3378 encounter a 'z' prefix.
3379 (riscv_get_prefix_class): New function, return prefix class based
3380 on first few characters of input string.
3381 (riscv_parse_config): New structure to factor out minor differences
3382 in extension class parsing behaviour.
3383 (riscv_parse_sv_or_non_std_ext): Rename to...
3384 (riscv_parse_prefixed_ext): and parameterise with
3385 riscv_parse_config.
3386 (riscv_std_z_ext_strtab, riscv_std_s_ext_strtab): New.
3387 (riscv_multi_letter_ext_valid_p): New.
3388 (riscv_ext_x_valid_p, riscv_ext_z_valid_p, riscv_ext_s_valid_p): New.
3389 (riscv_parse_subset): Delegate all non-single-letter parsing work
3390 to riscv_parse_prefixed_ext.
3391 * bfd/elfxx-riscv.h (riscv_isa_ext_class): New type.
3392 (riscv_get_prefix_class): Declare.
3393
3394 2020-01-22 Alan Modra <amodra@gmail.com>
3395
3396 * elf64-ppc.c (struct ppc_link_hash_table): Add tga_group.
3397 (ppc64_elf_archive_symbol_lookup): Extract __tls_get_addr_opt for
3398 __tls_get_addr_desc.
3399 (ppc64_elf_size_stubs): Add section for linker generated
3400 __tls_get_addr_desc wrapper function. Loop at least once if
3401 generating this function.
3402 (emit_tga_desc, emit_tga_desc_eh_frame): New functions.
3403 (ppc64_elf_build_stubs): Generate __tls_get_addr_desc.
3404
3405 2020-01-22 Alan Modra <amodra@gmail.com>
3406
3407 * elf64-ppc.h (struct ppc64_elf_params): Add no_tls_get_addr_regsave.
3408 * elf64-ppc.c (struct ppc_link_hash_table): Add tga_desc and
3409 tga_desc_fd.
3410 (is_tls_get_addr): Match tga_desc and tga_desc_df too.
3411 (STDU_R1_0R1, ADDI_R1_R1): Define.
3412 (tls_get_addr_prologue, tls_get_addr_epilogue): New functions.
3413 (ppc64_elf_tls_setup): Set up tga_desc and tga_desc_fd. Indirect
3414 tga_desc_fd to opt_fd, and tga_desc to opt. Set
3415 no_tls_get_addr_regsave.
3416 (branch_reloc_hash_match): Add hash3 and hash4.
3417 (ppc64_elf_tls_optimize): Handle tga_desc_fd and tga_desc too.
3418 (ppc64_elf_size_dynamic_sections): Likewise.
3419 (ppc64_elf_relocate_section): Likewise.
3420 (plt_stub_size, build_plt_stub): Likewise. Size regsave
3421 __tls_get_addr stub.
3422 (build_tls_get_addr_stub): Build regsave __tls_get_addr stub and
3423 eh_frame.
3424 (ppc_size_one_stub): Handle tga_desc_fd and tga_desc too. Size
3425 eh_frame for regsave __tls_get_addr.
3426
3427 2020-01-22 Alan Modra <amodra@gmail.com>
3428
3429 * elf64-ppc.c (ppc64_elf_size_stubs): Correct condition under
3430 which __tls_get_addr calls will be eliminated.
3431
3432 2020-01-20 Nick Clifton <nickc@redhat.com>
3433
3434 * po/pt.po: Updates Portuguese translation.
3435 * po/ru.po: Updated Russian translation.
3436 * po/uk.po: Updated Ukranian translation.
3437
3438 2020-01-20 H.J. Lu <hongjiu.lu@intel.com>
3439
3440 PR ld/25416
3441 * elf64-x86-64.c (elf_x86_64_check_tls_transition): Support
3442 "rex leal x@tlsdesc(%rip), %reg" and "call *x@tlsdesc(%eax)" in
3443 X32 mode.
3444 (elf_x86_64_relocate_section): In x32 mode, for GDesc -> LE
3445 transition, relax "rex leal x@tlsdesc(%rip), %reg" to
3446 "rex movl $x@tpoff, %reg", for GDesc -> IE transition, relax
3447 "rex leal x@tlsdesc(%rip), %reg" to
3448 "rex movl x@gottpoff(%rip), %eax". For both transitions, relax
3449 "call *(%eax)" to "nopl (%rax)".
3450
3451 2020-01-20 Alan Modra <amodra@gmail.com>
3452
3453 * elf64-ppc.c (LD_R11_0R3, CMPDI_R11_0, STD_R11_0R1, LD_R11_0R1),
3454 (MTLR_R11): Don't define.
3455 (LD_R0_0R3, CMPDI_R0_0): Define.
3456 (build_tls_get_addr_stub): Don't use r11 in stub.
3457
3458 2020-01-20 Alan Modra <amodra@gmail.com>
3459
3460 * elf64-ppc.c (ppc_elf_hash_entry): New function, use throughout file.
3461 (defined_sym_val, is_tls_get_addr): Likewise.
3462
3463 2020-01-18 Nick Clifton <nickc@redhat.com>
3464
3465 * version.m4 (BFD_VERSION): Set to 2.34.50.
3466 * configure: Regenerate.
3467 * po/bfd.pot: Regenerate.
3468
3469 2020-01-18 Nick Clifton <nickc@redhat.com>
3470
3471 Binutils 2.34 branch created.
3472
3473 2020-01-17 Christian Biesinger <cbiesinger@google.com>
3474
3475 * coff-arm.c: Fix spelling error (seperate).
3476 * elfxx-riscv.c (riscv_parse_sv_or_non_std_ext): Fix spelling
3477 error (seperate).
3478 * sysdep.h (strnlen): Fix spelling error (seperate).
3479
3480 2020-01-15 Lars Brinkhoff <lars@nocrew.org>
3481
3482 PR 20694
3483 * pdp11.c (TARGET_PAGE_SIZE): Set to 8192.
3484
3485 2020-01-15 Alan Modra <amodra@gmail.com>
3486
3487 PR 25384
3488 * elf64-ppc.c (ELIMINATE_COPY_RELOCS): Update comment.
3489 (ppc64_elf_adjust_dynamic_symbol): Don't allow .dynbss copies
3490 of function symbols unless dot symbols are present. Do warn
3491 whenever one is created, regardles of whether a PLT entry is
3492 also emitted for the function symbol.
3493
3494 2020-01-14 Alan Modra <amodra@gmail.com>
3495
3496 * som.c (som_bfd_count_ar_symbols): Error when file position
3497 of symbols on chains is not strictly increasing.
3498
3499 2020-01-14 Alan Modra <amodra@gmail.com>
3500
3501 * vms.h (VMS_DEBUG): Define as 0.
3502 * vms-alpha.c (image_write): Move debug output after bounds check.
3503 Tidy bounds check.
3504 (_bfd_vms_slurp_eihd): Warning fix.
3505 (_bfd_vms_slurp_etir): Init variables to avoid bogus warnings.
3506
3507 2020-01-13 Alan Modra <amodra@gmail.com>
3508
3509 * vms-alpha.c (_bfd_vms_slurp_egsd): Ensure minimum size even
3510 for "ignored" records.
3511
3512 2020-01-13 Alan Modra <amodra@gmail.com>
3513
3514 * wasm-module.c (wasm_scan_name_function_section): Formatting.
3515 Delete asect name check. Move asect NULL check to wasm_object_p.
3516 Correct bounds check of sizes against end. Replace uses of
3517 bfd_zalloc with bfd_alloc, zeroing only necessary bytes. Use
3518 just one bfd_release.
3519 (wasm_scan): Don't use malloc/strdup for section names,
3520 bfd_alloc instead. Simplify code prefixing section name.
3521 Formatting. Don't attempt to free memory here..
3522 (wasm_object_p): ..do so here.
3523
3524 2020-01-10 Szabolcs Nagy <szabolcs.nagy@arm.com>
3525
3526 PR ld/22269
3527 * elf32-arm.c (elf32_arm_final_link_relocate): Use
3528 UNDEFWEAK_NO_DYNAMIC_RELOC.
3529 (allocate_dynrelocs_for_symbol): Likewise.
3530
3531 2020-01-10 Tamar Christina <tamar.christina@arm.com>
3532
3533 PR 25210
3534 * elfnn-aarch64.c (_bfd_aarch64_create_stub_section): Remove elfclass.
3535
3536 2020-01-10 Alan Modra <amodra@gmail.com>
3537
3538 * coff-alpha.c (alpha_ecoff_object_p): Calculate size in bfd_size_type.
3539
3540 2020-01-09 Nick Clifton <nickc@redhat.com>
3541
3542 PR 25221
3543 * bfd.c (bfd_convert_section_contents): Check for a compress
3544 header size that is larger than the actual section size.
3545
3546 2020-01-08 Alan Modra <amodra@gmail.com>
3547
3548 PR 25351
3549 * elflink.c (bfd_elf_final_link): Call _bfd_fix_excluded_sec_syms
3550 after removing sections.
3551
3552 2020-01-06 Jim Wilson <jimw@sifive.com>
3553
3554 PR 25205
3555 * elfnn-riscv.c (riscv_elf_relocate_section) <R_RISCV_CALL>: Add
3556 check for !bfd_link_pic (info).
3557 <R_RISCV_CALL_PLT>: Move next to R_RISCV_CALL.
3558 <R_RISCV_JAL>: Add comment.
3559 (_bfd_riscv_relax_section): For plt.offset check, add check for
3560 bfd_link_pic (info). Add comment.
3561
3562 2020-01-06 Alan Modra <amodra@gmail.com>
3563
3564 * format.c (bfd_check_format_matches): Ignore bfd_error on target
3565 match failures. Don't init to bfd_error_wrong_format before
3566 calling _bfd_check_format.
3567
3568 2020-01-06 Alan Modra <amodra@gmail.com>
3569
3570 * vms-alpha.c (_bfd_vms_push, _bfd_vms_pop): Return pass/fail
3571 status rather than exiting on stack overflow or underflow.
3572 (_bfd_vms_slurp_etir): Adjust to suit.
3573
3574 2020-01-06 Alan Modra <amodra@gmail.com>
3575
3576 * som.c (som_bfd_fill_in_ar_symbols): Bounds check som_dict index.
3577
3578 2020-01-06 Alan Modra <amodra@gmail.com>
3579
3580 * mach-o.c (bfd_mach_o_read_dylinker): Don't read past end of
3581 command. Check name offset is within command.
3582 (bfd_mach_o_read_dylib, bfd_mach_o_read_prebound_dylib),
3583 (bfd_mach_o_read_prebind_cksum, bfd_mach_o_read_twolevel_hints),
3584 (bfd_mach_o_read_fvmlib, bfd_mach_o_read_dysymtab),
3585 (bfd_mach_o_read_symtab, bfd_mach_o_read_uuid),
3586 (bfd_mach_o_read_linkedit, bfd_mach_o_read_str),
3587 (bfd_mach_o_read_dyld_info, bfd_mach_o_read_version_min),
3588 (bfd_mach_o_read_encryption_info, bfd_mach_o_read_source_version),
3589 (bfd_mach_o_read_encryption_info_64, bfd_mach_o_read_main),
3590 (bfd_mach_o_read_note, bfd_mach_o_read_build_version),
3591 (bfd_mach_o_read_segment): Similarly.
3592 (bfd_mach_o_read_thread): Properly bound check thread struct.
3593 Don't repeat checks on second loop.
3594 (bfd_mach_o_read_command): Fail on invalid command length.
3595
3596 2020-01-04 Alan Modra <amodra@gmail.com>
3597
3598 * format.c (bfd_check_format_matches): Add preserve_match.
3599 Save initial bfd state in "preserve", matched bfd state in
3600 "preserve_match". Save just the first match. Release
3601 bfd_alloc memory. Restore and finish preserved state as
3602 appropriate on all function exit paths.
3603
3604 2020-01-04 Alan Modra <amodra@gmail.com>
3605
3606 * mmo.c (mmo_mkobject): Allocate tdata with bfd_zalloc.
3607
3608 2020-01-04 Alan Modra <amodra@gmail.com>
3609
3610 * coffgen.c (coff_real_object_p): Free malloc'd memory on target
3611 match too.
3612
3613 2020-01-03 Nick Clifton <nickc@redhat.com>
3614
3615 PR 25307
3616 (bfd_pef_parse_function_stubs): Correct the test that ensures that
3617 there is enough data remaining in the code buffer before
3618 attempting to read a function stub.
3619
3620 2020-01-03 Nick Clifton <nickc@redhat.com>
3621
3622 PR 25308
3623 * elf-properties.c (_bfd_elf_convert_gnu_properties): Check the
3624 return value from bfd_malloc.
3625 * elf32-arm.c (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise.
3626 (bfd_elf32_arm_stm32l4xx_fix_veneer_locations): Likewise.
3627 (elf32_arm_filter_cmse_symbols): Likewise.
3628 (elf32_arm_write_section): Likewise.
3629 * mach-o.c (bfd_mach_o_core_fetch_environment): Likewise.
3630 (bfd_mach_o_follow_dsym): Likewise.
3631 * pef.c (bfd_pef_print_loader_section): Likewise.
3632 (bfd_pef_scan_start_address): Likewise.
3633 (bfd_pef_parse_function_stubs): Likewise.
3634 (bfd_pef_parse_symbols): Likewise.
3635
3636 2020-01-03 Sergei Trofimovich <siarheit@google.com>
3637
3638 * elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): don't fail
3639 on binary inputs ld/PR25316.
3640 (is_ia64_elf): new helper to filter on ia64 objects.
3641
3642 2020-01-03 Jan Beulich <jbeulich@suse.com>
3643
3644 * mach-o.c (cpusubtype, bfd_mach_o_header_p): Insert underscore
3645 in parameter names.
3646 (bfd_mach_o_scan): Insert underscore in two variable names.
3647
3648 2020-01-02 Sergey Belyashov <sergey.belyashov@gmail.com>
3649
3650 * Makefile.am: Add z80-elf target support.
3651 * configure.ac: Likewise.
3652 * targets.c: Likewise.
3653 * Makefile.in: Regenerate.
3654 * configure: Regenerate.
3655 * config.bfd: Add z80-elf target support and new arches: ez80 and
3656 z180.
3657 * elf32-z80.c: New file.
3658 * archures.c: Add new z80 architectures: eZ80 and Z180.
3659 * coffcode.h: Likewise.
3660 * cpu-z80.c: Likewise.
3661 * coff-z80.c: Add new relocations for Z80 target and local label
3662 check.
3663 * reloc.c: Add new relocs.
3664 * bfd-in2.h: Regenerate.
3665 * libbfd.h: Regenerate.
3666
3667 2020-01-02 Tamar Christina <tamar.christina@arm.com>
3668
3669 PR 25210
3670 PR 24753
3671 * elfnn-aarch64.c (_bfd_aarch64_create_stub_section): Set ELF class.
3672
3673 2020-01-01 Alan Modra <amodra@gmail.com>
3674
3675 Update year range in copyright notice of all files.
3676
3677 For older changes see ChangeLog-2019
3678 \f
3679 Copyright (C) 2020 Free Software Foundation, Inc.
3680
3681 Copying and distribution of this file, with or without modification,
3682 are permitted in any medium without royalty provided the copyright
3683 notice and this notice are preserved.
3684
3685 Local Variables:
3686 mode: change-log
3687 left-margin: 8
3688 fill-column: 74
3689 version-control: never
3690 End: