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