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