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