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