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