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