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