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