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