3 * config.bfd: Obsolete arm*-*-symbianelf*.
7 * elf64-ppc.h (struct ppc64_elf_params): Add no_pcrel_opt.
8 * elf64-ppc.c (ppc64_elf_relocate_section): Disable GOT reloc
9 optimizations when --no-toc-optimize. Disable R_PPC64_PCREL_OPT
10 optimization when --no-pcrel-optimize.
15 * bfd.c (struct bfd): Add read_only.
16 * elfcode.h (elf_swap_shdr_in): Test both sh_offset and sh_size.
17 Set read_only on warning.
18 (elf_object_p): Sanity check program header alignment. Set
20 * bfd-in2.h: Regenerate.
24 * elf.c (elfcore_grok_win32pstatus): Use unsigned int for
25 win32pstatus note type to avoid signedness comparison warning.
29 * elf.c (elfcore_grok_win32pstatus): Warn on malformed
30 win32pstatus notes, and return TRUE so we continue rather than
31 stopping as if it was an error.
35 * elf.c (elfcore_grok_win32pstatus): Handle NOTE_INFO_MODULE64.
39 * elf.c (elfcore_grok_win32pstatus): Don't apply size constraint
40 for NOTE_INFO_THREAD to all win32pstatus ELF notes, instead apply
41 appropriate size constraint for each win32pstatus note type.
45 * elf.c (elfcore_grok_win32pstatus): Don't hardcode the size of
46 the Win32 API thread CONTEXT type read from a NOTE_INFO_THREAD
51 * elf.c (NOTE_INFO{_PROCESS,_THREAD,_MODULE}): Define.
52 (elfcore_grok_win32pstatus): Use.
56 * elf.c (elfcore_grok_win32pstatus): Fix the offset used to read
57 the tid from a win32pstatus NOTE_INFO_THREAD ELF note. Fix
58 offsets used to read NOTE_INFO_PROCESS.
62 * po/ru.po: Updated Russian translation.
63 * po/sr.po: Updated Serbian translation.
67 * elf64-bpf.c (bpf_elf_relocate_section): Ensure signed division for
68 DISP16 and DISP32 relocations.
72 * elf64-bpf.c (bpf_elf_generic_reloc): New function.
73 (bpf_elf_howto_table): Use it here.
74 (bpf_elf_relocate_section): Use addends recorded in input_bfd for
75 instruction and data relocations.
79 * vms-lib.c (vms_traverse_index): Sanity check size remaining
80 before accessing vms_idx or vms_elfidx.
85 * elf.c (_bfd_elf_get_symtab_upper_bound): Sanity check symbol table
86 size against file size. Correct LONG_MAX limit check.
87 (_bfd_elf_get_dynamic_symtab_upper_bound): Likewise.
88 (_bfd_elf_get_reloc_upper_bound): Don't check file size if writing.
89 (_bfd_elf_get_dynamic_reloc_upper_bound): Likewise.
90 * elf64-x86-64-.c (elf_x86_64_get_synthetic_symtab): Use
91 bfd_malloc_and_get_section.
96 * elflink.c (bfd_elf_link_record_dynamic_symbol): Don't allow
97 IR symbols to become dynamic.
98 (elf_link_add_object_symbols): Don't exclude IR symbols when
99 deciding whether an as-needed shared library is needed.
104 * elfnn-aarch64.c (elfNN_aarch64_init_small_plt0_entry): Set sh_entsize
106 (elfNN_aarch64_finish_dynamic_sections): Remove sh_entsize setting.
110 * bfd.m4 (BFD_SYS_PROCFS_H): New macro.
111 (BFD_HAVE_SYS_PROCFS_TYPE): Require BFD_SYS_PROCFS_H.
112 Don't define _STRUCTURED_PROC.
113 (BFD_HAVE_SYS_PROCFS_TYPE_MEMBER): Likewise.
114 * elf.c [HAVE_SYS_PROCFS_H] (_STRUCTURED_PROC): Don't define.
115 * configure.ac: Use BFD_SYS_PROCFS_H to check for <sys/procfs.h>.
116 * configure, config.in: Regenerate.
117 * Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS.
118 * Makefile.in, doc/Makefile.in: Regenerate.
122 * elf-bfd.h (sym_cache): Moved before elf_link_hash_table.
123 (elf_link_hash_table): Add sym_cache.
124 * elf32-arm.c (elf32_arm_link_hash_table): Remove sym_cache.
125 (elf32_arm_check_relocs): Updated.
126 (elf32_arm_size_dynamic_sections): Likewise.
127 * elf32-bfin.c (bfin_link_hash_table): Removed.
128 (bfin_link_hash_newfunc): Updated.
129 (bfin_hash_table): Removed.
130 * elf32-csky.c (csky_elf_link_hash_table): Remove sym_cache.
131 (csky_elf_check_relocs): Updated.
132 * elf32-hppa.c (elf32_hppa_link_hash_table): Remove sym_cache.
133 (elf32_hppa_check_relocs): Updated.
134 * elf32-i386.c (elf_i386_tls_transition): Updated.
135 (elf_i386_convert_load_reloc): Likewise.
136 (elf_i386_check_relocs): Likewise.
137 * elf32-m32r.c (elf_m32r_link_hash_table): Removed.
138 (m32r_elf_hash_table): Updated.
139 (m32r_elf_link_hash_table_create): Likewise.
140 (m32r_elf_create_dynamic_sections): Likewise.
141 (m32r_elf_adjust_dynamic_symbol): Likewise.
142 (allocate_dynrelocs): Likewise.
143 (m32r_elf_size_dynamic_sections): Likewise.
144 (m32r_elf_relocate_section): Likewise.
145 (m32r_elf_finish_dynamic_symbol): Likewise.
146 (m32r_elf_check_relocs): Likewise.
147 * elf32-m68hc1x.h (m68hc11_elf_link_hash_table): Remove
149 * elf32-m68k.c (elf_m68k_link_hash_table): Likewise.
150 (elf_m68k_check_relocs): Updated.
151 * elf32-metag.c (elf_metag_link_hash_table): Remove sym_cache.
152 (elf_metag_check_relocs): Updated.
153 * elf32-microblaze.c (elf32_mb_link_hash_table): Remove sym_sec.
154 (microblaze_elf_check_relocs): Updated.
155 * elf32-nds32.c (nds32_elf_link_hash_table_create): Likewise.
156 (nds32_elf_create_dynamic_sections): Likewise.
157 (nds32_elf_adjust_dynamic_symbol): Likewise.
158 (nds32_elf_check_relocs): Likewise.
159 * elf32-nds32.h (elf_nds32_link_hash_table): Remove sdynbss,
160 srelbss and aym_cache.
161 * elf32-nios2.c (elf32_nios2_link_hash_table): Remove sym_cache.
162 (nios2_elf32_check_relocs): Updated.
163 * elf32-or1k.c (elf_or1k_link_hash_table): Remove sym_sec.
164 (or1k_elf_check_relocs): Updated.
165 * elf32-ppc.c (ppc_elf_check_relocs): Remove sym_cache.
166 (ppc_elf_check_relocs): Updated.
167 * elf32-s390.c (elf_s390_link_hash_table): Remove sym_cache.
168 (elf_s390_check_relocs): Updated.
169 (elf_s390_finish_dynamic_sections): Likewise.
170 * elf32-sh.c (elf_sh_link_hash_table): Remove sdynbss, srelbss
172 (sh_elf_create_dynamic_sections): Updated.
173 (sh_elf_adjust_dynamic_symbol): Likewise.
174 (sh_elf_size_dynamic_sections): Likewise.
175 (sh_elf_check_relocs): Likewise.
176 * elf32-tic6x.c (elf32_tic6x_link_hash_table): Remove sym_cache.
177 (elf32_tic6x_check_relocs): Updated.
178 * elf32-tilepro.c (tilepro_elf_link_hash_table): Removed.
179 (tilepro_elf_hash_table): Updated.
180 (tilepro_elf_link_hash_table_create): Likewise.
181 (tilepro_elf_check_relocs): Likewise.
182 (tilepro_elf_adjust_dynamic_symbol): Likewise.
183 (allocate_dynrelocs): Likewise.
184 (tilepro_elf_size_dynamic_sections): Likewise.
185 (tilepro_elf_relocate_section): Likewise.
186 (tilepro_elf_finish_dynamic_symbol): Likewise.
187 (tilepro_finish_dyn): Likewise.
188 (tilepro_elf_finish_dynamic_sections): Likewise.
189 * elf64-ppc.c (ppc_link_hash_table): Remove sym_cache.
190 (ppc64_elf_before_check_relocs): Updated.
191 (ppc64_elf_check_relocs): Likewise.
192 * elf64-s390.c (elf_s390_link_hash_table): Remove sym_cache.
193 (elf_s390_check_relocs): Updated.
194 (elf_s390_relocate_section): Likewise.
195 (elf_s390_finish_dynamic_sections): Likewise.
196 * elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
197 (elf_x86_64_check_relocs): Likewise.
198 * elfnn-aarch64.c (elf_aarch64_link_hash_table): Remove
200 (elfNN_aarch64_check_relocs): Updated.
201 * elfnn-riscv.c (riscv_elf_link_hash_table): Remove sym_cache.
202 (riscv_elf_check_relocs): Updated.
203 * elfxx-mips.c (mips_elf_link_hash_table): Remove sym_cache.
204 (mips_elf_resolve_got_page_ref): Updated.
205 * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
206 * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Remove
208 * elfxx-tilegx.c (tilegx_elf_link_hash_table): Likewise.
209 (tilegx_elf_check_relocs): Updated.
210 * elfxx-x86.h (elf_x86_link_hash_table): Remove sym_cache.
214 * elflink.c (bfd_elf_final_link): Give local symbols a name if
216 * elfxx-mips.c (_bfd_mips_elf_name_local_section_symbols): Only
217 return TRUE if making ET_REL output.
221 * elf-bfd.h (elf_backend_data): Add
222 `elf_backend_elfsym_local_is_section' member.
223 * elfxx-target.h (elf_backend_elfsym_local_is_section): New
225 (elfNN_bed): Add `elf_backend_elfsym_local_is_section' member.
226 * elflink.c (bfd_elf_final_link): Use it to determine whether
227 set the `.symtab' section's `sh_info' value to the index of the
228 first non-local or non-section symbol.
229 * elf32-mips.c (mips_elf32_elfsym_local_is_section): New
231 (elf_backend_elfsym_local_is_section): New macro.
232 * elfn32-mips.c (mips_elf_n32_elfsym_local_is_section): New
234 (elf_backend_elfsym_local_is_section): New macro.
238 * elflink.c (bfd_elf_final_link): Don't segfault on local dynsyms
239 defined in excluded sections.
243 * elf.c (assign_section_numbers): Comment. Don't segfault on
244 discarded sections when setting linked-to section for generic
246 * elflink.c (bfd_elf_match_symbols_in_sections): Allow NULL info.
250 * xcofflink.c (xcoff_need_ldrel_p): Accept --just-symbols symbols and
252 (bfd_xcoff_import_symbol): Don't fuss over absolute symbol
257 * config.bfd: Move xc16x target to the obsolete list.
261 * binary.c (binary_get_section_contents): Seek using offset
262 from section's file position.
266 * elf.c (_bfd_elf_make_section_from_phdr): Remove hack for GDB.
271 * elf32-xtensa.c (removed_literal_compare): Use correct pointer
272 type for the first function argument. Rename pointers to reflect
273 that they have distinct types.
277 * elflink.c (_bfd_elf_gc_keep): Use bfd_is_const_section.
281 * elf64-ppc.c (struct ppc_link_hash_table): Add has_power10_relocs.
282 (select_alt_stub): New function.
283 (ppc_get_stub_entry): Use it here.
284 (ppc64_elf_check_relocs): Set had_power10_relocs rather than
286 (ppc64_elf_size_stubs): Clear power10_stubs here instead. Don't
287 merge notoc stubs with other varieties when power10_stubs is "auto".
288 Instead dup the stub hash table entry.
289 (plt_stub_size, ppc_build_one_stub, ppc_size_one_stub): Adjust
290 tests of power10_stubs.
295 * coffgen.c (_bfd_coff_close_and_cleanup): Free dwarf2 info.
300 * coffgen.c (coff_get_normalized_symtab): Fix off-by-one error in
301 check for aux entries that overflow the buufer.
305 * elf64-mmix.c (mmix_elf_relax_section): Improve accounting for
306 R_MMIX_PUSHJ_STUBBABLE relocs against undefined symbols.
312 * coffgen.c (_bfd_coff_section_already_linked): Allow for plugin
313 objects both before and after normal object files.
314 * elflink.c (_bfd_elf_section_already_linked): Likewise.
318 * elf64-ppc.h (struct ppc64_elf_params): Add power10_stubs.
319 * elf64-ppc.c (struct ppc_link_hash_table): Delete
321 (ppc64_elf_check_relocs): Adjust setting of power10_stubs.
322 (plt_stub_size, ppc_build_one_stub, ppc_size_one_stub): Adjust
323 uses of power10_stubs.
327 * coff-ppc.c: Delete.
330 * Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Remove PE PPC.
331 * coffcode.h (coff_set_arch_mach_hook, coff_set_flags): Remove
333 (coff_write_object_contents): Remove PPC_PE code.
334 * config.bfd: Move powerpcle-pe to removed targets.
335 * configure.ac: Remove powerpc PE entries.
336 * libcoff-in.h (ppc_allocate_toc_section): Delete.
337 (ppc_process_before_allocation): Delete.
338 * peXXigen.c: Remove POWERPC_LE_PE code and comments.
339 * targets.c: Remove powerpc PE vectors.
340 * po/SRC-POTFILES.in: Regenerate.
341 * libcoff.h: Regenerate.
342 * Makefile.in: Regenerate.
343 * configure: Regenerate.
347 * po/fr.po: Updated French translation.
351 * xcofflink.c (xcoff_mark): Don't mark const sections.
352 (bfd_xcoff_record_link_assignment): Add FIXME.
353 (_bfd_xcoff_bfd_final_link): Don't segfault on assorted magic
354 sections being discarded by linker script.
358 * coff-rs6000.c (xcoff_write_archive_contents_old): Set default
359 time, uid, gid and mode for deterministic archive.
360 (xcoff_write_archive_contents_big): Likewise.
364 * coffcode.h (coff_classify_symbol): Handle C_HIDEXT and
369 * po/pt.po: Updated Portuguese translation.
370 * po/uk.po: Updated Ukranian translation.
374 * version.m4: Set version to 2.35.50.
375 * configure: Regenerate.
376 * po/bbfd.pot: Regenerate.
380 Binutils 2.35 branch created.
385 * coffgen.c (coff_find_nearest_line_with_names): Sanity check
386 raw syment index before dereferencing.
390 * elf32-i386.c (elf_backend_object_p): Undef for vxworks.
394 * config.bfd: Obsolete xc16x.
398 * archures.c (bfd_mach_i386_nacl): Removed.
399 (bfd_mach_i386_i386_nacl): Likewise.
400 (bfd_mach_x86_64_nacl): Likewise.
401 (bfd_mach_x64_32_nacl): Likewise.
402 * config.bfd: Remove *-*-nacl* targets.
403 * configure.ac: Remove x86 NaCl target vectors.
404 * cpu-i386.c (bfd_arch_i386_onebyte_nop_fill): Removed.
405 (bfd_x64_32_nacl_arch): Likewise.
406 (bfd_x86_64_nacl_arch): Likewise.
407 (bfd_i386_nacl_arch): Likewise.
408 (bfd_x64_32_arch_intel_syntax): Updated.
409 * elf32-i386.c: Don't include "elf-nacl.h".
410 (elf_i386_nacl_plt): Removed.
411 (elf_i386_nacl_plt0_entry): Likewise.
412 (elf_i386_nacl_plt_entry): Likewise.
413 (elf_i386_nacl_pic_plt0_entry): Likewise.
414 (elf_i386_nacl_pic_plt_entry): Likewise.
415 (elf_i386_nacl_eh_frame_plt): Likewise.
416 (elf_i386_nacl_plt): Likewise.
417 (elf32_i386_nacl_elf_object_p): Likewise.
418 (elf_i386_get_synthetic_symtab): Updated.
419 (elf_i386_link_setup_gnu_properties): Likewise.
420 * elf64-x86-64.c: Don't include "elf-nacl.h".
421 (elf_x86_64_nacl_plt): Removed.
422 (elf64_x86_64_nacl_elf_object_p): Likewise.
423 (elf_x86_64_nacl_plt0_entry): Likewise.
424 (elf_x86_64_nacl_plt_entry): Likewise.
425 (elf_x86_64_nacl_eh_frame_plt): Likewise.
426 (elf_x86_64_nacl_plt): Likewise.
427 (elf32_x86_64_nacl_elf_object_p): Likewise.
428 (elf_x86_64_get_synthetic_symtab): Updated.
429 (elf_x86_64_link_setup_gnu_properties): Likewise.
430 * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Likewise.
431 * targets.c: Remove x86 NaCl target vectors.
432 * bfd-in2.h: Regenerated.
433 * configure: Likewise.
437 * elf32-tic6x.c (elf32_tic6x_size_dynamic_sections): Call
438 _bfd_elf_add_dynamic_tags.
442 * peXXigen.c (_bfd_XXi_slurp_codeview_record): Properly check
443 return value of bfd_bread. Don't read more than requested length.
444 Sanity check length. Properly terminate file name.
448 * arc-got.h: Use C style comments.
449 * coff-z80.c: Likewise.
450 * elf32-csky.c: Likewise.
451 * peXXigen.c: Likewise.
452 * elf32-m32c.c (m32c_elf_relax_delete_bytes): Remove commented out
457 * elf32-m68k.c (m68k_elf_merge_obj_attributes): New function.
458 (elf32_m68k_merge_private_bfd_data): Merge GNU attributes.
462 * elfxx-riscv.c (struct priv_spec_t, priv_specs),
463 (riscv_get_priv_spec_class, riscv_get_priv_spec_class_from_numbers),
464 (riscv_get_priv_spec_name): Move to..
465 * cpu-riscv.c: ..here.
466 (riscv_get_priv_spec_class_from_numbers): Don't xmalloc temp buffer.
467 Use %u to print unsigned numbers.
471 * cpu-riscv.c (riscv_scan): Don't allow shorter matches using the
472 default architecture.
477 * elf32-csky.c (csky_elf_size_dynamic_sections): Call
478 _bfd_elf_add_dynamic_tags.
483 * elf32-cris.c (elf_cris_size_dynamic_sections): Call
484 _bfd_elf_add_dynamic_tags.
488 * vms-alpha.c (_bfd_vms_slurp_etir <ETIR__C_OPR_ASH>): Implement
489 shifts without undefined behaviour.
493 * elf-bfd.h (elf_link_hash_table): Add dt_pltgot_required and
495 (_bfd_elf_add_dynamic_tags): New.
496 * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Call
497 _bfd_elf_add_dynamic_tags.
498 * elf32-arc.c (elf_arc_size_dynamic_sections): Likewise.
499 * elf32-bfin.c (elf32_bfinfdpic_size_dynamic_sections): Likewise.
500 * elf32-cr16.c (_bfd_cr16_elf_size_dynamic_sections): Likewise.
501 * elf32-frv.c (elf32_frvfdpic_size_dynamic_sections): Likewise.
502 * elf32-lm32.c (lm32_elf_size_dynamic_sections): Likewise.
503 * elf32-m32r.c (m32r_elf_size_dynamic_sections): Likewise.
504 * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
505 * elf32-microblaze.c (microblaze_elf_size_dynamic_sections):
507 * elf32-nds32.c (nds32_elf_size_dynamic_sections): Likewise.
508 * elf32-nios2.c (nios2_elf32_size_dynamic_sections): Likewise.
509 * elf32-or1k.c (or1k_elf_size_dynamic_sections): Likewise.
510 * elf32-s390.c (elf_s390_size_dynamic_sections): Likewise.
511 * elf32-tilepro.c (tilepro_elf_size_dynamic_sections): Likewise.
512 * elf32-vax.c (elf_vax_size_dynamic_sections): Likewise.
513 * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
514 * elf64-s390.c (elf_s390_size_dynamic_sections): Likewise.
515 * elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections):
517 * elfnn-riscv.c (riscv_elf_size_dynamic_sections): Likewise.
518 * elfxx-tilegx.c (tilegx_elf_size_dynamic_sections): Likewise.
519 * elf32-arm.c (elf32_arm_size_dynamic_sections): Call
520 _bfd_elf_maybe_vxworks_add_dynamic_tags.
521 * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
522 * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections):
524 * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Likewise.
525 (_bfd_x86_elf_size_dynamic_sections): Likewise.
526 * elfxx-x86.h (elf_x86_link_hash_table): Remove dt_reloc,
527 dt_reloc_sz and dt_reloc_ent.
528 * elf-vxworks.c (_bfd_elf_maybe_vxworks_add_dynamic_tags): New.
529 * elf-vxworks.h (_bfd_elf_maybe_vxworks_add_dynamic_tags):
531 * elf32-hppa.c (elf32_hppa_link_hash_table_create): Set
532 etab.dt_pltgot_required.
533 (elf32_hppa_size_dynamic_sections): Call
534 _bfd_elf_add_dynamic_tags.
535 * elf32-metag.c (elf_metag_link_hash_table_create): Set
536 etab.dt_pltgot_required.
537 (elf_metag_size_dynamic_sections): Call _bfd_elf_add_dynamic_tags.
538 * elf32-sh.c (sh_elf_link_hash_table_create): Set
539 root.dt_pltgot_required for FDPIC output.
540 (sh_elf_size_dynamic_sections): Call
541 _bfd_elf_maybe_vxworks_add_dynamic_tags.
542 * elf32-xtensa.c (elf_xtensa_link_hash_table_create): Set
543 elf.dt_pltgot_required.
544 (elf_xtensa_size_dynamic_sections): Call
545 _bfd_elf_add_dynamic_tags.
546 * elf64-hppa.c (elf64_hppa_hash_table_create): Set
547 root.dt_pltgot_required.
548 (elf64_hppa_size_dynamic_sections): Call
549 _bfd_elf_add_dynamic_tags.
550 * elfnn-ia64.c (elfNN_ia64_hash_table_create): Set
551 root.dt_pltgot_required.
552 (elfNN_ia64_size_dynamic_sections): Set root.dt_jmprel_required
553 for rel_pltoff_sec. Call _bfd_elf_add_dynamic_tags.
554 * elflink.c (_bfd_elf_add_dynamic_tags): New.
558 * mach-o.c: Support the new load commands by reading a linkedit
559 data command for them.
563 * elfxx-riscv.c (struct priv_spec_t priv_specs[]): Move them from
564 opcodes/riscv-opc.c to bfd/elfxx-riscv.c, since we need it in linker.
565 (riscv_get_priv_spec_class): Likewise.
566 (riscv_get_priv_spec_name): Likewise.
567 (riscv_get_priv_spec_class_from_numbers): New function, convert
568 the version numbers into string, then call riscv_get_priv_spec_class
569 to get the priv spec class.
570 * elfxx-riscv.h (riscv_get_priv_spec_class): Move forward declaration
571 from include/opcode/riscv.h to bfd/elfxx-riscv.h.
572 (riscv_get_priv_spec_name): Likewise.
573 (riscv_get_priv_spec_class_from_numbers): New forward declaration.
574 (opcode/riscv.h): Include it in the header rather than elfxx-riscv.c.
575 * elfnn-riscv.c (riscv_merge_attributes): Get the priv spec classes
576 of input and output objects form their priv spec attributes by
577 riscv_get_priv_spec_class_from_numbers. Report warning rather than
578 errors when linking objects with differnet priv spec versions. We do
579 know v1.9.1 may have conflicts to other versions, so report the
580 warning, too. After that, update the output priv spec version to the
585 * elfnn-riscv.c (riscv_merge_attributes): Once we meet one of the
586 priv attributes, we will check the conflicts for all of them (major,
587 minor and revision), and then set the priv_attrs_merged to TRUE to
588 indicate that we have handled all of the priv attributes. Remove
589 the unused boolean priv_may_conflict, in_priv_zero and out_priv_zero.
594 * configure.ac: Disable plugins by default for some targets.
595 * plugin.c: Comment typo fix.
596 * configure: Regenerate.
600 * plugin.c (try_load_plugin): Suppress the error message about
601 being unable to open a plugin if creating a list of viable
606 * aout-tic30.c: Delete file.
607 * Makefile.am (BFD32_BACKENDS): Remove aout-tic30.lo.
608 (BFD32_BACKENDS_CFILES): Remove aout-tic30.c.
609 * config.bfd (c30-*-*aout*, tic30-*-*aout*): Remove entry.
610 (xc16x-*-elf): Sort properly.
611 * configure.ac: Remove tic30_aout_vec.
612 * targets.c: Likewise.
613 * Makefile.in: Regenerate.
614 * configure: Regenerate.
615 * po/SRC-POTFILES.in: Regenerate.
619 * elf32-xtensa.c (XSHAL_ABI, XTHAL_ABI_UNDEFINED)
620 (XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): New macros.
621 (elf32xtensa_abi): New global variable.
622 (xtensa_abi_choice): New function.
623 (elf_xtensa_create_plt_entry): Use xtensa_abi_choice instead of
624 XSHAL_ABI to select PLT code.
628 * elflink.c (bfd_elf_define_start_stop): Use start_stop_visibility
629 field of bfd_link_info.
633 * config.bfd: Obsolete powerpcle-*-pe targets.
638 * elflink.c (elf_link_add_archive_symbols): Exclude undefined
639 symbols that were defined in discarded sections.
640 * cofflink.c (coff_link_check_archive_element): Likewise.
641 (coff_link_add_symbols): Set indx to -3 for symbols defined in
643 (_bfd_coff_write_global_sym): Don't emit such symbols.
644 libcoff-in.h (struct coff_link_hash_entry): Update indx comment.
645 libcoff.h: Regenerate.
650 * pdp11.c (is_stab): Replace legacy "index" function with "strchr".
654 * elfnn-ia64.c (elfNN_ia64_link_hash_table): Remove reltext.
655 (allocate_dynrel_entries): Set DF_TEXTREL instead of reltext.
656 (elfNN_ia64_size_dynamic_sections): Check DF_TEXTREL instead
662 * elflink.c (bfd_elf_define_start_stop): Handle common symbols.
663 Clear verinfo.verdef.
668 * elf-bfd.h (elf_link_hash_table): Add ifunc_resolvers.
669 (_bfd_elf_allocate_ifunc_dyn_relocs): Remove the
670 bfd_boolean * argument. Set ifunc_resolvers if there are IFUNC
672 * elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Updated.
673 Set ifunc_resolvers if there are FUNC resolvers.
674 * elf64-ppc.c (ppc_link_hash_table): Remove local_ifunc_resolver.
675 (build_global_entry_stubs_and_plt): Replace local_ifunc_resolver
676 with elf.ifunc_resolvers.
677 (write_plt_relocs_for_local_syms): Likewise.
678 (ppc64_elf_relocate_section): Likewise.
679 (ppc64_elf_finish_dynamic_sections): Likewise.
680 * elfnn-aarch64.c (elfNN_aarch64_allocate_ifunc_dynrelocs):
682 * elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise.
683 (_bfd_x86_elf_size_dynamic_sections): Check elf.ifunc_resolvers
684 instead of readonly_dynrelocs_against_ifunc.
685 * elfxx-x86.h (elf_x86_link_hash_table): Remove
686 readonly_dynrelocs_against_ifunc.
690 * elf64-ppc.c (struct ppc_link_hash_table): Delete
691 maybe_local_ifunc_resolver field.
692 (build_global_entry_stubs_and_plt): Set local_ifunc_resolver in
693 cases where maybe_local_ifunc_resolver was set.
694 (ppc64_elf_relocate_section): Likewise.
695 (ppc64_elf_finish_dynamic_sections): Downgrade ifunc with textrel
700 * elf-bfd.h (elf_link_hash_entry): Add tlsdesc_plt and
702 * elf32-arm.c (elf32_arm_link_hash_table): Remove tlsdesc_plt
704 (elf32_arm_size_dynamic_sections): Updated. Clear
705 root.tlsdesc_plt for DF_BIND_NOW.
706 (elf32_arm_finish_dynamic_sections): Updated.
707 (elf32_arm_output_arch_local_syms): Likewise.
708 * elf32-nds32.c (nds32_elf_size_dynamic_sections): Updated.
709 Clear root.tlsdesc_plt for DF_BIND_NOW.
710 (nds32_elf_finish_dynamic_sections): Updated.
711 * elf32-nds32.h (elf_nds32_link_hash_table): Remove
712 dt_tlsdesc_plt and dt_tlsdesc_got.
713 * elf64-x86-64.c (elf_x86_64_finish_dynamic_sections): Updated.
714 * elfnn-aarch64.c (elf_aarch64_link_hash_table): Remove
715 tlsdesc_plt and dt_tlsdesc_got.
716 (elfNN_aarch64_allocate_dynrelocs): Updated.
717 (elfNN_aarch64_finish_dynamic_sections): Likewise.
718 (elfNN_aarch64_size_dynamic_sections): Updated. Clear
719 root.tlsdesc_plt for DF_BIND_NOW. Don't check DF_BIND_NOW
721 * elfxx-x86.c (elf_x86_allocate_dynrelocs): Updated.
722 (_bfd_x86_elf_size_dynamic_sections): Likewise.
723 (_bfd_x86_elf_finish_dynamic_sections): Likewise.
724 * elfxx-x86.h (elf_x86_link_hash_table): Remove tlsdesc_plt and
729 * elf32-tic6x.c (elf32_bed): Defined the default to
734 * elf64-hppa.c (elf64_hppa_link_hash_table): Remove plt_sec and
736 (elf64_hppa_check_relocs): Replace plt_sec/plt_rel_sec with
737 root.splt/root.srelplt.
738 (elf64_hppa_create_dynamic_sections): Likewise.
739 (elf64_hppa_size_dynamic_sections): Likewise.
740 (elf64_hppa_finish_dynamic_symbol): Likewise.
741 (elf_hppa_final_link): Likewise.
742 (elf_hppa_final_link_relocate): Likewise.
746 * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Updated.
747 * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Remove
752 * elf-bfd.h (elf_target_os): New.
753 (elf_link_hash_table): Add target_os.
754 (elf_backend_data): Add target_os.
755 * elf32-arm.c (elf32_arm_link_hash_table): Remove vxworks_p,
756 symbian_p and nacl_p.
757 (create_got_section): Updated.
758 (elf32_arm_create_dynamic_sections): Likewise.
759 (arm_type_of_stub): Likewise.
760 (elf32_arm_create_or_find_stub_sec): Likewise.
761 (elf32_arm_allocate_plt_entry): Likewise.
762 (elf32_arm_populate_plt_entry): Likewise.
763 (elf32_arm_final_link_relocate): Likewise.
764 (elf32_arm_check_relocs): Likewise.
765 (allocate_dynrelocs_for_symbol): Likewise.
766 (elf32_arm_finish_dynamic_symbol): Likewise.
767 (elf32_arm_finish_dynamic_sections): Likewise.
768 (elf32_arm_output_plt_map_1): Likewise.
769 (elf32_arm_output_arch_local_syms): Likewise.
770 (elf32_arm_add_symbol_hook): Likewise.
771 (elf32_arm_nacl_link_hash_table_create): Likewise.
772 (elf32_arm_vxworks_link_hash_table_create): Likewise.
773 (elf32_arm_symbian_link_hash_table_create): Likewise.
774 (ELF_TARGET_OS): New.
775 * elf32-i386.c (elf_i386_arch_bed): Removed.
776 (elf_backend_arch_data): Likewise.
777 (elf_i386_solaris_arch_bed): Likewise.
778 (elf_i386_nacl_arch_bed): Likewise.
779 (elf_i386_vxworks_arch_bed): Likewise.
780 (elf_i386_relocate_section): Updated.
781 (elf_i386_finish_dynamic_sections): Likewise.
782 (elf_i386_get_synthetic_symtab): Likewise.
783 (elf_i386_link_setup_gnu_properties): Likewise.
784 (ELF_TARGET_OS): New.
785 * elf32-mips.c (ELF_TARGET_OS): New.
786 * elf32-ppc.c (ppc_elf_link_hash_table): Remove is_vxworks.
787 (ppc_elf_create_got): Updated.
788 (ppc_elf_create_dynamic_sections): Likewise.
789 (ppc_elf_check_relocs): Likewise.
790 (ppc_elf_adjust_dynamic_symbol): Likewise.
791 (ppc_elf_size_dynamic_sections): Likewise.
792 (ppc_elf_relocate_section): Likewise.
793 (ppc_elf_finish_dynamic_sections): Likewise.
794 (ppc_elf_vxworks_link_hash_table_create): Likewise.
795 (ELF_TARGET_OS): New.
796 * elf32-sh.c (elf_sh_link_hash_table): Remove vxworks_p.
797 (sh_elf_link_hash_table_create): Updated.
798 (sh_elf_create_dynamic_sections): Likewise.
799 (allocate_dynrelocs): Likewise.
800 (sh_elf_size_dynamic_sections): Likewise.
801 (sh_elf_relocate_section): Likewise.
802 (sh_elf_finish_dynamic_symbol): Likewise.
803 (sh_elf_finish_dynamic_sections): Likewise.
804 (ELF_TARGET_OS): New.
805 * elf32-sparc.c (elf32_sparc_vxworks_link_hash_table_create):
807 (bfd_elf32_bfd_link_hash_table_create): Likewise.
808 (ELF_TARGET_OS): New.
809 * elf64-x86-64.c (elf_x86_64_arch_bed): Removed.
810 (elf_x86_64_solaris_arch_bed): Likewise.
811 (elf_x86_64_nacl_arch_bed): Likewise.
812 (elf_x86_64_finish_dynamic_sections): Updated.
813 (elf_x86_64_get_synthetic_symtab): Likewise.
814 (elf_x86_64_link_setup_gnu_properties): Likewise.
815 (ELF_TARGET_OS): New.
816 * elflink.c (_bfd_elf_link_hash_table_init): Initialize
818 * elfxx-mips.c (mips_elf_link_hash_table): Remove is_vxworks.
819 (MIPS_ELF_REL_DYN_NAME): Updated.
820 (ELF_MIPS_GP_OFFSET): Likewise.
821 (mips_elf_create_local_got_entry): Likewise.
822 (mips_elf_allocate_dynamic_relocations): Likewise.
823 (mips_elf_count_got_symbols): Likewise.
824 (is_gott_symbol): Likewise.
825 (mips_elf_calculate_relocation): Likewise.
826 (mips_elf_create_dynamic_relocation): Likewise.
827 (_bfd_mips_elf_check_relocs): Likewise.
828 (allocate_dynrelocs): Likewise.
829 (_bfd_mips_elf_adjust_dynamic_symbol): Likewise.
830 (mips_elf_lay_out_got): Likewise.
831 (mips_elf_set_plt_sym_value): Likewise.
832 (_bfd_mips_elf_size_dynamic_sections): Likewise.
833 (_bfd_mips_elf_finish_dynamic_symbol): Likewise.
834 (_bfd_mips_elf_finish_dynamic_sections): Likewise.
835 (_bfd_mips_elf_final_link): Likewise.
836 (_bfd_mips_init_file_header): Likewise.
837 * elfxx-sparc.c (_bfd_sparc_elf_create_dynamic_sections):
839 (allocate_dynrelocs): Likewise.
840 (_bfd_sparc_elf_size_dynamic_sections): Likewise.
841 (_bfd_sparc_elf_relocate_section): Likewise.
842 (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
843 (sparc_finish_dyn): Likewise.
844 (_bfd_sparc_elf_finish_dynamic_sections): Likewise.
845 * elfxx-target.h (ELF_TARGET_OS): New.
846 (elfNN_bed): Add ELF_TARGET_OS.
847 * elfxx-x86.c (elf_x86_allocate_dynrelocs): Updated.
848 (_bfd_x86_elf_link_hash_table_create): Likewise.
849 (_bfd_x86_elf_size_dynamic_sections): Likewise.
850 (_bfd_x86_elf_finish_dynamic_sections): Likewise.
851 (_bfd_x86_elf_adjust_dynamic_symbol): Likewise.
852 (_bfd_x86_elf_link_setup_gnu_properties): Likewise.
853 * elfxx-x86.h (elf_x86_target_os): Removed.
854 (elf_x86_backend_data): Likewise.
855 (get_elf_x86_backend_data): Likewise.
856 (elf_x86_link_hash_table): Remove target_os.
861 BFD_RELOC_PPC64_GOT_TLSGD34 to BFD_RELOC_PPC64_GOT_TLSGD_PCREL34,
862 BFD_RELOC_PPC64_GOT_TLSLD34 to BFD_RELOC_PPC64_GOT_TLSLD_PCREL34,
863 BFD_RELOC_PPC64_GOT_TPREL34 to BFD_RELOC_PPC64_GOT_TPREL_PCREL34,
864 BFD_RELOC_PPC64_GOT_DTPREL34 to BFD_RELOC_PPC64_GOT_DTPREL_PCREL34.
865 * elf64-ppc.c: Update throughout for reloc renaming.
866 (ppc64_elf_reloc_name_lookup): Handle old reloc names.
867 * libbfd.h: Regenerate.
868 * bfd-in2.h: Regenerate.
873 * elf32-bfin.c (bfinfdpic_relocate_section): Skip non SEC_ALLOC
878 * pdp11.c (aout_link_add_symbols): Fix use before initialisation
883 * elfnn-riscv.c (riscv_merge_attributes): Add new boolean
884 priv_may_conflict, in_priv_zero and out_priv_zero to decide
885 whether the object can be linked according to it's priv
886 attributes. The object without any priv spec attributes can
887 be linked with others. If the first input object doesn't contain
888 any priv attributes, then we need to copy the setting from the
889 next input one. Also report more detailed error messages to user.
893 Extend pdp11-aout symbol table format to accommodate .stab
894 symbols and implement correct handling of them.
896 * pdp11.c (pdp11_external_nlist): Repurposed e_unused to e_desc.
897 (N_STAB, is_stab): Needed new function is_stab to disambiguate
898 normal vs. .stab symbol table type values, replacing N_STAB mask.
899 (translate_from_native_sym_flags): Determine correct section for
900 different .stab types.
901 (translate_to_native_sym_flags): Leave .stab types intact.
902 (translate_symbol_table): Error if symbol indicates overlay;
903 store desc field from .stab symbols.
904 (write_syms): Output desc field with symbol.
905 (aout_link_check_ar_symbols): Skip .stab symbols.
906 (aout_link_add_symbols): Correctly distinguish .stab symbols.
907 (aout_link_write_other_symbol): Write 0 for desk and ovly fields.
908 (aout_link_write_symbols): Write 0 for desk and ovly fields;
909 correctly distinguish .stab symbols and select calculate their
910 section and value; and copy desc and ovly fields from input symbol
915 * aoutx.h (translate_symbol_table): Comment had external and
917 * pdp11.c (translate_symbol_table): Likewise.
921 * elfxx-x86.h (elf_x86_link_hash_table): Remove target_id.
922 (is_x86_elf): Check elf.hash_table_id instead of target_id.
923 * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Updated.
928 * elf-m10300.c (mn10300_elf_relocate_section): Resolve relocation
929 in debug section against symbol defined in shared library to 0.
930 * elf32-i386.c (elf_i386_check_relocs): Remove SEC_ALLOC check.
931 * elf32-lm32.c (lm32_elf_check_relocs): Likewise.
932 * elf32-m32r.c (m32r_elf_check_relocs): Likewise.
933 * elf32-nds32.c (nds32_elf_check_relocs): Likewise.
934 * elf32-nios2.c (nios2_elf32_check_relocs): Likewise.
935 * elf32-or1k.c (or1k_elf_check_relocs): Likewise.
936 * elf32-ppc.c (ppc_elf_check_relocs): Likewise.
937 * elf32-sh.c (sh_elf_check_relocs): Likewise.
938 * elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
939 * elf64-alpha.c (elf64_alpha_check_relocs): Likewise.
940 * elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
941 * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
942 * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
943 * elf32-vax.c (elf_vax_check_relocs): Set non_got_ref for non-GOT
945 (elf_vax_adjust_dynamic_symbol): Generate a copy reloc only if
946 there is non-GOT reference.
947 * elflink.c (_bfd_elf_link_check_relocs): Skip non-loaded,
948 non-alloced sections.
952 Copy several years of fixes from bfd/aoutx.h to bfd/pdp11.c.
954 * pdp11.c (some_aout_object_p): 4c1534c7a2a - Don't set EXEC_P for
956 (aout_get_external_symbols): 6b8f0fd579d - Return if count is zero.
957 0301ce1486b PR 22306 - Handle stringsize of zero, and error for any
958 other size that doesn't qcover the header word.
959 bf82069dce1 PR 23056 - Allocate an extra byte at the end of the
960 string table, and zero it.
961 (translate_symbol_table): 0d329c0a83a PR 22887 - Print an error
962 message and set bfd_error on finding an invalid name string offset.
963 (add_to_stringtab): INLINE -> inline
964 (pdp11_aout_swap_reloc_in): 116acb2c268 PR 22887 - Correct r_index
966 (squirt_out_relocs): e2996cc315d PR 20921 - Check for and report
967 any relocs that could not be recognised.
968 92744f05809 PR 20929 - Check for relocs without an associated symbol.
969 (find_nearest_line): 808346fcfcf PR 23055 - Check that the symbol
970 name exists and is long enough, before attempting to see if it is
972 c3864421222 - Correct case for N_SO being the last symbol.
973 50455f1ab29 PR 20891 - Handle the case where the main file name
974 and the directory name are both empty.
975 e82ab856bb4 PR 20892 - Handle the case where function name is empty.
976 (aout_link_add_symbols): e517df3dbf7 PR 19629 - Check for out of
977 range string table offsets.
978 531336e3a0b PR 20909 - Fix off-by-one error in check for an
979 illegal string offset.
980 (aout_link_includes_newfunc): Add comment.
981 (pdp11_aout_link_input_section): ad756e3f9e6 - Return with an error
982 on unexpected relocation type rather than ASSERT.
987 * elf32-nios2.c (nios2_elf32_size_dynamic_sections): Call
988 _bfd_elf_maybe_set_textrel to set DF_TEXTREL.
993 * elf32-nios2.c (nios2_elf32_check_relocs): Skip non-loaded,
994 non-alloced sections.
998 * elf32-frv.c (elf32_frv_relocate_section): Don't generate
999 dynamic relocations for non SEC_ALLOC sections.
1003 * aout64.c (BMAGIC, QMAGIC): Do not define.
1004 * aoutx.h (N_IS_BMAGIC, N_SET_QMAGIC): New defines.
1005 (NAME (aout, some_aout_object_p)): Use N_IS_QMAGIC and N_IS_BMAGIC
1006 to check the file format.
1007 (adjust_z_magic): Use N_SET_QMAGIC to set file format.
1008 * i386aout.c (NO_WRITE_HEADER_KLUDGE): Delete define.
1009 * libaout.h (NO_WRITE_HEADER_KLUDGE): Do not define.
1013 * elf32-arc.c (elf_arc_relocate_section): Don't generate dynamic
1014 relocations for non SEC_ALLOC sections.
1018 * elf-bfd.h (_bfd_elf_maybe_set_textrel): New
1019 * elf32-arm.c (maybe_set_textrel): Removed.
1020 (elf32_arm_size_dynamic_sections): Replace maybe_set_textrel
1021 with _bfd_elf_maybe_set_textrel.
1022 * elf32-csky.c (maybe_set_textrel): Removed.
1023 (csky_elf_size_dynamic_sections): Replace maybe_set_textrel
1024 with _bfd_elf_maybe_set_textrel.
1025 * elf32-hppa.c (maybe_set_textrel): Removed.
1026 (elf32_hppa_size_dynamic_sections): Replace maybe_set_textrel
1027 with _bfd_elf_maybe_set_textrel.
1028 * elf32-lm32.c (maybe_set_textrel): Removed.
1029 (lm32_elf_size_dynamic_sections): Replace maybe_set_textrel
1030 with _bfd_elf_maybe_set_textrel.
1031 * elf32-m32r.c (maybe_set_textrel): Removed.
1032 (m32r_elf_size_dynamic_sections): Replace maybe_set_textrel
1033 with _bfd_elf_maybe_set_textrel.
1034 * elf32-metag.c (maybe_set_textrel): Removed.
1035 (elf_metag_size_dynamic_sections): Replace maybe_set_textrel
1036 with _bfd_elf_maybe_set_textrel.
1037 * elf32-nds32.c (maybe_set_textrel): Removed.
1038 (nds32_elf_size_dynamic_sections): Replace maybe_set_textrel
1039 with _bfd_elf_maybe_set_textrel.
1040 * elf32-or1k.c (maybe_set_textrel): Removed.
1041 (or1k_elf_size_dynamic_sections): Replace maybe_set_textrel
1042 with _bfd_elf_maybe_set_textrel.
1043 * elf32-ppc.c (maybe_set_textrel): Removed.
1044 (ppc_elf_size_dynamic_sections): Replace maybe_set_textrel
1045 with _bfd_elf_maybe_set_textrel.
1046 * elf32-s390.c (maybe_set_textrel): Removed.
1047 (elf_s390_size_dynamic_sections): Replace maybe_set_textrel
1048 with _bfd_elf_maybe_set_textrel.
1049 * elf32-sh.c (maybe_set_textrel): Removed.
1050 (sh_elf_size_dynamic_sections): Replace maybe_set_textrel
1051 with _bfd_elf_maybe_set_textrel.
1052 * elf32-tic6x.c (maybe_set_textrel): Removed.
1053 (elf32_tic6x_size_dynamic_sections): Replace maybe_set_textrel
1054 with _bfd_elf_maybe_set_textrel.
1055 * elf32-tilepro.c (maybe_set_textrel): Removed.
1056 (tilepro_elf_size_dynamic_sections): Replace maybe_set_textrel
1057 with _bfd_elf_maybe_set_textrel.
1058 * elf64-ppc.c (maybe_set_textrel): Removed.
1059 (ppc64_elf_size_dynamic_sections): Replace maybe_set_textrel
1060 with _bfd_elf_maybe_set_textrel.
1061 * elf64-s390.c (maybe_set_textrel): Removed.
1062 (elf_s390_size_dynamic_sections): Replace maybe_set_textrel
1063 with _bfd_elf_maybe_set_textrel.
1064 * elfnn-aarch64.c (maybe_set_textrel): Removed.
1065 (elfNN_aarch64_size_dynamic_sections): Replace maybe_set_textrel
1066 with _bfd_elf_maybe_set_textrel.
1067 * elfnn-riscv.c (maybe_set_textrel): Removed.
1068 (riscv_elf_size_dynamic_sections): Replace maybe_set_textrel
1069 with _bfd_elf_maybe_set_textrel.
1070 * elfxx-sparc.c (maybe_set_textrel): Removed.
1071 (_bfd_sparc_elf_size_dynamic_sections): Replace maybe_set_textrel
1072 with _bfd_elf_maybe_set_textrel.
1073 * elfxx-tilegx.c (maybe_set_textrel): Removed.
1074 (tilegx_elf_size_dynamic_sections): Replace maybe_set_textrel
1075 with _bfd_elf_maybe_set_textrel.
1076 * elfxx-x86.c (maybe_set_textrel): Removed.
1077 (_bfd_x86_elf_size_dynamic_sections): Replace maybe_set_textrel
1078 with _bfd_elf_maybe_set_textrel.
1079 * elflink.c (_bfd_elf_maybe_set_textrel): New.
1084 * elf32-arm.c (elf32_arm_copy_indirect_symbol): Don't copy
1086 * elf32-csky.c (csky_elf_copy_indirect_symbol): Likewise.
1087 * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Likewise.
1088 * elf32-metag.c (elf_metag_copy_indirect_symbol): Likewise.
1089 * elf32-microblaze.c (microblaze_elf_copy_indirect_symbol):
1091 * elf32-nds32.c (nds32_elf_copy_indirect_symbol): Likewise.
1092 * elf32-nios2.c (nios2_elf32_copy_indirect_symbol): Likewise.
1093 * elf32-or1k.c (or1k_elf_copy_indirect_symbol): Likewise.
1094 * elf32-s390.c (elf_s390_copy_indirect_symbol): Likewise.
1095 * elf32-sh.c (sh_elf_copy_indirect_symbol): Likewise.
1096 * elf32-tilepro.c (tilepro_elf_copy_indirect_symbol): Likewise.
1097 * elf64-s390.c (elf_s390_copy_indirect_symbol): Likewise.
1098 * elfnn-aarch64.c (elfNN_aarch64_copy_indirect_symbol): Likewise.
1099 * elfnn-riscv.c (riscv_elf_copy_indirect_symbol): Likewise.
1100 * elfxx-sparc.c (_bfd_sparc_elf_copy_indirect_symbol): Likewise.
1101 * elfxx-tilegx.c (tilegx_elf_copy_indirect_symbol): Likewise.
1102 * elfxx-x86.c (_bfd_x86_elf_copy_indirect_symbol): Likewise.
1103 * elf32-lm32.c (lm32_elf_copy_indirect_symbol): Removed.
1104 (elf_backend_copy_indirect_symbol): Likewise.
1105 * elf32-m32r.c (m32r_elf_copy_indirect_symbol): Removed.
1106 (elf_backend_copy_indirect_symbol): Likewise.
1107 * elflink.c (_bfd_elf_link_hash_copy_indirect): Copy dyn_relocs.
1112 * elf-bfd.h (_bfd_elf_readonly_dynrelocs): New.
1113 * elf32-arm.c (readonly_dynrelocs): Removed.
1114 (maybe_set_textrel): Replace readonly_dynrelocs with
1115 _bfd_elf_readonly_dynrelocs.
1116 * elf32-csky.c (readonly_dynrelocs): Removed.
1117 (maybe_set_textrel): Replace readonly_dynrelocs with
1118 _bfd_elf_readonly_dynrelocs.
1119 * elf32-hppa.c(readonly_dynrelocs): Removed.
1120 (alias_readonly_dynrelocs): Replace readonly_dynrelocs with
1121 _bfd_elf_readonly_dynrelocs.
1122 (maybe_set_textrel): Likewise.
1123 * elf32-lm32.c (readonly_dynrelocs): Removed.
1124 (lm32_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1125 with _bfd_elf_readonly_dynrelocs.
1126 (maybe_set_textrel): Likewise.
1127 * elf32-m32r.c (readonly_dynrelocs): Removed.
1128 (m32r_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1129 with _bfd_elf_readonly_dynrelocs.
1130 (maybe_set_textrel): Likewise.
1131 * elf32-metag.c (readonly_dynrelocs): Removed.
1132 (elf_metag_adjust_dynamic_symbol): Replace readonly_dynrelocs
1133 with _bfd_elf_readonly_dynrelocs.
1134 (maybe_set_textrel): Likewise.
1135 * elf32-microblaze.c (readonly_dynrelocs): Removed.
1136 (microblaze_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1137 with _bfd_elf_readonly_dynrelocs.
1138 * elf32-nds32.c (readonly_dynrelocs): Removed.
1139 (nds32_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1140 with _bfd_elf_readonly_dynrelocs.
1141 (maybe_set_textrel): Likewise.
1142 * elf32-or1k.c (readonly_dynrelocs): Removed.
1143 (or1k_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1144 with _bfd_elf_readonly_dynrelocs.
1145 * elf32-ppc.c (readonly_dynrelocs): Removed.
1146 (alias_readonly_dynrelocs): Replace readonly_dynrelocs with
1147 _bfd_elf_readonly_dynrelocs.
1148 (ppc_elf_adjust_dynamic_symbol): Likewise.
1149 (maybe_set_textrel): Likewise.
1150 * elf32-s390.c (readonly_dynrelocs): Removed.
1151 (elf_s390_adjust_dynamic_symbol): Replace readonly_dynrelocs
1152 with _bfd_elf_readonly_dynrelocs.
1153 (maybe_set_textrel): Likewise.
1154 * elf32-sh.c (readonly_dynrelocs): Removed.
1155 (sh_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs with
1156 _bfd_elf_readonly_dynrelocs.
1157 (maybe_set_textrel): Likewise.
1158 * elf32-tic6x.c (readonly_dynrelocs): Removed.
1159 (maybe_set_textrel): Replace readonly_dynrelocs with
1160 _bfd_elf_readonly_dynrelocs.
1161 * elf32-tilepro.c (readonly_dynrelocs): Removed.
1162 (tilepro_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1163 with _bfd_elf_readonly_dynrelocs.
1164 (maybe_set_textrel): Likewise.
1165 * elf64-ppc.c (readonly_dynrelocs): Removed.
1166 (alias_readonly_dynrelocs): Replace readonly_dynrelocs with
1167 _bfd_elf_readonly_dynrelocs.
1168 (ppc64_elf_adjust_dynamic_symbol): Likewise.
1169 (maybe_set_textrel): Likewise.
1170 * elf64-s390.c (readonly_dynrelocs): Removed.
1171 (elf_s390_adjust_dynamic_symbol): Replace readonly_dynrelocs
1172 with _bfd_elf_readonly_dynrelocs.
1173 (maybe_set_textrel): Likewise.
1174 * elflink.c (_bfd_elf_readonly_dynrelocs): New.
1175 * elfnn-aarch64.c (readonly_dynrelocs): Removed.
1176 (maybe_set_textrel): Replace readonly_dynrelocs with
1177 _bfd_elf_readonly_dynrelocs.
1178 * elfnn-riscv.c (readonly_dynrelocs): Removed.
1179 (riscv_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1180 with _bfd_elf_readonly_dynrelocs.
1181 (maybe_set_textrel): Likewise.
1182 * elfxx-sparc.c (readonly_dynrelocs): Removed.
1183 (_bfd_sparc_elf_adjust_dynamic_symbol): Replace
1184 readonly_dynrelocs with _bfd_elf_readonly_dynrelocs.
1185 (maybe_set_textrel): Likewise.
1186 * elfxx-tilegx.c (readonly_dynrelocs): Removed.
1187 (tilegx_elf_adjust_dynamic_symbol): Replace readonly_dynrelocs
1188 with _bfd_elf_readonly_dynrelocs.
1189 (maybe_set_textrel): Likewise.
1190 * elfxx-x86.c (readonly_dynrelocs): Removed.
1191 (maybe_set_textrel): Replace readonly_dynrelocs with
1192 _bfd_elf_readonly_dynrelocs.
1193 (_bfd_x86_elf_adjust_dynamic_symbol): Likewise.
1197 * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Silence
1198 -fsanitize=undefined.
1204 * peicode.h (pe_ILF_make_a_section): Align data for compilers
1206 (pe_ILF_build_a_bfd): Likewise.
1211 * elf.c (_bfd_elf_close_and_cleanup): Free elf_shstrtab for
1212 core files as well as objects.
1217 * elf-bfd.h (elf_link_hash_entry): Add dyn_relocs after size.
1218 * elf-s390-common.c (s390_elf_allocate_ifunc_dyn_relocs):
1220 * elf32-arc.c (elf_arc_link_hash_entry): Remove dyn_relocs.
1221 (elf_arc_link_hash_newfunc): Updated.
1222 * elf32-arm.c (elf32_arm_link_hash_entry): Remove dyn_relocs.
1223 (elf32_arm_link_hash_newfunc): Updated.
1224 (elf32_arm_copy_indirect_symbol): Likewise.
1225 (elf32_arm_check_relocs): Likewise.
1226 (readonly_dynrelocs): Likewise.
1227 (allocate_dynrelocs_for_symbol): Likewise.
1228 * elf32-csky.c (csky_elf_link_hash_entry): Remove dyn_relocs.
1229 (csky_elf_link_hash_newfunc): Updated.
1230 (csky_allocate_dynrelocs): Likewise.
1231 (readonly_dynrelocs): Likewise.
1232 (csky_elf_copy_indirect_symbol): Likewise.
1233 * elf32-hppa.c (elf32_hppa_link_hash_entry): Remove dyn_relocs.
1234 (hppa_link_hash_newfunc): Updated.
1235 (elf32_hppa_copy_indirect_symbol): Likewise.
1236 (elf32_hppa_hide_symbol): Likewise.
1237 (elf32_hppa_adjust_dynamic_symbol): Likewise.
1238 (allocate_dynrelocs): Likewise.
1239 (elf32_hppa_relocate_section): Likewise.
1240 * elf32-i386.c (elf_i386_check_relocs): Likewise.
1241 * elf32-lm32.c (elf_lm32_link_hash_entry): Removed.
1242 (lm32_elf_link_hash_newfunc): Likewise.
1243 (lm32_elf_link_hash_table_create): Updated.
1244 (readonly_dynrelocs): Likewise.
1245 (allocate_dynrelocs): Likewise.
1246 (lm32_elf_copy_indirect_symbol): Likewise.
1247 * elf32-m32r.c (elf_m32r_link_hash_entry): Removed.
1248 (m32r_elf_link_hash_newfunc): Likewise.
1249 (m32r_elf_link_hash_table_create): Updated.
1250 (m32r_elf_copy_indirect_symbol): Likewise.
1251 (allocate_dynrelocs): Likewise.
1252 * elf32-metag.c (elf_metag_link_hash_entry): Remove dyn_relocs.
1253 (metag_link_hash_newfunc): Updated.
1254 (elf_metag_copy_indirect_symbol): Likewise.
1255 (readonly_dynrelocs): Likewise.
1256 (allocate_dynrelocs): Likewise.
1257 * elf32-microblaze.c (elf32_mb_link_hash_entry): Remove
1259 (link_hash_newfunc): Updated.
1260 (microblaze_elf_check_relocs): Likewise.
1261 (microblaze_elf_copy_indirect_symbol): Likewise.
1262 (readonly_dynrelocs): Likewise.
1263 (allocate_dynrelocs): Likewise.
1264 * elf32-nds32.c (elf_nds32_link_hash_entry): Remove dyn_relocs.
1265 (nds32_elf_link_hash_newfunc): Updated.
1266 (nds32_elf_copy_indirect_symbol): Likewise.
1267 (readonly_dynrelocs): Likewise.
1268 (allocate_dynrelocs): Likewise.
1269 (nds32_elf_check_relocs): Likewise.
1270 * elf32-nios2.c (elf32_nios2_link_hash_entry): Remove dyn_relocs.
1271 (link_hash_newfunc): Updated.
1272 (nios2_elf32_copy_indirect_symbol): Likewise.
1273 (nios2_elf32_check_relocs): Likewise.
1274 (allocate_dynrelocs): Likewise.
1275 * elf32-or1k.c (elf_or1k_link_hash_entry): Remove dyn_relocs.
1276 (or1k_elf_link_hash_newfunc): Updated.
1277 (readonly_dynrelocs): Likewise.
1278 (allocate_dynrelocs): Likewise.
1279 (or1k_elf_copy_indirect_symbol): Likewise.
1280 * elf32-ppc.c (ppc_elf_link_hash_entry): Remove dyn_relocs.
1281 (ppc_elf_link_hash_newfunc): Updated.
1282 (ppc_elf_copy_indirect_symbol): Likewise.
1283 (ppc_elf_check_relocs): Likewise.
1284 (readonly_dynrelocs): Likewise.
1285 (ppc_elf_adjust_dynamic_symbol): Likewise.
1286 (allocate_dynrelocs): Likewise.
1287 (ppc_elf_relocate_section): Likewise.
1288 * elf32-s390.c (elf_s390_link_hash_entry): Remove dyn_relocs.
1289 (link_hash_newfunc): Updated.
1290 (elf_s390_copy_indirect_symbol): Likewise.
1291 (readonly_dynrelocs): Likewise.
1292 (elf_s390_adjust_dynamic_symbol): Likewise.
1293 (allocate_dynrelocs): Likewise.
1294 * elf32-sh.c (elf_sh_link_hash_entry): Remove dyn_relocs.
1295 (sh_elf_link_hash_newfunc): Updated.
1296 (readonly_dynrelocs): Likewise.
1297 (allocate_dynrelocs): Likewise.
1298 (sh_elf_copy_indirect_symbol): Likewise.
1299 (sh_elf_check_relocs): Likewise.
1300 * elf32-tic6x.c (elf32_tic6x_link_hash_entry): Removed.
1301 (elf32_tic6x_link_hash_newfunc): Likewise.
1302 (elf32_tic6x_link_hash_table_create): Updated.
1303 (readonly_dynrelocs): Likewise.
1304 (elf32_tic6x_check_relocs): Likewise.
1305 (elf32_tic6x_allocate_dynrelocs): Likewise.
1306 * elf32-tilepro.c (tilepro_elf_link_hash_entry): Remove
1308 (link_hash_newfunc): Updated.
1309 (tilepro_elf_copy_indirect_symbol): Likewise.
1310 (tilepro_elf_check_relocs): Likewise.
1311 (allocate_dynrelocs): Likewise.
1312 * elf64-ppc.c (ppc_link_hash_entry): Remove dyn_relocs.
1313 (ppc64_elf_copy_indirect_symbol): Updated.
1314 (ppc64_elf_check_relocs): Likewise.
1315 (readonly_dynrelocs): Likewise.
1316 (ppc64_elf_adjust_dynamic_symbol): Likewise.
1317 (dec_dynrel_count): Likewise.
1318 (allocate_dynrelocs): Likewise.
1319 (ppc64_elf_relocate_section): Likewise.
1320 * elf64-s390.c (elf_s390_link_hash_entry): Remove dyn_relocs.
1321 (link_hash_newfunc): Updated.
1322 (elf_s390_copy_indirect_symbol): Likewise.
1323 (readonly_dynrelocs): Likewise.
1324 (allocate_dynrelocs): Likewise.
1325 * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
1326 * elfnn-aarch64.c (elf_aarch64_link_hash_entry): Remove
1328 (elfNN_aarch64_link_hash_newfunc): Updated.
1329 (elfNN_aarch64_copy_indirect_symbol): Likewise.
1330 (readonly_dynrelocs): Likewise.
1331 (need_copy_relocation_p): Likewise.
1332 (elfNN_aarch64_allocate_dynrelocs): Likewise.
1333 (elfNN_aarch64_allocate_ifunc_dynrelocs): Likewise.
1334 * elfnn-riscv.c (riscv_elf_link_hash_entry): Remove dyn_relocs.
1335 (link_hash_newfunc): Updated.
1336 (riscv_elf_copy_indirect_symbol): Likewise.
1337 (riscv_elf_check_relocs): Likewise.
1338 (readonly_dynrelocs): Likewise.
1339 (allocate_dynrelocs): Likewise.
1340 * elfxx-sparc.c (_bfd_sparc_elf_link_hash_entry): Remove
1342 (link_hash_newfunc): Updated.
1343 (_bfd_sparc_elf_copy_indirect_symbol): Likewise.
1344 (_bfd_sparc_elf_check_relocs): Likewise.
1345 (readonly_dynrelocs): Likewise.
1346 (allocate_dynrelocs): Likewise.
1347 * elfxx-tilegx.c (tilegx_elf_link_hash_entry): Remove dyn_relocs.
1348 (link_hash_newfunc): Updated.
1349 (tilegx_elf_copy_indirect_symbol): Likewise.
1350 (tilegx_elf_check_relocs): Likewise.
1351 (readonly_dynrelocs): Likewise.
1352 (allocate_dynrelocs): Likewise.
1353 * elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise.
1354 (readonly_dynrelocs): Likewise.
1355 (_bfd_x86_elf_copy_indirect_symbol): Likewise.
1356 * elfxx-x86.h (elf_x86_link_hash_entry): Remove dyn_relocs.
1360 * vms-alpha.c (_bfd_vms_slurp_etir): Check bound for the current
1361 command against cmd_length, not the end of record. For
1362 ETIR__C_STO_IMMR check size against cmd_length, mask repeat count
1363 to 32-bits and break out on zero size. Add ETIR__C_STC_LP_PSB
1368 * elf64-bpf.c (bpf_elf_relocate_section): Fix handling of
1369 R_BPF_INSN_{32,64} relocations.
1373 * pdp11.c: Implement BRD_RELOC_32 to relocate the low 16 bits of
1374 addreses in .long (used in testsuites) and .stab values.
1379 * elflink.c (bfd_elf_final_link): Use bfd_link_textrel_check.
1380 Check bfd_link_dll when issue a DT_TEXTREL warning.
1381 * elfxx-x86.c (maybe_set_textrel): Likewise.
1382 (_bfd_x86_elf_size_dynamic_sections): Likewise.
1386 * plugin.c (try_load_plugin): Extend error message when a plugin
1391 * bfdio.c (bfd_get_file_size): Don't segfault on NULL arch_header.
1396 * elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Don't init FP
1397 attributes from shared libraries, and do not return an error if
1403 * opncls.c (_bfd_free_cached_info): Keep a copy of the bfd
1405 (_bfd_delete_bfd): Free the copy.
1406 (_bfd_new_bfd): Free nbfd->memory on error.
1410 * aoutx.h: Replace "if (x) free (x)" with "free (x)" throughout.
1411 * archive.c, * bfd.c, * bfdio.c, * coff-alpha.c, * coff-ppc.c,
1412 * coff-sh.c, * coff-stgo32.c, * coffcode.h, * coffgen.c,
1413 * cofflink.c, * cpu-arm.c, * doc/chew.c, * dwarf2.c, * ecoff.c,
1414 * ecofflink.c, * elf-eh-frame.c, * elf-m10200.c, * elf-m10300.c,
1415 * elf-strtab.c, * elf.c, * elf32-arc.c, * elf32-arm.c,
1416 * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-crx.c,
1417 * elf32-epiphany.c, * elf32-ft32.c, * elf32-h8300.c,
1418 * elf32-ip2k.c, * elf32-m32c.c, * elf32-m68hc11.c,
1419 * elf32-m68k.c, * elf32-microblaze.c, * elf32-msp430.c,
1420 * elf32-nds32.c, * elf32-nios2.c, * elf32-ppc.c, * elf32-pru.c,
1421 * elf32-rl78.c, * elf32-rx.c, * elf32-sh.c, * elf32-spu.c,
1422 * elf32-v850.c, * elf32-xtensa.c, * elf64-alpha.c,
1423 * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c
1424 * elf64-mmix.c, * elf64-ppc.c, * elf64-sparc.c, * elfcode.h,
1425 * elflink.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-mips.c,
1426 * elfxx-x86.c, * format.c, * ihex.c, * libbfd.c, * linker.c,
1427 * mmo.c, * opncls.c, * pdp11.c, * peXXigen.c, * pef.c,
1428 * peicode.h, * simple.c, * som.c, * srec.c, * stabs.c, * syms.c,
1429 * targets.c, * vms-lib.c, * xcofflink.c, * xtensa-isa.c: Likewise.
1433 * elfxx-riscv.h (riscv_parse_subset_t): Add new callback function
1434 get_default_version. It is used to find the default version for
1435 the specific extension.
1436 * elfxx-riscv.c (riscv_parsing_subset_version): Remove the parameters
1437 default_major_version and default_minor_version. Add new bfd_boolean
1438 parameter *use_default_version. Set it to TRUE if we need to call
1439 the callback rps->get_default_version to find the default version.
1440 (riscv_parse_std_ext): Call rps->get_default_version if we fail to find
1441 the default version in riscv_parsing_subset_version, and then call
1442 riscv_add_subset to add the subset into subset list.
1443 (riscv_parse_prefixed_ext): Likewise.
1444 (riscv_std_z_ext_strtab): Support Zicsr extensions.
1445 * elfnn-riscv.c (riscv_merge_std_ext): Use strcasecmp to compare the
1446 strings rather than characters.
1447 riscv_merge_arch_attr_info): The callback function get_default_version
1448 is only needed for assembler, so set it to NULL int the linker.
1449 * elfxx-riscv.c (riscv_estimate_digit): Remove the static.
1450 * elfxx-riscv.h: Updated.
1455 * archive.c (_bfd_get_elt_at_filepos): Don't strdup filename,
1456 use bfd_set_filename.
1457 * elfcode.h (_bfd_elf_bfd_from_remote_memory): Likewise.
1458 * mach-o.c (bfd_mach_o_fat_member_init): Likewise.
1459 * opncls.c (bfd_fopen, bfd_openstreamr, bfd_openr_iovec, bfd_openw),
1460 (bfd_create): Likewise.
1461 (_bfd_delete_bfd): Don't free filename.
1462 (bfd_set_filename): Copy filename param to bfd_alloc'd memory,
1463 return pointer to the copy or NULL on alloc fail.
1464 * vms-lib.c (_bfd_vms_lib_get_module): Free newname and test
1465 result of bfd_set_filename.
1466 * bfd-in2.h: Regenerate.
1471 * elf.c (_bfd_elf_get_reloc_upper_bound): Sanity check reloc
1472 section size against file size.
1473 (_bfd_elf_get_dynamic_reloc_upper_bound): Likewise.
1478 * elf.c (bfd_section_from_shdr): Replace bfd_zmalloc with bfd_malloc
1479 and memset when allocating memory for the sections_being_created
1484 * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Rename srela
1486 (or1k_elf_relocate_section): Access srelgot via
1487 htab->root.srelgot. Add assertions for srelgot->contents.
1488 Introduce local variable for srelgot to not reuse global
1490 (or1k_elf_relocate_section): Fixup dynamic symbol detection.
1491 (or1k_set_got_and_rela_sizes): New function.
1492 (or1k_initial_exec_offset): New function.
1493 (TLS_GD, TLS_IE, TLS_LD, TLS_LE): Redefine macros as masks.
1494 (or1k_elf_relocate_section): Allow for TLS to handle multiple
1496 (or1k_elf_check_relocs): Use OR to set TLS access.
1497 (allocate_dynrelocs): Use or1k_set_got_and_rela_sizes to set
1499 (or1k_elf_size_dynamic_sections): Use
1500 or1k_set_got_and_rela_sizes to set sizes.
1501 (or1k_elf_relocate_section): Fixup PCREL relocation calculation.
1502 (TCB_SIZE): New macro.
1503 (tpoff): Use TCB_SIZE and alignment to calculate offset.
1504 (allocate_dynrelocs, readonly_dynrelocs, or1k_elf_check_relocs)
1505 (or1k_elf_size_dynamic_sections): Rename p to sec_relocs.
1506 (allocate_dynrelocs): Rename s to splt or sgot based on usage.
1507 (tpoff): Add dynamic boolean argument.
1508 (or1k_elf_relocate_section): Pass dynamic flag to tpoff.
1512 * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Club
1513 BFD_RELOC_AARCH64_BRANCH19 and BFD_RELOC_AARCH64_TSTBR14
1514 cases with BFD_RELOC_AARCH64_JUMP26.
1515 (elfNN_aarch64_check_relocs): Likewise.
1519 * aix5ppc-core.c (xcoff64_core_file_matches_executable_p): Use
1520 bfd_get_filename rather than accessing bfd->filename directly.
1521 * aout-target.h (MY (object_p)): Likewise.
1522 * aoutx.h (aout_find_nearest_line, aout_link_write_symbols): Likewise.
1523 * archive.c (find_nested_archive, _bfd_generic_read_ar_hdr_mag),
1524 (_bfd_construct_extended_name_table, _bfd_bsd44_write_ar_hdr),
1525 (_bfd_archive_bsd44_construct_extended_name_table),
1526 (_bfd_write_archive_contents, _bfd_compute_and_write_armap),
1527 (_bfd_bsd_write_armap): Likewise.
1528 * bfd.c (bfd_errmsg, _bfd_doprnt): Likewise.
1529 * cache.c (bfd_open_file): Likewise.
1530 * ecoff.c (_bfd_ecoff_write_armap): Likewise.
1531 * ecofflink.c (bfd_ecoff_debug_accumulate_other): Likewise.
1532 * elf32-bfin.c (bfinfdpic_relocate_section): Likewise.
1533 * elf32-frv.c (elf32_frv_relocate_section): Likewise.
1534 * elf32-hppa.c (elf32_hppa_final_link): Likewise.
1535 * elf32-nds32.c (nds32_elf_output_symbol_hook),
1536 (patch_tls_desc_to_ie): Likewise.
1537 * elf32-spu.c (sort_bfds, print_one_overlay_section),
1538 (spu_elf_auto_overlay): Likewise.
1539 * elf64-hppa.c (elf_hppa_final_link): Likewise.
1540 * elf64-ia64-vms.c (elf64_ia64_size_dynamic_sections): Likewise.
1541 * elfcore.h (elf_core_file_matches_executable_p): Likewise.
1542 * elflink.c (bfd_elf_size_dynamic_sections),
1543 (elf_link_input_bfd): Likewise.
1544 * linker.c (_bfd_generic_link_output_symbols): Likewise.
1545 * mach-o.c (bfd_mach_o_follow_dsym),
1546 (bfd_mach_o_close_and_cleanup): Likewise.
1547 * opncls.c (_bfd_delete_bfd, _maybe_make_executable),
1548 (find_separate_debug_file, get_build_id_name): Likewise.
1549 * pdp11.c (aout_find_nearest_line, aout_link_write_symbols): Likewise.
1550 * plugin.c (bfd_plugin_open_input): Likewise.
1551 * rs6000-core.c (rs6000coff_core_file_matches_executable_p): Likewise.
1552 * som.c (som_write_armap): Likewise.
1553 * srec.c (srec_write_record, srec_write_symbols): Likewise.
1554 * vms-lib.c (_bfd_vms_lib_get_imagelib_file),
1555 (_bfd_vms_lib_write_archive_contents): Likewise.
1556 * xcofflink.c (xcoff_link_add_dynamic_symbols): Likewise.
1561 * bfdio.c (_bfd_real_fopen): Typo fix.
1566 * elf.c (bfd_section_from_shdr): Use bfd_malloc to allocate memory
1567 for the sections_being_created array.
1571 * ecoff.c (ecoff_slurp_reloc_table): Malloc external_relocs so
1572 they can be freed without also freeing internal_relocs.
1577 * bfdio.c (_bfd_real_fopen): Convert UNIX style sirectory
1578 separators into DOS style when creating a WIN32 fullpath.
1582 * elfnn-riscv.c (elfNN_riscv_mkobject): New function. We need this
1583 to initialize RISC-V tdata.
1587 * aoutx.h (NAME (aout, swap_std_reloc_out)): Reject an unsupported
1592 * elf64-ppc.c (xlate_pcrel_opt): Handle lxvp and stxvp.
1596 * elf64-ppc.c: Rename powerxx to power10 throughout.
1601 * coffgen.c (coff_get_normalized_symtab): Check that buffer
1602 contains required number of auxents before processing any auxent.
1603 * coffswap.h (coff_swap_aux_in <C_FILE>): Only swap in extended
1604 file name from auxents for PE.
1608 * aout-cris.c (DEFAULT_ARCH): Delete define.
1609 (MY_set_arch_mach): Likewise.
1610 (SET_ARCH_MACH): Use bfd_set_arch_mach with an explicit architecture
1612 (swap_ext_reloc_in): Add casts to r_index extraction. Mask valid bits
1613 of r_type before the shift.
1618 * elfnn-aarch64.c (group_sections): Copy implementation from
1624 * elfnn-riscv.c (_bfd_riscv_relax_section): Check root.type before
1625 accessing root.u.def of symbols. Also check root.u.def.section
1626 is non-NULL. Reverse tests so as to make the logic positive.
1631 * elf32-tic6x.c (elf32_tic6x_merge_attributes): Don't transfer
1632 Tag_ABI_PIC or Tag_ABI_PID from dynamic objects to the output.
1637 * elf32-bfin.c (elf32_bfin_merge_private_bfd_data): Add FIXME.
1638 * elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
1639 * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Likewise.
1640 * elf32-nds32.c (nds32_elf_merge_private_bfd_data): Likewise.
1641 * elf32-score.c (s3_elf32_score_merge_private_bfd_data): Likewise.
1642 * elf32-score7.c (s7_elf32_score_merge_private_bfd_data): Likewise.
1643 * elf32-sh.c (sh_elf_merge_private_data): Likewise.
1644 * elf32-tic6x.c (elf32_tic6x_merge_attributes): Likewise.
1645 * elf64-ia64-vms.c (elf64_ia64_merge_private_bfd_data): Likewise.
1646 * elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): Likewise.
1651 * elf32-ppc.c (ppc_elf_merge_private_bfd_data): Ignore e_flags
1652 from shared libraries.
1656 * elf32-xtensa.c (relax_section): Don't negate diff_value for
1657 XTENSA_NDIFF relocations. Don't add sign bits whe diff_value
1658 equals 0. Report overflow when the result has negative sign but
1659 all significant bits are zero.
1663 * aoutx.h (swap_std_reloc_out): Special case 64 bit relocations.
1664 (aout_link_reloc_link_order): Likewise. Make r_length an unsigned.
1668 * vms-alpha.c (_bfd_vms_slurp_etir): Correct divide by zero check.
1669 Emit warning message.
1673 * coff-i386.c (COFF_WITH_PE_BIGOBJ): New.
1674 * coff-x86_64.c (COFF_WITH_PE_BIGOBJ): New.
1675 * config.bfd (targ_selvecs): Rename x86_64_pe_be_vec
1676 to x86_64_pe_big_vec as it not a big-endian format.
1677 (vec i386_pe_big_vec): New.
1678 * configure.ac: Likewise.
1679 * targets.c: Likewise.
1680 * configure: Regenerate.
1681 * pe-i386.c (TARGET_SYM_BIG, TARGET_NAME_BIG,
1682 COFF_WITH_PE_BIGOBJ): New.
1683 * pe-x86_64.c (TARGET_SYM_BIG, TARGET_NAME_BIG):
1685 (x86_64_pe_be_vec): Moved.
1689 * elf-bfd.h (elfcore_write_arc_v2): Add prototype.
1690 * elf.c (elfcore_grok_arc_v2): New function.
1691 (elfcore_grok_note): Call the new function to handle the corresponding
1693 (elfcore_write_arc_v2): New function.
1694 (elfcore_write_register_note): Call the new function to handle the
1695 corresponding pseudo-sections.
1700 * bfd-in2.h: Regenerated.
1701 * elf32-xtensa.c (elf_howto_table): New entries for
1702 R_XTENSA_PDIFF{8,16,32} and R_XTENSA_NDIFF{8,16,32}.
1703 (elf_xtensa_reloc_type_lookup, elf_xtensa_do_reloc)
1704 (relax_section): Add cases for R_XTENSA_PDIFF{8,16,32} and
1705 R_XTENSA_NDIFF{8,16,32}.
1706 * libbfd.h (bfd_reloc_code_real_names): Add names for
1707 BFD_RELOC_XTENSA_PDIFF{8,16,32} and
1708 BFD_RELOC_XTENSA_NDIFF{8,16,32}.
1709 * reloc.c: Add documentation for BFD_RELOC_XTENSA_PDIFF{8,16,32}
1710 and BFD_RELOC_XTENSA_NDIFF{8,16,32}.
1715 * compress.c (bfd_get_full_section_contents): Exclude sections with no
1721 * elf-bfd.h (elf_backend_data): Add
1722 elf_backend_strip_zero_sized_dynamic_sections.
1723 (_bfd_elf_strip_zero_sized_dynamic_sections): New prototype.
1724 * elf64-alpha.c (elf_backend_strip_zero_sized_dynamic_sections):
1726 * elflink.c (_bfd_elf_strip_zero_sized_dynamic_sections): New
1728 * elfxx-target.h (elf_backend_strip_zero_sized_dynamic_sections):
1730 (elfNN_bed): Add elf_backend_strip_zero_sized_dynamic_sections.
1734 * elf64-alpha.c (alpha_elf_reloc_entry): Replace reltext with
1736 (elf64_alpha_check_relocs): Set sec instead of reltext. Warn
1738 (elf64_alpha_calc_dynrel_sizes): Warn DT_TEXTREL with -M.
1742 * po/sr.po: Updated Serbian translation.
1746 * elf32-sh.c (sh_elf_relocate_section): Remove STO_SH5_ISA32
1751 * pdp11.c (N_STAB): Modify value to avoid conflict with N_EXT
1752 causing globals from linker script to be treated as debug symbols.
1753 (translate_symbol_table): Don't sign-extend symbol values from 16
1754 to 64 bits in nm output.
1758 * elf64-ppc.c (ppc64_elf_size_stubs): Strip relbrlt too.
1762 * section.c (bfd_is_const_section): Correct test for special
1764 * bfd-in2.h: Regenerate.
1769 * elf.c (_bfd_elf_get_symbol_version_string): Don't segfault on
1775 * elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Replace an
1776 abort with a more helpful error message.
1781 * dwarf2.c (scan_unit_for_symbols): Wrap overlong lines. Don't
1787 * coff-rs6000.c (xcoff_ppc_relocate_section): Change RM_GENERATE_ERROR
1788 to RM_DIAGNOSE plus a check of warn_unresolved_syms.
1789 * coff64-rs6000.c (xcoff_ppc_relocate_section): Likewise.
1790 * elf-bfd.h (_bfd_elf_large_com_section): Likewise.
1791 * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
1792 * elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise.
1793 * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
1794 * elf32-sh.c (sh_elf_relocate_section): Likewise.
1795 * elf32-spu.c (spu_elf_relocate_section): Likewise.
1796 * elf64-hppa.c (elf64_hppa_relocate_section): Likewise.
1797 * elflink.c (elf_link_output_extsym): Likewise.
1798 * elfxx-mips.c (mips_elf_calculate_relocation): Likewise.
1803 * peXXigen.c (_bfd_XXi_swap_sym_in <C_SECTION>): Don't use a
1804 pointer into strings that may be freed for section name, always
1805 allocate a new string.
1810 * coff-go32.c (COFF_GO32, IMAGE_SCN_LNK_NRELOC_OVFL)
1811 (coff_SWAP_scnhdr_in, coff_SWAP_scnhdr_out): Define.
1812 (_bfd_go32_swap_scnhdr_in, _bfd_go32_swap_scnhdr_out)
1813 (_bfd_go32_mkobject): New functions.
1814 * coff-stgo32.c (IMAGE_SCN_LNK_NRELOC_OVFL)
1815 (coff_SWAP_scnhdr_in, coff_SWAP_scnhdr_out): Define.
1816 (go32exe_mkobject): Call _bfd_go32_mkobject.
1817 * coffcode.h (COFF_WITH_EXTENDED_RELOC_COUNTER): Define.
1818 (coff_set_alignment_hook): Define function for COFF_GO32_EXE
1820 (coff_write_relocs): Enable extended reloc counter code if
1821 COFF_WITH_EXTENDED_RELOC_COUNTER is defined. Test for obj_go32.
1822 (coff_write_object_contents): Likewise. Pad section headers
1823 for COFF_GO32 and COFF_GO32EXE. Use bfd_coff_swap_scnhdr_out
1824 instead of coff_swap_scnhdr_out.
1825 * cofflink.c (_bfd_coff_final_link): Test also for obj_go32 to
1826 enable extended reloc counter.
1827 * coffswap.h: (coff_swap_scnhdr_in, coff_swap_scnhdr_out):
1828 Declare with ATTRIBUTE_UNUSED.
1829 * libcoff-in.h: (struct coff_tdata): New field go32.
1831 * libcoff.h: Regenerate.
1836 * elf.c (assign_section_numbers): Always set .stab sh_entsize to
1842 * pdp11.c: Add implementation of --imagic option.
1843 (adjust_o_magic): Fix objcopy --extract-symbol test.
1844 * libaout.h (enum aout_magic): Add i_magic.
1849 * elf32-sparc.c (sparc_final_write_processing): Fix whitespace.
1851 <default>: Error rather than abort.
1856 * elf.c (_bfd_elf_fixup_group_sections): Remove zero-sized
1857 relocation section from section group.
1861 * bfdio.c (bfd_bread, bfd_tell, bfd_seek, bfd_mmap): Always add
1862 bfd->origin to file offset.
1863 * bfdwin.c (bfd_get_file_window): Likewise.
1864 * bfd.c: Clarify the use of the bfd->origin field.
1865 * bfd-in2.h: Regenerate.
1866 * coff-i386.c: Don't include go32exe.h. Allow overriding
1867 coff_write_object_contents via COFF_WRITE_CONTENTS.
1868 * coff-stgo32.c (go32exe_cleanup, go32exe_mkobject)
1869 (go32exe_write_object_contents): New functions.
1870 (go32exe_temp_stub, go32exe_temp_stub_size): New static globals.
1871 (COFF_WRITE_CONTENTS, GO32EXE_DEFAULT_STUB_SIZE): Define.
1872 (create_go32_stub): Remove check for 2k size limit. Read stub
1873 from go32exe_temp_stub if present.
1874 (go32_stubbed_coff_bfd_copy_private_bfd_data): Allocate and
1875 copy variable-length stub.
1876 (go32_check_format): Read stub to go32exe_temp_stub, set
1877 origin, return go32exe_cleanup.
1878 (adjust_filehdr_in_post, adjust_filehdr_out_pre)
1879 (adjust_filehdr_out_post, adjust_scnhdr_in_post)
1880 (adjust_scnhdr_out_pre, adjust_scnhdr_out_post)
1881 (adjust_aux_in_post, adjust_aux_out_pre, adjust_aux_out_post):
1882 Remove functions and their associated #defines.
1883 * coffcode.h (coff_mkobject_hook): Remove stub copying code.
1884 * libcoff-in.h: (struct coff_tdata): New field stub_size.
1885 Rename field go32stub to stub.
1886 * libcoff.h: Regenerate.
1887 * coff-stgo32.c (go32_check_format): Rename to...
1888 (go32exe_check_format): ...this.
1889 (go32_stubbed_coff_bfd_copy_private_bfd_data): Rename to...
1890 (go32exe_copy_private_bfd_data): ...this.
1891 (stub_bytes): Rename to...
1892 (go32exe_default_stub): ...this.
1893 (create_go32_stub): Rename to...
1894 (go32exe_create_stub): ...this.
1895 * coff-stgo32.c (go32exe_copy_private_bfd_data): Avoid realloc
1902 * elf32-i386.c (elf_i386_convert_load_reloc): Convert load
1903 relocation to R_386_32 for relocation against non-preemptible
1905 (elf_i386_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Don't
1906 allocate dynamic relocation for non-preemptible absolute symbol.
1907 (elf_i386_relocate_section): Pass sec to
1908 GENERATE_DYNAMIC_RELOCATION_P.
1909 * elf64-x86-64.c (R_X86_64_converted_reloc_bit): Moved.
1910 (elf_x86_64_convert_load_reloc): Covert load relocation to
1911 R_X86_64_32S or R_X86_64_32 for relocation against non-preemptible
1912 absolute symbol. Don't convert to R_X86_64_32S nor R_X86_64_32
1913 for non-preemptible absolute symbol if they overflow.
1914 (elf_x86_64_check_relocs): Call _bfd_elf_x86_valid_reloc_p. Set
1915 tls_type for GOT slot to GOT_ABS for non-preemptible absolute
1916 symbol. Don't allocate dynamic relocation for non-preemptible
1918 (elf_x86_64_relocate_section): Don't generate relative relocation
1919 for GOTPCREL relocations aganst local absolute symbol. Pass sec
1920 to GENERATE_DYNAMIC_RELOCATION_P.
1921 * elfxx-x86.c (elf_x86_allocate_dynrelocs): No dynamic relocation
1922 against non-preemptible absolute symbol.
1923 (_bfd_elf_x86_valid_reloc_p): New function.
1924 (_bfd_x86_elf_size_dynamic_sections): No dynamic relocation for
1926 * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): Add an SEC
1927 argument. Don't generate dynamic relocation against
1928 non-preemptible absolute symbol.
1929 (ABS_SYMBOL_P): New.
1930 (GENERATE_RELATIVE_RELOC_P): Don't generate relative relocation
1931 against non-preemptible absolute symbol.
1933 (R_X86_64_converted_reloc_bit): New. Moved from elf64-x86-64.c.
1934 (_bfd_elf_x86_valid_reloc_p): New.
1939 * elf32-arm.c (elf32_arm_populate_plt_entry): Set LSB of the PLT0
1940 address in the GOT if in thumb only mode.
1944 * elf32-arm.c (elf32_thumb2_plt_entry): Fix PC-rel offset.
1948 * mmo.c (mmo_scan): Create .text section only when needed, not
1953 * coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Correct bfd_bread
1958 * vms-alpha.c (image_write): Check bounds for sections without
1959 contents too. Error on non-zero write to section without
1961 (_bfd_vms_slurp_etir): Check return of image_write* functions.
1965 * tekhex.c (pass_over): Check is_eof before reading buffer.
1970 * libcoff-in.h (struct pe_tdata): Rename the insert_timestamp
1971 field to timestamp and make it an integer.
1972 * libcoff.h: Regenerate.
1973 * peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Test the timestamp
1974 field in the pe_data structure rather than the insert_timestamp
1980 * elf64-ppc.c (ppc64_elf_build_stubs): Use asprintf to form
1985 * cofflink.c (bfd_coff_get_internal_extra_pe_aouthdr): Delete.
1986 * libbfd-in.h (bfd_coff_get_internal_extra_pe_aouthdr): Remove
1988 * libbfd.h: Regenerate.
1992 * i386msdos.c (msdos_object_p): Catch -1 return from bfd_bread.
1996 * vms-alpha.c (dst_define_location): Limit size of dst_ptr_offsets
1998 (_bfd_vms_slurp_object_records): Rename "err" to "ok".
2002 * cofflink.c (bfd_coff_get_internal_extra_pe_aouthdr): New
2004 * libbfd-in.h (bfd_coff_get_internal_extra_pe_aouthdr): Prototype.
2005 * libbfd.h: Regenerate.
2009 * elf32-arc.c (PRINT_DEBUG_RELOC_INFO_BEFORE): Use the
2010 correct field name in the output string.
2015 * elf.c (assign_file_positions_for_load_sections): Adjust offset
2016 for SHT_NOBITS section if first in segment.
2021 * elf-bfd.h (_bfd_elf_get_symbol_version_name): Renamed to ...
2022 (_bfd_elf_get_symbol_version_string): This.
2023 * elf.c (_bfd_elf_get_symbol_version_name): Renamed to ...
2024 (_bfd_elf_get_symbol_version_string): This.
2025 (bfd_elf_print_symbol): Pass TRUE to
2026 _bfd_elf_get_symbol_version_string.
2027 * libbfd-in.h (_bfd_nosymbols_get_symbol_version_string): Add a
2028 bfd_boolean argument.
2029 * syms.c (_bfd_nosymbols_get_symbol_version_string): Likewise.
2030 * targets.c (_bfd_get_symbol_version_string): Likewise.
2031 (bfd_get_symbol_version_string): Likewise.
2032 * bfd-in2.h: Regenerated.
2038 * bfdio.c (_bfd_real_fopen): Add code to handle long filenames on
2044 * elf.c (_bfd_elf_map_sections_to_segments): When looking for a
2045 segment to use for PT_GNU_RELRO, ignore empty sections in a
2046 segment's current list.
2051 * elf-bfd.h (elf_obj_tdata): Change num_group to unsigned int.
2056 * elf-bfd.h (_bfd_elf_get_symbol_version_name): New.
2057 * elf.c (_bfd_elf_get_symbol_version_name): New function. Based
2058 on the previous _bfd_elf_get_symbol_version_string.
2059 (_bfd_elf_get_symbol_version_string): Use it.
2063 * archive.c (_bfd_generic_read_ar_hdr_mag): Sanity check extended
2064 name size. Use bfd_malloc rather than bfd_zmalloc, clearing just
2069 * elflink.c (_bfd_elf_tls_setup): Mention .tdata in comment.
2073 * ecoff.c (_bfd_ecoff_slurp_armap): Sanity check parsed_size and
2074 symbol count. Allocate an extra byte to ensure name strings
2075 are terminated. Sanity check name offsets. Release memory on
2080 * i386msdos.c (msdos_object_p): Don't access e_lfanew when that
2081 field hasn't been read. Remove unnecessary casts.
2085 * coff64-rs6000.c (xcoff64_slurp_armap): Ensure size is large
2086 enough to read number of symbols.
2090 * configure.ac (HAVE_EXECUTABLE_SUFFIX): Removed.
2091 (EXECUTABLE_SUFFIX): Likewise.
2092 * config.in: Regenerated.
2093 * configure: Likewise.
2094 * plugin.c (bfd_plugin_close_and_cleanup): Defined as
2095 _bfd_generic_close_and_cleanup.
2096 (plugin_list_entry): Remove resolution_file, resolution_option,
2097 real_bfd, real_nsyms, real_syms, lto_nsyms, lto_syms, gcc,
2098 lto_wrapper, gcc_env and initialized,
2099 (need_lto_wrapper_p): Removed.
2100 (get_lto_wrapper): Likewise.
2101 (setup_lto_wrapper_env): Likewise.
2102 (register_all_symbols_read): Likewise.
2103 (egister_cleanup): Likewise.
2104 (get_symbols): Likewise.
2105 (add_input_file): Likewise.
2106 (bfd_plugin_set_program_name): Remove need_lto_wrapper.
2107 (add_symbols): Updated.
2108 (try_claim): Likewise.
2109 (try_load_plugin): Likewise.
2110 (bfd_plugin_canonicalize_symtab): Likewise.
2111 * plugin.h (bfd_plugin_set_program_name): Remove int argument.
2112 (plugin_data_struct): Remove real_bfd, real_nsyms and real_syms.
2117 * plugin.c (plugin_list_entry): Add has_symbol_type.
2118 (add_symbols_v2): New function.
2119 (bfd_plugin_open_input): Don't invoke LTO wrapper if LTO plugin
2120 provides symbol type.
2121 (try_load_plugin): Add LDPT_ADD_SYMBOLS_V2.
2122 (bfd_plugin_canonicalize_symtab): Use LTO plugin symbol type if
2127 * coff-rs6000.c (_bfd_xcoff_slurp_armap): Ensure size is large
2128 enough to read number of symbols.
2132 * elf.c (_bfd_elf_setup_sections): Don't test known non-NULL
2133 backend functions for NULL before calling.
2134 (copy_special_section_fields, _bfd_elf_copy_private_bfd_data),
2135 (bfd_section_from_shdr, assign_section_numbers): Likewise.
2136 * elfcode.h (elf_write_relocs, elf_slurp_reloc_table): Likewise.
2137 * elfnn-ia64.c (ignore_errors): New function.
2138 (elf_backend_link_order_error_handler): Redefine as ignore_errors.
2143 * dwarf2.c (struct varinfo): Add unit_offset field to record the
2144 location of the varinfo in the unit's debug info data. Change the
2145 type of the stack field to a boolean.
2146 (lookup_var_by_offset): New function. Returns the varinfo
2147 structure for the variable described at the given offset in the
2149 (scan_unit_for_symbols): Add support for variables which have the
2150 DW_AT_specification attribute.
2155 * elf.c (bfd_elf_set_group_contents): Replace assertion with an
2160 * elfxx-riscv.c (riscv_parse_subset): Don't use C99.
2165 * elf.c (_bfd_elf_write_secondary_reloc_section): Fix illegal
2166 memory access when processing a corrupt secondary reloc section.
2170 * elf32-arm.c (arm_build_one_stub): Emit a fatal error message
2171 instead of calling abort.
2172 * elf32-csky.c (csky_build_one_stub): Likewise.
2173 * elf32-hppa.c (hppa_build_one_stub): Likewise.
2174 * elf32-m68hc11.c (m68hc11_elf_build_one_stub): Likewise.
2175 * elf32-m68hc12.c (m68hc12_elf_build_one_stub): Likewise.
2176 * elf32-metag.c (metag_build_one_stub): Likewise.
2177 * elf32-nios2.c (nios2_build_one_stub): Likewise.
2178 * elf64-ppc.c (ppc_build_one_stub): Likewise.
2179 (ppc_size_one_stub): Likewise.
2180 * elfnn-aarch64.c (aarch64_build_one_stub): Likewise.
2185 * elf.c (_bfd_elf_copy_special_section_fields): Replace assertions
2186 with error messages.
2191 * elf.c (_bfd_elf_slurp_secondary_reloc_section): Remove redundant
2192 free. Add free on another failure path.
2197 * elf.c (elf_sort_segments): Don't call bfd_octets_per_byte unless
2198 we have a non-zero section count. Do lma comparison in octets.
2202 * vms-alpha.c (dst_restore_location): Validate index into
2203 dst_ptr_offsets array before accessing. Return status.
2204 (dst_retrieve_location): Similarly, making "loc" parameter a
2205 pointer to return value.
2206 (_bfd_vms_slurp_etir): Update calls to above functions.
2210 * configure.ac: Include netbsd-core.lo for all NetBSD arm and mips
2212 * configure: Regenerated.
2216 * section.c (BFD_FAKE_SECTIONS): Formatting.
2217 * bfd-in2.h: Regenerate.
2221 * elf.c (elfcore_grok_netbsd_note): Add support for
2222 NT_NETBSDCORE_LWPSTATUS notes.
2226 * bfd-in2.h: Regenerate.
2227 * section.c (asection): Add already_assigned field.
2228 (BFD_FAKE_SECTION): Add default initializer for it.
2229 * ecoff.c (bfd_debug_section): Initialize already_assigned field.
2230 * elf32-arm.c (arm_build_one_stub): Add support for
2231 non_contiguous_regions.
2232 * elf32-csky.c (csky_build_one_stub): Likewise.
2233 * elf32-hppa.c (hppa_build_one_stub): Likewise.
2234 * elf32-m68hc11.c (m68hc11_elf_build_one_stub): Likewise.
2235 * elf32-m68hc12.c (m68hc12_elf_build_one_stub): Likewise.
2236 * elf32-metag.c (metag_build_one_stub): Likewise.
2237 * elf32-nios2.c (nios2_build_one_stub): Likewise.
2238 * elf64-ppc.c (ppc_build_one_stub): Likewise.
2239 (ppc_size_one_stub): Likewise.
2240 * elfnn-aarch64.c (aarch64_build_one_stub): Likewise.
2241 * elflink.c (elf_link_input_bfd): Likewise.
2246 * elf-linker-x86.h (elf_linker_x86_params): Add
2247 static_before_all_inputs and has_dynamic_linker.
2248 * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Report
2249 dynamic input objects if -static is passed at command-line
2250 before all input files without --dynamic-linker unless
2251 --no-dynamic-linker is used.
2255 * elf.c (elfcore_grok_netbsd_note): Add support for aarch64.
2259 * bfd.c (bfd_record_phdr): New local "opb". Fix assignment of
2260 "p_paddr" from "at".
2261 * elfcode.h (bfd_from_remote_memory): Add units to several
2262 parameters. New local "opb". Fix usage of p_align. Fix
2263 calculation of "localbase" from "ehdr_vma" and "p_vaddr". Fix
2264 call of target_read_memory.
2265 * elflink.c (elf_fixup_link_order): Fix scope of "s" local. Fix
2266 calculation of "offset" and "output_offset".
2267 (bfd_elf_final_link): New local "opb". Fix calculation of "size"
2268 from "offset" and fix calculation of "end" from "vma+size". Fix
2269 comparison between "sh_addr" and "vma"/"output_offset".
2270 (bfd_elf_discard_info): Fix calculation of "eh_alignment".
2271 * elf-bfd.h (struct elf_link_hash_table): Add unit to tls_size
2273 * elf.c (_bfd_elf_map_sections_to_segments): Add unit (bytes/
2274 octets) to "wrap_to2 and "phdr_size" locals. Fix calculation of
2275 "wrap_to" value. Add unit (bytes) to phdr_lma variable. Fix
2276 assignment of p_paddr from phdr_lma. Fix comparison between
2277 "lma+size" and "next->lma".
2278 (elf_sort_segments): Fix assignment from p_paddr to lma.
2279 (assign_file_positions_for_load_sections): Add unit (bytes) to
2280 local "align". Fix calculation of local "off_adjust". Fix
2281 calculation of local "filehdr_vaddr".
2282 (assign_file_positions_for_non_load_sections): New local "opb".
2283 Fix calculation of "end" from "p_size". Fix comparison between
2284 "vma+SECTION_SIZE" and "start". Fix calculation of "p_memsz"
2285 from "end" and "p_vaddr".
2286 (rewrite_elf_program_header): Fix comparison between p_vaddr and
2287 vma. Fix assignment to p_paddr from lma. Fix comparison between
2288 p_paddr and lma. Fix assignment to p_paddr from lma.
2289 * merge.c (sec_merge_emit): New local "opb". Convert
2290 "alignment_power" to octets.
2291 (_bfd_add_merge_section): New locals "alignment_power" and
2292 "opb". Fix comparison between "alignment_power" and
2294 (_bfd_merge_sections): New local "opb". Divide size by opb
2295 before checking align mask.
2299 * elf.c (_bfd_elf_make_section_from_shdr): Introduce new temp
2300 opb. Divide Elf_Internal_Shdr::sh_addr by opb when setting
2302 (_bfd_elf_make_section_from_phdr): Similarly.
2303 (elf_fake_sections): Fix calculation of
2304 Elf_Internal_shdr::sh_addr from section VMA.
2305 (_bfd_elf_map_sections_to_segments): Fix mixup between octets
2307 (assign_file_positions_for_load_sections): Fix calculations of
2308 Elf_Internal_shdr::p_vaddr and p_paddr from section LMA/VMA. Fix
2309 comparison between program header address and section LMA.
2310 (assign_file_positions_for_non_load_sections): Likewise.
2311 (rewrite_elf_program_header): Likewise. Introduce new temp opb.
2312 (IS_CONTAINED_BY_VMA): Add parameter opb.
2313 (IS_CONTAINED_BY_LMA,IS_SECTION_IN_INPUT_SEGMENT,
2314 INCLUDE_SECTION_IN_SEGMENT): Likewise.
2315 (copy_elf_program_header): Update call to ELF_SECTION_IN_SEGMENT.
2316 Fix calculations of p_addr_valid and p_vaddr_offset.
2317 * elflink.c (elf_link_add_object_symbols): Multiply section VMA
2318 with octets per byte when comparing against p_vaddr.
2322 * som.c (setup_sections): Sanity check subspace.name.
2326 * elf64-ppc.c (ppc64_elf_inline_plt): Do increment rel in for loop.
2331 * ihex.c (ihex_write_object_contents): Don't assume ordering of
2336 * wasm-module.c (wasm_scan): Sanity check file name length
2337 before allocating memory. Move common section setup code. Do
2338 without bfd_tell to calculate section size.
2342 * elf.c (_bfd_elf_set_section_contents): Replace call to abort
2343 with error messages and failure return values.
2347 * elf32-xtensa.c (shrink_dynamic_reloc_sections): Shrink dynamic
2348 relocation sections for any removed reference to a dynamic symbol.
2352 * elf-bfd.h (struct elf_backend_data): Add new fields:
2353 init_secondary_reloc_section, slurp_secondary_reloc_section,
2354 write_secondary_reloc_section.
2355 (_bfd_elf_init_secondary_reloc_section): Prototype.
2356 (_bfd_elf_slurp_secondary_reloc_section): Prototype.
2357 (_bfd_elf_write_secondary_reloc_section): Prototype.
2358 * elf.c ( bfd_section_from_shdr): Invoke the new
2359 init_secondary_reloc_section backend function, if defined, when a
2360 second reloc section is encountered.
2361 (swap_out_syms): Invoke the new symbol_section_index function, if
2362 defined, when computing the section index of an OS/PROC specific
2364 (_bfd_elf_init_secondary_reloc_section): New function.
2365 (_bfd_elf_slurp_secondary_reloc_section): New function.
2366 (_bfd_elf_write_secondary_reloc_section): New function.
2367 (_bfd_elf_copy_special_section_fields): New function.
2368 * elfcode.h (elf_write_relocs): Invoke the new
2369 write_secondary_relocs function, if defined, in order to emit
2371 (elf_slurp_reloc_table): Invoke the new slurp_secondary_relocs
2372 function, if defined, in order to read in secondary relocs.
2373 * elfxx-target.h (elf_backend_copy_special_section_fields):
2374 Provide a non-NULL default definition.
2375 (elf_backend_init_secondary_reloc_section): Likewise.
2376 (elf_backend_slurp_secondary_reloc_section): Likewise.
2377 (elf_backend_write_secondary_reloc_section): Likewise.
2378 (struct elf_backend_data elfNN_bed): Add initialisers for the new
2380 * configure.ac (score_elf32_[bl]e_vec): Add elf64.lo
2381 * configure: Regenerate.
2385 * archive64.c (_bfd_archive_64_bit_slurp_armap): Check parsed_size
2386 against file size before allocating memory. Use bfd_alloc rather
2387 than bfd_zalloc for carsym/strings memory.
2391 * elf.c (elf_fake_sections): Ensure sh_addralign is such that
2392 sh_addr mod sh_addalign is zero.
2396 * format.c (bfd_check_format_matches): Call cleanup on error exit.
2400 * format.c (struct bfd_preserve): Add cleanup field.
2401 (bfd_preserve_save): Add cleanup param and save.
2402 (bfd_preserve_restore): Return cleanup.
2403 (bfd_preserve_finish): Call the cleanup for the discarded match.
2404 (bfd_check_format_matches): Pass cleanup to bfd_preserve_save,
2405 and clear when preserving a match. Restore cleanup too when
2406 restoring that match.
2410 * cisco-core.c (cisco_core_file_p): Return bfd_cleanup.
2411 * hpux-core.c (hpux_core_core_file_p): Update prototype.
2412 * sco5-core.c (sco5_core_file_p): Return bfd_cleanup.
2413 (core_sco5_vec): Correct initialisers.
2417 * aix386-core.c (aix386_core_file_p): Return bfd_cleanup.
2418 * aix5ppc-core.c (xcoff64_core_p): Likewise.
2419 * cisco-core.c (cisco_core_file_validate): Likewise.
2420 * hppabsd-core.c (hppabsd_core_core_file_p): Likewise.
2421 * hpux-core.c (hpux_core_core_file_p): Likewise.
2422 * irix-core.c (irix_core_core_file_p): Likewise.
2423 * lynx-core.c (lynx_core_file_p): Likewise.
2424 * netbsd-core.c (netbsd_core_file_p): Likewise.
2425 * osf-core.c (osf_core_core_file_p): Likewise.
2426 * ptrace-core.c (ptrace_unix_core_file_p): Likewise.
2427 * sco5-core.c (sco5_core_file_p): Likewise.
2431 * trad-core.c (trad_unix_core_file_p): Return bfd_cleanup.
2435 * targets.c (bfd_cleanup): New typedef.
2436 (struct bfd <_bfd_check_format>): Return a bfd_cleanup.
2437 * libbfd-in.h (_bfd_no_cleanup): Define.
2438 * format.c (bfd_reinit): Add cleanup parameter, call it.
2439 (bfd_check_format_matches): Set cleanup from _bfd_check_format
2440 call and pass to bfd_reinit. Delete temp, use abfd->xvec instead.
2441 * aout-target.h (callback, object_p): Return bfd_cleanup.
2442 * aout-tic30.c (tic30_aout_callback, tic30_aout_object_p): Likewise.
2443 * archive.c (bfd_generic_archive_p): Likewise.
2444 * binary.c (binary_object_p): Likewise.
2445 * coff-alpha.c (alpha_ecoff_object_p): Likewise.
2446 * coff-ia64.c (ia64coff_object_p): Likewise.
2447 * coff-rs6000.c (_bfd_xcoff_archive_p, rs6000coff_core_p): Likewise.
2448 * coff-sh.c (coff_small_object_p): Likewise.
2449 * coff-stgo32.c (go32_check_format): Likewise.
2450 * coff64-rs6000.c (xcoff64_archive_p, rs6000coff_core_p),
2451 (xcoff64_core_p): Likewise.
2452 * coffgen.c (coff_real_object_p, coff_object_p): Likewise.
2453 * elf-bfd.h (bfd_elf32_object_p, bfd_elf32_core_file_p),
2454 (bfd_elf64_object_p, bfd_elf64_core_file_p): Likewise.
2455 * elfcode.h (elf_object_p): Likewise.
2456 * elfcore.h (elf_core_file_p): Likewise.
2457 * i386msdos.c (msdos_object_p): Likewise.
2458 * ihex.c (ihex_object_p): Likewise.
2459 * libaout.h (some_aout_object_p): Likewise.
2460 * libbfd-in.h (bfd_generic_archive_p, _bfd_dummy_target),
2461 (_bfd_vms_lib_alpha_archive_p, _bfd_vms_lib_ia64_archive_p): Likewise.
2462 * libbfd.c (_bfd_dummy_target): Likewise.
2463 * libcoff-in.h (coff_object_p): Likewise.
2464 * mach-o-aarch64.c (bfd_mach_o_arm64_object_p),
2465 (bfd_mach_o_arm64_core_p): Likewise.
2466 * mach-o-arm.c (bfd_mach_o_arm_object_p),
2467 (bfd_mach_o_arm_core_p): Likewise.
2468 * mach-o-i386.c (bfd_mach_o_i386_object_p),
2469 (bfd_mach_o_i386_core_p): Likewise.
2470 * mach-o-x86-64.c (bfd_mach_o_x86_64_object_p),
2471 (bfd_mach_o_x86_64_core_p): Likewise.
2472 * mach-o.c (bfd_mach_o_header_p, bfd_mach_o_gen_object_p),
2473 (bfd_mach_o_gen_core_p, bfd_mach_o_fat_archive_p): Likewise.
2474 * mach-o.h (bfd_mach_o_object_p, bfd_mach_o_core_p),
2475 (bfd_mach_o_fat_archive_p, bfd_mach_o_header_p): Likewise.
2476 * mmo.c (mmo_object_p): Likewise.
2477 * pef.c (bfd_pef_object_p, bfd_pef_xlib_object_p): Likewise.
2478 * peicode.h (coff_real_object_p, pe_ILF_object_p),
2479 (pe_bfd_object_p): Likewise.
2480 * plugin.c (ld_plugin_object_p, bfd_plugin_object_p): Likewise.
2481 * ppcboot.c (ppcboot_object_p): Likewise.
2482 * rs6000-core.c (rs6000coff_core_p): Likewise.
2483 * som.c (som_object_setup, som_object_p): Likewise.
2484 * srec.c (srec_object_p, symbolsrec_object_p): Likewise.
2485 * tekhex.c (tekhex_object_p): Likewise.
2486 * vms-alpha.c (alpha_vms_object_p): Likewise.
2487 * vms-lib.c (_bfd_vms_lib_archive_p, _bfd_vms_lib_alpha_archive_p),
2488 (_bfd_vms_lib_ia64_archive_p, _bfd_vms_lib_txt_archive_p): Likewise.
2489 * wasm-module.c (wasm_object_p): Likewise.
2490 * xsym.c (bfd_sym_object_p): Likewise.
2491 * xsym.h (bfd_sym_object_p): Likewise.
2492 * aoutx.h (some_aout_object_p): Likewise, and callback parameter
2494 * pdp11.c (some_aout_object_p): Likewise.
2495 * plugin.c (register_ld_plugin_object_p): Update object_p
2497 * plugin.h (register_ld_plugin_object_p): Likewise.
2498 * bfd-in2.h: Regenerate.
2499 * libbfd.h: Regenerate.
2500 * libcoff.h: Regenerate.
2504 * coff-alpha.c (alpha_ecoff_le_vec): Add SEC_SMALL_DATA to
2505 applicable section flags.
2506 * coff-mips.c (mips_ecoff_le_vec, mips_ecoff_be_vec): Likewise.
2507 (mips_ecoff_bele_vec): Likewise.
2508 * coffcode.h (sec_to_styp_flags): Set SEC_SMALL_DATA for .sdata
2510 * ecoff.c (_bfd_ecoff_new_section_hook): Likewise.
2511 (_bfd_ecoff_styp_to_sec_flags): Likewise.
2515 * elf32-m32r.c (m32r_elf_section_flags): New function.
2516 (elf_backend_section_flags): Define.
2517 * elf32-nds32.c (nds32_elf_section_flags): New function.
2518 (elf_backend_section_flags): Define.
2519 * elf32-ppc.c (ppc_elf_section_from_shdr): Set SEC_SMALL_DATA for
2520 .sbss and .sdata sections.
2521 * elf32-v850.c (v850_elf_section_from_shdr): Set SEC_SMALL_DATA
2522 for SHF_V850_GPREL sections.
2523 * elf64-alpha.c (elf64_alpha_section_from_shdr): Delete outdated
2525 * elf64-hppa.c (elf64_hppa_section_from_shdr): Set SEC_SMALL_DATA
2526 for SHF_PARISC_SHORT sections.
2527 * elf64-ppc.c (ppc64_elf_section_flags): New function.
2528 (elf_backend_section_flags): Define.
2529 * elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Set SEC_SMALL_DATA
2530 for SHF_MIPS_GPREL sections. Delete FIXME.
2534 * elf-bfd.h (elf_backend_section_flags): Remove flagword* param.
2535 * elf.c (_bfd_elf_make_section_from_shdr): Set section flags before
2536 calling elf_backend_section_flags with adjusted params. Use
2537 newsect->flags past that point.
2538 (_bfd_elf_new_section_hook): Always set sh_type and sh_flags for
2540 (_bfd_elf_init_private_section_data): Allow normal sh_type sections
2541 to have their type overridden, and all sh_flags but processor and
2543 * elf32-arm.c (elf32_arm_section_flags): Adjust for changed params.
2544 * elf32-mep.c (mep_elf_section_flags): Likewise.
2545 * elf32-nios2.c (nios2_elf32_section_flags): Likewise.
2546 * elf64-alpha.c (elf64_alpha_section_flags): Likewise.
2547 * elf64-ia64-vms.c (elf64_ia64_section_flags): Likewise.
2548 * elfnn-ia64.c (elfNN_ia64_section_flags): Likewise.
2549 * elfnn-aarch64.c (elfNN_aarch64_size_stubs): Exclude the linker
2550 stub BFD and non-aarch64 input files when scanning for stubs.
2554 * coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Provide an upper
2555 limit to decompressed element size.
2559 * vms-lib.c (vms_traverse_index): Add recur_count param and
2560 update calls. Fail on excessive recursion.
2564 * vms-alpha.c (vms_get_remaining_object_record): Use
2565 bfd_realloc_or_free rather than bfd_realloc.
2566 (add_symbol_entry, vector_grow1, alpha_vms_slurp_relocs): Likewise.
2567 (dst_define_location, parse_module): Likewise, and check realloc
2568 return status before using memory. Return status from function
2569 adjusting all callers.
2573 * vms-lib.c (_bfd_vms_lib_archive_p): Free memory on error paths.
2577 * vms-alpha.c (alpha_vms_object_p): Use _bfd_malloc_and_read.
2578 Remove duplicate undersize check.
2583 * mmo.c (mmo_scan): Set SEC_DATA for .data.
2588 * syms.c (stt): Trim off all but 'e', 'i' and 'p' entries.
2589 (coff_section_type): Adjust comment.
2590 (decode_section_type): Likewise. Call coff_section_type before
2591 decode_section_type.
2592 (bfd_decode_symclass): Use 'c' for common sections other than
2597 * coff-rs6000.c (_bfd_xcoff_read_ar_hdr): Put all data in one
2602 * bfd.c (bfd_stat_arch_elt): Use vector of containing archive,
2603 if file is an archive element.
2604 * bfd-in2.h: Regenerate.
2608 * archive.c (do_slurp_bsd_armap): Increase minimum parsed_size, and
2609 bfd_set_error on failing test. Don't bother changing bfd_error on
2610 file read error. Check symdef_count is multiple of BSD_SYMDEF_SIZE.
2611 Check sym name is within string buffer. Use size_t for some vars.
2612 (do_slurp_coff_armap): Use size_t for some variables, fix size of
2613 int_buf. Don't change bfd_error on file read error. Use
2614 _bfd_mul_overflow when calculating carsym buffer size. Reorder
2615 calculations to catch overflows before they occur. malloc and
2616 free raw armap rather than using bfd_alloc. Read raw armap before
2617 allocating carsym+strings buffer.
2618 (_bfd_slurp_extended_name_table): Localize variables. Check
2619 name size against file size.
2623 * vms-lib.c (vms_lib_read_index): Release correct buffer.
2627 * elf32-rx.c (rx_elf_relocate_section): Use bfd_malloc rather than
2628 malloc. Check for NULL return from bfd_malloc.
2629 (rx_table_find, rx_table_map): Likewise.
2630 (rx_set_section_contents): Check bfd_alloc return.
2631 (rx_dump_symtab): Don't alloc internal_syms or external_syms.
2635 * aoutx.h: Indent labels correctly. Format error strings.
2636 * archive.c: Likewise.
2637 * archive64.c: Likewise.
2638 * coff-arm.c: Likewise.
2639 * coff-rs6000.c: Likewise.
2640 * coff-stgo32.c: Likewise.
2641 * cpu-arm.c: Likewise.
2642 * dwarf2.c: Likewise.
2643 * elf-ifunc.c: Likewise.
2644 * elf-properties.c: Likewise.
2645 * elf-s390-common.c: Likewise.
2646 * elf-strtab.c: Likewise.
2648 * elf32-arm.c: Likewise.
2649 * elf32-bfin.c: Likewise.
2650 * elf32-cr16.c: Likewise.
2651 * elf32-csky.c: Likewise.
2652 * elf32-i386.c: Likewise.
2653 * elf32-m68k.c: Likewise.
2654 * elf32-msp430.c: Likewise.
2655 * elf32-nds32.c: Likewise.
2656 * elf32-nios2.c: Likewise.
2657 * elf32-pru.c: Likewise.
2658 * elf32-xtensa.c: Likewise.
2659 * elf64-ia64-vms.c: Likewise.
2660 * elf64-x86-64.c: Likewise.
2661 * elfcode.h: Likewise.
2662 * elfcore.h: Likewise.
2663 * elflink.c: Likewise.
2664 * elfnn-aarch64.c: Likewise.
2665 * elfnn-ia64.c: Likewise.
2666 * elfnn-riscv.c: Likewise.
2667 * elfxx-mips.c: Likewise.
2668 * elfxx-sparc.c: Likewise.
2669 * elfxx-x86.c: Likewise.
2670 * i386lynx.c: Likewise.
2671 * merge.c: Likewise.
2672 * pdp11.c: Likewise.
2673 * plugin.c: Likewise.
2674 * reloc.c: Likewise.
2679 * elf-bfd.h (struct elf_link_hash_table): Rename "loaded" to
2681 (bfd_elf_add_dt_needed_tag): Declare.
2682 * elf-strtab.c (_bfd_elf_strtab_restore): Handle NULL buf.
2683 * elflink.c (bfd_elf_add_dt_needed_tag): Make global and rename
2684 from elf_add_dt_needed_tag. Remove soname and doit param.
2685 (elf_link_add_object_symbols): Don't use elf_add_dt_needed_tag
2686 to see whether as-needed lib is already loaded, use dyn_loaded
2687 list instead. When saving and restoring around as-needed lib
2688 handle possibility that dynstr has not been initialised. Don't
2689 add DT_NEEDED tags here. Limit dyn_loaded list to dynamic libs.
2690 Mark libs loaded via DT_NEEDED entries of other libs with
2691 DYN_NO_NEEDED if they should not be mentioned in DT_NEEDED of
2693 (elf_link_check_versioned_symbol): Remove now unneccesary
2694 DYNAMIC check when traversing dyn_loaded list.
2698 * bfdio.c (bfd_get_file_size): Ignore bogus archive element sizes.
2703 * plugin.c (need_lto_wrapper_p): New.
2704 (bfd_plugin_set_program_name): Add an int argument to set
2706 (get_lto_wrapper): Return FALSE if need_lto_wrapper_p isn't
2708 * plugin.h (bfd_plugin_set_program_name): Add an int argument.
2712 * vms-lib.c (_bfd_vms_lib_archive_p): Correct overflow checks.
2716 * vms-lib.c (struct carsym_mem): Add limit.
2717 (vms_add_index): Heed limit.
2718 (vms_traverse_index): Catch buffer overflows. Remove outdated fixme.
2719 (vms_lib_read_index): Set up limit. Catch 32-bit overflow.
2720 Always return actual number read.
2721 (_bfd_vms_lib_archive_p): Catch buffer overflows. Replace
2722 assertion with error exit.
2727 * elf.c (assign_file_positions_for_load_sections): Continue linking
2728 on "PHDR segment not covered by LOAD segment" errors.
2732 * mach-o.c (bfd_mach_o_canonicalize_relocs): Fix ineffective
2734 (bfd_mach_o_canonicalize_reloc): Likewise.
2735 (bfd_mach_o_canonicalize_dynamic_reloc): Likewise. Sanity check
2736 counts and offsets against file size.
2737 (bfd_mach_o_build_dysymtab): Fix ineffective overflow check.
2738 (bfd_mach_o_mangle_sections): Remove unnecessary overflow check.
2739 (bfd_mach_o_read_symtab_symbols): Sanity check count and offset
2740 against file size. Delete symbol table error message.
2741 (bfd_mach_o_read_dysymtab): Sanity check counts and offsets
2743 (bfd_mach_o_read_symtab): Likewise.
2744 (bfd_mach_o_read_command): Pass file size.
2745 (bfd_mach_o_scan): Sanity check command count against file size.
2750 * aoutx.h (adjust_o_magic, adjust_z_magic, adjust_n_magic): Use
2751 "text", "data" and "bss" section pointer vars. Don't update
2752 section size, just exec header sizes.
2753 (adjust_sizes_and_vmas): Don't update text section size. Set
2754 initial exec header a_text. Print exec headers sizes.
2755 * pdp11.c (adjust_o_magic, adjust_z_magic, adjust_n_magic),
2756 (adjust_sizes_and_vmas): Similarly. Formatting.
2757 (final_link): Correct final file extension.
2761 * elf-bfd.h (struct elf_backend_data): Add symbol_section_index
2763 * elfxx-target.h (elf_backend_symbol_section_index): Provide
2765 (elfNN_bed): Initialise the symbol_section_index field.
2766 * elf.c (swap_out_syms): Call symbol_section_index, if defined, on
2767 OS and PROC specific section indicies. Warn if converting other
2768 reserved incidies to SHN_ABS.
2773 * cpu-z80.c: Add machine type compatibility checking.
2778 * plugin.c (plugin_list_entry): Remove handle.
2779 (try_load_plugin): Call dlclose before return.
2783 * libbfd-in.h (_bfd_constant_p): Define.
2784 (_bfd_alloc_and_read, _bfd_malloc_and_read): Check read size against
2785 file size before allocating memory.
2786 * coffgen.c (_bfd_coff_get_external_symbols): Remove file size check.
2787 * elf.c (bfd_elf_get_str_section): Likewise.
2788 (_bfd_elf_slurp_version_tables): Likewise.
2789 * libbfd.h: Regenerate.
2793 * libbfd-in.h (_bfd_alloc_and_read, _bfd_malloc_and_read): New.
2794 * aoutx.h (aout_get_external_symbols): Replace calls to
2795 bfd_[m]alloc and bfd_bread with call to _bfd_[m]alloc_and_read.
2796 (slurp_reloc_table): Likewise.
2797 * archive.c (do_slurp_bsd_armap): Likewise.
2798 (do_slurp_coff_armap): Likewise.
2799 * archive64.c (_bfd_archive_64_bit_slurp_armap): Likewise.
2800 * coff-rs6000.c (_bfd_xcoff_slurp_armap): Likewise.
2801 * coff64-rs6000.c (xcoff64_slurp_armap): Likewise.
2802 * coffcode.h (coff_set_arch_mach_hook, buy_and_read): Likewise.
2803 * coffgen.c (coff_real_object_p, coff_object_p, build_debug_section),
2804 (_bfd_coff_get_external_symbols): Likewise.
2805 * ecoff.c (ecoff_slurp_symbolic_header),
2806 (_bfd_ecoff_slurp_symbolic_info, ecoff_slurp_reloc_table),
2807 (_bfd_ecoff_slurp_armap, ecoff_link_add_object_symbols, READ),
2808 (ecoff_indirect_link_order): Likewise.
2809 * elf.c (bfd_elf_get_str_section, setup_group, elf_read_notes),
2810 (_bfd_elf_slurp_version_tables): Likewise.
2811 * elf32-m32c.c (m32c_elf_relax_section): Likewise.
2812 * elf32-rl78.c (rl78_elf_relax_section): Likewise.
2813 * elf32-rx.c (elf32_rx_relax_section): Likewise.
2814 * elf64-alpha.c (READ): Likewise.
2815 * elf64-mips.c (mips_elf64_slurp_one_reloc_table): Likewise.
2816 * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Likewise.
2817 * elfcode.h (elf_slurp_symbol_table),
2818 (elf_slurp_reloc_table_from_section): Likewise.
2819 * elflink.c (elf_link_add_object_symbols),
2820 (elf_link_check_versioned_symbol): Likewise.
2821 * elfxx-mips.c (READ): Likewise.
2822 * i386lynx.c (slurp_reloc_table): Likewise.
2823 * lynx-core.c (lynx_core_file_p): Likewise.
2824 * mach-o.c (bfd_mach_o_canonicalize_relocs),
2825 (bfd_mach_o_read_symtab_strtab, bfd_mach_o_alloc_and_read),
2826 (bfd_mach_o_read_prebound_dylib, bfd_mach_o_read_dyld_content
2827 * pdp11.c (aout_get_external_symbols, slurp_reloc_table
2828 * pef.c (bfd_pef_print_loader_section, bfd_pef_scan_start_address),
2829 (bfd_pef_parse_symbols): Likewise.
2830 * peicode.h (pe_ILF_object_p, pe_bfd_object_p
2831 * som.c (setup_sections, som_slurp_string_table),
2832 (som_slurp_reloc_table, som_bfd_count_ar_symbols),
2833 (som_bfd_fill_in_ar_symbols): Likewise.
2834 * vms-alpha.c (module_find_nearest_line, evax_bfd_print_dst),
2835 (evax_bfd_print_image): Likewise.
2836 * vms-lib.c (_bfd_vms_lib_archive_p): Likewise.
2837 * wasm-module.c (wasm_scan): Likewise.
2838 * xcofflink.c (xcoff_link_add_symbols): Likewise.
2839 * xsym.c (bfd_sym_read_name_table),
2840 (bfd_sym_print_type_information_table_entry): Likewise.
2841 * libbfd.h: Regenerate.
2845 * aoutx.h (slurp_reloc_table): Allocate reloc_cache after
2846 reading external relocs.
2847 * ecoff.c (ecoff_slurp_reloc_table): Likewise.
2848 * archive.c (_bfd_write_archive_contents): Don't twiddle bfd_error
2850 * archive64.c (_bfd_archive_64_bit_slurp_armap): Remove unnecessary
2852 * elf32-m32c.c (m32c_offset_for_reloc): Make shndx_buf a bfd_byte*.
2853 (m32c_elf_relax_section): Likewise.
2854 * elf32-rl78.c (rl78_offset_for_reloc): Likewise.
2855 (rl78_elf_relax_section): Likewise.
2856 * elf32-rx.c (rx_offset_for_reloc): Likewise.
2857 (elf32_rx_relax_section): Likewise.
2858 * mach-o.c (bfd_mach_o_alloc_and_read): Move earlier with better
2859 parameter types and use..
2860 (bfd_mach_o_read_dylinker, bfd_mach_o_read_dylib),
2861 (bfd_mach_o_read_fvmlib, bfd_mach_o_read_str): ..in these functions.
2862 * peicode.h (pe_bfd_object_p): Don't zero the part of opthdr
2863 being read from file, just the extra.
2864 * som.c (som_slurp_symbol_table): Allocate internal symbol buffer
2865 after reading external syms. Free on failure.
2869 * coffcode.h (buy_and_read, coff_slurp_line_table),
2870 (coff_slurp_symbol_table, coff_slurp_reloc_table): Replace
2871 bfd_[z][m]alloc2 calls with _bfd_mul_overflow followed by the
2872 corresponding bfd_alloc call. Adjust variables to suit.
2873 * coffgen.c (_bfd_coff_get_external_symbols): Likewise.
2874 * ecoff.c (_bfd_ecoff_slurp_symbolic_info),
2875 (_bfd_ecoff_slurp_symbol_table, READ): Likewise.
2876 * elf.c (bfd_elf_get_elf_syms, setup_group, bfd_section_from_shdr),
2877 (swap_out_syms, _bfd_elf_slurp_version_tables): Likewise.
2878 * elf32-m32c.c (m32c_elf_relax_section): Likewise.
2879 * elf32-rl78.c (rl78_elf_relax_section): Likewise.
2880 * elf32-rx.c (elf32_rx_relax_section): Likewise.
2881 * elf64-alpha.c (READ): Likewise.
2882 * elfcode.h (elf_object_p, elf_write_relocs, elf_write_shdrs_and_ehdr),
2883 (elf_slurp_symbol_table, elf_slurp_reloc_table),
2884 (bfd_from_remote_memory): Likewise.
2885 * elfcore.h (core_find_build_id): Likewise.
2886 * elfxx-mips.c (READ): Likewise.
2887 * mach-o.c (bfd_mach_o_mangle_sections),
2888 (bfd_mach_o_read_symtab_symbols, bfd_mach_o_read_thread),
2889 (bfd_mach_o_read_dysymtab, bfd_mach_o_flatten_sections),
2890 (bfd_mach_o_scan, bfd_mach_o_fat_archive_p): Likewise.
2891 * som.c (setup_sections, som_prep_for_fixups)
2892 (som_build_and_write_symbol_table, som_slurp_symbol_table),
2893 (som_slurp_reloc_table, som_bfd_count_ar_symbols),
2894 (som_bfd_fill_in_ar_symbols, som_slurp_armap),
2895 (som_bfd_ar_write_symbol_stuff): Likewise.
2896 * vms-alpha.c (vector_grow1): Likewise.
2897 * vms-lib.c (vms_add_index): Likewise.
2898 * wasm-module.c (wasm_scan_name_function_section): Likewise.
2899 * libbfd.c (bfd_malloc2, bfd_realloc2, bfd_zmalloc2): Delete.
2900 * opncls.c (bfd_alloc2, bfd_zalloc2): Delete.
2901 * libbfd-in.h (bfd_malloc2, bfd_realloc2, bfd_zmalloc2),
2902 (bfd_alloc2, bfd_zalloc2): Delete.
2903 (_bfd_mul_overflow): Define.
2904 * libbfd.h: Regenerate.
2908 * elf.c (bfd_section_from_shdr): Use bfd_zalloc rather than
2910 (assign_section_numbers): Likewise.
2911 (elf_map_symbols): Likewise, and bfd_alloc rather than bfd_alloc2.
2912 (_bfd_elf_map_sections_to_segments): Use bfd_malloc rather than
2913 bfd_malloc2, size_t amt, and unsigned tls_count.
2914 (rewrite_elf_program_header): Use bfd_malloc and size_t amt.
2915 * elflink.c (elf_create_symbuf): Use bfd_malloc.
2916 (elf_output_implib): Use bfd_alloc.
2920 * bfd.c (struct bfd): Move format and direction to other
2921 bitfields. Add "size".
2922 * bfdio.c (bfd_get_size): Cache size when not writing file.
2923 * opncls.c (bfd_get_debug_link_info_1): Allow for bfd_get_size
2924 returning zero, ie. unknown.
2925 (bfd_get_alt_debug_link_info): Likewise.
2926 * bfd-in2.h: Regenerate.
2930 * coffgen.c (_bfd_coff_get_external_symbols): Don't call
2931 bfd_get_file_size twice.
2932 (_bfd_coff_read_string_table): Allow for bfd_get_file_size
2933 zero, ie. unknown, return.
2934 * elf-attrs.c (_bfd_elf_parse_attributes): Likewise.
2935 * elfcode.h (elf_swap_shdr_in): Likewise.
2936 (elf_object_p): Don't call bfd_get_file_size twice and correct
2941 * mach-o.c (bfd_mach_o_flatten_sections): Return a bfd_boolean,
2942 FALSE if memory alloc fails. Adjust calls.
2943 * som.c (som_prep_for_fixups): Likewise.
2944 * vms-alpha.c (alpha_vms_add_fixup_lp, alpha_vms_add_fixup_ca),
2945 (alpha_vms_add_fixup_qr, alpha_vms_add_fixup_lr),
2946 (alpha_vms_add_lw_reloc, alpha_vms_add_qw_reloc): Likewise.
2947 * som.c (som_build_and_write_symbol_table): Return via error_return
2949 * vms-alpha.c (VEC_APPEND): Adjust for vector_grow1 changes.
2950 (VEC_APPEND_EL): Delete.
2951 (vector_grow1): Return pointer to element. Catch overflow.
2952 Return NULL on memory allocation failure.
2953 (alpha_vms_add_fixup_lp): Replace VEC_APPEND_EL with VEC_APPEND.
2954 (alpha_vms_add_fixup_ca): Likewise.
2955 (alpha_vms_link_add_object_symbols): Check VEC_APPEND result
2957 * elf.c (bfd_section_from_shdr): Check bfd_zalloc2 result.
2961 * aix386-core.c (aix386_core_file_p): Use size_t for "amt".
2962 * aout-target.h (object_p): Likewise.
2963 * aout-tic30.c (tic30_aout_object_p): Likewise.
2964 * aoutx.h (some_aout_object_p, mkobject, make_empty_symbol),
2965 (emit_stringtab, write_syms, link_hash_table_create),
2966 (aout_link_write_other_symbol): Likewise.
2967 * archive.c (_bfd_generic_mkarchive, bfd_generic_archive_p),
2968 (bfd_ar_hdr_from_filesystem, _bfd_write_archive_contents),
2969 (_bfd_compute_and_write_armap): Likewise.
2970 * archures.c (bfd_arch_list): Likewise.
2971 * bfd.c (bfd_record_phdr): Likewise.
2972 * binary.c (binary_canonicalize_symtab): Likewise.
2973 * cisco-core.c (cisco_core_file_validate): Likewise.
2974 * coff-arm.c (coff_arm_link_hash_table_create, find_thumb_glue),
2975 (find_arm_glue, record_arm_to_thumb_glue),
2976 (record_thumb_to_arm_glue): Likewise.
2977 * coff-ppc.c (ppc_coff_link_hash_table_create, record_toc),
2978 (ppc_allocate_toc_section): Likewise.
2979 * coff-rs6000.c (_bfd_xcoff_mkobject, _bfd_xcoff_archive_p): Likewise.
2980 * coff-sh.c (sh_relax_section): Likewise.
2981 * coff64-rs6000.c (xcoff64_archive_p): Likewise.
2982 * coffcode.h (handle_COMDAT, coff_new_section_hook),
2983 (coff_set_alignment_hook, coff_mkobject),
2984 (coff_compute_section_file_positions): Likewise.
2985 * coffgen.c (coff_make_empty_symbol, coff_bfd_make_debug_symbol),
2986 (coff_find_nearest_line_with_names),
2987 ( bfd_coff_set_symbol_class): Likewise.
2988 * cofflink.c (_bfd_coff_link_hash_table_create),
2989 (_bfd_coff_link_input_bfd): Likewise.
2990 * dwarf1.c (alloc_dwarf1_unit, alloc_dwarf1_func): Likewise.
2991 * dwarf2.c (read_abbrevs, read_attribute_value, add_line_info),
2992 (build_line_info_table, sort_line_sequences),
2993 (line_info_add_include_dir, line_info_add_file_name),
2994 (decode_line_info, scan_unit_for_symbols, parse_comp_unit),
2995 (place_sections, _bfd_dwarf2_slurp_debug_info): Likewise.
2996 * ecoff.c (_bfd_ecoff_mkobject, _bfd_ecoff_make_empty_symbol),
2997 (_bfd_ecoff_find_nearest_line),
2998 (_bfd_ecoff_bfd_link_hash_table_create): Likewise.
2999 * ecofflink.c (bfd_ecoff_debug_init): Likewise.
3000 * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Likewise.
3001 * elf-m10300.c (mn10300_elf_relax_section),
3002 (elf32_mn10300_link_hash_table_create): Likewise.
3003 * elf-strtab.c (_bfd_elf_strtab_init): Likewise.
3004 * elf.c (make_mapping, copy_elf_program_header): Likewise.
3005 * elf32-arm.c (elf32_arm_link_hash_table_create),
3006 (elf32_arm_setup_section_lists, elf32_arm_check_relocs),
3007 (elf32_arm_new_section_hook): Likewise.
3008 * elf32-avr.c (elf_avr_new_section_hook),
3009 (elf32_avr_link_hash_table_create, get_local_syms),
3010 (elf32_avr_setup_section_lists): Likewise.
3011 * elf32-bfin.c (bfinfdpic_elf_link_hash_table_create),
3012 (bfin_link_hash_table_create): Likewise.
3013 * elf32-cr16.c (elf32_cr16_link_hash_table_create): Likewise.
3014 * elf32-cris.c (elf_cris_link_hash_table_create): Likewise.
3015 * elf32-csky.c (csky_elf_link_hash_table_create),
3016 (csky_elf_check_relocs, elf32_csky_setup_section_lists): Likewise.
3017 * elf32-frv.c (frvfdpic_elf_link_hash_table_create): Likewise.
3018 * elf32-hppa.c (elf32_hppa_link_hash_table_create),
3019 (elf32_hppa_setup_section_lists, get_local_syms): Likewise.
3020 * elf32-i386.c (elf_i386_check_relocs): Likewise.
3021 * elf32-lm32.c (lm32_elf_link_hash_table_create): Likewise.
3022 * elf32-m32r.c (m32r_elf_link_hash_table_create),
3023 (m32r_elf_check_relocs): Likewise.
3024 * elf32-m68hc1x.c (m68hc11_elf_hash_table_create),
3025 (elf32_m68hc11_setup_section_lists),
3026 (elf32_m68hc11_size_stubs): Likewise.
3027 * elf32-m68k.c (elf_m68k_link_hash_table_create): Likewise.
3028 * elf32-metag.c (elf_metag_link_hash_table_create),
3029 (elf_metag_setup_section_lists): Likewise.
3030 * elf32-microblaze.c (microblaze_elf_link_hash_table_create),
3031 (microblaze_elf_check_relocs): Likewise.
3032 * elf32-nds32.c (nds32_elf_link_hash_table_create),
3033 (nds32_elf_check_relocs): Likewise.
3034 * elf32-nios2.c (nios2_elf32_setup_section_lists),
3035 (get_local_syms, nios2_elf32_check_relocs),
3036 (nios2_elf32_link_hash_table_create): Likewise.
3037 * elf32-or1k.c (or1k_elf_link_hash_table_create),
3038 (or1k_elf_check_relocs): Likewise.
3039 * elf32-ppc.c (ppc_elf_modify_segment_map, update_plt_info): Likewise.
3040 * elf32-pru.c (pru_elf32_link_hash_table_create): Likewise.
3041 * elf32-s390.c (elf_s390_link_hash_table_create),
3042 (elf_s390_check_relocs): Likewise.
3043 * elf32-score.c (score_elf_create_got_section),
3044 (s3_elf32_score_new_section_hook),
3045 (elf32_score_link_hash_table_create): Likewise.
3046 * elf32-score7.c (score_elf_create_got_section),
3047 (s7_elf32_score_new_section_hook): Likewise.
3048 * elf32-sh.c (sh_elf_link_hash_table_create),
3049 (sh_elf_check_relocs): Likewise.
3050 * elf32-tic6x.c (elf32_tic6x_link_hash_table_create),
3051 (elf32_tic6x_new_section_hook, elf32_tic6x_check_relocs): Likewise.
3052 * elf32-tilepro.c (tilepro_elf_link_hash_table_create),
3053 (tilepro_elf_check_relocs): Likewise.
3054 * elf32-v850.c (remember_hi16s_reloc): Likewise.
3055 * elf32-vax.c (elf_vax_link_hash_table_create): Likewise.
3056 * elf32-xtensa.c (elf_xtensa_link_hash_table_create),
3057 (elf_xtensa_new_section_hook): Likewise.
3058 * elf64-alpha.c (elf64_alpha_bfd_link_hash_table_create),
3059 (get_got_entry, elf64_alpha_check_relocs): Likewise.
3060 * elf64-hppa.c (elf64_hppa_hash_table_create): Likewise.
3061 * elf64-ia64-vms.c (elf64_ia64_object_p): Likewise.
3062 * elf64-mmix.c (mmix_elf_new_section_hook): Likewise.
3063 * elf64-ppc.c (ppc64_elf_new_section_hook),
3064 (ppc64_elf_link_hash_table_create, update_local_sym_info),
3065 (update_plt_info, ppc64_elf_check_relocs): Likewise.
3066 * elf64-s390.c (elf_s390_link_hash_table_create),
3067 (elf_s390_check_relocs): Likewise.
3068 * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
3069 * elflink.c (bfd_elf_link_record_local_dynamic_symbol),
3070 (_bfd_elf_link_find_version_dependencies, elf_link_add_object_symbols),
3071 (elf_link_add_archive_symbols, compute_bucket_count),
3072 (bfd_elf_size_dynsym_hash_dynstr, _bfd_elf_link_hash_table_create),
3073 (bfd_elf_get_bfd_needed_list, elf_link_swap_symbols_out),
3074 (bfd_elf_final_link): Likewise.
3075 * elfnn-aarch64.c (elfNN_aarch64_link_hash_table_create),
3076 (elfNN_aarch64_setup_section_lists, elfNN_aarch64_check_relocs),
3077 (elfNN_aarch64_new_section_hook): Likewise.
3078 * elfnn-ia64.c (elfNN_ia64_object_p): Likewise.
3079 * elfnn-riscv.c (riscv_elf_link_hash_table_create),
3080 (riscv_elf_check_relocs): Likewise.
3081 * elfxx-mips.c (_bfd_mips_elf_new_section_hook),
3082 (_bfd_mips_elf_add_symbol_hook, _bfd_mips_elf_check_relocs),
3083 (_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_set_section_contents),
3084 (_bfd_mips_elf_link_hash_table_create): Likewise.
3085 * elfxx-sparc.c (_bfd_sparc_elf_link_hash_table_create),
3086 (_bfd_sparc_elf_check_relocs),
3087 (_bfd_sparc_elf_new_section_hook): Likewise.
3088 * elfxx-tilegx.c (tilegx_elf_link_hash_table_create),
3089 (tilegx_elf_check_relocs): Likewise.
3090 * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Likewise.
3091 * format.c (bfd_check_format_matches): Likewise.
3092 * hash.c (_bfd_stringtab_init): Likewise.
3093 * ihex.c (ihex_scan): Likewise.
3094 * irix-core.c (irix_core_core_file_p): Likewise.
3095 * linker.c (bfd_wrapped_link_hash_lookup),
3096 (_bfd_generic_link_hash_table_create),
3097 (_bfd_generic_reloc_link_order): Likewise.
3098 * lynx-core.c (lynx_core_file_p): Likewise.
3099 * netbsd-core.c (netbsd_core_file_p): Likewise.
3100 * osf-core.c (osf_core_core_file_p): Likewise.
3101 * pdp11.c (some_aout_object_p, mkobject, make_empty_symbol),
3102 (link_hash_table_create, aout_link_write_other_symbol): Likewise.
3103 * peXXigen.c (_bfd_XX_bfd_copy_private_section_data): Likewise.
3104 * peicode.h (pe_mkobject): Likewise.
3105 * ppcboot.c (ppcboot_mkobject, ppcboot_canonicalize_symtab): Likewise.
3106 * ptrace-core.c (ptrace_unix_core_file_p): Likewise.
3107 * sco5-core.c (read_uarea): Likewise.
3108 * som.c (hppa_som_gen_reloc_type, som_object_p, som_prep_headers),
3109 (som_write_fixups, som_write_space_strings, som_write_symbol_strings),
3110 (som_finish_writing, som_canonicalize_symtab, som_new_section_hook),
3111 (som_bfd_copy_private_section_data, bfd_som_set_section_attributes),
3112 (bfd_som_attach_aux_hdr, som_write_armap): Likewise.
3113 * srec.c (srec_scan): Likewise.
3114 * syms.c (_bfd_generic_make_empty_symbol): Likewise.
3115 * targets.c (bfd_target_list): Likewise.
3116 * tekhex.c (first_phase, tekhex_sizeof_headers): Likewise.
3117 * trad-core.c (trad_unix_core_file_p): Likewise.
3118 * vms-alpha.c (vms_initialize, alpha_vms_bfd_link_hash_table_create),
3119 (vms_new_section_hook): Likewise.
3120 * wasm-module.c (wasm_make_empty_symbol): Likewise.
3121 * xcofflink.c (xcoff_get_section_contents),
3122 (_bfd_xcoff_bfd_link_hash_table_create, xcoff_set_import_path),
3123 (xcoff_find_function, bfd_xcoff_link_record_set, xcoff_build_ldsym),
3124 (bfd_xcoff_size_dynamic_sections, xcoff_link_input_bfd): Likewise.
3128 * elfxx-riscv.c (riscv_multi_letter_ext_valid_p): Don't use C99.
3132 * plugin.c (try_load_plugin): Make plugin_list_iter an argument
3133 and use it if it isn't NULL. Remove has_plugin_p argument. Add
3134 a build_list_p argument. Don't search plugin_list. Short circuit
3135 when building the plugin list.
3136 (has_plugin): Renamed to has_plugin_list.
3137 (bfd_plugin_set_plugin): Don't set has_plugin.
3138 (bfd_plugin_specified_p): Check plugin_list instead.
3139 (build_plugin_list): New function.
3140 (load_plugin): Call build_plugin_list and use plugin_list.
3145 * plugin.c (try_claim): Always clean up for LTO wrapper.
3146 (try_load_plugin): Treat each object as independent. Create a
3147 copy for plugin name.
3151 * elf32-msp430.c (msp430_final_link_relocate): Always use longs
3152 for addresses in print statements.
3153 (msp430_elf_relax_delete_bytes): Likewise.
3154 (msp430_elf_relax_add_words): Likewise.
3155 (msp430_elf_relax_section): Likewise.
3159 * plugin.c (add_symbols): Clear plugin_data memory.
3164 * configure.ac (HAVE_EXECUTABLE_SUFFIX): New AC_DEFINE.
3165 (EXECUTABLE_SUFFIX): Likewise.
3166 * config.in: Regenerated.
3167 * configure: Likewise.
3168 * plugin.c (bfd_plugin_close_and_cleanup): Removed.
3169 (plugin_list_entry): Add all_symbols_read, cleanup_handler,
3170 gcc, lto_wrapper, resolution_file, resolution_option, gcc_env,
3171 real_bfd, real_nsyms, real_syms, lto_nsyms and lto_syms.
3172 (get_lto_wrapper): New.
3173 (setup_lto_wrapper_env): Likewise.
3174 (current_plugin): Likewise.
3175 (register_all_symbols_read): Likewise.
3176 (register_cleanup): Likewise.
3177 (get_symbols): Likewise.
3178 (add_input_file): Likewise.
3179 (bfd_plugin_close_and_cleanup): Likewise.
3180 (claim_file): Removed.
3181 (register_claim_file): Set current_plugin->claim_file.
3182 (add_symbols): Make a copy of LTO symbols. Set lto_nsyms and
3183 lto_syms in current_plugin.
3184 (try_claim): Use current_plugin->claim_file. Call LTO plugin
3185 all_symbols_read handler. Copy real symbols to plugin_data.
3186 Call LTO plugin cleanup handler. Clean up for LTO wrapper.
3187 (try_load_plugin): Don't reuse the previous plugin for LTO
3188 wrapper. Set up GCC LTO wrapper if possible. Don't set
3189 plugin_list_iter->claim_file.
3190 (bfd_plugin_canonicalize_symtab): Use real LTO symbols if
3192 * plugin.h (plugin_data_struct): Add real_bfd, real_nsyms and
3197 * elf32-msp430.c (msp430_elf_relax_section): Before relaxing a branch,
3198 check if previous instruction matches a conditional jump inserted
3199 earlier. Invert conditional jump and delete branch in this case.
3203 * elf32-msp430.c (msp430_elf_relax_add_two_words): Rename to
3204 msp430_elf_relax_add_words. Support insertion of either one or two
3206 (msp430_elf_relax_section): Catch opcode of 0x3c00 when relocation
3207 needs to be grown. Handle insertion of branch instruction to replace
3212 * elf32-msp430.c (msp430_final_link_relocate): Add printf statements for
3213 debugging relocations.
3214 (msp430_elf_relax_delete_bytes): Likewise.
3215 (msp430_elf_relax_add_two_words): Likewise.
3216 (msp430_elf_relax_section): Likewise.
3220 * archures.c: Wrap overlong z80 comments.
3221 * bfd-in2.h: Regenerate.
3226 * archures.c: Add GBZ80 and Z80N machine values.
3227 * reloc.c: Add BFD_RELOC_Z80_16_BE.
3228 * coff-z80.c: Add support for new reloc.
3229 * coffcode.h: Add support for new machine values.
3230 * cpu-z80.c: Add support for new machine names.
3231 * elf32-z80.c: Add support for new reloc.
3232 * bfd-in2.h: Regenerate.
3233 * libbfd.h: Regenerate.
3238 * elf.c (rewrite_elf_program_header): Do not complain if no
3239 sections are mapped to a segment.
3244 * elflink.c (_bfd_elf_gc_mark_extra_sections): Issue an error
3245 for garbage collection on __patchable_function_entries section
3246 without linked-to section.
3251 * bfd-in2.h: Regenerated.
3252 * elflink.c (_bfd_elf_gc_mark_extra_sections): Call mark_hook
3253 on section if gc_mark of any of its linked-to sections is set
3254 and don't set gc_mark again.
3255 * section.c (asection): Add linked_to_symbol_name to map_head
3260 * elf32-v850.c (v850_elf_relax_section): Fix the index used for
3261 reporting an unrecognized instruction with R_V850_LONGJUMP.
3265 * elf64-ppc.c (ppc_stub_plt_branch): Match comment with reality.
3269 * elf32-ppc.c (ppc_elf_relocate_section): After applying
3270 R_PPC_VLE_ADDR20, goto copy_reloc.
3274 * bfd-in2.h: Regenerated.
3275 * section.c (SEC_ASSEMBLER_SECTION_ID): Fix a typo in comments.
3280 * bfd-in2.h: Regenerated.
3281 * ecoff.c (bfd_debug_section): Add section_id.
3282 * section.c (bfd_section): Add section_id.
3283 (SEC_ASSEMBLER_SECTION_ID): New.
3284 (BFD_FAKE_SECTION): Add section_id.
3288 * config.bfd: Move the c30-aout and tic30-aout targets onto the
3293 * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): DW_EH_PE_datarel
3294 encodings are relative to the GOT on nios2, too.
3298 * Makefile.am (elf32-target.h, elf64-target.h): Don't use a temp
3299 file. Use $< and $@ in rules.
3300 (elf32-aarch64.c, elf64-aarch64.c): Likewise.
3301 (elf32-ia64.c, elf64-ia64.c): Likewise.
3302 (elf32-riscv.c, elf64-riscv.c): Likewise.
3303 (peigen.c, pepigen.c, pex64igen.c): Likewise.
3304 (elf32-aarch64.c, elf64-aarch64.c): Don't emit $srcdir on #line.
3305 (elf32-riscv.c, elf64-riscv.c): Likewise, and use $(SED).
3306 (elf32-ia64.c, elf64-ia64.c): Do emit #line.
3307 (peigen.c, pepigen.c, pex64igen.c): Likewise.
3308 * Makefile.in: Regenerate.
3313 * elf.c (setup_group): Don't clear entire section contents,
3314 just the padding after group flags. Release alloc'd memory
3315 after a seek or read failure.
3319 * peXXigen.c (pe_is_repro): New function.
3320 (_bfd_XX_print_private_bfd_data_common): Note timestamp is
3321 actually a build hash if PE_IMAGE_DEBUG_TYPE_REPRO is present.
3325 * peXXigen.c (debug_type_names): Add names for new debug data type
3330 * peXXigen.c (pe_print_debugdata): Fix the iteration variable for
3331 inner loop. Fix a memory leak.
3335 * coffgen.c (coff_real_object_p): Don't clear obj_coff_keep_syms
3336 or obj_coff_keep_strings here.
3337 (coff_get_normalized_symtab): Free external syms directly.
3338 * xcofflink.c (xcoff_link_input_bfd): Restore obj_coff_keep_syms
3343 * cpu-riscv.c (riscv_scan): New.
3344 (N): Change bfd_default_scan to riscv_scan.
3348 * Makefile.am (ALL_MACHINES): Remove cpu-plugin.lo.
3349 (ALL_MACHINES_CFILES): Remove cpu-plugin.c.
3350 * Makefile.in: Regenerate.
3351 * cpu-plugin.c: Remove.
3352 * archures.c (enum bfd_architecture): Remove bfd_arch_plugin.
3353 (bfd_plugin_arch): Remove declaration.
3354 * bfd-in2.h: Regenerate.
3355 * po/SRC-POTFILES.in: Regenerate.
3361 * elflink.c (_bfd_elf_gc_mark_rsec): Mark all weak aliases.
3365 * elfxx-riscv.c (riscv_get_prefix_class): Format s case like others.
3366 (riscv_parse_prefixed_ext): Fix s extension comment and reword to
3367 avoid over long line.
3372 * coffgen.c (_bfd_coff_close_and_cleanup): Do not clear the keep
3373 syms and keep strings flags as these may have been set in order to
3374 prevent a bogus call to free.
3378 * po/fr.po: Updated French translation.
3383 * elf.c (assign_file_positions_for_load_sections): Avoid divide
3384 by zero when p_align is zero.
3388 * bfd/elfnn-riscv.c (riscv_skip_prefix): New.
3389 (riscv_prefix_cmp): Likewise.
3390 (riscv_non_std_ext_p): Deleted.
3391 (riscv_std_sv_ext_p): Likewise.
3392 (riscv_non_std_sv_ext_p): Likewise.
3393 (riscv_merge_non_std_and_sv_ext): Rename to...
3394 (riscv_merge_multi_letter_ext): and modified to use riscv_prefix_cmp.
3395 (riscv_merge_arch_attr_info): Replace 3 calls to
3396 riscv_merge_non_std_and_sv_ext with single call to
3397 riscv_merge_multi_letter_ext.
3398 * bfd/elfxx-riscv.c (riscv_parse_std_ext): Break if we
3399 encounter a 'z' prefix.
3400 (riscv_get_prefix_class): New function, return prefix class based
3401 on first few characters of input string.
3402 (riscv_parse_config): New structure to factor out minor differences
3403 in extension class parsing behaviour.
3404 (riscv_parse_sv_or_non_std_ext): Rename to...
3405 (riscv_parse_prefixed_ext): and parameterise with
3407 (riscv_std_z_ext_strtab, riscv_std_s_ext_strtab): New.
3408 (riscv_multi_letter_ext_valid_p): New.
3409 (riscv_ext_x_valid_p, riscv_ext_z_valid_p, riscv_ext_s_valid_p): New.
3410 (riscv_parse_subset): Delegate all non-single-letter parsing work
3411 to riscv_parse_prefixed_ext.
3412 * bfd/elfxx-riscv.h (riscv_isa_ext_class): New type.
3413 (riscv_get_prefix_class): Declare.
3417 * elf64-ppc.c (struct ppc_link_hash_table): Add tga_group.
3418 (ppc64_elf_archive_symbol_lookup): Extract __tls_get_addr_opt for
3419 __tls_get_addr_desc.
3420 (ppc64_elf_size_stubs): Add section for linker generated
3421 __tls_get_addr_desc wrapper function. Loop at least once if
3422 generating this function.
3423 (emit_tga_desc, emit_tga_desc_eh_frame): New functions.
3424 (ppc64_elf_build_stubs): Generate __tls_get_addr_desc.
3428 * elf64-ppc.h (struct ppc64_elf_params): Add no_tls_get_addr_regsave.
3429 * elf64-ppc.c (struct ppc_link_hash_table): Add tga_desc and
3431 (is_tls_get_addr): Match tga_desc and tga_desc_df too.
3432 (STDU_R1_0R1, ADDI_R1_R1): Define.
3433 (tls_get_addr_prologue, tls_get_addr_epilogue): New functions.
3434 (ppc64_elf_tls_setup): Set up tga_desc and tga_desc_fd. Indirect
3435 tga_desc_fd to opt_fd, and tga_desc to opt. Set
3436 no_tls_get_addr_regsave.
3437 (branch_reloc_hash_match): Add hash3 and hash4.
3438 (ppc64_elf_tls_optimize): Handle tga_desc_fd and tga_desc too.
3439 (ppc64_elf_size_dynamic_sections): Likewise.
3440 (ppc64_elf_relocate_section): Likewise.
3441 (plt_stub_size, build_plt_stub): Likewise. Size regsave
3442 __tls_get_addr stub.
3443 (build_tls_get_addr_stub): Build regsave __tls_get_addr stub and
3445 (ppc_size_one_stub): Handle tga_desc_fd and tga_desc too. Size
3446 eh_frame for regsave __tls_get_addr.
3450 * elf64-ppc.c (ppc64_elf_size_stubs): Correct condition under
3451 which __tls_get_addr calls will be eliminated.
3455 * po/pt.po: Updates Portuguese translation.
3456 * po/ru.po: Updated Russian translation.
3457 * po/uk.po: Updated Ukranian translation.
3462 * elf64-x86-64.c (elf_x86_64_check_tls_transition): Support
3463 "rex leal x@tlsdesc(%rip), %reg" and "call *x@tlsdesc(%eax)" in
3465 (elf_x86_64_relocate_section): In x32 mode, for GDesc -> LE
3466 transition, relax "rex leal x@tlsdesc(%rip), %reg" to
3467 "rex movl $x@tpoff, %reg", for GDesc -> IE transition, relax
3468 "rex leal x@tlsdesc(%rip), %reg" to
3469 "rex movl x@gottpoff(%rip), %eax". For both transitions, relax
3470 "call *(%eax)" to "nopl (%rax)".
3474 * elf64-ppc.c (LD_R11_0R3, CMPDI_R11_0, STD_R11_0R1, LD_R11_0R1),
3475 (MTLR_R11): Don't define.
3476 (LD_R0_0R3, CMPDI_R0_0): Define.
3477 (build_tls_get_addr_stub): Don't use r11 in stub.
3481 * elf64-ppc.c (ppc_elf_hash_entry): New function, use throughout file.
3482 (defined_sym_val, is_tls_get_addr): Likewise.
3486 * version.m4 (BFD_VERSION): Set to 2.34.50.
3487 * configure: Regenerate.
3488 * po/bfd.pot: Regenerate.
3492 Binutils 2.34 branch created.
3496 * coff-arm.c: Fix spelling error (seperate).
3497 * elfxx-riscv.c (riscv_parse_sv_or_non_std_ext): Fix spelling
3499 * sysdep.h (strnlen): Fix spelling error (seperate).
3504 * pdp11.c (TARGET_PAGE_SIZE): Set to 8192.
3509 * elf64-ppc.c (ELIMINATE_COPY_RELOCS): Update comment.
3510 (ppc64_elf_adjust_dynamic_symbol): Don't allow .dynbss copies
3511 of function symbols unless dot symbols are present. Do warn
3512 whenever one is created, regardles of whether a PLT entry is
3513 also emitted for the function symbol.
3517 * som.c (som_bfd_count_ar_symbols): Error when file position
3518 of symbols on chains is not strictly increasing.
3522 * vms.h (VMS_DEBUG): Define as 0.
3523 * vms-alpha.c (image_write): Move debug output after bounds check.
3525 (_bfd_vms_slurp_eihd): Warning fix.
3526 (_bfd_vms_slurp_etir): Init variables to avoid bogus warnings.
3530 * vms-alpha.c (_bfd_vms_slurp_egsd): Ensure minimum size even
3531 for "ignored" records.
3535 * wasm-module.c (wasm_scan_name_function_section): Formatting.
3536 Delete asect name check. Move asect NULL check to wasm_object_p.
3537 Correct bounds check of sizes against end. Replace uses of
3538 bfd_zalloc with bfd_alloc, zeroing only necessary bytes. Use
3539 just one bfd_release.
3540 (wasm_scan): Don't use malloc/strdup for section names,
3541 bfd_alloc instead. Simplify code prefixing section name.
3542 Formatting. Don't attempt to free memory here..
3543 (wasm_object_p): ..do so here.
3548 * elf32-arm.c (elf32_arm_final_link_relocate): Use
3549 UNDEFWEAK_NO_DYNAMIC_RELOC.
3550 (allocate_dynrelocs_for_symbol): Likewise.
3555 * elfnn-aarch64.c (_bfd_aarch64_create_stub_section): Remove elfclass.
3559 * coff-alpha.c (alpha_ecoff_object_p): Calculate size in bfd_size_type.
3564 * bfd.c (bfd_convert_section_contents): Check for a compress
3565 header size that is larger than the actual section size.
3570 * elflink.c (bfd_elf_final_link): Call _bfd_fix_excluded_sec_syms
3571 after removing sections.
3576 * elfnn-riscv.c (riscv_elf_relocate_section) <R_RISCV_CALL>: Add
3577 check for !bfd_link_pic (info).
3578 <R_RISCV_CALL_PLT>: Move next to R_RISCV_CALL.
3579 <R_RISCV_JAL>: Add comment.
3580 (_bfd_riscv_relax_section): For plt.offset check, add check for
3581 bfd_link_pic (info). Add comment.
3585 * format.c (bfd_check_format_matches): Ignore bfd_error on target
3586 match failures. Don't init to bfd_error_wrong_format before
3587 calling _bfd_check_format.
3591 * vms-alpha.c (_bfd_vms_push, _bfd_vms_pop): Return pass/fail
3592 status rather than exiting on stack overflow or underflow.
3593 (_bfd_vms_slurp_etir): Adjust to suit.
3597 * som.c (som_bfd_fill_in_ar_symbols): Bounds check som_dict index.
3601 * mach-o.c (bfd_mach_o_read_dylinker): Don't read past end of
3602 command. Check name offset is within command.
3603 (bfd_mach_o_read_dylib, bfd_mach_o_read_prebound_dylib),
3604 (bfd_mach_o_read_prebind_cksum, bfd_mach_o_read_twolevel_hints),
3605 (bfd_mach_o_read_fvmlib, bfd_mach_o_read_dysymtab),
3606 (bfd_mach_o_read_symtab, bfd_mach_o_read_uuid),
3607 (bfd_mach_o_read_linkedit, bfd_mach_o_read_str),
3608 (bfd_mach_o_read_dyld_info, bfd_mach_o_read_version_min),
3609 (bfd_mach_o_read_encryption_info, bfd_mach_o_read_source_version),
3610 (bfd_mach_o_read_encryption_info_64, bfd_mach_o_read_main),
3611 (bfd_mach_o_read_note, bfd_mach_o_read_build_version),
3612 (bfd_mach_o_read_segment): Similarly.
3613 (bfd_mach_o_read_thread): Properly bound check thread struct.
3614 Don't repeat checks on second loop.
3615 (bfd_mach_o_read_command): Fail on invalid command length.
3619 * format.c (bfd_check_format_matches): Add preserve_match.
3620 Save initial bfd state in "preserve", matched bfd state in
3621 "preserve_match". Save just the first match. Release
3622 bfd_alloc memory. Restore and finish preserved state as
3623 appropriate on all function exit paths.
3627 * mmo.c (mmo_mkobject): Allocate tdata with bfd_zalloc.
3631 * coffgen.c (coff_real_object_p): Free malloc'd memory on target
3637 (bfd_pef_parse_function_stubs): Correct the test that ensures that
3638 there is enough data remaining in the code buffer before
3639 attempting to read a function stub.
3644 * elf-properties.c (_bfd_elf_convert_gnu_properties): Check the
3645 return value from bfd_malloc.
3646 * elf32-arm.c (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise.
3647 (bfd_elf32_arm_stm32l4xx_fix_veneer_locations): Likewise.
3648 (elf32_arm_filter_cmse_symbols): Likewise.
3649 (elf32_arm_write_section): Likewise.
3650 * mach-o.c (bfd_mach_o_core_fetch_environment): Likewise.
3651 (bfd_mach_o_follow_dsym): Likewise.
3652 * pef.c (bfd_pef_print_loader_section): Likewise.
3653 (bfd_pef_scan_start_address): Likewise.
3654 (bfd_pef_parse_function_stubs): Likewise.
3655 (bfd_pef_parse_symbols): Likewise.
3659 * elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): don't fail
3660 on binary inputs ld/PR25316.
3661 (is_ia64_elf): new helper to filter on ia64 objects.
3665 * mach-o.c (cpusubtype, bfd_mach_o_header_p): Insert underscore
3667 (bfd_mach_o_scan): Insert underscore in two variable names.
3671 * Makefile.am: Add z80-elf target support.
3672 * configure.ac: Likewise.
3673 * targets.c: Likewise.
3674 * Makefile.in: Regenerate.
3675 * configure: Regenerate.
3676 * config.bfd: Add z80-elf target support and new arches: ez80 and
3678 * elf32-z80.c: New file.
3679 * archures.c: Add new z80 architectures: eZ80 and Z180.
3680 * coffcode.h: Likewise.
3681 * cpu-z80.c: Likewise.
3682 * coff-z80.c: Add new relocations for Z80 target and local label
3684 * reloc.c: Add new relocs.
3685 * bfd-in2.h: Regenerate.
3686 * libbfd.h: Regenerate.
3692 * elfnn-aarch64.c (_bfd_aarch64_create_stub_section): Set ELF class.
3696 Update year range in copyright notice of all files.
3698 For older changes see ChangeLog-2019
3700 Copyright (C) 2020 Free Software Foundation, Inc.
3702 Copying and distribution of this file, with or without modification,
3703 are permitted in any medium without royalty provided the copyright
3704 notice and this notice are preserved.
3710 version-control: never