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