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