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