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