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