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