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