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