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