]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - bfd/ChangeLog
PR26132, ar creates invalid libraries for some targets with plugins enabled
[thirdparty/binutils-gdb.git] / bfd / ChangeLog
1 2020-06-21 Alan Modra <amodra@gmail.com>
2
3 PR 26132
4 * configure.ac: Disable plugins by default for some targets.
5 * plugin.c: Comment typo fix.
6 * configure: Regenerate.
7
8 2020-06-19 Nick Clifton <nickc@redhat.com>
9
10 * plugin.c (try_load_plugin): Suppress the error message about
11 being unable to open a plugin if creating a list of viable
12 plugins.
13
14 2020-06-16 Alan Modra <amodra@gmail.com>
15
16 * aout-tic30.c: Delete file.
17 * Makefile.am (BFD32_BACKENDS): Remove aout-tic30.lo.
18 (BFD32_BACKENDS_CFILES): Remove aout-tic30.c.
19 * config.bfd (c30-*-*aout*, tic30-*-*aout*): Remove entry.
20 (xc16x-*-elf): Sort properly.
21 * configure.ac: Remove tic30_aout_vec.
22 * targets.c: Likewise.
23 * Makefile.in: Regenerate.
24 * configure: Regenerate.
25 * po/SRC-POTFILES.in: Regenerate.
26
27 2020-06-15 Max Filippov <jcmvbkbc@gmail.com>
28
29 * elf32-xtensa.c (XSHAL_ABI, XTHAL_ABI_UNDEFINED)
30 (XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): New macros.
31 (elf32xtensa_abi): New global variable.
32 (xtensa_abi_choice): New function.
33 (elf_xtensa_create_plt_entry): Use xtensa_abi_choice instead of
34 XSHAL_ABI to select PLT code.
35
36 2020-06-15 Roland McGrath <mcgrathr@google.com>
37
38 * elflink.c (bfd_elf_define_start_stop): Use start_stop_visibility
39 field of bfd_link_info.
40
41 2020-06-15 Alan Modra <amodra@gmail.com>
42
43 * config.bfd: Obsolete powerpcle-*-pe targets.
44
45 2020-06-15 Alan Modra <amodra@gmail.com>
46
47 PR 26103
48 * elflink.c (elf_link_add_archive_symbols): Exclude undefined
49 symbols that were defined in discarded sections.
50 * cofflink.c (coff_link_check_archive_element): Likewise.
51 (coff_link_add_symbols): Set indx to -3 for symbols defined in
52 discarded sections.
53 (_bfd_coff_write_global_sym): Don't emit such symbols.
54 libcoff-in.h (struct coff_link_hash_entry): Update indx comment.
55 libcoff.h: Regenerate.
56
57 2020-06-11 Alan Modra <amodra@gmail.com>
58
59 PR 26107
60 * pdp11.c (is_stab): Replace legacy "index" function with "strchr".
61
62 2020-06-10 H.J. Lu <hongjiu.lu@intel.com>
63
64 * elfnn-ia64.c (elfNN_ia64_link_hash_table): Remove reltext.
65 (allocate_dynrel_entries): Set DF_TEXTREL instead of reltext.
66 (elfNN_ia64_size_dynamic_sections): Check DF_TEXTREL instead
67 of reltext.
68
69 2020-06-10 H.J. Lu <hongjiu.lu@intel.com>
70
71 PR ld/26094
72 * elflink.c (bfd_elf_define_start_stop): Handle common symbols.
73 Clear verinfo.verdef.
74
75 2020-06-09 H.J. Lu <hongjiu.lu@intel.com>
76
77 PR ld/18801
78 * elf-bfd.h (elf_link_hash_table): Add ifunc_resolvers.
79 (_bfd_elf_allocate_ifunc_dyn_relocs): Remove the
80 bfd_boolean * argument. Set ifunc_resolvers if there are IFUNC
81 resolvers.
82 * elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Updated.
83 Set ifunc_resolvers if there are FUNC resolvers.
84 * elf64-ppc.c (ppc_link_hash_table): Remove local_ifunc_resolver.
85 (build_global_entry_stubs_and_plt): Replace local_ifunc_resolver
86 with elf.ifunc_resolvers.
87 (write_plt_relocs_for_local_syms): Likewise.
88 (ppc64_elf_relocate_section): Likewise.
89 (ppc64_elf_finish_dynamic_sections): Likewise.
90 * elfnn-aarch64.c (elfNN_aarch64_allocate_ifunc_dynrelocs):
91 Updated.
92 * elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise.
93 (_bfd_x86_elf_size_dynamic_sections): Check elf.ifunc_resolvers
94 instead of readonly_dynrelocs_against_ifunc.
95 * elfxx-x86.h (elf_x86_link_hash_table): Remove
96 readonly_dynrelocs_against_ifunc.
97
98 2020-06-09 Alan Modra <amodra@gmail.com>
99
100 * elf64-ppc.c (struct ppc_link_hash_table): Delete
101 maybe_local_ifunc_resolver field.
102 (build_global_entry_stubs_and_plt): Set local_ifunc_resolver in
103 cases where maybe_local_ifunc_resolver was set.
104 (ppc64_elf_relocate_section): Likewise.
105 (ppc64_elf_finish_dynamic_sections): Downgrade ifunc with textrel
106 error to a warning.
107
108 2020-06-08 H.J. Lu <hongjiu.lu@intel.com>
109
110 * elf-bfd.h (elf_link_hash_entry): Add tlsdesc_plt and
111 tlsdesc_got.
112 * elf32-arm.c (elf32_arm_link_hash_table): Remove tlsdesc_plt
113 and dt_tlsdesc_got.
114 (elf32_arm_size_dynamic_sections): Updated. Clear
115 root.tlsdesc_plt for DF_BIND_NOW.
116 (elf32_arm_finish_dynamic_sections): Updated.
117 (elf32_arm_output_arch_local_syms): Likewise.
118 * elf32-nds32.c (nds32_elf_size_dynamic_sections): Updated.
119 Clear root.tlsdesc_plt for DF_BIND_NOW.
120 (nds32_elf_finish_dynamic_sections): Updated.
121 * elf32-nds32.h (elf_nds32_link_hash_table): Remove
122 dt_tlsdesc_plt and dt_tlsdesc_got.
123 * elf64-x86-64.c (elf_x86_64_finish_dynamic_sections): Updated.
124 * elfnn-aarch64.c (elf_aarch64_link_hash_table): Remove
125 tlsdesc_plt and dt_tlsdesc_got.
126 (elfNN_aarch64_allocate_dynrelocs): Updated.
127 (elfNN_aarch64_finish_dynamic_sections): Likewise.
128 (elfNN_aarch64_size_dynamic_sections): Updated. Clear
129 root.tlsdesc_plt for DF_BIND_NOW. Don't check DF_BIND_NOW
130 twice.
131 * elfxx-x86.c (elf_x86_allocate_dynrelocs): Updated.
132 (_bfd_x86_elf_size_dynamic_sections): Likewise.
133 (_bfd_x86_elf_finish_dynamic_sections): Likewise.
134 * elfxx-x86.h (elf_x86_link_hash_table): Remove tlsdesc_plt and
135 tlsdesc_got.
136
137 2020-06-07 H.J. Lu <hongjiu.lu@intel.com>
138
139 * elf32-tic6x.c (elf32_bed): Defined the default to
140 elf32_tic6x_bed.
141
142 2020-06-07 H.J. Lu <hongjiu.lu@intel.com>
143
144 * elf64-hppa.c (elf64_hppa_link_hash_table): Remove plt_sec and
145 plt_rel_sec.
146 (elf64_hppa_check_relocs): Replace plt_sec/plt_rel_sec with
147 root.splt/root.srelplt.
148 (elf64_hppa_create_dynamic_sections): Likewise.
149 (elf64_hppa_size_dynamic_sections): Likewise.
150 (elf64_hppa_finish_dynamic_symbol): Likewise.
151 (elf_hppa_final_link): Likewise.
152 (elf_hppa_final_link_relocate): Likewise.
153
154 2020-06-06 H.J. Lu <hongjiu.lu@intel.com>
155
156 * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Updated.
157 * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Remove
158 is_vxworks.
159
160 2020-06-06 H.J. Lu <hongjiu.lu@intel.com>
161
162 * elf-bfd.h (elf_target_os): New.
163 (elf_link_hash_table): Add target_os.
164 (elf_backend_data): Add target_os.
165 * elf32-arm.c (elf32_arm_link_hash_table): Remove vxworks_p,
166 symbian_p and nacl_p.
167 (create_got_section): Updated.
168 (elf32_arm_create_dynamic_sections): Likewise.
169 (arm_type_of_stub): Likewise.
170 (elf32_arm_create_or_find_stub_sec): Likewise.
171 (elf32_arm_allocate_plt_entry): Likewise.
172 (elf32_arm_populate_plt_entry): Likewise.
173 (elf32_arm_final_link_relocate): Likewise.
174 (elf32_arm_check_relocs): Likewise.
175 (allocate_dynrelocs_for_symbol): Likewise.
176 (elf32_arm_finish_dynamic_symbol): Likewise.
177 (elf32_arm_finish_dynamic_sections): Likewise.
178 (elf32_arm_output_plt_map_1): Likewise.
179 (elf32_arm_output_arch_local_syms): Likewise.
180 (elf32_arm_add_symbol_hook): Likewise.
181 (elf32_arm_nacl_link_hash_table_create): Likewise.
182 (elf32_arm_vxworks_link_hash_table_create): Likewise.
183 (elf32_arm_symbian_link_hash_table_create): Likewise.
184 (ELF_TARGET_OS): New.
185 * elf32-i386.c (elf_i386_arch_bed): Removed.
186 (elf_backend_arch_data): Likewise.
187 (elf_i386_solaris_arch_bed): Likewise.
188 (elf_i386_nacl_arch_bed): Likewise.
189 (elf_i386_vxworks_arch_bed): Likewise.
190 (elf_i386_relocate_section): Updated.
191 (elf_i386_finish_dynamic_sections): Likewise.
192 (elf_i386_get_synthetic_symtab): Likewise.
193 (elf_i386_link_setup_gnu_properties): Likewise.
194 (ELF_TARGET_OS): New.
195 * elf32-mips.c (ELF_TARGET_OS): New.
196 * elf32-ppc.c (ppc_elf_link_hash_table): Remove is_vxworks.
197 (ppc_elf_create_got): Updated.
198 (ppc_elf_create_dynamic_sections): Likewise.
199 (ppc_elf_check_relocs): Likewise.
200 (ppc_elf_adjust_dynamic_symbol): Likewise.
201 (ppc_elf_size_dynamic_sections): Likewise.
202 (ppc_elf_relocate_section): Likewise.
203 (ppc_elf_finish_dynamic_sections): Likewise.
204 (ppc_elf_vxworks_link_hash_table_create): Likewise.
205 (ELF_TARGET_OS): New.
206 * elf32-sh.c (elf_sh_link_hash_table): Remove vxworks_p.
207 (sh_elf_link_hash_table_create): Updated.
208 (sh_elf_create_dynamic_sections): Likewise.
209 (allocate_dynrelocs): Likewise.
210 (sh_elf_size_dynamic_sections): Likewise.
211 (sh_elf_relocate_section): Likewise.
212 (sh_elf_finish_dynamic_symbol): Likewise.
213 (sh_elf_finish_dynamic_sections): Likewise.
214 (ELF_TARGET_OS): New.
215 * elf32-sparc.c (elf32_sparc_vxworks_link_hash_table_create):
216 Removed.
217 (bfd_elf32_bfd_link_hash_table_create): Likewise.
218 (ELF_TARGET_OS): New.
219 * elf64-x86-64.c (elf_x86_64_arch_bed): Removed.
220 (elf_x86_64_solaris_arch_bed): Likewise.
221 (elf_x86_64_nacl_arch_bed): Likewise.
222 (elf_x86_64_finish_dynamic_sections): Updated.
223 (elf_x86_64_get_synthetic_symtab): Likewise.
224 (elf_x86_64_link_setup_gnu_properties): Likewise.
225 (ELF_TARGET_OS): New.
226 * elflink.c (_bfd_elf_link_hash_table_init): Initialize
227 target_o.
228 * elfxx-mips.c (mips_elf_link_hash_table): Remove is_vxworks.
229 (MIPS_ELF_REL_DYN_NAME): Updated.
230 (ELF_MIPS_GP_OFFSET): Likewise.
231 (mips_elf_create_local_got_entry): Likewise.
232 (mips_elf_allocate_dynamic_relocations): Likewise.
233 (mips_elf_count_got_symbols): Likewise.
234 (is_gott_symbol): Likewise.
235 (mips_elf_calculate_relocation): Likewise.
236 (mips_elf_create_dynamic_relocation): Likewise.
237 (_bfd_mips_elf_check_relocs): Likewise.
238 (allocate_dynrelocs): Likewise.
239 (_bfd_mips_elf_adjust_dynamic_symbol): Likewise.
240 (mips_elf_lay_out_got): Likewise.
241 (mips_elf_set_plt_sym_value): Likewise.
242 (_bfd_mips_elf_size_dynamic_sections): Likewise.
243 (_bfd_mips_elf_finish_dynamic_symbol): Likewise.
244 (_bfd_mips_elf_finish_dynamic_sections): Likewise.
245 (_bfd_mips_elf_final_link): Likewise.
246 (_bfd_mips_init_file_header): Likewise.
247 * elfxx-sparc.c (_bfd_sparc_elf_create_dynamic_sections):
248 Likewise.
249 (allocate_dynrelocs): Likewise.
250 (_bfd_sparc_elf_size_dynamic_sections): Likewise.
251 (_bfd_sparc_elf_relocate_section): Likewise.
252 (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
253 (sparc_finish_dyn): Likewise.
254 (_bfd_sparc_elf_finish_dynamic_sections): Likewise.
255 * elfxx-target.h (ELF_TARGET_OS): New.
256 (elfNN_bed): Add ELF_TARGET_OS.
257 * elfxx-x86.c (elf_x86_allocate_dynrelocs): Updated.
258 (_bfd_x86_elf_link_hash_table_create): Likewise.
259 (_bfd_x86_elf_size_dynamic_sections): Likewise.
260 (_bfd_x86_elf_finish_dynamic_sections): Likewise.
261 (_bfd_x86_elf_adjust_dynamic_symbol): Likewise.
262 (_bfd_x86_elf_link_setup_gnu_properties): Likewise.
263 * elfxx-x86.h (elf_x86_target_os): Removed.
264 (elf_x86_backend_data): Likewise.
265 (get_elf_x86_backend_data): Likewise.
266 (elf_x86_link_hash_table): Remove target_os.
267
268 2020-06-06 Alan Modra <amodra@gmail.com>
269
270 * reloc.c: Rename
271 BFD_RELOC_PPC64_GOT_TLSGD34 to BFD_RELOC_PPC64_GOT_TLSGD_PCREL34,
272 BFD_RELOC_PPC64_GOT_TLSLD34 to BFD_RELOC_PPC64_GOT_TLSLD_PCREL34,
273 BFD_RELOC_PPC64_GOT_TPREL34 to BFD_RELOC_PPC64_GOT_TPREL_PCREL34,
274 BFD_RELOC_PPC64_GOT_DTPREL34 to BFD_RELOC_PPC64_GOT_DTPREL_PCREL34.
275 * elf64-ppc.c: Update throughout for reloc renaming.
276 (ppc64_elf_reloc_name_lookup): Handle old reloc names.
277 * libbfd.h: Regenerate.
278 * bfd-in2.h: Regenerate.
279
280 2020-06-05 H.J. Lu <hongjiu.lu@intel.com>
281
282 PR ld/26080
283 * elf32-bfin.c (bfinfdpic_relocate_section): Skip non SEC_ALLOC
284 section.
285
286 2020-06-05 Nick Clifton <nickc@redhat.com>
287
288 * pdp11.c (aout_link_add_symbols): Fix use before initialisation
289 bug.
290
291 2020-06-05 Nelson Chu <nelson.chu@sifive.com>
292
293 * elfnn-riscv.c (riscv_merge_attributes): Add new boolean
294 priv_may_conflict, in_priv_zero and out_priv_zero to decide
295 whether the object can be linked according to it's priv
296 attributes. The object without any priv spec attributes can
297 be linked with others. If the first input object doesn't contain
298 any priv attributes, then we need to copy the setting from the
299 next input one. Also report more detailed error messages to user.
300
301 2020-06-04 Stephen Casner <casner@acm.org>
302
303 Extend pdp11-aout symbol table format to accommodate .stab
304 symbols and implement correct handling of them.
305
306 * pdp11.c (pdp11_external_nlist): Repurposed e_unused to e_desc.
307 (N_STAB, is_stab): Needed new function is_stab to disambiguate
308 normal vs. .stab symbol table type values, replacing N_STAB mask.
309 (translate_from_native_sym_flags): Determine correct section for
310 different .stab types.
311 (translate_to_native_sym_flags): Leave .stab types intact.
312 (translate_symbol_table): Error if symbol indicates overlay;
313 store desc field from .stab symbols.
314 (write_syms): Output desc field with symbol.
315 (aout_link_check_ar_symbols): Skip .stab symbols.
316 (aout_link_add_symbols): Correctly distinguish .stab symbols.
317 (aout_link_write_other_symbol): Write 0 for desk and ovly fields.
318 (aout_link_write_symbols): Write 0 for desk and ovly fields;
319 correctly distinguish .stab symbols and select calculate their
320 section and value; and copy desc and ovly fields from input symbol
321 to output symbol.
322
323 2020-06-04 Stephen Casner <casner@acm.org>
324
325 * aoutx.h (translate_symbol_table): Comment had external and
326 internal swapped.
327 * pdp11.c (translate_symbol_table): Likewise.
328
329 2020-06-04 H.J. Lu <hongjiu.lu@intel.com>
330
331 * elfxx-x86.h (elf_x86_link_hash_table): Remove target_id.
332 (is_x86_elf): Check elf.hash_table_id instead of target_id.
333 * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Updated.
334
335 2020-06-04 H.J. Lu <hongjiu.lu@intel.com>
336
337 PR ld/26080
338 * elf-m10300.c (mn10300_elf_relocate_section): Resolve relocation
339 in debug section against symbol defined in shared library to 0.
340 * elf32-i386.c (elf_i386_check_relocs): Remove SEC_ALLOC check.
341 * elf32-lm32.c (lm32_elf_check_relocs): Likewise.
342 * elf32-m32r.c (m32r_elf_check_relocs): Likewise.
343 * elf32-nds32.c (nds32_elf_check_relocs): Likewise.
344 * elf32-nios2.c (nios2_elf32_check_relocs): Likewise.
345 * elf32-or1k.c (or1k_elf_check_relocs): Likewise.
346 * elf32-ppc.c (ppc_elf_check_relocs): Likewise.
347 * elf32-sh.c (sh_elf_check_relocs): Likewise.
348 * elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
349 * elf64-alpha.c (elf64_alpha_check_relocs): Likewise.
350 * elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
351 * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
352 * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
353 * elf32-vax.c (elf_vax_check_relocs): Set non_got_ref for non-GOT
354 reference.
355 (elf_vax_adjust_dynamic_symbol): Generate a copy reloc only if
356 there is non-GOT reference.
357 * elflink.c (_bfd_elf_link_check_relocs): Skip non-loaded,
358 non-alloced sections.
359
360 2020-06-03 Stephen Casner <casner@acm.org>
361
362 Copy several years of fixes from bfd/aoutx.h to bfd/pdp11.c.
363
364 * pdp11.c (some_aout_object_p): 4c1534c7a2a - Don't set EXEC_P for
365 files with relocs.
366 (aout_get_external_symbols): 6b8f0fd579d - Return if count is zero.
367 0301ce1486b PR 22306 - Handle stringsize of zero, and error for any
368 other size that doesn't qcover the header word.
369 bf82069dce1 PR 23056 - Allocate an extra byte at the end of the
370 string table, and zero it.
371 (translate_symbol_table): 0d329c0a83a PR 22887 - Print an error
372 message and set bfd_error on finding an invalid name string offset.
373 (add_to_stringtab): INLINE -> inline
374 (pdp11_aout_swap_reloc_in): 116acb2c268 PR 22887 - Correct r_index
375 bound check.
376 (squirt_out_relocs): e2996cc315d PR 20921 - Check for and report
377 any relocs that could not be recognised.
378 92744f05809 PR 20929 - Check for relocs without an associated symbol.
379 (find_nearest_line): 808346fcfcf PR 23055 - Check that the symbol
380 name exists and is long enough, before attempting to see if it is
381 for a .o file.
382 c3864421222 - Correct case for N_SO being the last symbol.
383 50455f1ab29 PR 20891 - Handle the case where the main file name
384 and the directory name are both empty.
385 e82ab856bb4 PR 20892 - Handle the case where function name is empty.
386 (aout_link_add_symbols): e517df3dbf7 PR 19629 - Check for out of
387 range string table offsets.
388 531336e3a0b PR 20909 - Fix off-by-one error in check for an
389 illegal string offset.
390 (aout_link_includes_newfunc): Add comment.
391 (pdp11_aout_link_input_section): ad756e3f9e6 - Return with an error
392 on unexpected relocation type rather than ASSERT.
393
394 2020-06-03 H.J. Lu <hongjiu.lu@intel.com>
395
396 PR ld/26066
397 * elf32-nios2.c (nios2_elf32_size_dynamic_sections): Call
398 _bfd_elf_maybe_set_textrel to set DF_TEXTREL.
399
400 2020-06-03 H.J. Lu <hongjiu.lu@intel.com>
401
402 PR ld/26066
403 * elf32-nios2.c (nios2_elf32_check_relocs): Skip non-loaded,
404 non-alloced sections.
405
406 2020-06-03 H.J. Lu <hongjiu.lu@intel.com>
407
408 * elf32-frv.c (elf32_frv_relocate_section): Don't generate
409 dynamic relocations for non SEC_ALLOC sections.
410
411 2020-06-03 Gunther Nikl <gnikl@justmail.de>
412
413 * aout64.c (BMAGIC, QMAGIC): Do not define.
414 * aoutx.h (N_IS_BMAGIC, N_SET_QMAGIC): New defines.
415 (NAME (aout, some_aout_object_p)): Use N_IS_QMAGIC and N_IS_BMAGIC
416 to check the file format.
417 (adjust_z_magic): Use N_SET_QMAGIC to set file format.
418 * i386aout.c (NO_WRITE_HEADER_KLUDGE): Delete define.
419 * libaout.h (NO_WRITE_HEADER_KLUDGE): Do not define.
420
421 2020-06-03 H.J. Lu <hongjiu.lu@intel.com>
422
423 * elf32-arc.c (elf_arc_relocate_section): Don't generate dynamic
424 relocations for non SEC_ALLOC sections.
425
426 2020-06-03 H.J. Lu <hongjiu.lu@intel.com>
427
428 * elf-bfd.h (_bfd_elf_maybe_set_textrel): New
429 * elf32-arm.c (maybe_set_textrel): Removed.
430 (elf32_arm_size_dynamic_sections): Replace maybe_set_textrel
431 with _bfd_elf_maybe_set_textrel.
432 * elf32-csky.c (maybe_set_textrel): Removed.
433 (csky_elf_size_dynamic_sections): Replace maybe_set_textrel
434 with _bfd_elf_maybe_set_textrel.
435 * elf32-hppa.c (maybe_set_textrel): Removed.
436 (elf32_hppa_size_dynamic_sections): Replace maybe_set_textrel
437 with _bfd_elf_maybe_set_textrel.
438 * elf32-lm32.c (maybe_set_textrel): Removed.
439 (lm32_elf_size_dynamic_sections): Replace maybe_set_textrel
440 with _bfd_elf_maybe_set_textrel.
441 * elf32-m32r.c (maybe_set_textrel): Removed.
442 (m32r_elf_size_dynamic_sections): Replace maybe_set_textrel
443 with _bfd_elf_maybe_set_textrel.
444 * elf32-metag.c (maybe_set_textrel): Removed.
445 (elf_metag_size_dynamic_sections): Replace maybe_set_textrel
446 with _bfd_elf_maybe_set_textrel.
447 * elf32-nds32.c (maybe_set_textrel): Removed.
448 (nds32_elf_size_dynamic_sections): Replace maybe_set_textrel
449 with _bfd_elf_maybe_set_textrel.
450 * elf32-or1k.c (maybe_set_textrel): Removed.
451 (or1k_elf_size_dynamic_sections): Replace maybe_set_textrel
452 with _bfd_elf_maybe_set_textrel.
453 * elf32-ppc.c (maybe_set_textrel): Removed.
454 (ppc_elf_size_dynamic_sections): Replace maybe_set_textrel
455 with _bfd_elf_maybe_set_textrel.
456 * elf32-s390.c (maybe_set_textrel): Removed.
457 (elf_s390_size_dynamic_sections): Replace maybe_set_textrel
458 with _bfd_elf_maybe_set_textrel.
459 * elf32-sh.c (maybe_set_textrel): Removed.
460 (sh_elf_size_dynamic_sections): Replace maybe_set_textrel
461 with _bfd_elf_maybe_set_textrel.
462 * elf32-tic6x.c (maybe_set_textrel): Removed.
463 (elf32_tic6x_size_dynamic_sections): Replace maybe_set_textrel
464 with _bfd_elf_maybe_set_textrel.
465 * elf32-tilepro.c (maybe_set_textrel): Removed.
466 (tilepro_elf_size_dynamic_sections): Replace maybe_set_textrel
467 with _bfd_elf_maybe_set_textrel.
468 * elf64-ppc.c (maybe_set_textrel): Removed.
469 (ppc64_elf_size_dynamic_sections): Replace maybe_set_textrel
470 with _bfd_elf_maybe_set_textrel.
471 * elf64-s390.c (maybe_set_textrel): Removed.
472 (elf_s390_size_dynamic_sections): Replace maybe_set_textrel
473 with _bfd_elf_maybe_set_textrel.
474 * elfnn-aarch64.c (maybe_set_textrel): Removed.
475 (elfNN_aarch64_size_dynamic_sections): Replace maybe_set_textrel
476 with _bfd_elf_maybe_set_textrel.
477 * elfnn-riscv.c (maybe_set_textrel): Removed.
478 (riscv_elf_size_dynamic_sections): Replace maybe_set_textrel
479 with _bfd_elf_maybe_set_textrel.
480 * elfxx-sparc.c (maybe_set_textrel): Removed.
481 (_bfd_sparc_elf_size_dynamic_sections): Replace maybe_set_textrel
482 with _bfd_elf_maybe_set_textrel.
483 * elfxx-tilegx.c (maybe_set_textrel): Removed.
484 (tilegx_elf_size_dynamic_sections): Replace maybe_set_textrel
485 with _bfd_elf_maybe_set_textrel.
486 * elfxx-x86.c (maybe_set_textrel): Removed.
487 (_bfd_x86_elf_size_dynamic_sections): Replace maybe_set_textrel
488 with _bfd_elf_maybe_set_textrel.
489 * elflink.c (_bfd_elf_maybe_set_textrel): New.
490
491 2020-06-03 H.J. Lu <hongjiu.lu@intel.com>
492
493 PR ld/26067
494 * elf32-arm.c (elf32_arm_copy_indirect_symbol): Don't copy
495 dyn_relocs.
496 * elf32-csky.c (csky_elf_copy_indirect_symbol): Likewise.
497 * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Likewise.
498 * elf32-metag.c (elf_metag_copy_indirect_symbol): Likewise.
499 * elf32-microblaze.c (microblaze_elf_copy_indirect_symbol):
500 Likewise.
501 * elf32-nds32.c (nds32_elf_copy_indirect_symbol): Likewise.
502 * elf32-nios2.c (nios2_elf32_copy_indirect_symbol): Likewise.
503 * elf32-or1k.c (or1k_elf_copy_indirect_symbol): Likewise.
504 * elf32-s390.c (elf_s390_copy_indirect_symbol): Likewise.
505 * elf32-sh.c (sh_elf_copy_indirect_symbol): Likewise.
506 * elf32-tilepro.c (tilepro_elf_copy_indirect_symbol): Likewise.
507 * elf64-s390.c (elf_s390_copy_indirect_symbol): Likewise.
508 * elfnn-aarch64.c (elfNN_aarch64_copy_indirect_symbol): Likewise.
509 * elfnn-riscv.c (riscv_elf_copy_indirect_symbol): Likewise.
510 * elfxx-sparc.c (_bfd_sparc_elf_copy_indirect_symbol): Likewise.
511 * elfxx-tilegx.c (tilegx_elf_copy_indirect_symbol): Likewise.
512 * elfxx-x86.c (_bfd_x86_elf_copy_indirect_symbol): Likewise.
513 * elf32-lm32.c (lm32_elf_copy_indirect_symbol): Removed.
514 (elf_backend_copy_indirect_symbol): Likewise.
515 * elf32-m32r.c (m32r_elf_copy_indirect_symbol): Removed.
516 (elf_backend_copy_indirect_symbol): Likewise.
517 * elflink.c (_bfd_elf_link_hash_copy_indirect): Copy dyn_relocs.
518
519 2020-06-03 H.J. Lu <hongjiu.lu@intel.com>
520
521 PR ld/26067
522 * elf-bfd.h (_bfd_elf_readonly_dynrelocs): New.
523 * elf32-arm.c (readonly_dynrelocs): Removed.
524 (maybe_set_textrel): Replace readonly_dynrelocs with
525 _bfd_elf_readonly_dynrelocs.
526 * elf32-csky.c (readonly_dynrelocs): Removed.
527 (maybe_set_textrel): Replace readonly_dynrelocs with
528 _bfd_elf_readonly_dynrelocs.
529 * elf32-hppa.c(readonly_dynrelocs): Removed.
530 (alias_readonly_dynrelocs): Replace readonly_dynrelocs with
531 _bfd_elf_readonly_dynrelocs.
532 (maybe_set_textrel): Likewise.
533 * elf32-lm32.c (readonly_dynrelocs): Removed.
534 (lm32_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
535 with _bfd_elf_readonly_dynrelocs.
536 (maybe_set_textrel): Likewise.
537 * elf32-m32r.c (readonly_dynrelocs): Removed.
538 (m32r_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
539 with _bfd_elf_readonly_dynrelocs.
540 (maybe_set_textrel): Likewise.
541 * elf32-metag.c (readonly_dynrelocs): Removed.
542 (elf_metag_adjust_dynamic_symbol): Replace readonly_dynrelocs
543 with _bfd_elf_readonly_dynrelocs.
544 (maybe_set_textrel): Likewise.
545 * elf32-microblaze.c (readonly_dynrelocs): Removed.
546 (microblaze_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
547 with _bfd_elf_readonly_dynrelocs.
548 * elf32-nds32.c (readonly_dynrelocs): Removed.
549 (nds32_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
550 with _bfd_elf_readonly_dynrelocs.
551 (maybe_set_textrel): Likewise.
552 * elf32-or1k.c (readonly_dynrelocs): Removed.
553 (or1k_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
554 with _bfd_elf_readonly_dynrelocs.
555 * elf32-ppc.c (readonly_dynrelocs): Removed.
556 (alias_readonly_dynrelocs): Replace readonly_dynrelocs with
557 _bfd_elf_readonly_dynrelocs.
558 (ppc_elf_adjust_dynamic_symbol): Likewise.
559 (maybe_set_textrel): Likewise.
560 * elf32-s390.c (readonly_dynrelocs): Removed.
561 (elf_s390_adjust_dynamic_symbol): Replace readonly_dynrelocs
562 with _bfd_elf_readonly_dynrelocs.
563 (maybe_set_textrel): Likewise.
564 * elf32-sh.c (readonly_dynrelocs): Removed.
565 (sh_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs with
566 _bfd_elf_readonly_dynrelocs.
567 (maybe_set_textrel): Likewise.
568 * elf32-tic6x.c (readonly_dynrelocs): Removed.
569 (maybe_set_textrel): Replace readonly_dynrelocs with
570 _bfd_elf_readonly_dynrelocs.
571 * elf32-tilepro.c (readonly_dynrelocs): Removed.
572 (tilepro_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
573 with _bfd_elf_readonly_dynrelocs.
574 (maybe_set_textrel): Likewise.
575 * elf64-ppc.c (readonly_dynrelocs): Removed.
576 (alias_readonly_dynrelocs): Replace readonly_dynrelocs with
577 _bfd_elf_readonly_dynrelocs.
578 (ppc64_elf_adjust_dynamic_symbol): Likewise.
579 (maybe_set_textrel): Likewise.
580 * elf64-s390.c (readonly_dynrelocs): Removed.
581 (elf_s390_adjust_dynamic_symbol): Replace readonly_dynrelocs
582 with _bfd_elf_readonly_dynrelocs.
583 (maybe_set_textrel): Likewise.
584 * elflink.c (_bfd_elf_readonly_dynrelocs): New.
585 * elfnn-aarch64.c (readonly_dynrelocs): Removed.
586 (maybe_set_textrel): Replace readonly_dynrelocs with
587 _bfd_elf_readonly_dynrelocs.
588 * elfnn-riscv.c (readonly_dynrelocs): Removed.
589 (riscv_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
590 with _bfd_elf_readonly_dynrelocs.
591 (maybe_set_textrel): Likewise.
592 * elfxx-sparc.c (readonly_dynrelocs): Removed.
593 (_bfd_sparc_elf_adjust_dynamic_symbol): Replace
594 readonly_dynrelocs with _bfd_elf_readonly_dynrelocs.
595 (maybe_set_textrel): Likewise.
596 * elfxx-tilegx.c (readonly_dynrelocs): Removed.
597 (tilegx_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
598 with _bfd_elf_readonly_dynrelocs.
599 (maybe_set_textrel): Likewise.
600 * elfxx-x86.c (readonly_dynrelocs): Removed.
601 (maybe_set_textrel): Replace readonly_dynrelocs with
602 _bfd_elf_readonly_dynrelocs.
603 (_bfd_x86_elf_adjust_dynamic_symbol): Likewise.
604
605 2020-06-03 H.J. Lu <hongjiu.lu@intel.com>
606
607 * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Silence
608 -fsanitize=undefined.
609
610 2020-06-03 Alan Modra <amodra@gmail.com>
611
612 PR 26069
613 PR 18758
614 * peicode.h (pe_ILF_make_a_section): Align data for compilers
615 other than gcc.
616 (pe_ILF_build_a_bfd): Likewise.
617
618 2020-06-03 Alan Modra <amodra@gmail.com>
619
620 PR 26069
621 * elf.c (_bfd_elf_close_and_cleanup): Free elf_shstrtab for
622 core files as well as objects.
623
624 2020-06-01 H.J. Lu <hongjiu.lu@intel.com>
625
626 PR ld/26067
627 * elf-bfd.h (elf_link_hash_entry): Add dyn_relocs after size.
628 * elf-s390-common.c (s390_elf_allocate_ifunc_dyn_relocs):
629 Updated.
630 * elf32-arc.c (elf_arc_link_hash_entry): Remove dyn_relocs.
631 (elf_arc_link_hash_newfunc): Updated.
632 * elf32-arm.c (elf32_arm_link_hash_entry): Remove dyn_relocs.
633 (elf32_arm_link_hash_newfunc): Updated.
634 (elf32_arm_copy_indirect_symbol): Likewise.
635 (elf32_arm_check_relocs): Likewise.
636 (readonly_dynrelocs): Likewise.
637 (allocate_dynrelocs_for_symbol): Likewise.
638 * elf32-csky.c (csky_elf_link_hash_entry): Remove dyn_relocs.
639 (csky_elf_link_hash_newfunc): Updated.
640 (csky_allocate_dynrelocs): Likewise.
641 (readonly_dynrelocs): Likewise.
642 (csky_elf_copy_indirect_symbol): Likewise.
643 * elf32-hppa.c (elf32_hppa_link_hash_entry): Remove dyn_relocs.
644 (hppa_link_hash_newfunc): Updated.
645 (elf32_hppa_copy_indirect_symbol): Likewise.
646 (elf32_hppa_hide_symbol): Likewise.
647 (elf32_hppa_adjust_dynamic_symbol): Likewise.
648 (allocate_dynrelocs): Likewise.
649 (elf32_hppa_relocate_section): Likewise.
650 * elf32-i386.c (elf_i386_check_relocs): Likewise.
651 * elf32-lm32.c (elf_lm32_link_hash_entry): Removed.
652 (lm32_elf_link_hash_newfunc): Likewise.
653 (lm32_elf_link_hash_table_create): Updated.
654 (readonly_dynrelocs): Likewise.
655 (allocate_dynrelocs): Likewise.
656 (lm32_elf_copy_indirect_symbol): Likewise.
657 * elf32-m32r.c (elf_m32r_link_hash_entry): Removed.
658 (m32r_elf_link_hash_newfunc): Likewise.
659 (m32r_elf_link_hash_table_create): Updated.
660 (m32r_elf_copy_indirect_symbol): Likewise.
661 (allocate_dynrelocs): Likewise.
662 * elf32-metag.c (elf_metag_link_hash_entry): Remove dyn_relocs.
663 (metag_link_hash_newfunc): Updated.
664 (elf_metag_copy_indirect_symbol): Likewise.
665 (readonly_dynrelocs): Likewise.
666 (allocate_dynrelocs): Likewise.
667 * elf32-microblaze.c (elf32_mb_link_hash_entry): Remove
668 dyn_relocs.
669 (link_hash_newfunc): Updated.
670 (microblaze_elf_check_relocs): Likewise.
671 (microblaze_elf_copy_indirect_symbol): Likewise.
672 (readonly_dynrelocs): Likewise.
673 (allocate_dynrelocs): Likewise.
674 * elf32-nds32.c (elf_nds32_link_hash_entry): Remove dyn_relocs.
675 (nds32_elf_link_hash_newfunc): Updated.
676 (nds32_elf_copy_indirect_symbol): Likewise.
677 (readonly_dynrelocs): Likewise.
678 (allocate_dynrelocs): Likewise.
679 (nds32_elf_check_relocs): Likewise.
680 * elf32-nios2.c (elf32_nios2_link_hash_entry): Remove dyn_relocs.
681 (link_hash_newfunc): Updated.
682 (nios2_elf32_copy_indirect_symbol): Likewise.
683 (nios2_elf32_check_relocs): Likewise.
684 (allocate_dynrelocs): Likewise.
685 * elf32-or1k.c (elf_or1k_link_hash_entry): Remove dyn_relocs.
686 (or1k_elf_link_hash_newfunc): Updated.
687 (readonly_dynrelocs): Likewise.
688 (allocate_dynrelocs): Likewise.
689 (or1k_elf_copy_indirect_symbol): Likewise.
690 * elf32-ppc.c (ppc_elf_link_hash_entry): Remove dyn_relocs.
691 (ppc_elf_link_hash_newfunc): Updated.
692 (ppc_elf_copy_indirect_symbol): Likewise.
693 (ppc_elf_check_relocs): Likewise.
694 (readonly_dynrelocs): Likewise.
695 (ppc_elf_adjust_dynamic_symbol): Likewise.
696 (allocate_dynrelocs): Likewise.
697 (ppc_elf_relocate_section): Likewise.
698 * elf32-s390.c (elf_s390_link_hash_entry): Remove dyn_relocs.
699 (link_hash_newfunc): Updated.
700 (elf_s390_copy_indirect_symbol): Likewise.
701 (readonly_dynrelocs): Likewise.
702 (elf_s390_adjust_dynamic_symbol): Likewise.
703 (allocate_dynrelocs): Likewise.
704 * elf32-sh.c (elf_sh_link_hash_entry): Remove dyn_relocs.
705 (sh_elf_link_hash_newfunc): Updated.
706 (readonly_dynrelocs): Likewise.
707 (allocate_dynrelocs): Likewise.
708 (sh_elf_copy_indirect_symbol): Likewise.
709 (sh_elf_check_relocs): Likewise.
710 * elf32-tic6x.c (elf32_tic6x_link_hash_entry): Removed.
711 (elf32_tic6x_link_hash_newfunc): Likewise.
712 (elf32_tic6x_link_hash_table_create): Updated.
713 (readonly_dynrelocs): Likewise.
714 (elf32_tic6x_check_relocs): Likewise.
715 (elf32_tic6x_allocate_dynrelocs): Likewise.
716 * elf32-tilepro.c (tilepro_elf_link_hash_entry): Remove
717 dyn_relocs.
718 (link_hash_newfunc): Updated.
719 (tilepro_elf_copy_indirect_symbol): Likewise.
720 (tilepro_elf_check_relocs): Likewise.
721 (allocate_dynrelocs): Likewise.
722 * elf64-ppc.c (ppc_link_hash_entry): Remove dyn_relocs.
723 (ppc64_elf_copy_indirect_symbol): Updated.
724 (ppc64_elf_check_relocs): Likewise.
725 (readonly_dynrelocs): Likewise.
726 (ppc64_elf_adjust_dynamic_symbol): Likewise.
727 (dec_dynrel_count): Likewise.
728 (allocate_dynrelocs): Likewise.
729 (ppc64_elf_relocate_section): Likewise.
730 * elf64-s390.c (elf_s390_link_hash_entry): Remove dyn_relocs.
731 (link_hash_newfunc): Updated.
732 (elf_s390_copy_indirect_symbol): Likewise.
733 (readonly_dynrelocs): Likewise.
734 (allocate_dynrelocs): Likewise.
735 * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
736 * elfnn-aarch64.c (elf_aarch64_link_hash_entry): Remove
737 dyn_relocs.
738 (elfNN_aarch64_link_hash_newfunc): Updated.
739 (elfNN_aarch64_copy_indirect_symbol): Likewise.
740 (readonly_dynrelocs): Likewise.
741 (need_copy_relocation_p): Likewise.
742 (elfNN_aarch64_allocate_dynrelocs): Likewise.
743 (elfNN_aarch64_allocate_ifunc_dynrelocs): Likewise.
744 * elfnn-riscv.c (riscv_elf_link_hash_entry): Remove dyn_relocs.
745 (link_hash_newfunc): Updated.
746 (riscv_elf_copy_indirect_symbol): Likewise.
747 (riscv_elf_check_relocs): Likewise.
748 (readonly_dynrelocs): Likewise.
749 (allocate_dynrelocs): Likewise.
750 * elfxx-sparc.c (_bfd_sparc_elf_link_hash_entry): Remove
751 dyn_relocs.
752 (link_hash_newfunc): Updated.
753 (_bfd_sparc_elf_copy_indirect_symbol): Likewise.
754 (_bfd_sparc_elf_check_relocs): Likewise.
755 (readonly_dynrelocs): Likewise.
756 (allocate_dynrelocs): Likewise.
757 * elfxx-tilegx.c (tilegx_elf_link_hash_entry): Remove dyn_relocs.
758 (link_hash_newfunc): Updated.
759 (tilegx_elf_copy_indirect_symbol): Likewise.
760 (tilegx_elf_check_relocs): Likewise.
761 (readonly_dynrelocs): Likewise.
762 (allocate_dynrelocs): Likewise.
763 * elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise.
764 (readonly_dynrelocs): Likewise.
765 (_bfd_x86_elf_copy_indirect_symbol): Likewise.
766 * elfxx-x86.h (elf_x86_link_hash_entry): Remove dyn_relocs.
767
768 2020-06-01 Alan Modra <amodra@gmail.com>
769
770 * vms-alpha.c (_bfd_vms_slurp_etir): Check bound for the current
771 command against cmd_length, not the end of record. For
772 ETIR__C_STO_IMMR check size against cmd_length, mask repeat count
773 to 32-bits and break out on zero size. Add ETIR__C_STC_LP_PSB
774 cmd_length test.
775
776 2020-05-28 David Faust <david.faust@oracle.com>
777
778 * elf64-bpf.c (bpf_elf_relocate_section): Fix handling of
779 R_BPF_INSN_{32,64} relocations.
780
781 2020-05-28 Stephen Casner <casner@acm.org>
782
783 * pdp11.c: Implement BRD_RELOC_32 to relocate the low 16 bits of
784 addreses in .long (used in testsuites) and .stab values.
785
786 2020-05-27 H.J. Lu <hongjiu.lu@intel.com>
787
788 PR ld/22909
789 * elflink.c (bfd_elf_final_link): Use bfd_link_textrel_check.
790 Check bfd_link_dll when issue a DT_TEXTREL warning.
791 * elfxx-x86.c (maybe_set_textrel): Likewise.
792 (_bfd_x86_elf_size_dynamic_sections): Likewise.
793
794 2020-05-26 Nick Clifton <nickc@redhat.com>
795
796 * plugin.c (try_load_plugin): Extend error message when a plugin
797 fails to open.
798
799 2020-05-23 Alan Modra <amodra@gmail.com>
800
801 * bfdio.c (bfd_get_file_size): Don't segfault on NULL arch_header.
802
803 2020-05-22 Alan Modra <amodra@gmail.com>
804
805 PR 25882
806 * elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Don't init FP
807 attributes from shared libraries, and do not return an error if
808 they don't match.
809
810 2020-05-21 Alan Modra <amodra@gmail.com>
811
812 PR 25993
813 * opncls.c (_bfd_free_cached_info): Keep a copy of the bfd
814 filename.
815 (_bfd_delete_bfd): Free the copy.
816 (_bfd_new_bfd): Free nbfd->memory on error.
817
818 2020-05-21 Alan Modra <amodra@gmail.com>
819
820 * aoutx.h: Replace "if (x) free (x)" with "free (x)" throughout.
821 * archive.c, * bfd.c, * bfdio.c, * coff-alpha.c, * coff-ppc.c,
822 * coff-sh.c, * coff-stgo32.c, * coffcode.h, * coffgen.c,
823 * cofflink.c, * cpu-arm.c, * doc/chew.c, * dwarf2.c, * ecoff.c,
824 * ecofflink.c, * elf-eh-frame.c, * elf-m10200.c, * elf-m10300.c,
825 * elf-strtab.c, * elf.c, * elf32-arc.c, * elf32-arm.c,
826 * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-crx.c,
827 * elf32-epiphany.c, * elf32-ft32.c, * elf32-h8300.c,
828 * elf32-ip2k.c, * elf32-m32c.c, * elf32-m68hc11.c,
829 * elf32-m68k.c, * elf32-microblaze.c, * elf32-msp430.c,
830 * elf32-nds32.c, * elf32-nios2.c, * elf32-ppc.c, * elf32-pru.c,
831 * elf32-rl78.c, * elf32-rx.c, * elf32-sh.c, * elf32-spu.c,
832 * elf32-v850.c, * elf32-xtensa.c, * elf64-alpha.c,
833 * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c
834 * elf64-mmix.c, * elf64-ppc.c, * elf64-sparc.c, * elfcode.h,
835 * elflink.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-mips.c,
836 * elfxx-x86.c, * format.c, * ihex.c, * libbfd.c, * linker.c,
837 * mmo.c, * opncls.c, * pdp11.c, * peXXigen.c, * pef.c,
838 * peicode.h, * simple.c, * som.c, * srec.c, * stabs.c, * syms.c,
839 * targets.c, * vms-lib.c, * xcofflink.c, * xtensa-isa.c: Likewise.
840
841 2020-05-20 Nelson Chu <nelson.chu@sifive.com>
842
843 * elfxx-riscv.h (riscv_parse_subset_t): Add new callback function
844 get_default_version. It is used to find the default version for
845 the specific extension.
846 * elfxx-riscv.c (riscv_parsing_subset_version): Remove the parameters
847 default_major_version and default_minor_version. Add new bfd_boolean
848 parameter *use_default_version. Set it to TRUE if we need to call
849 the callback rps->get_default_version to find the default version.
850 (riscv_parse_std_ext): Call rps->get_default_version if we fail to find
851 the default version in riscv_parsing_subset_version, and then call
852 riscv_add_subset to add the subset into subset list.
853 (riscv_parse_prefixed_ext): Likewise.
854 (riscv_std_z_ext_strtab): Support Zicsr extensions.
855 * elfnn-riscv.c (riscv_merge_std_ext): Use strcasecmp to compare the
856 strings rather than characters.
857 riscv_merge_arch_attr_info): The callback function get_default_version
858 is only needed for assembler, so set it to NULL int the linker.
859 * elfxx-riscv.c (riscv_estimate_digit): Remove the static.
860 * elfxx-riscv.h: Updated.
861
862 2020-05-20 Alan Modra <amodra@gmail.com>
863
864 PR 25993
865 * archive.c (_bfd_get_elt_at_filepos): Don't strdup filename,
866 use bfd_set_filename.
867 * elfcode.h (_bfd_elf_bfd_from_remote_memory): Likewise.
868 * mach-o.c (bfd_mach_o_fat_member_init): Likewise.
869 * opncls.c (bfd_fopen, bfd_openstreamr, bfd_openr_iovec, bfd_openw),
870 (bfd_create): Likewise.
871 (_bfd_delete_bfd): Don't free filename.
872 (bfd_set_filename): Copy filename param to bfd_alloc'd memory,
873 return pointer to the copy or NULL on alloc fail.
874 * vms-lib.c (_bfd_vms_lib_get_module): Free newname and test
875 result of bfd_set_filename.
876 * bfd-in2.h: Regenerate.
877
878 2020-05-20 Alan Modra <amodra@gmail.com>
879
880 PR 26011
881 * elf.c (_bfd_elf_get_reloc_upper_bound): Sanity check reloc
882 section size against file size.
883 (_bfd_elf_get_dynamic_reloc_upper_bound): Likewise.
884
885 2020-05-19 Gunther Nikl <gnikl@justmail.de>
886
887 PR 26005
888 * elf.c (bfd_section_from_shdr): Replace bfd_zmalloc with bfd_malloc
889 and memset when allocating memory for the sections_being_created
890 array.
891
892 2020-05-19 Stafford Horne <shorne@gmail.com>
893
894 * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Rename srela
895 to relgot.
896 (or1k_elf_relocate_section): Access srelgot via
897 htab->root.srelgot. Add assertions for srelgot->contents.
898 Introduce local variable for srelgot to not reuse global
899 sreloc.
900 (or1k_elf_relocate_section): Fixup dynamic symbol detection.
901 (or1k_set_got_and_rela_sizes): New function.
902 (or1k_initial_exec_offset): New function.
903 (TLS_GD, TLS_IE, TLS_LD, TLS_LE): Redefine macros as masks.
904 (or1k_elf_relocate_section): Allow for TLS to handle multiple
905 model access.
906 (or1k_elf_check_relocs): Use OR to set TLS access.
907 (allocate_dynrelocs): Use or1k_set_got_and_rela_sizes to set
908 sizes.
909 (or1k_elf_size_dynamic_sections): Use
910 or1k_set_got_and_rela_sizes to set sizes.
911 (or1k_elf_relocate_section): Fixup PCREL relocation calculation.
912 (TCB_SIZE): New macro.
913 (tpoff): Use TCB_SIZE and alignment to calculate offset.
914 (allocate_dynrelocs, readonly_dynrelocs, or1k_elf_check_relocs)
915 (or1k_elf_size_dynamic_sections): Rename p to sec_relocs.
916 (allocate_dynrelocs): Rename s to splt or sgot based on usage.
917 (tpoff): Add dynamic boolean argument.
918 (or1k_elf_relocate_section): Pass dynamic flag to tpoff.
919
920 2020-05-19 Siddhesh Poyarekar <siddesh.poyarekar@arm.com>
921
922 * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Club
923 BFD_RELOC_AARCH64_BRANCH19 and BFD_RELOC_AARCH64_TSTBR14
924 cases with BFD_RELOC_AARCH64_JUMP26.
925 (elfNN_aarch64_check_relocs): Likewise.
926
927 2020-05-19 Alan Modra <amodra@gmail.com>
928
929 * aix5ppc-core.c (xcoff64_core_file_matches_executable_p): Use
930 bfd_get_filename rather than accessing bfd->filename directly.
931 * aout-target.h (MY (object_p)): Likewise.
932 * aoutx.h (aout_find_nearest_line, aout_link_write_symbols): Likewise.
933 * archive.c (find_nested_archive, _bfd_generic_read_ar_hdr_mag),
934 (_bfd_construct_extended_name_table, _bfd_bsd44_write_ar_hdr),
935 (_bfd_archive_bsd44_construct_extended_name_table),
936 (_bfd_write_archive_contents, _bfd_compute_and_write_armap),
937 (_bfd_bsd_write_armap): Likewise.
938 * bfd.c (bfd_errmsg, _bfd_doprnt): Likewise.
939 * cache.c (bfd_open_file): Likewise.
940 * ecoff.c (_bfd_ecoff_write_armap): Likewise.
941 * ecofflink.c (bfd_ecoff_debug_accumulate_other): Likewise.
942 * elf32-bfin.c (bfinfdpic_relocate_section): Likewise.
943 * elf32-frv.c (elf32_frv_relocate_section): Likewise.
944 * elf32-hppa.c (elf32_hppa_final_link): Likewise.
945 * elf32-nds32.c (nds32_elf_output_symbol_hook),
946 (patch_tls_desc_to_ie): Likewise.
947 * elf32-spu.c (sort_bfds, print_one_overlay_section),
948 (spu_elf_auto_overlay): Likewise.
949 * elf64-hppa.c (elf_hppa_final_link): Likewise.
950 * elf64-ia64-vms.c (elf64_ia64_size_dynamic_sections): Likewise.
951 * elfcore.h (elf_core_file_matches_executable_p): Likewise.
952 * elflink.c (bfd_elf_size_dynamic_sections),
953 (elf_link_input_bfd): Likewise.
954 * linker.c (_bfd_generic_link_output_symbols): Likewise.
955 * mach-o.c (bfd_mach_o_follow_dsym),
956 (bfd_mach_o_close_and_cleanup): Likewise.
957 * opncls.c (_bfd_delete_bfd, _maybe_make_executable),
958 (find_separate_debug_file, get_build_id_name): Likewise.
959 * pdp11.c (aout_find_nearest_line, aout_link_write_symbols): Likewise.
960 * plugin.c (bfd_plugin_open_input): Likewise.
961 * rs6000-core.c (rs6000coff_core_file_matches_executable_p): Likewise.
962 * som.c (som_write_armap): Likewise.
963 * srec.c (srec_write_record, srec_write_symbols): Likewise.
964 * vms-lib.c (_bfd_vms_lib_get_imagelib_file),
965 (_bfd_vms_lib_write_archive_contents): Likewise.
966 * xcofflink.c (xcoff_link_add_dynamic_symbols): Likewise.
967
968 2020-05-19 Alan Modra <amodra@gmail.com>
969
970 PR 25713
971 * bfdio.c (_bfd_real_fopen): Typo fix.
972
973 2020-05-18 Nick Clifton <nickc@redhat.com>
974
975 PR 26005
976 * elf.c (bfd_section_from_shdr): Use bfd_malloc to allocate memory
977 for the sections_being_created array.
978
979 2020-05-18 Alan Modra <amodra@gmail.com>
980
981 * ecoff.c (ecoff_slurp_reloc_table): Malloc external_relocs so
982 they can be freed without also freeing internal_relocs.
983
984 2020-05-18 Jaydeep Chauhan <jaydeepchauhan1494@gmail.com>
985
986 PR 25713
987 * bfdio.c (_bfd_real_fopen): Convert UNIX style sirectory
988 separators into DOS style when creating a WIN32 fullpath.
989
990 2020-05-14 Nelson Chu <nelson.chu@sifive.com>
991
992 * elfnn-riscv.c (elfNN_riscv_mkobject): New function. We need this
993 to initialize RISC-V tdata.
994
995 2020-05-12 Gunther Nikl <gnikl@justmail.de>
996
997 * aoutx.h (NAME (aout, swap_std_reloc_out)): Reject an unsupported
998 relocation size.
999
1000 2020-05-11 Alan Modra <amodra@gmail.com>
1001
1002 * elf64-ppc.c (xlate_pcrel_opt): Handle lxvp and stxvp.
1003
1004 2020-05-11 Alan Modra <amodra@gmail.com>
1005
1006 * elf64-ppc.c: Rename powerxx to power10 throughout.
1007
1008 2020-05-11 Alan Modra <amodra@gmail.com>
1009
1010 PR 25961
1011 * coffgen.c (coff_get_normalized_symtab): Check that buffer
1012 contains required number of auxents before processing any auxent.
1013 * coffswap.h (coff_swap_aux_in <C_FILE>): Only swap in extended
1014 file name from auxents for PE.
1015
1016 2020-05-04 Gunther Nikl <gnikl@justmail.de>
1017
1018 * aout-cris.c (DEFAULT_ARCH): Delete define.
1019 (MY_set_arch_mach): Likewise.
1020 (SET_ARCH_MACH): Use bfd_set_arch_mach with an explicit architecture
1021 of bfd_arch_cris.
1022 (swap_ext_reloc_in): Add casts to r_index extraction. Mask valid bits
1023 of r_type before the shift.
1024
1025 2020-05-04 Wilco Dijkstra <wdijkstr@arm.com>
1026
1027 PR ld/25665
1028 * elfnn-aarch64.c (group_sections): Copy implementation from
1029 elf32-arm.c.
1030
1031 2020-05-01 Alan Modra <amodra@gmail.com>
1032
1033 PR 25900
1034 * elfnn-riscv.c (_bfd_riscv_relax_section): Check root.type before
1035 accessing root.u.def of symbols. Also check root.u.def.section
1036 is non-NULL. Reverse tests so as to make the logic positive.
1037
1038 2020-05-01 Alan Modra <amodra@gmail.com>
1039
1040 PR 25882
1041 * elf32-tic6x.c (elf32_tic6x_merge_attributes): Don't transfer
1042 Tag_ABI_PIC or Tag_ABI_PID from dynamic objects to the output.
1043
1044 2020-05-01 Alan Modra <amodra@gmail.com>
1045
1046 PR 25882
1047 * elf32-bfin.c (elf32_bfin_merge_private_bfd_data): Add FIXME.
1048 * elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
1049 * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Likewise.
1050 * elf32-nds32.c (nds32_elf_merge_private_bfd_data): Likewise.
1051 * elf32-score.c (s3_elf32_score_merge_private_bfd_data): Likewise.
1052 * elf32-score7.c (s7_elf32_score_merge_private_bfd_data): Likewise.
1053 * elf32-sh.c (sh_elf_merge_private_data): Likewise.
1054 * elf32-tic6x.c (elf32_tic6x_merge_attributes): Likewise.
1055 * elf64-ia64-vms.c (elf64_ia64_merge_private_bfd_data): Likewise.
1056 * elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): Likewise.
1057
1058 2020-05-01 Alan Modra <amodra@gmail.com>
1059
1060 PR 25882
1061 * elf32-ppc.c (ppc_elf_merge_private_bfd_data): Ignore e_flags
1062 from shared libraries.
1063
1064 2020-04-29 Max Filippov <jcmvbkbc@gmail.com>
1065
1066 * elf32-xtensa.c (relax_section): Don't negate diff_value for
1067 XTENSA_NDIFF relocations. Don't add sign bits whe diff_value
1068 equals 0. Report overflow when the result has negative sign but
1069 all significant bits are zero.
1070
1071 2020-04-29 Gunther Nikl <gnikl@justmail.de>
1072
1073 * aoutx.h (swap_std_reloc_out): Special case 64 bit relocations.
1074 (aout_link_reloc_link_order): Likewise. Make r_length an unsigned.
1075
1076 2020-04-28 Alan Modra <amodra@gmail.com>
1077
1078 * vms-alpha.c (_bfd_vms_slurp_etir): Correct divide by zero check.
1079 Emit warning message.
1080
1081 2020-04-27 Tamar Christina <tamar.christina@arm.com>
1082
1083 * coff-i386.c (COFF_WITH_PE_BIGOBJ): New.
1084 * coff-x86_64.c (COFF_WITH_PE_BIGOBJ): New.
1085 * config.bfd (targ_selvecs): Rename x86_64_pe_be_vec
1086 to x86_64_pe_big_vec as it not a big-endian format.
1087 (vec i386_pe_big_vec): New.
1088 * configure.ac: Likewise.
1089 * targets.c: Likewise.
1090 * configure: Regenerate.
1091 * pe-i386.c (TARGET_SYM_BIG, TARGET_NAME_BIG,
1092 COFF_WITH_PE_BIGOBJ): New.
1093 * pe-x86_64.c (TARGET_SYM_BIG, TARGET_NAME_BIG):
1094 New.
1095 (x86_64_pe_be_vec): Moved.
1096
1097 2020-04-23 Anton Kolesov <anton.kolesov@synopsys.com>
1098
1099 * elf-bfd.h (elfcore_write_arc_v2): Add prototype.
1100 * elf.c (elfcore_grok_arc_v2): New function.
1101 (elfcore_grok_note): Call the new function to handle the corresponding
1102 note.
1103 (elfcore_write_arc_v2): New function.
1104 (elfcore_write_register_note): Call the new function to handle the
1105 corresponding pseudo-sections.
1106
1107 2020-04-22 Max Filippov <jcmvbkbc@gmail.com>
1108
1109 PR ld/25861
1110 * bfd-in2.h: Regenerated.
1111 * elf32-xtensa.c (elf_howto_table): New entries for
1112 R_XTENSA_PDIFF{8,16,32} and R_XTENSA_NDIFF{8,16,32}.
1113 (elf_xtensa_reloc_type_lookup, elf_xtensa_do_reloc)
1114 (relax_section): Add cases for R_XTENSA_PDIFF{8,16,32} and
1115 R_XTENSA_NDIFF{8,16,32}.
1116 * libbfd.h (bfd_reloc_code_real_names): Add names for
1117 BFD_RELOC_XTENSA_PDIFF{8,16,32} and
1118 BFD_RELOC_XTENSA_NDIFF{8,16,32}.
1119 * reloc.c: Add documentation for BFD_RELOC_XTENSA_PDIFF{8,16,32}
1120 and BFD_RELOC_XTENSA_NDIFF{8,16,32}.
1121
1122 2020-04-21 Tamar Christina <tamar.christina@arm.com>
1123
1124 PR binutils/24753
1125 * compress.c (bfd_get_full_section_contents): Exclude sections with no
1126 content.
1127
1128 2020-04-21 H.J. Lu <hongjiu.lu@intel.com>
1129
1130 PR ld/25849
1131 * elf-bfd.h (elf_backend_data): Add
1132 elf_backend_strip_zero_sized_dynamic_sections.
1133 (_bfd_elf_strip_zero_sized_dynamic_sections): New prototype.
1134 * elf64-alpha.c (elf_backend_strip_zero_sized_dynamic_sections):
1135 New macro.
1136 * elflink.c (_bfd_elf_strip_zero_sized_dynamic_sections): New
1137 function.
1138 * elfxx-target.h (elf_backend_strip_zero_sized_dynamic_sections):
1139 New macro.
1140 (elfNN_bed): Add elf_backend_strip_zero_sized_dynamic_sections.
1141
1142 2020-04-21 H.J. Lu <hongjiu.lu@intel.com>
1143
1144 * elf64-alpha.c (alpha_elf_reloc_entry): Replace reltext with
1145 sec.
1146 (elf64_alpha_check_relocs): Set sec instead of reltext. Warn
1147 DT_TEXTREL with -M.
1148 (elf64_alpha_calc_dynrel_sizes): Warn DT_TEXTREL with -M.
1149
1150 2020-04-21 Nick Clifton <nickc@redhat.com>
1151
1152 * po/sr.po: Updated Serbian translation.
1153
1154 2020-04-21 Alan Modra <amodra@gmail.com>
1155
1156 * elf32-sh.c (sh_elf_relocate_section): Remove STO_SH5_ISA32
1157 processing.
1158
1159 2020-04-20 Stephen Casner <casner@acm.org>
1160
1161 * pdp11.c (N_STAB): Modify value to avoid conflict with N_EXT
1162 causing globals from linker script to be treated as debug symbols.
1163 (translate_symbol_table): Don't sign-extend symbol values from 16
1164 to 64 bits in nm output.
1165
1166 2020-04-20 Alan Modra <amodra@gmail.com>
1167
1168 * elf64-ppc.c (ppc64_elf_size_stubs): Strip relbrlt too.
1169
1170 2020-04-18 Alan Modra <amodra@gmail.com>
1171
1172 * section.c (bfd_is_const_section): Correct test for special
1173 sections.
1174 * bfd-in2.h: Regenerate.
1175
1176 2020-04-17 Alan Modra <amodra@gmail.com>
1177
1178 PR 25842
1179 * elf.c (_bfd_elf_get_symbol_version_string): Don't segfault on
1180 NULL nodename.
1181
1182 2020-04-16 Nick Clifton <nickc@redhat.com>
1183
1184 PR 25803
1185 * elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Replace an
1186 abort with a more helpful error message.
1187
1188 2020-04-16 Alan Modra <amodra@gmail.com>
1189
1190 PR 25827
1191 * dwarf2.c (scan_unit_for_symbols): Wrap overlong lines. Don't
1192 strdup(0).
1193
1194 2020-04-15 Fangrui Song <maskray@google.com>
1195
1196 PR binutils/24613
1197 * coff-rs6000.c (xcoff_ppc_relocate_section): Change RM_GENERATE_ERROR
1198 to RM_DIAGNOSE plus a check of warn_unresolved_syms.
1199 * coff64-rs6000.c (xcoff_ppc_relocate_section): Likewise.
1200 * elf-bfd.h (_bfd_elf_large_com_section): Likewise.
1201 * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
1202 * elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise.
1203 * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
1204 * elf32-sh.c (sh_elf_relocate_section): Likewise.
1205 * elf32-spu.c (spu_elf_relocate_section): Likewise.
1206 * elf64-hppa.c (elf64_hppa_relocate_section): Likewise.
1207 * elflink.c (elf_link_output_extsym): Likewise.
1208 * elfxx-mips.c (mips_elf_calculate_relocation): Likewise.
1209
1210 2020-04-15 Alan Modra <amodra@gmail.com>
1211
1212 PR 25823
1213 * peXXigen.c (_bfd_XXi_swap_sym_in <C_SECTION>): Don't use a
1214 pointer into strings that may be freed for section name, always
1215 allocate a new string.
1216
1217 2020-04-14 Juan Manuel Guerrero <juan.guerrero@gmx.de>
1218 Jan W. Jagersma <jwjagersma@gmail.com>
1219
1220 * coff-go32.c (COFF_GO32, IMAGE_SCN_LNK_NRELOC_OVFL)
1221 (coff_SWAP_scnhdr_in, coff_SWAP_scnhdr_out): Define.
1222 (_bfd_go32_swap_scnhdr_in, _bfd_go32_swap_scnhdr_out)
1223 (_bfd_go32_mkobject): New functions.
1224 * coff-stgo32.c (IMAGE_SCN_LNK_NRELOC_OVFL)
1225 (coff_SWAP_scnhdr_in, coff_SWAP_scnhdr_out): Define.
1226 (go32exe_mkobject): Call _bfd_go32_mkobject.
1227 * coffcode.h (COFF_WITH_EXTENDED_RELOC_COUNTER): Define.
1228 (coff_set_alignment_hook): Define function for COFF_GO32_EXE
1229 and COFF_GO32.
1230 (coff_write_relocs): Enable extended reloc counter code if
1231 COFF_WITH_EXTENDED_RELOC_COUNTER is defined. Test for obj_go32.
1232 (coff_write_object_contents): Likewise. Pad section headers
1233 for COFF_GO32 and COFF_GO32EXE. Use bfd_coff_swap_scnhdr_out
1234 instead of coff_swap_scnhdr_out.
1235 * cofflink.c (_bfd_coff_final_link): Test also for obj_go32 to
1236 enable extended reloc counter.
1237 * coffswap.h: (coff_swap_scnhdr_in, coff_swap_scnhdr_out):
1238 Declare with ATTRIBUTE_UNUSED.
1239 * libcoff-in.h: (struct coff_tdata): New field go32.
1240 (obj_go32): Define.
1241 * libcoff.h: Regenerate.
1242
1243 2020-04-14 Fangrui Song <maskray@google.com>
1244
1245 PR gas/25768
1246 * elf.c (assign_section_numbers): Always set .stab sh_entsize to
1247 12.
1248
1249 2020-04-14 Stephen Casner <casner@acm.org>
1250
1251 PR ld/25677
1252 * pdp11.c: Add implementation of --imagic option.
1253 (adjust_o_magic): Fix objcopy --extract-symbol test.
1254 * libaout.h (enum aout_magic): Add i_magic.
1255
1256 2020-04-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
1257 Nick Clifton <nickc@redhat.com>
1258
1259 * elf32-sparc.c (sparc_final_write_processing): Fix whitespace.
1260 <0>: Ignore.
1261 <default>: Error rather than abort.
1262
1263 2020-04-03 H.J. Lu <hongjiu.lu@intel.com>
1264
1265 PR ld/25767
1266 * elf.c (_bfd_elf_fixup_group_sections): Remove zero-sized
1267 relocation section from section group.
1268
1269 2020-04-02 Jan W. Jagersma <jwjagersma@gmail.com>
1270
1271 * bfdio.c (bfd_bread, bfd_tell, bfd_seek, bfd_mmap): Always add
1272 bfd->origin to file offset.
1273 * bfdwin.c (bfd_get_file_window): Likewise.
1274 * bfd.c: Clarify the use of the bfd->origin field.
1275 * bfd-in2.h: Regenerate.
1276 * coff-i386.c: Don't include go32exe.h. Allow overriding
1277 coff_write_object_contents via COFF_WRITE_CONTENTS.
1278 * coff-stgo32.c (go32exe_cleanup, go32exe_mkobject)
1279 (go32exe_write_object_contents): New functions.
1280 (go32exe_temp_stub, go32exe_temp_stub_size): New static globals.
1281 (COFF_WRITE_CONTENTS, GO32EXE_DEFAULT_STUB_SIZE): Define.
1282 (create_go32_stub): Remove check for 2k size limit. Read stub
1283 from go32exe_temp_stub if present.
1284 (go32_stubbed_coff_bfd_copy_private_bfd_data): Allocate and
1285 copy variable-length stub.
1286 (go32_check_format): Read stub to go32exe_temp_stub, set
1287 origin, return go32exe_cleanup.
1288 (adjust_filehdr_in_post, adjust_filehdr_out_pre)
1289 (adjust_filehdr_out_post, adjust_scnhdr_in_post)
1290 (adjust_scnhdr_out_pre, adjust_scnhdr_out_post)
1291 (adjust_aux_in_post, adjust_aux_out_pre, adjust_aux_out_post):
1292 Remove functions and their associated #defines.
1293 * coffcode.h (coff_mkobject_hook): Remove stub copying code.
1294 * libcoff-in.h: (struct coff_tdata): New field stub_size.
1295 Rename field go32stub to stub.
1296 * libcoff.h: Regenerate.
1297 * coff-stgo32.c (go32_check_format): Rename to...
1298 (go32exe_check_format): ...this.
1299 (go32_stubbed_coff_bfd_copy_private_bfd_data): Rename to...
1300 (go32exe_copy_private_bfd_data): ...this.
1301 (stub_bytes): Rename to...
1302 (go32exe_default_stub): ...this.
1303 (create_go32_stub): Rename to...
1304 (go32exe_create_stub): ...this.
1305 * coff-stgo32.c (go32exe_copy_private_bfd_data): Avoid realloc
1306 when possible.
1307
1308 2020-04-01 H.J. Lu <hongjiu.lu@intel.com>
1309
1310 PR ld/25749
1311 PR ld/25754
1312 * elf32-i386.c (elf_i386_convert_load_reloc): Convert load
1313 relocation to R_386_32 for relocation against non-preemptible
1314 absolute symbol.
1315 (elf_i386_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Don't
1316 allocate dynamic relocation for non-preemptible absolute symbol.
1317 (elf_i386_relocate_section): Pass sec to
1318 GENERATE_DYNAMIC_RELOCATION_P.
1319 * elf64-x86-64.c (R_X86_64_converted_reloc_bit): Moved.
1320 (elf_x86_64_convert_load_reloc): Covert load relocation to
1321 R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible
1322 absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32
1323 for non-preemptible absolute symbol if they overflow.
1324 (elf_x86_64_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Set
1325 tls_type for GOT slot to GOT_ABS for non-preemptible absolute
1326 symbol. Don't allocate dynamic relocation for non-preemptible
1327 absolute symbol.
1328 (elf_x86_64_relocate_section): Don't generate relative relocation
1329 for GOTPCREL relocations aganst local absolute symbol. Pass sec
1330 to GENERATE_DYNAMIC_RELOCATION_P.
1331 * elfxx-x86.c (elf_x86_allocate_dynrelocs): No dynamic relocation
1332 against non-preemptible absolute symbol.
1333 (_bfd_elf_x86_valid_reloc_p): New function.
1334 (_bfd_x86_elf_size_dynamic_sections): No dynamic relocation for
1335 GOT_ABS GOT slot.
1336 * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Add an SEC
1337 argument. Don't generate dynamic relocation against
1338 non-preemptible absolute symbol.
1339 (ABS_SYMBOL_P): New.
1340 (GENERATE_RELATIVE_RELOC_P): Don't generate relative relocation
1341 against non-preemptible absolute symbol.
1342 (GOT_ABS): New.
1343 (R_X86_64_converted_reloc_bit): New. Moved from elf64-x86-64.c.
1344 (_bfd_elf_x86_valid_reloc_p): New.
1345
1346 2020-04-01 Tamar Christina <tamar.christina@arm.com>
1347
1348 PR ld/16017
1349 * elf32-arm.c (elf32_arm_populate_plt_entry): Set LSB of the PLT0
1350 address in the GOT if in thumb only mode.
1351
1352 2020-04-01 Tamar Christina <tamar.christina@arm.com>
1353
1354 * elf32-arm.c (elf32_thumb2_plt_entry): Fix PC-rel offset.
1355
1356 2020-04-01 Hans-Peter Nilsson <hp@bitrange.com>
1357
1358 * mmo.c (mmo_scan): Create .text section only when needed, not
1359 from the start.
1360
1361 2020-03-31 Alan Modra <amodra@gmail.com>
1362
1363 * coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Correct bfd_bread
1364 return value check.
1365
1366 2020-03-31 Alan Modra <amodra@gmail.com>
1367
1368 * vms-alpha.c (image_write): Check bounds for sections without
1369 contents too. Error on non-zero write to section without
1370 contents.
1371 (_bfd_vms_slurp_etir): Check return of image_write* functions.
1372
1373 2020-03-31 Alan Modra <amodra@gmail.com>
1374
1375 * tekhex.c (pass_over): Check is_eof before reading buffer.
1376
1377 2020-03-30 Nick Clifton <nickc@redhat.com>
1378
1379 PR binutils/pr25662
1380 * libcoff-in.h (struct pe_tdata): Rename the insert_timestamp
1381 field to timestamp and make it an integer.
1382 * libcoff.h: Regenerate.
1383 * peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Test the timestamp
1384 field in the pe_data structure rather than the insert_timestamp
1385 field.
1386
1387 2020-03-30 Alan Modra <amodra@gmail.com>
1388
1389 PR 25745
1390 * elf64-ppc.c (ppc64_elf_build_stubs): Use asprintf to form
1391 statistics message.
1392
1393 2020-03-26 Nick Clifton <nickc@redhat.com>
1394
1395 * cofflink.c (bfd_coff_get_internal_extra_pe_aouthdr): Delete.
1396 * libbfd-in.h (bfd_coff_get_internal_extra_pe_aouthdr): Remove
1397 prototype.
1398 * libbfd.h: Regenerate.
1399
1400 2020-03-26 Alan Modra <amodra@gmail.com>
1401
1402 * i386msdos.c (msdos_object_p): Catch -1 return from bfd_bread.
1403
1404 2020-03-26 Alan Modra <amodra@gmail.com>
1405
1406 * vms-alpha.c (dst_define_location): Limit size of dst_ptr_offsets
1407 array.
1408 (_bfd_vms_slurp_object_records): Rename "err" to "ok".
1409
1410 2020-03-25 Nick Clifton <nickc@redhat.com>
1411
1412 * cofflink.c (bfd_coff_get_internal_extra_pe_aouthdr): New
1413 function.
1414 * libbfd-in.h (bfd_coff_get_internal_extra_pe_aouthdr): Prototype.
1415 * libbfd.h: Regenerate.
1416
1417 2020-03-25 Shahab Vahedi <shahab@synopsys.com>
1418
1419 * elf32-arc.c (PRINT_DEBUG_RELOC_INFO_BEFORE): Use the
1420 correct field name in the output string.
1421
1422 2020-03-25 Alan Modra <amodra@gmail.com>
1423
1424 PR 25662
1425 * elf.c (assign_file_positions_for_load_sections): Adjust offset
1426 for SHT_NOBITS section if first in segment.
1427
1428 2020-03-24 H.J. Lu <hongjiu.lu@intel.com>
1429
1430 PR binutils/25708
1431 * elf-bfd.h (_bfd_elf_get_symbol_version_name): Renamed to ...
1432 (_bfd_elf_get_symbol_version_string): This.
1433 * elf.c (_bfd_elf_get_symbol_version_name): Renamed to ...
1434 (_bfd_elf_get_symbol_version_string): This.
1435 (bfd_elf_print_symbol): Pass TRUE to
1436 _bfd_elf_get_symbol_version_string.
1437 * libbfd-in.h (_bfd_nosymbols_get_symbol_version_string): Add a
1438 bfd_boolean argument.
1439 * syms.c (_bfd_nosymbols_get_symbol_version_string): Likewise.
1440 * targets.c (_bfd_get_symbol_version_string): Likewise.
1441 (bfd_get_symbol_version_string): Likewise.
1442 * bfd-in2.h: Regenerated.
1443
1444 2020-03-24 Nick Clifton <nickc@redhat.com>
1445 Jaydeep Chauhan <jaydeepchauhan1494@gmail.com>
1446
1447 PR 25713
1448 * bfdio.c (_bfd_real_fopen): Add code to handle long filenames on
1449 Win32 systems.
1450
1451 2020-03-24 Nick Clifton <nickc@redhat.com>
1452
1453 PR 25681
1454 * elf.c (_bfd_elf_map_sections_to_segments): When looking for a
1455 segment to use for PT_GNU_RELRO, ignore empty sections in a
1456 segment's current list.
1457
1458 2020-03-24 H.J. Lu <hongjiu.lu@intel.com>
1459
1460 PR binutils/25717
1461 * elf-bfd.h (elf_obj_tdata): Change num_group to unsigned int.
1462
1463 2020-03-24 H.J. Lu <hongjiu.lu@intel.com>
1464
1465 PR binutils/25708
1466 * elf-bfd.h (_bfd_elf_get_symbol_version_name): New.
1467 * elf.c (_bfd_elf_get_symbol_version_name): New function. Based
1468 on the previous _bfd_elf_get_symbol_version_string.
1469 (_bfd_elf_get_symbol_version_string): Use it.
1470
1471 2020-03-24 Alan Modra <amodra@gmail.com>
1472
1473 * archive.c (_bfd_generic_read_ar_hdr_mag): Sanity check extended
1474 name size. Use bfd_malloc rather than bfd_zmalloc, clearing just
1475 struct areltdata.
1476
1477 2020-03-23 Sebastian Huber <sebastian.huber@embedded-brains.de>
1478
1479 * elflink.c (_bfd_elf_tls_setup): Mention .tdata in comment.
1480
1481 2020-03-23 Alan Modra <amodra@gmail.com>
1482
1483 * ecoff.c (_bfd_ecoff_slurp_armap): Sanity check parsed_size and
1484 symbol count. Allocate an extra byte to ensure name strings
1485 are terminated. Sanity check name offsets. Release memory on
1486 error return.
1487
1488 2020-03-23 Alan Modra <amodra@gmail.com>
1489
1490 * i386msdos.c (msdos_object_p): Don't access e_lfanew when that
1491 field hasn't been read. Remove unnecessary casts.
1492
1493 2020-03-22 Alan Modra <amodra@gmail.com>
1494
1495 * coff64-rs6000.c (xcoff64_slurp_armap): Ensure size is large
1496 enough to read number of symbols.
1497
1498 2020-03-20 H.J. Lu <hongjiu.lu@intel.com>
1499
1500 * configure.ac (HAVE_EXECUTABLE_SUFFIX): Removed.
1501 (EXECUTABLE_SUFFIX): Likewise.
1502 * config.in: Regenerated.
1503 * configure: Likewise.
1504 * plugin.c (bfd_plugin_close_and_cleanup): Defined as
1505 _bfd_generic_close_and_cleanup.
1506 (plugin_list_entry): Remove resolution_file, resolution_option,
1507 real_bfd, real_nsyms, real_syms, lto_nsyms, lto_syms, gcc,
1508 lto_wrapper, gcc_env and initialized,
1509 (need_lto_wrapper_p): Removed.
1510 (get_lto_wrapper): Likewise.
1511 (setup_lto_wrapper_env): Likewise.
1512 (register_all_symbols_read): Likewise.
1513 (egister_cleanup): Likewise.
1514 (get_symbols): Likewise.
1515 (add_input_file): Likewise.
1516 (bfd_plugin_set_program_name): Remove need_lto_wrapper.
1517 (add_symbols): Updated.
1518 (try_claim): Likewise.
1519 (try_load_plugin): Likewise.
1520 (bfd_plugin_canonicalize_symtab): Likewise.
1521 * plugin.h (bfd_plugin_set_program_name): Remove int argument.
1522 (plugin_data_struct): Remove real_bfd, real_nsyms and real_syms.
1523
1524 2020-03-19 H.J. Lu <hongjiu.lu@intel.com>
1525
1526 PR binutils/25640
1527 * plugin.c (plugin_list_entry): Add has_symbol_type.
1528 (add_symbols_v2): New function.
1529 (bfd_plugin_open_input): Don't invoke LTO wrapper if LTO plugin
1530 provides symbol type.
1531 (try_load_plugin): Add LDPT_ADD_SYMBOLS_V2.
1532 (bfd_plugin_canonicalize_symtab): Use LTO plugin symbol type if
1533 available.
1534
1535 2020-03-20 Alan Modra <amodra@gmail.com>
1536
1537 * coff-rs6000.c (_bfd_xcoff_slurp_armap): Ensure size is large
1538 enough to read number of symbols.
1539
1540 2020-03-20 Alan Modra <amodra@gmail.com>
1541
1542 * elf.c (_bfd_elf_setup_sections): Don't test known non-NULL
1543 backend functions for NULL before calling.
1544 (copy_special_section_fields, _bfd_elf_copy_private_bfd_data),
1545 (bfd_section_from_shdr, assign_section_numbers): Likewise.
1546 * elfcode.h (elf_write_relocs, elf_slurp_reloc_table): Likewise.
1547 * elfnn-ia64.c (ignore_errors): New function.
1548 (elf_backend_link_order_error_handler): Redefine as ignore_errors.
1549
1550 2020-03-19 Nick Clifton <nickc@redhat.com>
1551
1552 PR 25676
1553 * dwarf2.c (struct varinfo): Add unit_offset field to record the
1554 location of the varinfo in the unit's debug info data. Change the
1555 type of the stack field to a boolean.
1556 (lookup_var_by_offset): New function. Returns the varinfo
1557 structure for the variable described at the given offset in the
1558 unit's debug info.
1559 (scan_unit_for_symbols): Add support for variables which have the
1560 DW_AT_specification attribute.
1561
1562 2020-03-19 Nick Clifton <nickc@redhat.com>
1563
1564 PR 25699
1565 * elf.c (bfd_elf_set_group_contents): Replace assertion with an
1566 error return.
1567
1568 2020-03-19 Sebastian Huber <sebastian.huber@embedded-brains.de>
1569
1570 * elfxx-riscv.c (riscv_parse_subset): Don't use C99.
1571
1572 2020-03-18 Nick Clifton <nickc@redhat.com>
1573
1574 PR 25673
1575 * elf.c (_bfd_elf_write_secondary_reloc_section): Fix illegal
1576 memory access when processing a corrupt secondary reloc section.
1577
1578 2020-03-18 Christophe Lyon <christophe.lyon@linaro.org>
1579
1580 * elf32-arm.c (arm_build_one_stub): Emit a fatal error message
1581 instead of calling abort.
1582 * elf32-csky.c (csky_build_one_stub): Likewise.
1583 * elf32-hppa.c (hppa_build_one_stub): Likewise.
1584 * elf32-m68hc11.c (m68hc11_elf_build_one_stub): Likewise.
1585 * elf32-m68hc12.c (m68hc12_elf_build_one_stub): Likewise.
1586 * elf32-metag.c (metag_build_one_stub): Likewise.
1587 * elf32-nios2.c (nios2_build_one_stub): Likewise.
1588 * elf64-ppc.c (ppc_build_one_stub): Likewise.
1589 (ppc_size_one_stub): Likewise.
1590 * elfnn-aarch64.c (aarch64_build_one_stub): Likewise.
1591
1592 2020-03-17 Nick Clifton <nickc@redhat.com>
1593
1594 PR 25688
1595 * elf.c (_bfd_elf_copy_special_section_fields): Replace assertions
1596 with error messages.
1597
1598 2020-03-17 Nick Clifton <nickc@redhat.com>
1599
1600 PR 25687
1601 * elf.c (_bfd_elf_slurp_secondary_reloc_section): Remove redundant
1602 free. Add free on another failure path.
1603
1604 2020-03-16 Alan Modra <amodra@gmail.com>
1605
1606 PR 25675
1607 * elf.c (elf_sort_segments): Don't call bfd_octets_per_byte unless
1608 we have a non-zero section count. Do lma comparison in octets.
1609
1610 2020-03-16 Alan Modra <amodra@gmail.com>
1611
1612 * vms-alpha.c (dst_restore_location): Validate index into
1613 dst_ptr_offsets array before accessing. Return status.
1614 (dst_retrieve_location): Similarly, making "loc" parameter a
1615 pointer to return value.
1616 (_bfd_vms_slurp_etir): Update calls to above functions.
1617
1618 2020-03-14 Kamil Rytarowski <n54@gmx.com>
1619
1620 * configure.ac: Include netbsd-core.lo for all NetBSD arm and mips
1621 targets.
1622 * configure: Regenerated.
1623
1624 2020-03-14 Alan Modra <amodra@gmail.com>
1625
1626 * section.c (BFD_FAKE_SECTIONS): Formatting.
1627 * bfd-in2.h: Regenerate.
1628
1629 2020-03-13 Kamil Rytarowski <n54@gmx.com>
1630
1631 * elf.c (elfcore_grok_netbsd_note): Add support for
1632 NT_NETBSDCORE_LWPSTATUS notes.
1633
1634 2020-03-13 Christophe Lyon <christophe.lyon@linaro.org>
1635
1636 * bfd-in2.h: Regenerate.
1637 * section.c (asection): Add already_assigned field.
1638 (BFD_FAKE_SECTION): Add default initializer for it.
1639 * ecoff.c (bfd_debug_section): Initialize already_assigned field.
1640 * elf32-arm.c (arm_build_one_stub): Add support for
1641 non_contiguous_regions.
1642 * elf32-csky.c (csky_build_one_stub): Likewise.
1643 * elf32-hppa.c (hppa_build_one_stub): Likewise.
1644 * elf32-m68hc11.c (m68hc11_elf_build_one_stub): Likewise.
1645 * elf32-m68hc12.c (m68hc12_elf_build_one_stub): Likewise.
1646 * elf32-metag.c (metag_build_one_stub): Likewise.
1647 * elf32-nios2.c (nios2_build_one_stub): Likewise.
1648 * elf64-ppc.c (ppc_build_one_stub): Likewise.
1649 (ppc_size_one_stub): Likewise.
1650 * elfnn-aarch64.c (aarch64_build_one_stub): Likewise.
1651 * elflink.c (elf_link_input_bfd): Likewise.
1652
1653 2020-03-13 H.J. Lu <hongjiu.lu@intel.com>
1654
1655 PR ld/24920
1656 * elf-linker-x86.h (elf_linker_x86_params): Add
1657 static_before_all_inputs and has_dynamic_linker.
1658 * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Report
1659 dynamic input objects if -static is passed at command-line
1660 before all input files without --dynamic-linker unless
1661 --no-dynamic-linker is used.
1662
1663 2020-03-13 Kamil Rytarowski <n54@gmx.com>
1664
1665 * elf.c (elfcore_grok_netbsd_note): Add support for aarch64.
1666
1667 2020-03-13 Christian Eggers <ceggers@gmx.de>
1668
1669 * bfd.c (bfd_record_phdr): New local "opb". Fix assignment of
1670 "p_paddr" from "at".
1671 * elfcode.h (bfd_from_remote_memory): Add units to several
1672 parameters. New local "opb". Fix usage of p_align. Fix
1673 calculation of "localbase" from "ehdr_vma" and "p_vaddr". Fix
1674 call of target_read_memory.
1675 * elflink.c (elf_fixup_link_order): Fix scope of "s" local. Fix
1676 calculation of "offset" and "output_offset".
1677 (bfd_elf_final_link): New local "opb". Fix calculation of "size"
1678 from "offset" and fix calculation of "end" from "vma+size". Fix
1679 comparison between "sh_addr" and "vma"/"output_offset".
1680 (bfd_elf_discard_info): Fix calculation of "eh_alignment".
1681 * elf-bfd.h (struct elf_link_hash_table): Add unit to tls_size
1682 member.
1683 * elf.c (_bfd_elf_map_sections_to_segments): Add unit (bytes/
1684 octets) to "wrap_to2 and "phdr_size" locals. Fix calculation of
1685 "wrap_to" value. Add unit (bytes) to phdr_lma variable. Fix
1686 assignment of p_paddr from phdr_lma. Fix comparison between
1687 "lma+size" and "next->lma".
1688 (elf_sort_segments): Fix assignment from p_paddr to lma.
1689 (assign_file_positions_for_load_sections): Add unit (bytes) to
1690 local "align". Fix calculation of local "off_adjust". Fix
1691 calculation of local "filehdr_vaddr".
1692 (assign_file_positions_for_non_load_sections): New local "opb".
1693 Fix calculation of "end" from "p_size". Fix comparison between
1694 "vma+SECTION_SIZE" and "start". Fix calculation of "p_memsz"
1695 from "end" and "p_vaddr".
1696 (rewrite_elf_program_header): Fix comparison between p_vaddr and
1697 vma. Fix assignment to p_paddr from lma. Fix comparison between
1698 p_paddr and lma. Fix assignment to p_paddr from lma.
1699 * merge.c (sec_merge_emit): New local "opb". Convert
1700 "alignment_power" to octets.
1701 (_bfd_add_merge_section): New locals "alignment_power" and
1702 "opb". Fix comparison between "alignment_power" and
1703 "sizeof(align)".
1704 (_bfd_merge_sections): New local "opb". Divide size by opb
1705 before checking align mask.
1706
1707 2020-03-13 Christian Eggers <ceggers@gmx.de>
1708
1709 * elf.c (_bfd_elf_make_section_from_shdr): Introduce new temp
1710 opb. Divide Elf_Internal_Shdr::sh_addr by opb when setting
1711 section LMA/VMA.
1712 (_bfd_elf_make_section_from_phdr): Similarly.
1713 (elf_fake_sections): Fix calculation of
1714 Elf_Internal_shdr::sh_addr from section VMA.
1715 (_bfd_elf_map_sections_to_segments): Fix mixup between octets
1716 and bytes.
1717 (assign_file_positions_for_load_sections): Fix calculations of
1718 Elf_Internal_shdr::p_vaddr and p_paddr from section LMA/VMA. Fix
1719 comparison between program header address and section LMA.
1720 (assign_file_positions_for_non_load_sections): Likewise.
1721 (rewrite_elf_program_header): Likewise. Introduce new temp opb.
1722 (IS_CONTAINED_BY_VMA): Add parameter opb.
1723 (IS_CONTAINED_BY_LMA,IS_SECTION_IN_INPUT_SEGMENT,
1724 INCLUDE_SECTION_IN_SEGMENT): Likewise.
1725 (copy_elf_program_header): Update call to ELF_SECTION_IN_SEGMENT.
1726 Fix calculations of p_addr_valid and p_vaddr_offset.
1727 * elflink.c (elf_link_add_object_symbols): Multiply section VMA
1728 with octets per byte when comparing against p_vaddr.
1729
1730 2020-03-11 Alan Modra <amodra@gmail.com>
1731
1732 * som.c (setup_sections): Sanity check subspace.name.
1733
1734 2020-03-11 Alan Modra <amodra@gmail.com>
1735
1736 * elf64-ppc.c (ppc64_elf_inline_plt): Do increment rel in for loop.
1737
1738 2020-03-10 Alan Modra <amodra@gmail.com>
1739
1740 PR 25648
1741 * ihex.c (ihex_write_object_contents): Don't assume ordering of
1742 addresses here.
1743
1744 2020-03-09 Alan Modra <amodra@gmail.com>
1745
1746 * wasm-module.c (wasm_scan): Sanity check file name length
1747 before allocating memory. Move common section setup code. Do
1748 without bfd_tell to calculate section size.
1749
1750 2020-03-06 Nick Clifton <nickc@redhat.com>
1751
1752 * elf.c (_bfd_elf_set_section_contents): Replace call to abort
1753 with error messages and failure return values.
1754
1755 2020-03-05 Max Filippov <jcmvbkbc@gmail.com>
1756
1757 * elf32-xtensa.c (shrink_dynamic_reloc_sections): Shrink dynamic
1758 relocation sections for any removed reference to a dynamic symbol.
1759
1760 2020-03-05 Nick Clifton <nickc@redhat.com>
1761
1762 * elf-bfd.h (struct elf_backend_data): Add new fields:
1763 init_secondary_reloc_section, slurp_secondary_reloc_section,
1764 write_secondary_reloc_section.
1765 (_bfd_elf_init_secondary_reloc_section): Prototype.
1766 (_bfd_elf_slurp_secondary_reloc_section): Prototype.
1767 (_bfd_elf_write_secondary_reloc_section): Prototype.
1768 * elf.c ( bfd_section_from_shdr): Invoke the new
1769 init_secondary_reloc_section backend function, if defined, when a
1770 second reloc section is encountered.
1771 (swap_out_syms): Invoke the new symbol_section_index function, if
1772 defined, when computing the section index of an OS/PROC specific
1773 symbol.
1774 (_bfd_elf_init_secondary_reloc_section): New function.
1775 (_bfd_elf_slurp_secondary_reloc_section): New function.
1776 (_bfd_elf_write_secondary_reloc_section): New function.
1777 (_bfd_elf_copy_special_section_fields): New function.
1778 * elfcode.h (elf_write_relocs): Invoke the new
1779 write_secondary_relocs function, if defined, in order to emit
1780 secondary relocs.
1781 (elf_slurp_reloc_table): Invoke the new slurp_secondary_relocs
1782 function, if defined, in order to read in secondary relocs.
1783 * elfxx-target.h (elf_backend_copy_special_section_fields):
1784 Provide a non-NULL default definition.
1785 (elf_backend_init_secondary_reloc_section): Likewise.
1786 (elf_backend_slurp_secondary_reloc_section): Likewise.
1787 (elf_backend_write_secondary_reloc_section): Likewise.
1788 (struct elf_backend_data elfNN_bed): Add initialisers for the new
1789 fields.
1790 * configure.ac (score_elf32_[bl]e_vec): Add elf64.lo
1791 * configure: Regenerate.
1792
1793 2020-03-05 Alan Modra <amodra@gmail.com>
1794
1795 * archive64.c (_bfd_archive_64_bit_slurp_armap): Check parsed_size
1796 against file size before allocating memory. Use bfd_alloc rather
1797 than bfd_zalloc for carsym/strings memory.
1798
1799 2020-03-04 Alan Modra <amodra@gmail.com>
1800
1801 * elf.c (elf_fake_sections): Ensure sh_addralign is such that
1802 sh_addr mod sh_addalign is zero.
1803
1804 2020-03-04 Alan Modra <amodra@gmail.com>
1805
1806 * format.c (bfd_check_format_matches): Call cleanup on error exit.
1807
1808 2020-03-03 Alan Modra <amodra@gmail.com>
1809
1810 * format.c (struct bfd_preserve): Add cleanup field.
1811 (bfd_preserve_save): Add cleanup param and save.
1812 (bfd_preserve_restore): Return cleanup.
1813 (bfd_preserve_finish): Call the cleanup for the discarded match.
1814 (bfd_check_format_matches): Pass cleanup to bfd_preserve_save,
1815 and clear when preserving a match. Restore cleanup too when
1816 restoring that match.
1817
1818 2020-03-02 Alan Modra <amodra@gmail.com>
1819
1820 * cisco-core.c (cisco_core_file_p): Return bfd_cleanup.
1821 * hpux-core.c (hpux_core_core_file_p): Update prototype.
1822 * sco5-core.c (sco5_core_file_p): Return bfd_cleanup.
1823 (core_sco5_vec): Correct initialisers.
1824
1825 2020-03-02 Alan Modra <amodra@gmail.com>
1826
1827 * aix386-core.c (aix386_core_file_p): Return bfd_cleanup.
1828 * aix5ppc-core.c (xcoff64_core_p): Likewise.
1829 * cisco-core.c (cisco_core_file_validate): Likewise.
1830 * hppabsd-core.c (hppabsd_core_core_file_p): Likewise.
1831 * hpux-core.c (hpux_core_core_file_p): Likewise.
1832 * irix-core.c (irix_core_core_file_p): Likewise.
1833 * lynx-core.c (lynx_core_file_p): Likewise.
1834 * netbsd-core.c (netbsd_core_file_p): Likewise.
1835 * osf-core.c (osf_core_core_file_p): Likewise.
1836 * ptrace-core.c (ptrace_unix_core_file_p): Likewise.
1837 * sco5-core.c (sco5_core_file_p): Likewise.
1838
1839 2020-03-02 H.J. Lu <hongjiu.lu@intel.com>
1840
1841 * trad-core.c (trad_unix_core_file_p): Return bfd_cleanup.
1842
1843 2020-03-02 Alan Modra <amodra@gmail.com>
1844
1845 * targets.c (bfd_cleanup): New typedef.
1846 (struct bfd <_bfd_check_format>): Return a bfd_cleanup.
1847 * libbfd-in.h (_bfd_no_cleanup): Define.
1848 * format.c (bfd_reinit): Add cleanup parameter, call it.
1849 (bfd_check_format_matches): Set cleanup from _bfd_check_format
1850 call and pass to bfd_reinit. Delete temp, use abfd->xvec instead.
1851 * aout-target.h (callback, object_p): Return bfd_cleanup.
1852 * aout-tic30.c (tic30_aout_callback, tic30_aout_object_p): Likewise.
1853 * archive.c (bfd_generic_archive_p): Likewise.
1854 * binary.c (binary_object_p): Likewise.
1855 * coff-alpha.c (alpha_ecoff_object_p): Likewise.
1856 * coff-ia64.c (ia64coff_object_p): Likewise.
1857 * coff-rs6000.c (_bfd_xcoff_archive_p, rs6000coff_core_p): Likewise.
1858 * coff-sh.c (coff_small_object_p): Likewise.
1859 * coff-stgo32.c (go32_check_format): Likewise.
1860 * coff64-rs6000.c (xcoff64_archive_p, rs6000coff_core_p),
1861 (xcoff64_core_p): Likewise.
1862 * coffgen.c (coff_real_object_p, coff_object_p): Likewise.
1863 * elf-bfd.h (bfd_elf32_object_p, bfd_elf32_core_file_p),
1864 (bfd_elf64_object_p, bfd_elf64_core_file_p): Likewise.
1865 * elfcode.h (elf_object_p): Likewise.
1866 * elfcore.h (elf_core_file_p): Likewise.
1867 * i386msdos.c (msdos_object_p): Likewise.
1868 * ihex.c (ihex_object_p): Likewise.
1869 * libaout.h (some_aout_object_p): Likewise.
1870 * libbfd-in.h (bfd_generic_archive_p, _bfd_dummy_target),
1871 (_bfd_vms_lib_alpha_archive_p, _bfd_vms_lib_ia64_archive_p): Likewise.
1872 * libbfd.c (_bfd_dummy_target): Likewise.
1873 * libcoff-in.h (coff_object_p): Likewise.
1874 * mach-o-aarch64.c (bfd_mach_o_arm64_object_p),
1875 (bfd_mach_o_arm64_core_p): Likewise.
1876 * mach-o-arm.c (bfd_mach_o_arm_object_p),
1877 (bfd_mach_o_arm_core_p): Likewise.
1878 * mach-o-i386.c (bfd_mach_o_i386_object_p),
1879 (bfd_mach_o_i386_core_p): Likewise.
1880 * mach-o-x86-64.c (bfd_mach_o_x86_64_object_p),
1881 (bfd_mach_o_x86_64_core_p): Likewise.
1882 * mach-o.c (bfd_mach_o_header_p, bfd_mach_o_gen_object_p),
1883 (bfd_mach_o_gen_core_p, bfd_mach_o_fat_archive_p): Likewise.
1884 * mach-o.h (bfd_mach_o_object_p, bfd_mach_o_core_p),
1885 (bfd_mach_o_fat_archive_p, bfd_mach_o_header_p): Likewise.
1886 * mmo.c (mmo_object_p): Likewise.
1887 * pef.c (bfd_pef_object_p, bfd_pef_xlib_object_p): Likewise.
1888 * peicode.h (coff_real_object_p, pe_ILF_object_p),
1889 (pe_bfd_object_p): Likewise.
1890 * plugin.c (ld_plugin_object_p, bfd_plugin_object_p): Likewise.
1891 * ppcboot.c (ppcboot_object_p): Likewise.
1892 * rs6000-core.c (rs6000coff_core_p): Likewise.
1893 * som.c (som_object_setup, som_object_p): Likewise.
1894 * srec.c (srec_object_p, symbolsrec_object_p): Likewise.
1895 * tekhex.c (tekhex_object_p): Likewise.
1896 * vms-alpha.c (alpha_vms_object_p): Likewise.
1897 * vms-lib.c (_bfd_vms_lib_archive_p, _bfd_vms_lib_alpha_archive_p),
1898 (_bfd_vms_lib_ia64_archive_p, _bfd_vms_lib_txt_archive_p): Likewise.
1899 * wasm-module.c (wasm_object_p): Likewise.
1900 * xsym.c (bfd_sym_object_p): Likewise.
1901 * xsym.h (bfd_sym_object_p): Likewise.
1902 * aoutx.h (some_aout_object_p): Likewise, and callback parameter
1903 return type.
1904 * pdp11.c (some_aout_object_p): Likewise.
1905 * plugin.c (register_ld_plugin_object_p): Update object_p
1906 parameter type.
1907 * plugin.h (register_ld_plugin_object_p): Likewise.
1908 * bfd-in2.h: Regenerate.
1909 * libbfd.h: Regenerate.
1910 * libcoff.h: Regenerate.
1911
1912 2020-03-02 Alan Modra <amodra@gmail.com>
1913
1914 * coff-alpha.c (alpha_ecoff_le_vec): Add SEC_SMALL_DATA to
1915 applicable section flags.
1916 * coff-mips.c (mips_ecoff_le_vec, mips_ecoff_be_vec): Likewise.
1917 (mips_ecoff_bele_vec): Likewise.
1918 * coffcode.h (sec_to_styp_flags): Set SEC_SMALL_DATA for .sdata
1919 and .sbss sections.
1920 * ecoff.c (_bfd_ecoff_new_section_hook): Likewise.
1921 (_bfd_ecoff_styp_to_sec_flags): Likewise.
1922
1923 2020-03-02 Alan Modra <amodra@gmail.com>
1924
1925 * elf32-m32r.c (m32r_elf_section_flags): New function.
1926 (elf_backend_section_flags): Define.
1927 * elf32-nds32.c (nds32_elf_section_flags): New function.
1928 (elf_backend_section_flags): Define.
1929 * elf32-ppc.c (ppc_elf_section_from_shdr): Set SEC_SMALL_DATA for
1930 .sbss and .sdata sections.
1931 * elf32-v850.c (v850_elf_section_from_shdr): Set SEC_SMALL_DATA
1932 for SHF_V850_GPREL sections.
1933 * elf64-alpha.c (elf64_alpha_section_from_shdr): Delete outdated
1934 FIXME.
1935 * elf64-hppa.c (elf64_hppa_section_from_shdr): Set SEC_SMALL_DATA
1936 for SHF_PARISC_SHORT sections.
1937 * elf64-ppc.c (ppc64_elf_section_flags): New function.
1938 (elf_backend_section_flags): Define.
1939 * elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Set SEC_SMALL_DATA
1940 for SHF_MIPS_GPREL sections. Delete FIXME.
1941
1942 2020-03-02 Alan Modra <amodra@gmail.com>
1943
1944 * elf-bfd.h (elf_backend_section_flags): Remove flagword* param.
1945 * elf.c (_bfd_elf_make_section_from_shdr): Set section flags before
1946 calling elf_backend_section_flags with adjusted params. Use
1947 newsect->flags past that point.
1948 (_bfd_elf_new_section_hook): Always set sh_type and sh_flags for
1949 special sections.
1950 (_bfd_elf_init_private_section_data): Allow normal sh_type sections
1951 to have their type overridden, and all sh_flags but processor and
1952 os specific.
1953 * elf32-arm.c (elf32_arm_section_flags): Adjust for changed params.
1954 * elf32-mep.c (mep_elf_section_flags): Likewise.
1955 * elf32-nios2.c (nios2_elf32_section_flags): Likewise.
1956 * elf64-alpha.c (elf64_alpha_section_flags): Likewise.
1957 * elf64-ia64-vms.c (elf64_ia64_section_flags): Likewise.
1958 * elfnn-ia64.c (elfNN_ia64_section_flags): Likewise.
1959 * elfnn-aarch64.c (elfNN_aarch64_size_stubs): Exclude the linker
1960 stub BFD and non-aarch64 input files when scanning for stubs.
1961
1962 2020-03-02 Alan Modra <amodra@gmail.com>
1963
1964 * coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Provide an upper
1965 limit to decompressed element size.
1966
1967 2020-03-02 Alan Modra <amodra@gmail.com>
1968
1969 * vms-lib.c (vms_traverse_index): Add recur_count param and
1970 update calls. Fail on excessive recursion.
1971
1972 2020-03-02 Alan Modra <amodra@gmail.com>
1973
1974 * vms-alpha.c (vms_get_remaining_object_record): Use
1975 bfd_realloc_or_free rather than bfd_realloc.
1976 (add_symbol_entry, vector_grow1, alpha_vms_slurp_relocs): Likewise.
1977 (dst_define_location, parse_module): Likewise, and check realloc
1978 return status before using memory. Return status from function
1979 adjusting all callers.
1980
1981 2020-02-28 Alan Modra <amodra@gmail.com>
1982
1983 * vms-lib.c (_bfd_vms_lib_archive_p): Free memory on error paths.
1984
1985 2020-02-28 Alan Modra <amodra@gmail.com>
1986
1987 * vms-alpha.c (alpha_vms_object_p): Use _bfd_malloc_and_read.
1988 Remove duplicate undersize check.
1989
1990 2020-02-27 Alan Modra <amodra@gmail.com>
1991
1992 PR 24511
1993 * mmo.c (mmo_scan): Set SEC_DATA for .data.
1994
1995 2020-02-27 Alan Modra <amodra@gmail.com>
1996
1997 PR 24511
1998 * syms.c (stt): Trim off all but 'e', 'i' and 'p' entries.
1999 (coff_section_type): Adjust comment.
2000 (decode_section_type): Likewise. Call coff_section_type before
2001 decode_section_type.
2002 (bfd_decode_symclass): Use 'c' for common sections other than
2003 the standard one.
2004
2005 2020-02-27 Alan Modra <amodra@gmail.com>
2006
2007 * coff-rs6000.c (_bfd_xcoff_read_ar_hdr): Put all data in one
2008 malloc'd block.
2009
2010 2020-02-27 Alan Modra <amodra@gmail.com>
2011
2012 * bfd.c (bfd_stat_arch_elt): Use vector of containing archive,
2013 if file is an archive element.
2014 * bfd-in2.h: Regenerate.
2015
2016 2020-02-26 Alan Modra <amodra@gmail.com>
2017
2018 * archive.c (do_slurp_bsd_armap): Increase minimum parsed_size, and
2019 bfd_set_error on failing test. Don't bother changing bfd_error on
2020 file read error. Check symdef_count is multiple of BSD_SYMDEF_SIZE.
2021 Check sym name is within string buffer. Use size_t for some vars.
2022 (do_slurp_coff_armap): Use size_t for some variables, fix size of
2023 int_buf. Don't change bfd_error on file read error. Use
2024 _bfd_mul_overflow when calculating carsym buffer size. Reorder
2025 calculations to catch overflows before they occur. malloc and
2026 free raw armap rather than using bfd_alloc. Read raw armap before
2027 allocating carsym+strings buffer.
2028 (_bfd_slurp_extended_name_table): Localize variables. Check
2029 name size against file size.
2030
2031 2020-02-26 Alan Modra <amodra@gmail.com>
2032
2033 * vms-lib.c (vms_lib_read_index): Release correct buffer.
2034
2035 2020-02-26 Alan Modra <amodra@gmail.com>
2036
2037 * elf32-rx.c (rx_elf_relocate_section): Use bfd_malloc rather than
2038 malloc. Check for NULL return from bfd_malloc.
2039 (rx_table_find, rx_table_map): Likewise.
2040 (rx_set_section_contents): Check bfd_alloc return.
2041 (rx_dump_symtab): Don't alloc internal_syms or external_syms.
2042
2043 2020-02-26 Alan Modra <amodra@gmail.com>
2044
2045 * aoutx.h: Indent labels correctly. Format error strings.
2046 * archive.c: Likewise.
2047 * archive64.c: Likewise.
2048 * coff-arm.c: Likewise.
2049 * coff-rs6000.c: Likewise.
2050 * coff-stgo32.c: Likewise.
2051 * cpu-arm.c: Likewise.
2052 * dwarf2.c: Likewise.
2053 * elf-ifunc.c: Likewise.
2054 * elf-properties.c: Likewise.
2055 * elf-s390-common.c: Likewise.
2056 * elf-strtab.c: Likewise.
2057 * elf.c: Likewise.
2058 * elf32-arm.c: Likewise.
2059 * elf32-bfin.c: Likewise.
2060 * elf32-cr16.c: Likewise.
2061 * elf32-csky.c: Likewise.
2062 * elf32-i386.c: Likewise.
2063 * elf32-m68k.c: Likewise.
2064 * elf32-msp430.c: Likewise.
2065 * elf32-nds32.c: Likewise.
2066 * elf32-nios2.c: Likewise.
2067 * elf32-pru.c: Likewise.
2068 * elf32-xtensa.c: Likewise.
2069 * elf64-ia64-vms.c: Likewise.
2070 * elf64-x86-64.c: Likewise.
2071 * elfcode.h: Likewise.
2072 * elfcore.h: Likewise.
2073 * elflink.c: Likewise.
2074 * elfnn-aarch64.c: Likewise.
2075 * elfnn-ia64.c: Likewise.
2076 * elfnn-riscv.c: Likewise.
2077 * elfxx-mips.c: Likewise.
2078 * elfxx-sparc.c: Likewise.
2079 * elfxx-x86.c: Likewise.
2080 * i386lynx.c: Likewise.
2081 * merge.c: Likewise.
2082 * pdp11.c: Likewise.
2083 * plugin.c: Likewise.
2084 * reloc.c: Likewise.
2085
2086 2020-02-26 Alan Modra <amodra@gmail.com>
2087
2088 PR 25593
2089 * elf-bfd.h (struct elf_link_hash_table): Rename "loaded" to
2090 "dyn_loaded".
2091 (bfd_elf_add_dt_needed_tag): Declare.
2092 * elf-strtab.c (_bfd_elf_strtab_restore): Handle NULL buf.
2093 * elflink.c (bfd_elf_add_dt_needed_tag): Make global and rename
2094 from elf_add_dt_needed_tag. Remove soname and doit param.
2095 (elf_link_add_object_symbols): Don't use elf_add_dt_needed_tag
2096 to see whether as-needed lib is already loaded, use dyn_loaded
2097 list instead. When saving and restoring around as-needed lib
2098 handle possibility that dynstr has not been initialised. Don't
2099 add DT_NEEDED tags here. Limit dyn_loaded list to dynamic libs.
2100 Mark libs loaded via DT_NEEDED entries of other libs with
2101 DYN_NO_NEEDED if they should not be mentioned in DT_NEEDED of
2102 the output.
2103 (elf_link_check_versioned_symbol): Remove now unneccesary
2104 DYNAMIC check when traversing dyn_loaded list.
2105
2106 2020-02-26 Alan Modra <amodra@gmail.com>
2107
2108 * bfdio.c (bfd_get_file_size): Ignore bogus archive element sizes.
2109
2110 2020-02-25 H.J. Lu <hongjiu.lu@intel.com>
2111
2112 PR binutils/25584
2113 * plugin.c (need_lto_wrapper_p): New.
2114 (bfd_plugin_set_program_name): Add an int argument to set
2115 need_lto_wrapper_p.
2116 (get_lto_wrapper): Return FALSE if need_lto_wrapper_p isn't
2117 set.
2118 * plugin.h (bfd_plugin_set_program_name): Add an int argument.
2119
2120 2020-02-24 Alan Modra <amodra@gmail.com>
2121
2122 * vms-lib.c (_bfd_vms_lib_archive_p): Correct overflow checks.
2123
2124 2020-02-24 Alan Modra <amodra@gmail.com>
2125
2126 * vms-lib.c (struct carsym_mem): Add limit.
2127 (vms_add_index): Heed limit.
2128 (vms_traverse_index): Catch buffer overflows. Remove outdated fixme.
2129 (vms_lib_read_index): Set up limit. Catch 32-bit overflow.
2130 Always return actual number read.
2131 (_bfd_vms_lib_archive_p): Catch buffer overflows. Replace
2132 assertion with error exit.
2133
2134 2020-02-22 Alan Modra <amodra@gmail.com>
2135
2136 PR 25585
2137 * elf.c (assign_file_positions_for_load_sections): Continue linking
2138 on "PHDR segment not covered by LOAD segment" errors.
2139
2140 2020-02-21 Alan Modra <amodra@gmail.com>
2141
2142 * mach-o.c (bfd_mach_o_canonicalize_relocs): Fix ineffective
2143 overflow check.
2144 (bfd_mach_o_canonicalize_reloc): Likewise.
2145 (bfd_mach_o_canonicalize_dynamic_reloc): Likewise. Sanity check
2146 counts and offsets against file size.
2147 (bfd_mach_o_build_dysymtab): Fix ineffective overflow check.
2148 (bfd_mach_o_mangle_sections): Remove unnecessary overflow check.
2149 (bfd_mach_o_read_symtab_symbols): Sanity check count and offset
2150 against file size. Delete symbol table error message.
2151 (bfd_mach_o_read_dysymtab): Sanity check counts and offsets
2152 against file size.
2153 (bfd_mach_o_read_symtab): Likewise.
2154 (bfd_mach_o_read_command): Pass file size.
2155 (bfd_mach_o_scan): Sanity check command count against file size.
2156
2157 2020-02-21 Alan Modra <amodra@gmail.com>
2158
2159 PR 25569
2160 * aoutx.h (adjust_o_magic, adjust_z_magic, adjust_n_magic): Use
2161 "text", "data" and "bss" section pointer vars. Don't update
2162 section size, just exec header sizes.
2163 (adjust_sizes_and_vmas): Don't update text section size. Set
2164 initial exec header a_text. Print exec headers sizes.
2165 * pdp11.c (adjust_o_magic, adjust_z_magic, adjust_n_magic),
2166 (adjust_sizes_and_vmas): Similarly. Formatting.
2167 (final_link): Correct final file extension.
2168
2169 2020-02-20 Nick Clifton <nickc@redhat.com>
2170
2171 * elf-bfd.h (struct elf_backend_data): Add symbol_section_index
2172 callback.
2173 * elfxx-target.h (elf_backend_symbol_section_index): Provide
2174 default definition.
2175 (elfNN_bed): Initialise the symbol_section_index field.
2176 * elf.c (swap_out_syms): Call symbol_section_index, if defined, on
2177 OS and PROC specific section indicies. Warn if converting other
2178 reserved incidies to SHN_ABS.
2179
2180 2020-02-19 Sergey Belyashov <sergey.belyashov@gmail.com>
2181
2182 PR 25537
2183 * cpu-z80.c: Add machine type compatibility checking.
2184
2185 2020-02-19 H.J. Lu <hongjiu.lu@intel.com>
2186
2187 PR binutils/25355
2188 * plugin.c (plugin_list_entry): Remove handle.
2189 (try_load_plugin): Call dlclose before return.
2190
2191 2020-02-19 Alan Modra <amodra@gmail.com>
2192
2193 * libbfd-in.h (_bfd_constant_p): Define.
2194 (_bfd_alloc_and_read, _bfd_malloc_and_read): Check read size against
2195 file size before allocating memory.
2196 * coffgen.c (_bfd_coff_get_external_symbols): Remove file size check.
2197 * elf.c (bfd_elf_get_str_section): Likewise.
2198 (_bfd_elf_slurp_version_tables): Likewise.
2199 * libbfd.h: Regenerate.
2200
2201 2020-02-19 Alan Modra <amodra@gmail.com>
2202
2203 * libbfd-in.h (_bfd_alloc_and_read, _bfd_malloc_and_read): New.
2204 * aoutx.h (aout_get_external_symbols): Replace calls to
2205 bfd_[m]alloc and bfd_bread with call to _bfd_[m]alloc_and_read.
2206 (slurp_reloc_table): Likewise.
2207 * archive.c (do_slurp_bsd_armap): Likewise.
2208 (do_slurp_coff_armap): Likewise.
2209 * archive64.c (_bfd_archive_64_bit_slurp_armap): Likewise.
2210 * coff-rs6000.c (_bfd_xcoff_slurp_armap): Likewise.
2211 * coff64-rs6000.c (xcoff64_slurp_armap): Likewise.
2212 * coffcode.h (coff_set_arch_mach_hook, buy_and_read): Likewise.
2213 * coffgen.c (coff_real_object_p, coff_object_p, build_debug_section),
2214 (_bfd_coff_get_external_symbols): Likewise.
2215 * ecoff.c (ecoff_slurp_symbolic_header),
2216 (_bfd_ecoff_slurp_symbolic_info, ecoff_slurp_reloc_table),
2217 (_bfd_ecoff_slurp_armap, ecoff_link_add_object_symbols, READ),
2218 (ecoff_indirect_link_order): Likewise.
2219 * elf.c (bfd_elf_get_str_section, setup_group, elf_read_notes),
2220 (_bfd_elf_slurp_version_tables): Likewise.
2221 * elf32-m32c.c (m32c_elf_relax_section): Likewise.
2222 * elf32-rl78.c (rl78_elf_relax_section): Likewise.
2223 * elf32-rx.c (elf32_rx_relax_section): Likewise.
2224 * elf64-alpha.c (READ): Likewise.
2225 * elf64-mips.c (mips_elf64_slurp_one_reloc_table): Likewise.
2226 * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Likewise.
2227 * elfcode.h (elf_slurp_symbol_table),
2228 (elf_slurp_reloc_table_from_section): Likewise.
2229 * elflink.c (elf_link_add_object_symbols),
2230 (elf_link_check_versioned_symbol): Likewise.
2231 * elfxx-mips.c (READ): Likewise.
2232 * i386lynx.c (slurp_reloc_table): Likewise.
2233 * lynx-core.c (lynx_core_file_p): Likewise.
2234 * mach-o.c (bfd_mach_o_canonicalize_relocs),
2235 (bfd_mach_o_read_symtab_strtab, bfd_mach_o_alloc_and_read),
2236 (bfd_mach_o_read_prebound_dylib, bfd_mach_o_read_dyld_content
2237 * pdp11.c (aout_get_external_symbols, slurp_reloc_table
2238 * pef.c (bfd_pef_print_loader_section, bfd_pef_scan_start_address),
2239 (bfd_pef_parse_symbols): Likewise.
2240 * peicode.h (pe_ILF_object_p, pe_bfd_object_p
2241 * som.c (setup_sections, som_slurp_string_table),
2242 (som_slurp_reloc_table, som_bfd_count_ar_symbols),
2243 (som_bfd_fill_in_ar_symbols): Likewise.
2244 * vms-alpha.c (module_find_nearest_line, evax_bfd_print_dst),
2245 (evax_bfd_print_image): Likewise.
2246 * vms-lib.c (_bfd_vms_lib_archive_p): Likewise.
2247 * wasm-module.c (wasm_scan): Likewise.
2248 * xcofflink.c (xcoff_link_add_symbols): Likewise.
2249 * xsym.c (bfd_sym_read_name_table),
2250 (bfd_sym_print_type_information_table_entry): Likewise.
2251 * libbfd.h: Regenerate.
2252
2253 2020-02-19 Alan Modra <amodra@gmail.com>
2254
2255 * aoutx.h (slurp_reloc_table): Allocate reloc_cache after
2256 reading external relocs.
2257 * ecoff.c (ecoff_slurp_reloc_table): Likewise.
2258 * archive.c (_bfd_write_archive_contents): Don't twiddle bfd_error
2259 after bfd_bread.
2260 * archive64.c (_bfd_archive_64_bit_slurp_armap): Remove unnecessary
2261 bfd_release.
2262 * elf32-m32c.c (m32c_offset_for_reloc): Make shndx_buf a bfd_byte*.
2263 (m32c_elf_relax_section): Likewise.
2264 * elf32-rl78.c (rl78_offset_for_reloc): Likewise.
2265 (rl78_elf_relax_section): Likewise.
2266 * elf32-rx.c (rx_offset_for_reloc): Likewise.
2267 (elf32_rx_relax_section): Likewise.
2268 * mach-o.c (bfd_mach_o_alloc_and_read): Move earlier with better
2269 parameter types and use..
2270 (bfd_mach_o_read_dylinker, bfd_mach_o_read_dylib),
2271 (bfd_mach_o_read_fvmlib, bfd_mach_o_read_str): ..in these functions.
2272 * peicode.h (pe_bfd_object_p): Don't zero the part of opthdr
2273 being read from file, just the extra.
2274 * som.c (som_slurp_symbol_table): Allocate internal symbol buffer
2275 after reading external syms. Free on failure.
2276
2277 2020-02-19 Alan Modra <amodra@gmail.com>
2278
2279 * coffcode.h (buy_and_read, coff_slurp_line_table),
2280 (coff_slurp_symbol_table, coff_slurp_reloc_table): Replace
2281 bfd_[z][m]alloc2 calls with _bfd_mul_overflow followed by the
2282 corresponding bfd_alloc call. Adjust variables to suit.
2283 * coffgen.c (_bfd_coff_get_external_symbols): Likewise.
2284 * ecoff.c (_bfd_ecoff_slurp_symbolic_info),
2285 (_bfd_ecoff_slurp_symbol_table, READ): Likewise.
2286 * elf.c (bfd_elf_get_elf_syms, setup_group, bfd_section_from_shdr),
2287 (swap_out_syms, _bfd_elf_slurp_version_tables): Likewise.
2288 * elf32-m32c.c (m32c_elf_relax_section): Likewise.
2289 * elf32-rl78.c (rl78_elf_relax_section): Likewise.
2290 * elf32-rx.c (elf32_rx_relax_section): Likewise.
2291 * elf64-alpha.c (READ): Likewise.
2292 * elfcode.h (elf_object_p, elf_write_relocs, elf_write_shdrs_and_ehdr),
2293 (elf_slurp_symbol_table, elf_slurp_reloc_table),
2294 (bfd_from_remote_memory): Likewise.
2295 * elfcore.h (core_find_build_id): Likewise.
2296 * elfxx-mips.c (READ): Likewise.
2297 * mach-o.c (bfd_mach_o_mangle_sections),
2298 (bfd_mach_o_read_symtab_symbols, bfd_mach_o_read_thread),
2299 (bfd_mach_o_read_dysymtab, bfd_mach_o_flatten_sections),
2300 (bfd_mach_o_scan, bfd_mach_o_fat_archive_p): Likewise.
2301 * som.c (setup_sections, som_prep_for_fixups)
2302 (som_build_and_write_symbol_table, som_slurp_symbol_table),
2303 (som_slurp_reloc_table, som_bfd_count_ar_symbols),
2304 (som_bfd_fill_in_ar_symbols, som_slurp_armap),
2305 (som_bfd_ar_write_symbol_stuff): Likewise.
2306 * vms-alpha.c (vector_grow1): Likewise.
2307 * vms-lib.c (vms_add_index): Likewise.
2308 * wasm-module.c (wasm_scan_name_function_section): Likewise.
2309 * libbfd.c (bfd_malloc2, bfd_realloc2, bfd_zmalloc2): Delete.
2310 * opncls.c (bfd_alloc2, bfd_zalloc2): Delete.
2311 * libbfd-in.h (bfd_malloc2, bfd_realloc2, bfd_zmalloc2),
2312 (bfd_alloc2, bfd_zalloc2): Delete.
2313 (_bfd_mul_overflow): Define.
2314 * libbfd.h: Regenerate.
2315
2316 2020-02-19 Alan Modra <amodra@gmail.com>
2317
2318 * elf.c (bfd_section_from_shdr): Use bfd_zalloc rather than
2319 bfd_zalloc2.
2320 (assign_section_numbers): Likewise.
2321 (elf_map_symbols): Likewise, and bfd_alloc rather than bfd_alloc2.
2322 (_bfd_elf_map_sections_to_segments): Use bfd_malloc rather than
2323 bfd_malloc2, size_t amt, and unsigned tls_count.
2324 (rewrite_elf_program_header): Use bfd_malloc and size_t amt.
2325 * elflink.c (elf_create_symbuf): Use bfd_malloc.
2326 (elf_output_implib): Use bfd_alloc.
2327
2328 2020-02-19 Alan Modra <amodra@gmail.com>
2329
2330 * bfd.c (struct bfd): Move format and direction to other
2331 bitfields. Add "size".
2332 * bfdio.c (bfd_get_size): Cache size when not writing file.
2333 * opncls.c (bfd_get_debug_link_info_1): Allow for bfd_get_size
2334 returning zero, ie. unknown.
2335 (bfd_get_alt_debug_link_info): Likewise.
2336 * bfd-in2.h: Regenerate.
2337
2338 2020-02-19 Alan Modra <amodra@gmail.com>
2339
2340 * coffgen.c (_bfd_coff_get_external_symbols): Don't call
2341 bfd_get_file_size twice.
2342 (_bfd_coff_read_string_table): Allow for bfd_get_file_size
2343 zero, ie. unknown, return.
2344 * elf-attrs.c (_bfd_elf_parse_attributes): Likewise.
2345 * elfcode.h (elf_swap_shdr_in): Likewise.
2346 (elf_object_p): Don't call bfd_get_file_size twice and correct
2347 file size check.
2348
2349 2020-02-19 Alan Modra <amodra@gmail.com>
2350
2351 * mach-o.c (bfd_mach_o_flatten_sections): Return a bfd_boolean,
2352 FALSE if memory alloc fails. Adjust calls.
2353 * som.c (som_prep_for_fixups): Likewise.
2354 * vms-alpha.c (alpha_vms_add_fixup_lp, alpha_vms_add_fixup_ca),
2355 (alpha_vms_add_fixup_qr, alpha_vms_add_fixup_lr),
2356 (alpha_vms_add_lw_reloc, alpha_vms_add_qw_reloc): Likewise.
2357 * som.c (som_build_and_write_symbol_table): Return via error_return
2358 on seek failure.
2359 * vms-alpha.c (VEC_APPEND): Adjust for vector_grow1 changes.
2360 (VEC_APPEND_EL): Delete.
2361 (vector_grow1): Return pointer to element. Catch overflow.
2362 Return NULL on memory allocation failure.
2363 (alpha_vms_add_fixup_lp): Replace VEC_APPEND_EL with VEC_APPEND.
2364 (alpha_vms_add_fixup_ca): Likewise.
2365 (alpha_vms_link_add_object_symbols): Check VEC_APPEND result
2366 before using.
2367 * elf.c (bfd_section_from_shdr): Check bfd_zalloc2 result.
2368
2369 2020-02-19 Alan Modra <amodra@gmail.com>
2370
2371 * aix386-core.c (aix386_core_file_p): Use size_t for "amt".
2372 * aout-target.h (object_p): Likewise.
2373 * aout-tic30.c (tic30_aout_object_p): Likewise.
2374 * aoutx.h (some_aout_object_p, mkobject, make_empty_symbol),
2375 (emit_stringtab, write_syms, link_hash_table_create),
2376 (aout_link_write_other_symbol): Likewise.
2377 * archive.c (_bfd_generic_mkarchive, bfd_generic_archive_p),
2378 (bfd_ar_hdr_from_filesystem, _bfd_write_archive_contents),
2379 (_bfd_compute_and_write_armap): Likewise.
2380 * archures.c (bfd_arch_list): Likewise.
2381 * bfd.c (bfd_record_phdr): Likewise.
2382 * binary.c (binary_canonicalize_symtab): Likewise.
2383 * cisco-core.c (cisco_core_file_validate): Likewise.
2384 * coff-arm.c (coff_arm_link_hash_table_create, find_thumb_glue),
2385 (find_arm_glue, record_arm_to_thumb_glue),
2386 (record_thumb_to_arm_glue): Likewise.
2387 * coff-ppc.c (ppc_coff_link_hash_table_create, record_toc),
2388 (ppc_allocate_toc_section): Likewise.
2389 * coff-rs6000.c (_bfd_xcoff_mkobject, _bfd_xcoff_archive_p): Likewise.
2390 * coff-sh.c (sh_relax_section): Likewise.
2391 * coff64-rs6000.c (xcoff64_archive_p): Likewise.
2392 * coffcode.h (handle_COMDAT, coff_new_section_hook),
2393 (coff_set_alignment_hook, coff_mkobject),
2394 (coff_compute_section_file_positions): Likewise.
2395 * coffgen.c (coff_make_empty_symbol, coff_bfd_make_debug_symbol),
2396 (coff_find_nearest_line_with_names),
2397 ( bfd_coff_set_symbol_class): Likewise.
2398 * cofflink.c (_bfd_coff_link_hash_table_create),
2399 (_bfd_coff_link_input_bfd): Likewise.
2400 * dwarf1.c (alloc_dwarf1_unit, alloc_dwarf1_func): Likewise.
2401 * dwarf2.c (read_abbrevs, read_attribute_value, add_line_info),
2402 (build_line_info_table, sort_line_sequences),
2403 (line_info_add_include_dir, line_info_add_file_name),
2404 (decode_line_info, scan_unit_for_symbols, parse_comp_unit),
2405 (place_sections, _bfd_dwarf2_slurp_debug_info): Likewise.
2406 * ecoff.c (_bfd_ecoff_mkobject, _bfd_ecoff_make_empty_symbol),
2407 (_bfd_ecoff_find_nearest_line),
2408 (_bfd_ecoff_bfd_link_hash_table_create): Likewise.
2409 * ecofflink.c (bfd_ecoff_debug_init): Likewise.
2410 * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Likewise.
2411 * elf-m10300.c (mn10300_elf_relax_section),
2412 (elf32_mn10300_link_hash_table_create): Likewise.
2413 * elf-strtab.c (_bfd_elf_strtab_init): Likewise.
2414 * elf.c (make_mapping, copy_elf_program_header): Likewise.
2415 * elf32-arm.c (elf32_arm_link_hash_table_create),
2416 (elf32_arm_setup_section_lists, elf32_arm_check_relocs),
2417 (elf32_arm_new_section_hook): Likewise.
2418 * elf32-avr.c (elf_avr_new_section_hook),
2419 (elf32_avr_link_hash_table_create, get_local_syms),
2420 (elf32_avr_setup_section_lists): Likewise.
2421 * elf32-bfin.c (bfinfdpic_elf_link_hash_table_create),
2422 (bfin_link_hash_table_create): Likewise.
2423 * elf32-cr16.c (elf32_cr16_link_hash_table_create): Likewise.
2424 * elf32-cris.c (elf_cris_link_hash_table_create): Likewise.
2425 * elf32-csky.c (csky_elf_link_hash_table_create),
2426 (csky_elf_check_relocs, elf32_csky_setup_section_lists): Likewise.
2427 * elf32-frv.c (frvfdpic_elf_link_hash_table_create): Likewise.
2428 * elf32-hppa.c (elf32_hppa_link_hash_table_create),
2429 (elf32_hppa_setup_section_lists, get_local_syms): Likewise.
2430 * elf32-i386.c (elf_i386_check_relocs): Likewise.
2431 * elf32-lm32.c (lm32_elf_link_hash_table_create): Likewise.
2432 * elf32-m32r.c (m32r_elf_link_hash_table_create),
2433 (m32r_elf_check_relocs): Likewise.
2434 * elf32-m68hc1x.c (m68hc11_elf_hash_table_create),
2435 (elf32_m68hc11_setup_section_lists),
2436 (elf32_m68hc11_size_stubs): Likewise.
2437 * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise.
2438 * elf32-metag.c (elf_metag_link_hash_table_create),
2439 (elf_metag_setup_section_lists): Likewise.
2440 * elf32-microblaze.c (microblaze_elf_link_hash_table_create),
2441 (microblaze_elf_check_relocs): Likewise.
2442 * elf32-nds32.c (nds32_elf_link_hash_table_create),
2443 (nds32_elf_check_relocs): Likewise.
2444 * elf32-nios2.c (nios2_elf32_setup_section_lists),
2445 (get_local_syms, nios2_elf32_check_relocs),
2446 (nios2_elf32_link_hash_table_create): Likewise.
2447 * elf32-or1k.c (or1k_elf_link_hash_table_create),
2448 (or1k_elf_check_relocs): Likewise.
2449 * elf32-ppc.c (ppc_elf_modify_segment_map, update_plt_info): Likewise.
2450 * elf32-pru.c (pru_elf32_link_hash_table_create): Likewise.
2451 * elf32-s390.c (elf_s390_link_hash_table_create),
2452 (elf_s390_check_relocs): Likewise.
2453 * elf32-score.c (score_elf_create_got_section),
2454 (s3_elf32_score_new_section_hook),
2455 (elf32_score_link_hash_table_create): Likewise.
2456 * elf32-score7.c (score_elf_create_got_section),
2457 (s7_elf32_score_new_section_hook): Likewise.
2458 * elf32-sh.c (sh_elf_link_hash_table_create),
2459 (sh_elf_check_relocs): Likewise.
2460 * elf32-tic6x.c (elf32_tic6x_link_hash_table_create),
2461 (elf32_tic6x_new_section_hook, elf32_tic6x_check_relocs): Likewise.
2462 * elf32-tilepro.c (tilepro_elf_link_hash_table_create),
2463 (tilepro_elf_check_relocs): Likewise.
2464 * elf32-v850.c (remember_hi16s_reloc): Likewise.
2465 * elf32-vax.c (elf_vax_link_hash_table_create): Likewise.
2466 * elf32-xtensa.c (elf_xtensa_link_hash_table_create),
2467 (elf_xtensa_new_section_hook): Likewise.
2468 * elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create),
2469 (get_got_entry, elf64_alpha_check_relocs): Likewise.
2470 * elf64-hppa.c (elf64_hppa_hash_table_create): Likewise.
2471 * elf64-ia64-vms.c (elf64_ia64_object_p): Likewise.
2472 * elf64-mmix.c (mmix_elf_new_section_hook): Likewise.
2473 * elf64-ppc.c (ppc64_elf_new_section_hook),
2474 (ppc64_elf_link_hash_table_create, update_local_sym_info),
2475 (update_plt_info, ppc64_elf_check_relocs): Likewise.
2476 * elf64-s390.c (elf_s390_link_hash_table_create),
2477 (elf_s390_check_relocs): Likewise.
2478 * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
2479 * elflink.c (bfd_elf_link_record_local_dynamic_symbol),
2480 (_bfd_elf_link_find_version_dependencies, elf_link_add_object_symbols),
2481 (elf_link_add_archive_symbols, compute_bucket_count),
2482 (bfd_elf_size_dynsym_hash_dynstr, _bfd_elf_link_hash_table_create),
2483 (bfd_elf_get_bfd_needed_list, elf_link_swap_symbols_out),
2484 (bfd_elf_final_link): Likewise.
2485 * elfnn-aarch64.c (elfNN_aarch64_link_hash_table_create),
2486 (elfNN_aarch64_setup_section_lists, elfNN_aarch64_check_relocs),
2487 (elfNN_aarch64_new_section_hook): Likewise.
2488 * elfnn-ia64.c (elfNN_ia64_object_p): Likewise.
2489 * elfnn-riscv.c (riscv_elf_link_hash_table_create),
2490 (riscv_elf_check_relocs): Likewise.
2491 * elfxx-mips.c (_bfd_mips_elf_new_section_hook),
2492 (_bfd_mips_elf_add_symbol_hook, _bfd_mips_elf_check_relocs),
2493 (_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_set_section_contents),
2494 (_bfd_mips_elf_link_hash_table_create): Likewise.
2495 * elfxx-sparc.c (_bfd_sparc_elf_link_hash_table_create),
2496 (_bfd_sparc_elf_check_relocs),
2497 (_bfd_sparc_elf_new_section_hook): Likewise.
2498 * elfxx-tilegx.c (tilegx_elf_link_hash_table_create),
2499 (tilegx_elf_check_relocs): Likewise.
2500 * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Likewise.
2501 * format.c (bfd_check_format_matches): Likewise.
2502 * hash.c (_bfd_stringtab_init): Likewise.
2503 * ihex.c (ihex_scan): Likewise.
2504 * irix-core.c (irix_core_core_file_p): Likewise.
2505 * linker.c (bfd_wrapped_link_hash_lookup),
2506 (_bfd_generic_link_hash_table_create),
2507 (_bfd_generic_reloc_link_order): Likewise.
2508 * lynx-core.c (lynx_core_file_p): Likewise.
2509 * netbsd-core.c (netbsd_core_file_p): Likewise.
2510 * osf-core.c (osf_core_core_file_p): Likewise.
2511 * pdp11.c (some_aout_object_p, mkobject, make_empty_symbol),
2512 (link_hash_table_create, aout_link_write_other_symbol): Likewise.
2513 * peXXigen.c (_bfd_XX_bfd_copy_private_section_data): Likewise.
2514 * peicode.h (pe_mkobject): Likewise.
2515 * ppcboot.c (ppcboot_mkobject, ppcboot_canonicalize_symtab): Likewise.
2516 * ptrace-core.c (ptrace_unix_core_file_p): Likewise.
2517 * sco5-core.c (read_uarea): Likewise.
2518 * som.c (hppa_som_gen_reloc_type, som_object_p, som_prep_headers),
2519 (som_write_fixups, som_write_space_strings, som_write_symbol_strings),
2520 (som_finish_writing, som_canonicalize_symtab, som_new_section_hook),
2521 (som_bfd_copy_private_section_data, bfd_som_set_section_attributes),
2522 (bfd_som_attach_aux_hdr, som_write_armap): Likewise.
2523 * srec.c (srec_scan): Likewise.
2524 * syms.c (_bfd_generic_make_empty_symbol): Likewise.
2525 * targets.c (bfd_target_list): Likewise.
2526 * tekhex.c (first_phase, tekhex_sizeof_headers): Likewise.
2527 * trad-core.c (trad_unix_core_file_p): Likewise.
2528 * vms-alpha.c (vms_initialize, alpha_vms_bfd_link_hash_table_create),
2529 (vms_new_section_hook): Likewise.
2530 * wasm-module.c (wasm_make_empty_symbol): Likewise.
2531 * xcofflink.c (xcoff_get_section_contents),
2532 (_bfd_xcoff_bfd_link_hash_table_create, xcoff_set_import_path),
2533 (xcoff_find_function, bfd_xcoff_link_record_set, xcoff_build_ldsym),
2534 (bfd_xcoff_size_dynamic_sections, xcoff_link_input_bfd): Likewise.
2535
2536 2020-02-19 Alan Modra <amodra@gmail.com>
2537
2538 * elfxx-riscv.c (riscv_multi_letter_ext_valid_p): Don't use C99.
2539
2540 2020-02-13 H.J. Lu <hongjiu.lu@intel.com>
2541
2542 * plugin.c (try_load_plugin): Make plugin_list_iter an argument
2543 and use it if it isn't NULL. Remove has_plugin_p argument. Add
2544 a build_list_p argument. Don't search plugin_list. Short circuit
2545 when building the plugin list.
2546 (has_plugin): Renamed to has_plugin_list.
2547 (bfd_plugin_set_plugin): Don't set has_plugin.
2548 (bfd_plugin_specified_p): Check plugin_list instead.
2549 (build_plugin_list): New function.
2550 (load_plugin): Call build_plugin_list and use plugin_list.
2551
2552 2020-02-11 H.J. Lu <hongjiu.lu@intel.com>
2553
2554 PR binutils/25355
2555 * plugin.c (try_claim): Always clean up for LTO wrapper.
2556 (try_load_plugin): Treat each object as independent. Create a
2557 copy for plugin name.
2558
2559 2020-02-11 Nick Clifton <nickc@redhat.com>
2560
2561 * elf32-msp430.c (msp430_final_link_relocate): Always use longs
2562 for addresses in print statements.
2563 (msp430_elf_relax_delete_bytes): Likewise.
2564 (msp430_elf_relax_add_words): Likewise.
2565 (msp430_elf_relax_section): Likewise.
2566
2567 2020-02-11 H.J. Lu <hongjiu.lu@intel.com>
2568
2569 * plugin.c (add_symbols): Clear plugin_data memory.
2570
2571 2020-02-10 H.J. Lu <hongjiu.lu@intel.com>
2572
2573 PR binutils/25355
2574 * configure.ac (HAVE_EXECUTABLE_SUFFIX): New AC_DEFINE.
2575 (EXECUTABLE_SUFFIX): Likewise.
2576 * config.in: Regenerated.
2577 * configure: Likewise.
2578 * plugin.c (bfd_plugin_close_and_cleanup): Removed.
2579 (plugin_list_entry): Add all_symbols_read, cleanup_handler,
2580 gcc, lto_wrapper, resolution_file, resolution_option, gcc_env,
2581 real_bfd, real_nsyms, real_syms, lto_nsyms and lto_syms.
2582 (get_lto_wrapper): New.
2583 (setup_lto_wrapper_env): Likewise.
2584 (current_plugin): Likewise.
2585 (register_all_symbols_read): Likewise.
2586 (register_cleanup): Likewise.
2587 (get_symbols): Likewise.
2588 (add_input_file): Likewise.
2589 (bfd_plugin_close_and_cleanup): Likewise.
2590 (claim_file): Removed.
2591 (register_claim_file): Set current_plugin->claim_file.
2592 (add_symbols): Make a copy of LTO symbols. Set lto_nsyms and
2593 lto_syms in current_plugin.
2594 (try_claim): Use current_plugin->claim_file. Call LTO plugin
2595 all_symbols_read handler. Copy real symbols to plugin_data.
2596 Call LTO plugin cleanup handler. Clean up for LTO wrapper.
2597 (try_load_plugin): Don't reuse the previous plugin for LTO
2598 wrapper. Set up GCC LTO wrapper if possible. Don't set
2599 plugin_list_iter->claim_file.
2600 (bfd_plugin_canonicalize_symtab): Use real LTO symbols if
2601 possible.
2602 * plugin.h (plugin_data_struct): Add real_bfd, real_nsyms and
2603 real_syms.
2604
2605 2020-02-10 Jozef Lawrynowicz <jozef.l@mittosystems.com>
2606
2607 * elf32-msp430.c (msp430_elf_relax_section): Before relaxing a branch,
2608 check if previous instruction matches a conditional jump inserted
2609 earlier. Invert conditional jump and delete branch in this case.
2610
2611 2020-02-10 Jozef Lawrynowicz <jozef.l@mittosystems.com>
2612
2613 * elf32-msp430.c (msp430_elf_relax_add_two_words): Rename to
2614 msp430_elf_relax_add_words. Support insertion of either one or two
2615 words.
2616 (msp430_elf_relax_section): Catch opcode of 0x3c00 when relocation
2617 needs to be grown. Handle insertion of branch instruction to replace
2618 jump.
2619
2620 2020-02-10 Jozef Lawrynowicz <jozef.l@mittosystems.com>
2621
2622 * elf32-msp430.c (msp430_final_link_relocate): Add printf statements for
2623 debugging relocations.
2624 (msp430_elf_relax_delete_bytes): Likewise.
2625 (msp430_elf_relax_add_two_words): Likewise.
2626 (msp430_elf_relax_section): Likewise.
2627
2628 2020-02-10 Alan Modra <amodra@gmail.com>
2629
2630 * archures.c: Wrap overlong z80 comments.
2631 * bfd-in2.h: Regenerate.
2632
2633 2020-02-07 Sergey Belyashov <sergey.belyashov@gmail.com>
2634
2635 PR 25469
2636 * archures.c: Add GBZ80 and Z80N machine values.
2637 * reloc.c: Add BFD_RELOC_Z80_16_BE.
2638 * coff-z80.c: Add support for new reloc.
2639 * coffcode.h: Add support for new machine values.
2640 * cpu-z80.c: Add support for new machine names.
2641 * elf32-z80.c: Add support for new reloc.
2642 * bfd-in2.h: Regenerate.
2643 * libbfd.h: Regenerate.
2644
2645 2020-02-07 Nick Clifton <nickc@redhat.com>
2646
2647 PR 23932
2648 * elf.c (rewrite_elf_program_header): Do not complain if no
2649 sections are mapped to a segment.
2650
2651 2020-02-06 H.J. Lu <hongjiu.lu@intel.com>
2652
2653 PR ld/25490
2654 * elflink.c (_bfd_elf_gc_mark_extra_sections): Issue an error
2655 for garbage collection on __patchable_function_entries section
2656 without linked-to section.
2657
2658 2020-02-06 H.J. Lu <hongjiu.lu@intel.com>
2659
2660 PR gas/25381
2661 * bfd-in2.h: Regenerated.
2662 * elflink.c (_bfd_elf_gc_mark_extra_sections): Call mark_hook
2663 on section if gc_mark of any of its linked-to sections is set
2664 and don't set gc_mark again.
2665 * section.c (asection): Add linked_to_symbol_name to map_head
2666 union.
2667
2668 2020-02-06 Maciej W. Rozycki <macro@wdc.com>
2669
2670 * elf32-v850.c (v850_elf_relax_section): Fix the index used for
2671 reporting an unrecognized instruction with R_V850_LONGJUMP.
2672
2673 2020-02-05 Alan Modra <amodra@gmail.com>
2674
2675 * elf64-ppc.c (ppc_stub_plt_branch): Match comment with reality.
2676
2677 2020-02-04 Alan Modra <amodra@gmail.com>
2678
2679 * elf32-ppc.c (ppc_elf_relocate_section): After applying
2680 R_PPC_VLE_ADDR20, goto copy_reloc.
2681
2682 2020-02-02 H.J. Lu <hongjiu.lu@intel.com>
2683
2684 * bfd-in2.h: Regenerated.
2685 * section.c (SEC_ASSEMBLER_SECTION_ID): Fix a typo in comments.
2686
2687 2020-02-02 H.J. Lu <hongjiu.lu@intel.com>
2688
2689 PR gas/25380
2690 * bfd-in2.h: Regenerated.
2691 * ecoff.c (bfd_debug_section): Add section_id.
2692 * section.c (bfd_section): Add section_id.
2693 (SEC_ASSEMBLER_SECTION_ID): New.
2694 (BFD_FAKE_SECTION): Add section_id.
2695
2696 2020-02-01 Nick Clifton <nickc@redhat.com>
2697
2698 * config.bfd: Move the c30-aout and tic30-aout targets onto the
2699 obsolete list.
2700
2701 2020-01-31 Sandra Loosemore <sandra@codesourcery.com>
2702
2703 * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): DW_EH_PE_datarel
2704 encodings are relative to the GOT on nios2, too.
2705
2706 2020-01-31 Alan Modra <amodra@gmail.com>
2707
2708 * Makefile.am (elf32-target.h, elf64-target.h): Don't use a temp
2709 file. Use $< and $@ in rules.
2710 (elf32-aarch64.c, elf64-aarch64.c): Likewise.
2711 (elf32-ia64.c, elf64-ia64.c): Likewise.
2712 (elf32-riscv.c, elf64-riscv.c): Likewise.
2713 (peigen.c, pepigen.c, pex64igen.c): Likewise.
2714 (elf32-aarch64.c, elf64-aarch64.c): Don't emit $srcdir on #line.
2715 (elf32-riscv.c, elf64-riscv.c): Likewise, and use $(SED).
2716 (elf32-ia64.c, elf64-ia64.c): Do emit #line.
2717 (peigen.c, pepigen.c, pex64igen.c): Likewise.
2718 * Makefile.in: Regenerate.
2719
2720 2020-01-31 Alan Modra <amodra@gmail.com>
2721
2722 PR 4110
2723 * elf.c (setup_group): Don't clear entire section contents,
2724 just the padding after group flags. Release alloc'd memory
2725 after a seek or read failure.
2726
2727 2020-01-16 Jon Turney <jon.turney@dronecode.org.uk>
2728
2729 * peXXigen.c (pe_is_repro): New function.
2730 (_bfd_XX_print_private_bfd_data_common): Note timestamp is
2731 actually a build hash if PE_IMAGE_DEBUG_TYPE_REPRO is present.
2732
2733 2020-01-16 Jon Turney <jon.turney@dronecode.org.uk>
2734
2735 * peXXigen.c (debug_type_names): Add names for new debug data type
2736 values.
2737
2738 2020-01-16 Jon Turney <jon.turney@dronecode.org.uk>
2739
2740 * peXXigen.c (pe_print_debugdata): Fix the iteration variable for
2741 inner loop. Fix a memory leak.
2742
2743 2020-01-30 Alan Modra <amodra@gmail.com>
2744
2745 * coffgen.c (coff_real_object_p): Don't clear obj_coff_keep_syms
2746 or obj_coff_keep_strings here.
2747 (coff_get_normalized_symtab): Free external syms directly.
2748 * xcofflink.c (xcoff_link_input_bfd): Restore obj_coff_keep_syms
2749 on error exit path.
2750
2751 2020-01-27 Jim Wilson <jimw@sifive.com>
2752
2753 * cpu-riscv.c (riscv_scan): New.
2754 (N): Change bfd_default_scan to riscv_scan.
2755
2756 2020-01-27 Andreas Schwab <schwab@suse.de>
2757
2758 * Makefile.am (ALL_MACHINES): Remove cpu-plugin.lo.
2759 (ALL_MACHINES_CFILES): Remove cpu-plugin.c.
2760 * Makefile.in: Regenerate.
2761 * cpu-plugin.c: Remove.
2762 * archures.c (enum bfd_architecture): Remove bfd_arch_plugin.
2763 (bfd_plugin_arch): Remove declaration.
2764 * bfd-in2.h: Regenerate.
2765 * po/SRC-POTFILES.in: Regenerate.
2766
2767 2020-01-27 H.J. Lu <hongjiu.lu@intel.com>
2768 Alan Modra <amodra@gmail.com>
2769
2770 PR ld/25458
2771 * elflink.c (_bfd_elf_gc_mark_rsec): Mark all weak aliases.
2772
2773 2020-01-24 Jim Wilson <jimw@sifive.com>
2774
2775 * elfxx-riscv.c (riscv_get_prefix_class): Format s case like others.
2776 (riscv_parse_prefixed_ext): Fix s extension comment and reword to
2777 avoid over long line.
2778
2779 2020-01-24 Nick Clifton <nickc@redhat.com>
2780
2781 PR 25447
2782 * coffgen.c (_bfd_coff_close_and_cleanup): Do not clear the keep
2783 syms and keep strings flags as these may have been set in order to
2784 prevent a bogus call to free.
2785
2786 2020-01-23 Nick Clifton <nickc@redhat.com>
2787
2788 * po/fr.po: Updated French translation.
2789
2790 2020-01-23 Alan Modra <amodra@gmail.com>
2791
2792 PR 25444
2793 * elf.c (assign_file_positions_for_load_sections): Avoid divide
2794 by zero when p_align is zero.
2795
2796 2020-01-22 Maxim Blinov <maxim.blinov@embecosm.com>
2797
2798 * bfd/elfnn-riscv.c (riscv_skip_prefix): New.
2799 (riscv_prefix_cmp): Likewise.
2800 (riscv_non_std_ext_p): Deleted.
2801 (riscv_std_sv_ext_p): Likewise.
2802 (riscv_non_std_sv_ext_p): Likewise.
2803 (riscv_merge_non_std_and_sv_ext): Rename to...
2804 (riscv_merge_multi_letter_ext): and modified to use riscv_prefix_cmp.
2805 (riscv_merge_arch_attr_info): Replace 3 calls to
2806 riscv_merge_non_std_and_sv_ext with single call to
2807 riscv_merge_multi_letter_ext.
2808 * bfd/elfxx-riscv.c (riscv_parse_std_ext): Break if we
2809 encounter a 'z' prefix.
2810 (riscv_get_prefix_class): New function, return prefix class based
2811 on first few characters of input string.
2812 (riscv_parse_config): New structure to factor out minor differences
2813 in extension class parsing behaviour.
2814 (riscv_parse_sv_or_non_std_ext): Rename to...
2815 (riscv_parse_prefixed_ext): and parameterise with
2816 riscv_parse_config.
2817 (riscv_std_z_ext_strtab, riscv_std_s_ext_strtab): New.
2818 (riscv_multi_letter_ext_valid_p): New.
2819 (riscv_ext_x_valid_p, riscv_ext_z_valid_p, riscv_ext_s_valid_p): New.
2820 (riscv_parse_subset): Delegate all non-single-letter parsing work
2821 to riscv_parse_prefixed_ext.
2822 * bfd/elfxx-riscv.h (riscv_isa_ext_class): New type.
2823 (riscv_get_prefix_class): Declare.
2824
2825 2020-01-22 Alan Modra <amodra@gmail.com>
2826
2827 * elf64-ppc.c (struct ppc_link_hash_table): Add tga_group.
2828 (ppc64_elf_archive_symbol_lookup): Extract __tls_get_addr_opt for
2829 __tls_get_addr_desc.
2830 (ppc64_elf_size_stubs): Add section for linker generated
2831 __tls_get_addr_desc wrapper function. Loop at least once if
2832 generating this function.
2833 (emit_tga_desc, emit_tga_desc_eh_frame): New functions.
2834 (ppc64_elf_build_stubs): Generate __tls_get_addr_desc.
2835
2836 2020-01-22 Alan Modra <amodra@gmail.com>
2837
2838 * elf64-ppc.h (struct ppc64_elf_params): Add no_tls_get_addr_regsave.
2839 * elf64-ppc.c (struct ppc_link_hash_table): Add tga_desc and
2840 tga_desc_fd.
2841 (is_tls_get_addr): Match tga_desc and tga_desc_df too.
2842 (STDU_R1_0R1, ADDI_R1_R1): Define.
2843 (tls_get_addr_prologue, tls_get_addr_epilogue): New functions.
2844 (ppc64_elf_tls_setup): Set up tga_desc and tga_desc_fd. Indirect
2845 tga_desc_fd to opt_fd, and tga_desc to opt. Set
2846 no_tls_get_addr_regsave.
2847 (branch_reloc_hash_match): Add hash3 and hash4.
2848 (ppc64_elf_tls_optimize): Handle tga_desc_fd and tga_desc too.
2849 (ppc64_elf_size_dynamic_sections): Likewise.
2850 (ppc64_elf_relocate_section): Likewise.
2851 (plt_stub_size, build_plt_stub): Likewise. Size regsave
2852 __tls_get_addr stub.
2853 (build_tls_get_addr_stub): Build regsave __tls_get_addr stub and
2854 eh_frame.
2855 (ppc_size_one_stub): Handle tga_desc_fd and tga_desc too. Size
2856 eh_frame for regsave __tls_get_addr.
2857
2858 2020-01-22 Alan Modra <amodra@gmail.com>
2859
2860 * elf64-ppc.c (ppc64_elf_size_stubs): Correct condition under
2861 which __tls_get_addr calls will be eliminated.
2862
2863 2020-01-20 Nick Clifton <nickc@redhat.com>
2864
2865 * po/pt.po: Updates Portuguese translation.
2866 * po/ru.po: Updated Russian translation.
2867 * po/uk.po: Updated Ukranian translation.
2868
2869 2020-01-20 H.J. Lu <hongjiu.lu@intel.com>
2870
2871 PR ld/25416
2872 * elf64-x86-64.c (elf_x86_64_check_tls_transition): Support
2873 "rex leal x@tlsdesc(%rip), %reg" and "call *x@tlsdesc(%eax)" in
2874 X32 mode.
2875 (elf_x86_64_relocate_section): In x32 mode, for GDesc -> LE
2876 transition, relax "rex leal x@tlsdesc(%rip), %reg" to
2877 "rex movl $x@tpoff, %reg", for GDesc -> IE transition, relax
2878 "rex leal x@tlsdesc(%rip), %reg" to
2879 "rex movl x@gottpoff(%rip), %eax". For both transitions, relax
2880 "call *(%eax)" to "nopl (%rax)".
2881
2882 2020-01-20 Alan Modra <amodra@gmail.com>
2883
2884 * elf64-ppc.c (LD_R11_0R3, CMPDI_R11_0, STD_R11_0R1, LD_R11_0R1),
2885 (MTLR_R11): Don't define.
2886 (LD_R0_0R3, CMPDI_R0_0): Define.
2887 (build_tls_get_addr_stub): Don't use r11 in stub.
2888
2889 2020-01-20 Alan Modra <amodra@gmail.com>
2890
2891 * elf64-ppc.c (ppc_elf_hash_entry): New function, use throughout file.
2892 (defined_sym_val, is_tls_get_addr): Likewise.
2893
2894 2020-01-18 Nick Clifton <nickc@redhat.com>
2895
2896 * version.m4 (BFD_VERSION): Set to 2.34.50.
2897 * configure: Regenerate.
2898 * po/bfd.pot: Regenerate.
2899
2900 2020-01-18 Nick Clifton <nickc@redhat.com>
2901
2902 Binutils 2.34 branch created.
2903
2904 2020-01-17 Christian Biesinger <cbiesinger@google.com>
2905
2906 * coff-arm.c: Fix spelling error (seperate).
2907 * elfxx-riscv.c (riscv_parse_sv_or_non_std_ext): Fix spelling
2908 error (seperate).
2909 * sysdep.h (strnlen): Fix spelling error (seperate).
2910
2911 2020-01-15 Lars Brinkhoff <lars@nocrew.org>
2912
2913 PR 20694
2914 * pdp11.c (TARGET_PAGE_SIZE): Set to 8192.
2915
2916 2020-01-15 Alan Modra <amodra@gmail.com>
2917
2918 PR 25384
2919 * elf64-ppc.c (ELIMINATE_COPY_RELOCS): Update comment.
2920 (ppc64_elf_adjust_dynamic_symbol): Don't allow .dynbss copies
2921 of function symbols unless dot symbols are present. Do warn
2922 whenever one is created, regardles of whether a PLT entry is
2923 also emitted for the function symbol.
2924
2925 2020-01-14 Alan Modra <amodra@gmail.com>
2926
2927 * som.c (som_bfd_count_ar_symbols): Error when file position
2928 of symbols on chains is not strictly increasing.
2929
2930 2020-01-14 Alan Modra <amodra@gmail.com>
2931
2932 * vms.h (VMS_DEBUG): Define as 0.
2933 * vms-alpha.c (image_write): Move debug output after bounds check.
2934 Tidy bounds check.
2935 (_bfd_vms_slurp_eihd): Warning fix.
2936 (_bfd_vms_slurp_etir): Init variables to avoid bogus warnings.
2937
2938 2020-01-13 Alan Modra <amodra@gmail.com>
2939
2940 * vms-alpha.c (_bfd_vms_slurp_egsd): Ensure minimum size even
2941 for "ignored" records.
2942
2943 2020-01-13 Alan Modra <amodra@gmail.com>
2944
2945 * wasm-module.c (wasm_scan_name_function_section): Formatting.
2946 Delete asect name check. Move asect NULL check to wasm_object_p.
2947 Correct bounds check of sizes against end. Replace uses of
2948 bfd_zalloc with bfd_alloc, zeroing only necessary bytes. Use
2949 just one bfd_release.
2950 (wasm_scan): Don't use malloc/strdup for section names,
2951 bfd_alloc instead. Simplify code prefixing section name.
2952 Formatting. Don't attempt to free memory here..
2953 (wasm_object_p): ..do so here.
2954
2955 2020-01-10 Szabolcs Nagy <szabolcs.nagy@arm.com>
2956
2957 PR ld/22269
2958 * elf32-arm.c (elf32_arm_final_link_relocate): Use
2959 UNDEFWEAK_NO_DYNAMIC_RELOC.
2960 (allocate_dynrelocs_for_symbol): Likewise.
2961
2962 2020-01-10 Tamar Christina <tamar.christina@arm.com>
2963
2964 PR 25210
2965 * elfnn-aarch64.c (_bfd_aarch64_create_stub_section): Remove elfclass.
2966
2967 2020-01-10 Alan Modra <amodra@gmail.com>
2968
2969 * coff-alpha.c (alpha_ecoff_object_p): Calculate size in bfd_size_type.
2970
2971 2020-01-09 Nick Clifton <nickc@redhat.com>
2972
2973 PR 25221
2974 * bfd.c (bfd_convert_section_contents): Check for a compress
2975 header size that is larger than the actual section size.
2976
2977 2020-01-08 Alan Modra <amodra@gmail.com>
2978
2979 PR 25351
2980 * elflink.c (bfd_elf_final_link): Call _bfd_fix_excluded_sec_syms
2981 after removing sections.
2982
2983 2020-01-06 Jim Wilson <jimw@sifive.com>
2984
2985 PR 25205
2986 * elfnn-riscv.c (riscv_elf_relocate_section) <R_RISCV_CALL>: Add
2987 check for !bfd_link_pic (info).
2988 <R_RISCV_CALL_PLT>: Move next to R_RISCV_CALL.
2989 <R_RISCV_JAL>: Add comment.
2990 (_bfd_riscv_relax_section): For plt.offset check, add check for
2991 bfd_link_pic (info). Add comment.
2992
2993 2020-01-06 Alan Modra <amodra@gmail.com>
2994
2995 * format.c (bfd_check_format_matches): Ignore bfd_error on target
2996 match failures. Don't init to bfd_error_wrong_format before
2997 calling _bfd_check_format.
2998
2999 2020-01-06 Alan Modra <amodra@gmail.com>
3000
3001 * vms-alpha.c (_bfd_vms_push, _bfd_vms_pop): Return pass/fail
3002 status rather than exiting on stack overflow or underflow.
3003 (_bfd_vms_slurp_etir): Adjust to suit.
3004
3005 2020-01-06 Alan Modra <amodra@gmail.com>
3006
3007 * som.c (som_bfd_fill_in_ar_symbols): Bounds check som_dict index.
3008
3009 2020-01-06 Alan Modra <amodra@gmail.com>
3010
3011 * mach-o.c (bfd_mach_o_read_dylinker): Don't read past end of
3012 command. Check name offset is within command.
3013 (bfd_mach_o_read_dylib, bfd_mach_o_read_prebound_dylib),
3014 (bfd_mach_o_read_prebind_cksum, bfd_mach_o_read_twolevel_hints),
3015 (bfd_mach_o_read_fvmlib, bfd_mach_o_read_dysymtab),
3016 (bfd_mach_o_read_symtab, bfd_mach_o_read_uuid),
3017 (bfd_mach_o_read_linkedit, bfd_mach_o_read_str),
3018 (bfd_mach_o_read_dyld_info, bfd_mach_o_read_version_min),
3019 (bfd_mach_o_read_encryption_info, bfd_mach_o_read_source_version),
3020 (bfd_mach_o_read_encryption_info_64, bfd_mach_o_read_main),
3021 (bfd_mach_o_read_note, bfd_mach_o_read_build_version),
3022 (bfd_mach_o_read_segment): Similarly.
3023 (bfd_mach_o_read_thread): Properly bound check thread struct.
3024 Don't repeat checks on second loop.
3025 (bfd_mach_o_read_command): Fail on invalid command length.
3026
3027 2020-01-04 Alan Modra <amodra@gmail.com>
3028
3029 * format.c (bfd_check_format_matches): Add preserve_match.
3030 Save initial bfd state in "preserve", matched bfd state in
3031 "preserve_match". Save just the first match. Release
3032 bfd_alloc memory. Restore and finish preserved state as
3033 appropriate on all function exit paths.
3034
3035 2020-01-04 Alan Modra <amodra@gmail.com>
3036
3037 * mmo.c (mmo_mkobject): Allocate tdata with bfd_zalloc.
3038
3039 2020-01-04 Alan Modra <amodra@gmail.com>
3040
3041 * coffgen.c (coff_real_object_p): Free malloc'd memory on target
3042 match too.
3043
3044 2020-01-03 Nick Clifton <nickc@redhat.com>
3045
3046 PR 25307
3047 (bfd_pef_parse_function_stubs): Correct the test that ensures that
3048 there is enough data remaining in the code buffer before
3049 attempting to read a function stub.
3050
3051 2020-01-03 Nick Clifton <nickc@redhat.com>
3052
3053 PR 25308
3054 * elf-properties.c (_bfd_elf_convert_gnu_properties): Check the
3055 return value from bfd_malloc.
3056 * elf32-arm.c (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise.
3057 (bfd_elf32_arm_stm32l4xx_fix_veneer_locations): Likewise.
3058 (elf32_arm_filter_cmse_symbols): Likewise.
3059 (elf32_arm_write_section): Likewise.
3060 * mach-o.c (bfd_mach_o_core_fetch_environment): Likewise.
3061 (bfd_mach_o_follow_dsym): Likewise.
3062 * pef.c (bfd_pef_print_loader_section): Likewise.
3063 (bfd_pef_scan_start_address): Likewise.
3064 (bfd_pef_parse_function_stubs): Likewise.
3065 (bfd_pef_parse_symbols): Likewise.
3066
3067 2020-01-03 Sergei Trofimovich <siarheit@google.com>
3068
3069 * elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): don't fail
3070 on binary inputs ld/PR25316.
3071 (is_ia64_elf): new helper to filter on ia64 objects.
3072
3073 2020-01-03 Jan Beulich <jbeulich@suse.com>
3074
3075 * mach-o.c (cpusubtype, bfd_mach_o_header_p): Insert underscore
3076 in parameter names.
3077 (bfd_mach_o_scan): Insert underscore in two variable names.
3078
3079 2020-01-02 Sergey Belyashov <sergey.belyashov@gmail.com>
3080
3081 * Makefile.am: Add z80-elf target support.
3082 * configure.ac: Likewise.
3083 * targets.c: Likewise.
3084 * Makefile.in: Regenerate.
3085 * configure: Regenerate.
3086 * config.bfd: Add z80-elf target support and new arches: ez80 and
3087 z180.
3088 * elf32-z80.c: New file.
3089 * archures.c: Add new z80 architectures: eZ80 and Z180.
3090 * coffcode.h: Likewise.
3091 * cpu-z80.c: Likewise.
3092 * coff-z80.c: Add new relocations for Z80 target and local label
3093 check.
3094 * reloc.c: Add new relocs.
3095 * bfd-in2.h: Regenerate.
3096 * libbfd.h: Regenerate.
3097
3098 2020-01-02 Tamar Christina <tamar.christina@arm.com>
3099
3100 PR 25210
3101 PR 24753
3102 * elfnn-aarch64.c (_bfd_aarch64_create_stub_section): Set ELF class.
3103
3104 2020-01-01 Alan Modra <amodra@gmail.com>
3105
3106 Update year range in copyright notice of all files.
3107
3108 For older changes see ChangeLog-2019
3109 \f
3110 Copyright (C) 2020 Free Software Foundation, Inc.
3111
3112 Copying and distribution of this file, with or without modification,
3113 are permitted in any medium without royalty provided the copyright
3114 notice and this notice are preserved.
3115
3116 Local Variables:
3117 mode: change-log
3118 left-margin: 8
3119 fill-column: 74
3120 version-control: never
3121 End: