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