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