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