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