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