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