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