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