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