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