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