summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/binutils/bfd')
-rw-r--r--contrib/binutils/bfd/ChangeLog5294
-rw-r--r--contrib/binutils/bfd/ChangeLog-00019592
-rw-r--r--contrib/binutils/bfd/ChangeLog-9193109
-rw-r--r--contrib/binutils/bfd/ChangeLog-949516
-rw-r--r--contrib/binutils/bfd/ChangeLog-969762
-rw-r--r--contrib/binutils/bfd/ChangeLog-989924
-rw-r--r--contrib/binutils/bfd/Makefile.am462
-rw-r--r--contrib/binutils/bfd/Makefile.in471
-rw-r--r--contrib/binutils/bfd/README2
-rw-r--r--contrib/binutils/bfd/aout-arm.c320
-rw-r--r--contrib/binutils/bfd/aout-encap.c84
-rw-r--r--contrib/binutils/bfd/aout-sparcle.c8
-rw-r--r--contrib/binutils/bfd/aout-target.h26
-rw-r--r--contrib/binutils/bfd/aout0.c8
-rw-r--r--contrib/binutils/bfd/aoutf1.h159
-rw-r--r--contrib/binutils/bfd/aoutx.h1328
-rw-r--r--contrib/binutils/bfd/archive.c254
-rw-r--r--contrib/binutils/bfd/archive64.c245
-rw-r--r--contrib/binutils/bfd/archures.c38
-rw-r--r--contrib/binutils/bfd/armnetbsd.c10
-rw-r--r--contrib/binutils/bfd/bfd-in.h162
-rw-r--r--contrib/binutils/bfd/bfd-in2.h1125
-rw-r--r--contrib/binutils/bfd/bfd.c406
-rw-r--r--contrib/binutils/bfd/binary.c37
-rw-r--r--contrib/binutils/bfd/cache.c4
-rw-r--r--contrib/binutils/bfd/coff-alpha.c133
-rw-r--r--contrib/binutils/bfd/coff-arm.c888
-rw-r--r--contrib/binutils/bfd/coff-i386.c4
-rw-r--r--contrib/binutils/bfd/coff-ia64.c27
-rw-r--r--contrib/binutils/bfd/coff-ppc.c207
-rw-r--r--contrib/binutils/bfd/coff-rs6000.c2943
-rw-r--r--contrib/binutils/bfd/coff-sparc.c15
-rw-r--r--contrib/binutils/bfd/coffcode.h860
-rw-r--r--contrib/binutils/bfd/coffgen.c307
-rw-r--r--contrib/binutils/bfd/cofflink.c271
-rw-r--r--contrib/binutils/bfd/coffswap.h808
-rwxr-xr-xcontrib/binutils/bfd/config.bfd199
-rwxr-xr-xcontrib/binutils/bfd/configure951
-rw-r--r--contrib/binutils/bfd/configure.host10
-rw-r--r--contrib/binutils/bfd/configure.in251
-rw-r--r--contrib/binutils/bfd/corefile.c4
-rw-r--r--contrib/binutils/bfd/cpu-arc.c2
-rw-r--r--contrib/binutils/bfd/cpu-i386.c8
-rw-r--r--contrib/binutils/bfd/cpu-ia64-opc.c2
-rw-r--r--contrib/binutils/bfd/cpu-powerpc.c6
-rw-r--r--contrib/binutils/bfd/demo64.c10
-rw-r--r--contrib/binutils/bfd/dep-in.sed7
-rw-r--r--contrib/binutils/bfd/doc/ChangeLog62
-rw-r--r--contrib/binutils/bfd/doc/Makefile.am88
-rw-r--r--contrib/binutils/bfd/doc/Makefile.in145
-rw-r--r--contrib/binutils/bfd/doc/bfd.texinfo20
-rw-r--r--contrib/binutils/bfd/doc/bfdint.texi21
-rw-r--r--contrib/binutils/bfd/doc/bfdsumm.texi2
-rw-r--r--contrib/binutils/bfd/doc/header.sed12
-rw-r--r--contrib/binutils/bfd/dwarf1.c62
-rw-r--r--contrib/binutils/bfd/dwarf2.c474
-rw-r--r--contrib/binutils/bfd/ecoff.c344
-rw-r--r--contrib/binutils/bfd/ecofflink.c122
-rw-r--r--contrib/binutils/bfd/ecoffswap.h439
-rw-r--r--contrib/binutils/bfd/elf-bfd.h797
-rw-r--r--contrib/binutils/bfd/elf-eh-frame.c1212
-rw-r--r--contrib/binutils/bfd/elf-strtab.c449
-rw-r--r--contrib/binutils/bfd/elf.c2492
-rw-r--r--contrib/binutils/bfd/elf32-arc.c52
-rw-r--r--contrib/binutils/bfd/elf32-arm.h740
-rw-r--r--contrib/binutils/bfd/elf32-gen.c23
-rw-r--r--contrib/binutils/bfd/elf32-i386.c1959
-rw-r--r--contrib/binutils/bfd/elf32-ppc.c309
-rw-r--r--contrib/binutils/bfd/elf32-sparc.c221
-rw-r--r--contrib/binutils/bfd/elf64-alpha.c1108
-rw-r--r--contrib/binutils/bfd/elf64-gen.c19
-rw-r--r--contrib/binutils/bfd/elf64-ppc.c4463
-rw-r--r--contrib/binutils/bfd/elf64-ppc.h22
-rw-r--r--contrib/binutils/bfd/elf64-sparc.c376
-rw-r--r--contrib/binutils/bfd/elf64-x86-64.c252
-rw-r--r--contrib/binutils/bfd/elfarm-nabi.c117
-rw-r--r--contrib/binutils/bfd/elfarm-oabi.c629
-rw-r--r--contrib/binutils/bfd/elfcode.h555
-rw-r--r--contrib/binutils/bfd/elfcore.h63
-rw-r--r--contrib/binutils/bfd/elflink.c57
-rw-r--r--contrib/binutils/bfd/elflink.h2706
-rw-r--r--contrib/binutils/bfd/elfxx-ia64.c828
-rw-r--r--contrib/binutils/bfd/elfxx-target.h87
-rw-r--r--contrib/binutils/bfd/format.c102
-rw-r--r--contrib/binutils/bfd/gen-aout.c9
-rw-r--r--contrib/binutils/bfd/hash.c14
-rw-r--r--contrib/binutils/bfd/host-aout.c8
-rw-r--r--contrib/binutils/bfd/i386aout.c15
-rw-r--r--contrib/binutils/bfd/i386bsd.c8
-rw-r--r--contrib/binutils/bfd/i386freebsd.c8
-rw-r--r--contrib/binutils/bfd/i386linux.c55
-rw-r--r--contrib/binutils/bfd/i386netbsd.c8
-rw-r--r--contrib/binutils/bfd/ieee.c572
-rw-r--r--contrib/binutils/bfd/ihex.c110
-rw-r--r--contrib/binutils/bfd/libaout.h344
-rw-r--r--contrib/binutils/bfd/libbfd-in.h64
-rw-r--r--contrib/binutils/bfd/libbfd.c260
-rw-r--r--contrib/binutils/bfd/libbfd.h174
-rw-r--r--contrib/binutils/bfd/libcoff-in.h108
-rw-r--r--contrib/binutils/bfd/libcoff.h608
-rw-r--r--contrib/binutils/bfd/libecoff.h11
-rw-r--r--contrib/binutils/bfd/libieee.h28
-rw-r--r--contrib/binutils/bfd/linker.c231
-rw-r--r--contrib/binutils/bfd/merge.c955
-rw-r--r--contrib/binutils/bfd/netbsd-core.c221
-rw-r--r--contrib/binutils/bfd/opncls.c105
-rw-r--r--contrib/binutils/bfd/osf-core.c92
-rw-r--r--contrib/binutils/bfd/peXXigen.c663
-rw-r--r--contrib/binutils/bfd/po/Make-in4
-rw-r--r--contrib/binutils/bfd/po/SRC-POTFILES.in22
-rw-r--r--contrib/binutils/bfd/po/bfd.pot1955
-rw-r--r--contrib/binutils/bfd/ppcboot.c40
-rw-r--r--contrib/binutils/bfd/ptrace-core.c39
-rw-r--r--contrib/binutils/bfd/reloc.c567
-rw-r--r--contrib/binutils/bfd/reloc16.c26
-rw-r--r--contrib/binutils/bfd/sco5-core.c115
-rw-r--r--contrib/binutils/bfd/section.c392
-rw-r--r--contrib/binutils/bfd/sparclinux.c45
-rw-r--r--contrib/binutils/bfd/sparcnetbsd.c8
-rw-r--r--contrib/binutils/bfd/srec.c97
-rw-r--r--contrib/binutils/bfd/stabs.c211
-rw-r--r--contrib/binutils/bfd/sunos.c199
-rw-r--r--contrib/binutils/bfd/syms.c98
-rw-r--r--contrib/binutils/bfd/sysdep.h6
-rw-r--r--contrib/binutils/bfd/targets.c550
-rw-r--r--contrib/binutils/bfd/targmatch.sed1
-rw-r--r--contrib/binutils/bfd/tekhex.c80
-rw-r--r--contrib/binutils/bfd/trad-core.c41
-rw-r--r--contrib/binutils/bfd/version.h1
129 files changed, 39557 insertions, 19199 deletions
diff --git a/contrib/binutils/bfd/ChangeLog b/contrib/binutils/bfd/ChangeLog
index d782ee5..b7a2496 100644
--- a/contrib/binutils/bfd/ChangeLog
+++ b/contrib/binutils/bfd/ChangeLog
@@ -1,5003 +1,467 @@
-2001-10-24 Richard Henderson <rth@redhat.com>
+2002-01-26 Hans-Peter Nilsson <hp@bitrange.com>
- * peXXigen.c (_bfd_XX_print_private_bfd_data_common): Copy
- timestamp to time_t for ctime.
-
-2001-10-24 Richard Henderson <rth@redhat.com>
-
- 2001-08-23 Jakub Jelinek <jakub@redhat.com>
- * elfxx-ia64.c (elfNN_ia64_hash_table_create): Clear ia64_info.
-
-2001-10-06 Stephane Carrez <Stephane.Carrez@worldnet.fr>
-
- * dwarf2.c (comp_unit_find_nearest_line): Check for end of
- compilation unit.
-
-2001-08-29 Joel Sherrill <joel@OARcorp.com>
-
- * config.bfd (i[3456]86-*-rtems*, m68*-*-rtems*): Change
- default from coff to elf.
-
-2001-08-03 Ben Harris <bjh21@netbsd.org>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): Include offset of
- reloc from start of section when computing value for R_ARM_REL32
- reloc.
-
-2001-07-06 Philip Blundell <philb@gnu.org>
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Correct sense of
- `interworking' warning message.
-
-2001-07-05 Nick Clifton <nickc@cambridge.redhat.com>
-
- * peicode.h (coff_swap_scnhdr_in): For sections containing
- uninitialised data, only set their size to s_paddr if this does
- not reset their size to zero. MS's latest compilers will set
- s_paddr to zero.
-
-2001-06-20 Bo Thorsen <bo@suse.co.uk>
-
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Fix linking of
- shared libraries.
-
-2001-06-21 Alan Modra <amodra@bigpond.net.au>
-
- * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Always
- allocate local .got space. Use shortcuts from hash table for .got
- and .plt rather than comparing section names.
- (elf32_hppa_check_relocs): Use local_plt_refcounts var rather than
- adjusting index into local_got_refcounts to document what we are
- really doing.
- (elf32_hppa_relocate_section): Similarly for local_plt_offsets.
- Tidy .got and .plt error checking.
-
-2001-06-19 Philip Blundell <philb@gnu.org>
-
- * configure.in: Set version to 2.11.2.
+ * configure.in <64-bit configuration>: If using gcc, check and
+ emit error for egcs-1.1.2.
* configure: Regenerate.
-2001-06-19 Andreas Jaeger <aj@suse.de>
-
- Merge from mainline sources:
- 2001-06-19 Andreas Jaeger <aj@suse.de>
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Fix creation of
- dynamic symbols.
- 2001-06-07 Andreas Jaeger <aj@suse.de>
- * elf64-x86-64.c (elf64_x86_64_finish_dynamic_symbol): Add an
- assertion.
- (elf64_x86_64_check_relocs): Set an alignment of 8 for .rela
- sections; handle further relocations.
- 2001-06-01 Andreas Jaeger <aj@suse.de>
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Add PC8
- relocation, small reformatting.
-
-2001-06-14 Nick Clifton <nickc@redhat.com>
-
- Merge from mainline sources:
- 2001-04-27 Sean McNeil <sean@mcneil.com>
- * config.bfd: Add arm-vxworks target.
- * coff-arm (coff_arm_relocate_section): Add in symbol value to
- addend (fro VXworks targets).
- 2001-03-06 Nick Clifton <nickc@redhat.com>
- * elf32-arm.h (elf32_arm_final_link_relocate): Clear bit zero
- of offset in BLX(1) instruction.
- * coff-arm.c (coff_arm_relocate_section): Clear bit zero of
- offset in BLX(1) instruction.
- Fix formatting.
- 2001-03-06 Nick Clifton <nickc@redhat.com>
- * coff-arm.c (coff_arm_reloc_type_lookup): Add
- BFD_RELOC_THUMB_PCREL_BLX.
- 2001-05-04 Nick Clifton <nickc@cambridge.redhat.com>
- * elf32-arm.h (elf32_arm_final_link_relocate): Set
- EF_ARM_HASENTRY if the start address is set.
-
-2001-06-11 Alan Modra <amodra@bigpond.net.au>
-
- * configure.in (<COREFILE case stmt>): Move powerpc-*-*bsd* after
- powerpc-*-freebsd*.
-
- Merge from mainline.
- 2001-06-02 H.J. Lu <hjl@gnu.org>
- * elf32-hppa.c (elf32_hppa_object_p): Check ELFOSABI_LINUX
- and ELFOSABI_HPUX.
- * elf64-hppa.c (elf64_hppa_object_p): Likewise.
-
- 2001-06-02 Hans-Peter Nilsson <hp@axis.com>
- * section.c (_bfd_strip_section_from_output): Handle NULL
- output_section.
-
- 2001-05-30 Alan Modra <amodra@one.net.au>
- * elf32-hppa.c (elf32_hppa_check_relocs): Don't NEED_PLT for
- millicode. Don't allocate .got and .rela.got space here..
- (elf32_hppa_gc_sweep_hook): ..and no need to deallocate here..
- (elf32_hppa_adjust_dynamic_symbol): ..and don't allocate .plt and
- .rela.plt here..
- (hppa_handle_PIC_calls): ..nor here..
- (allocate_plt_and_got): ..instead do it all here. New function.
- (elf32_hppa_size_dynamic_sections): Allocate local .got space and
- call allocate_plt_and_got. No need to zap .got if not dynamic.
- (elf32_hppa_final_link): Call regular bfd_final_link instead of
- gc_common_final_link.
- (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
- (elf32_hppa_relocate_section): Use it here.
- (elf32_hppa_finish_dynamic_symbol): Remove superfluous test of
- dynamic_sections_created.
- (hppa_type_of_stub): Don't LONG_BRANCH_VIA_PLT if millicode sym.
-
- 2001-05-28 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
- * elflink.h (elf_link_size_reloc_section): Use bfd_zmalloc instead of
- a zeroing loop.
- (elf_link_output_relocs): Handle MIPS ELF64 relocations correctly.
- (elf_link_input_bfd): Likewise.
- (elf_reloc_link_order): Likewise.
- (elf_finish_pointer_linker_section): Typo. Handle MIPS ELF64
- relocations correctly.
-
- 2001-05-28 Alan Modra <amodra@one.net.au>
- * elf32-hppa.c (elf32_hppa_relocate_section): Set up .plt entries
- for symbols forced local that need plabels.
- (elf32_hppa_adjust_dynamic_symbol): Don't allocate space in
- .plt.rela for local syms if non-shared.
- (hppa_build_one_stub): Mask lsb of plt.offset.
- (elf32_hppa_finish_dynamic_symbol): Abort if lsb of plt.offset set.
- (clobber_millicode_symbols): Correct comment.
- (elf32_hppa_relocate_section): Likewise.
- (elf32_hppa_finish_dynamic_symbol): Likewise.
-
- 2001-05-25 Alan Modra <amodra@one.net.au>
- * elf32-hppa.c (elf32_hppa_relocate_section): Don't allow
- undefined millicode syms in shared libs.
- (hppa_build_one_stub): Turn BFD_ASSERTs into aborts.
- (elf32_hppa_check_relocs): Likewise.
- (elf32_hppa_adjust_dynamic_symbol): Likewise.
- (elf32_hppa_size_dynamic_sections): Likewise.
- (elf32_hppa_relocate_section): Likewise.
- (elf32_hppa_finish_dynamic_symbol): Likewise.
- (elf32_hppa_finish_dynamic_sections): Likewise.
-
- 2001-05-23 Alexandre Oliva <aoliva@redhat.com>
- * elf64-sparc.c (sparc64_elf_slurp_reloc_table): Fix typo
- s/ENTIRES/ENTRIES/.
-
- 2001-05-23 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
- * reloc.c (bfd_reloc_code_real): Add MIPS ELF64 relocations.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
- * aoutx.h (aout_@var{size}_machine_type): Add MIPS r12k support.
- * archures.c (bfd_mach_mips12000): Define.
- * cpu-mips.c (arch_info_struct): Add MIPS r12k support.
- * elf32-mips.c (_bfd_mips_elf_final_write_processing): Add MIPS r12k
- support.
- (_bfd_mips_elf_size_dynamic_sections): Use official bfd typedef.
- * bfd-in2.h: Regenerate.
- * elfxx-target.h: Do not redefine bfd_elfNN_bfd_make_debug_symbol.
-
- 2001-05-23 Nick Clifton <nickc@cambridge.redhat.com>
- * elf-bfd.h (NUM_SHDR_ENTRIES): New macro: compute the number
- of entries in a structured section.
- * elf.c: Use new macro.
- * elf32-i386.c: Use new macro.
- * elf32-mips.c: Use new macro.
- * elf64-alpha.c: Use new macro.
- * elf64-sparc.c: Use new macro.
- * elfcode.h: Use new macro.
- * elflink.h: Use new macro.
-
- 2001-05-21 Andreas Jaeger <aj@suse.de>
- * dwarf2.c (decode_line_info): Fix error message.
- (read_abbrevs): Fix test for offset as suggested by Alan Modra and
- adjust error message.
-
- 2001-05-17 H.J. Lu <hjl@gnu.org>
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set the
- version definition to basename of the output filename.
-
- 2001-05-15 Alexandre Oliva <aoliva@redhat.com>
- * elf-m10300.c (mn10300_elf_relax_section): Don't relax
- negative 32-bit operands to 16 operands when the operand is
- going to be zero-extended by the modified opcode.
-
- 2001-05-11 Jakub Jelinek <jakub@redhat.com>
- * elfxx-ia64.c (is_unwind_section_name): Consider linkonce unwind
- sections as well.
- (elfNN_ia64_final_write_processing): Map .gnu.linkonce.ia64unw.FOO
- to .gnu.linkonce.t.FOO text section.
-
- 2001-05-11 Nick Clifton <nickc@cambridge.redhat.com>
- * dwarf1.c (_bfd_dwarf1_find_nearest_line): Change type of 'addr'
- to be unsigned long, in order to match its use.
-
- 2001-05-10 H.J. Lu <hjl@gnu.org>
- * linker.c (_bfd_generic_link_add_one_symbol): Check loop on
- indirect symbols.
-
- 2001-05-09 H.J. Lu <hjl@gnu.org>
- * elflink.h (elf_link_add_object_symbols): Fix a typo. Allocate
- versymhdr->sh_size bytes for extversym instead of hdr->sh_size.
- Remove the unused veriable `dynver'.
-
- 2001-05-07 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
- * elf.c (_bfd_elf_slurp_version_tables): Change maxidx to unsigned, it
- is always a positive integer. Cast away sign mismatch.
- * elf32-mips.c: Fix misleading comment and typo.
- (_bfd_mips_elf_section_from_bfd_section): Remove unused attribute, use
- correct data type.
- * elflink.c: Fix typo.
- (_bfd_elf_create_dynamic_sections): Remove superfluous initialization.
- * ecoffswap.h (ecoff_swap_fdr_in): Cast away sign mismatch.
-
- 2001-05-03 Nick Clifton <nickc@cambridge.redhat.com>
- * targets.c (_bfd_target_vector_entries): Compute value based on
- the size of the _bfd_target_vector and not bfd_target_vector.
-
- 2001-05-03 Andreas Jaeger <aj@suse.de>
- * elf64-gen.c (elf_generic_info_to_howto): Add unused attribute.
- (elf_generic_info_to_howto_rel): Likewise.
- * coff-alpha.c (reloc_nil): Likewise.
- (alpha_ecoff_bad_format_hook): Likewise.
- (alpha_adjust_reloc_out): Likewise.
- (alpha_bfd_reloc_type_lookup): Likewise.
- (alpha_convert_external_reloc): Likewise.
- * elf64-alpha.c (elf64_alpha_reloc_nil): Likewise.
- (elf64_alpha_reloc_bad): Likewise.
- (elf64_alpha_reloc_gpdisp): Likewise.
- (elf64_alpha_bfd_reloc_type_lookup): Likewise.
- (elf64_alpha_info_to_howto): Likewise.
- (elf64_alpha_add_symbol_hook): Likewise.
- (elf64_alpha_create_got_section): Likewise.
- (elf64_alpha_is_local_label_name): Likewise.
- (elf64_alpha_merge_ind_symbols): Likewise.
- * elf64-mips.c (mips_elf64_reloc_type_lookup): Likewise.
- (mips_elf64_get_reloc_upper_bound): Likewise.
- * nlm32-alpha.c (nlm_alpha_mangle_relocs): Likewise.
- (nlm_alpha_get_public_offset): Likewise.
-
- 2001-04-30 H.J. Lu <hjl@gnu.org>
- * elf.c (_bfd_elf_link_hash_hide_symbol): Set dynindx to -1
- only for ELF_LINK_FORCED_LOCAL.
- * elf32-hppa.c (elf32_hppa_hide_symbol): Likewise.
- * elf32-mips.c (_bfd_mips_elf_hide_symbol): Likewise.
- * elfxx-ia64.c (elfNN_ia64_hash_hide_symbol): Likewise.
- * elflink.h (elf_fix_symbol_flags): Set ELF_LINK_FORCED_LOCAL
- if the symbol has hidden or internal visibility.
-
- 2001-04-14 Mark Elbrecht <snowball3@bigfoot.com>
- * coffcode.h (coff_write_object_contents): Use
- bfd_coff_swap_filehdr_out instead of coff_swap_filehdr_out.
-
- 2001-04-09 Hans-Peter Nilsson <hp@axis.com>
- * elflink.h (elf_fix_symbol_flags): For non-default visibilities,
- only hide symbols marked STV_INTERNAL or STV_HIDDEN.
-
- 2001-04-05 Steven J. Hill <sjhill@cotw.com>
- * config.bfd (mips*el*-*-linux-gnu*): Use traditional little
- endian MIPS ELF target.
- (mips*-*-linux-gnu*): Use traditional big endian MIPS ELF target.
- * configure.in (bfd_elf64_tradbigmips_vec): New. Traditional
- 64bit big endian MIPS ELF target.
- (bfd_elf64_tradlittlemips_vec): New. Traditional 64bit little
- endian MIPS ELF target.
- * configure: Regenerated.
- * elf32-mips.c (IRIX_COMPAT): Handle traditional 64bit and
- little endian targets.
- (mips_elf_sym_is_global): Handle traditional targets.
- * elf64-mips.c (bfd_elf64_tradbigmips_vec): New. Traditional
- 64bit big endian MIPS ELF target.
- (bfd_elf64_tradlittlemips_vec): New. Traditional 64bit little
- endian MIPS ELF target.
- * targets.c: (_bfd_target_vector): Add bfd_elf64_tradbigmips_vec
- and bfd_elf64_tradlittlemips_vec.
-
- 2001-04-04 Alan Modra <alan@linuxcare.com.au>
- * elflink.h (elf_fix_symbol_flags): Call elf_backend_hide_symbol
- when -Bsymbolic causes a symbol to no longer need a .plt entry.
-
- 2001-04-03 David Mosberger <davidm@hpl.hp.com>
- * efi-app-ia32.c (ALIGN_SECTIONS_IN_FILE): Deleted.
-
- 2001-03-30 H.J. Lu <hjl@gnu.org>
- * efi-app-ia32.c (PEI_TARGET_SUBSYSTEM): Rename from ...
- (PEI_DEFAULT_TARGET_SUBSYSTEM): This.
-
- 2001-03-23 Nick Clifton <nickc@redhat.com>
- * Makefile.am (BUILD_CFILES): New variable: List of C source
- files created in build directory.
- (BUILD_HFILES): New variable: List of header files created in
- build directory.
- (POTFILES): Delete.
- (po/POTFILES.in): Replace rule with empty entry.
- (po/SRC-POTFILES.in): New rule: Create a list of source files
- in the source directory.
- (po/BLD-POTFILES.in): New rule: Create a list of source files
- in the build directory.
- (MOSTLYCLEAN): Do not delete source files created in build
- directory.
- * Makefile.in: Regenerate.
- * configure.in: Insert SRC-POTFILES.in and BLD-POTFILES.in
- into po/Makefile.
- * configure: Regenerate.
- * po/Make-in: Replace occurrences of POTFILES with SRC-POTFILES
- and BLD_POTFILES.
- Add .. to the search path when building bfd.pot.
- Delete POTFILES when performing distclean.
- Add comment describing why distclean is broken in maintainer mode.
- * po/POTFILES.in: Delete.
- * po/SRC-POTFILES.in: New file.
- * po/BLD-POTFILES.in: New file.
- * po/bfd.pot: Regenerate.
-
- 2001-03-06 Igor Shevlyakov <igor@windriver.com>
- * archures.c (bfd_default_scan): Add Coldfire CPUs.
- * bfd-in2.h: Regenerate.
- * cpu-m68k.c: Add Coldfire CPUs for arch table.
- * ieee.c (ieee_write_processor): Set proper id for
- Coldfire CPUs.
-
- 2001-02-27 H.J. Lu <hjl@gnu.org>
- * aoutx.h (NAME(aout,bfd_free_cached_info)): Return true if
- abfd->tdata.aout_data == NULL.
-
- 2001-02-26 Nick Clifton <nickc@redhat.com>
- * coffcode.h (styp_to_sec_flags) [COFF_WITH_PE version]: Tidy
- up, replacing multiple if statements with a switch.
- (handle_COMDAT): New function.
-
- 2001-02-26 H.J. Lu <hjl@gnu.org>
- * coffcode.h (styp_to_sec_flags) [COFF_WITH_PE version]: Issue
- a warning for section flags we do not handle instead of
- aborting.
-
- 2001-02-19 Jakub Jelinek <jakub@redhat.com>
- * elf32-sparc.c (elf32_sparc_finish_dynamic_symbol): Don't make PLT
- entries that could serve as a definition for a weak symbol.
- * elf64-sparc.c (sparc64_elf_finish_dynamic_symbol): Likewise.
-
- 2001-02-18 Jim Kingdon <jkingdon@engr.sgi.com>
- * irix-core.c (irix_core_core_file_p): Set the architecture (GDB
- multiarch needs it).
-
- 2001-02-18 H.J. Lu <hjl@gnu.org>
- * elflink.h (elf_link_input_bfd): Ignore invalid section symbol
- index.
-
- 2001-02-18 Kazu Hirata <kazu@hxi.com>
- * vms-misc.c: Fix formatting.
-
- 2001-02-16 Kazu Hirata <kazu@hxi.com>
- * vms.c: Fix formatting.
-
- 2001-02-14 H.J. Lu <hjl@gnu.org>
- * elf.c (elf_find_function): New function.
- (_bfd_elf_find_nearest_line): Call elf_find_function () to find
- the file name and function name.
-
- 2001-02-14 Nick Clifton <nickc@redhat.com>
- * Makefile.am (BFD32_BACKENDS_CFILES): Remove peigen.c
- (BFD64_BACKENDS): Add pepigen.c
- Add rules to create peigen.c and pepigen.c from peXXigen.c.
-
- 2001-02-14 H.J. Lu <hjl@gnu.org>
- * libcoff-in.h (pe_tdata): Add members target_subsystem and
- force_minimum_alignment.
-
- 2001-02-13 Kazu Hirata <kazu@hxi.com>
- * vms.c (vms_print_symbol): Remove unreachable code.
- * rs6000-core.c: Fix formatting.
-
- 2001-02-13 David Mosberger <davidm@hpl.hp.com>
- * peicode.h (coff_swap_filehdr_out) [COFF_IMAGE_WITH_PE]: Define
- as _bfd_XXi_only_swap_filehdr_out.
- (pe_mkobject) [PEI_FORCE_MINIMUM_ALIGNMENT]: Set
- pe->force_minimum_alignment to TRUE.
- (pe_mkobject) [PEI_TARGET_SUBSYSTEM]: Set pe->target_subsystem to
- PEI_TARGET_SUBSYSTEM.
- (pe_print_private_bfd_data): Call
- _bfd_XX_print_private_bfd_data_common() instead of
- _bfd_pe_print_private_bfd_data_common().
- (pe_bfd_copy_private_bfd_data): Call
- _bfd_XX_bfd_copy_private_bfd_data_common() instead of
- _bfd_pe_bfd_copy_private_bfd_data_common().
- (coff_bfd_copy_private_section_data): Define as
- _bfd_XX_bfd_copy_private_section_data instead of
- _bfd_pe_bfd_copy_private_section_data.
- (coff_get_symbol_info): Define as _bfd_XX_get_symbol_info instead
- of a _bfd_pe_get_symbol_info.
- * peigen.c: Delete.
- * peXXigen.c: Renamed from peigen.c.
- (COFF_WITH_XX): Define this macro (will get expanded into
- COFF_WITH_pep or COFF_WITH_pe, depending on whether this is being
- compiled as peigen.c or pepigen.c.
- [COFF_WITH_pep]: Include "coff/ia64.h" instead of "coff/i386.h" to
- define the canonical PEP structures and definitions.
- (_bfd_XXi_swap_aouthdr_out): If pe->force_minimum_alignment is in
- effect, enforce minimum file and section alignments. If
- extra->Subsystem is IMAGE_SUBSYSTEM_UNKNOWN, set it to
- pe->target_subsystem (this defaults to IMAGE_SUBSYSTEM_UNKNOWN,
- so, by default, this is a no-op).
- * libpei.h: Rename COFF_WITH_PEP to COFF_WITH_pep.
- (_bfd_XX_bfd_copy_private_bfd_data_common): Add macros to map
- _bfd_XXfoo to _bfd_pepfoo if COFF_WIT_PEP is defined and to
- _bfd_pefoo if it's not defined. Use these macros to define
- coff swap macros.
- * libcoff.h (pe_tdata): Add members target_subsystem and
- force_minimum_alignment.
- * efi-app-ia64.c (COFF_WITH_pep): Rename COFF_WITH_PEP to
- COFF_WITH_pep.
- (PEI_TARGET_SUBSYSTEM): Rename from PEI_DEFAULT_TARGET_SUBSYSTEM.
- * configure.in (bfd_efi_app_ia64_vec): Use pepigen.lo instead of
- peigen.lo.
- * coff-ia64.c: Rename COFF_WITH_PEP to COFF_WITH_pep.
- (AOUTSZ): Rename PEP64AOUTSZ and PEP64AOUTHDR to PEPAOUTSZ and
- PEPAOUTHDR.
- * Makefile.in (BFD64_BACKENDS): Mention pepigen.lo.
- (BFD64_BACKENDS_CFILES): Mention pepigen.c
- (peigen.c): Add rule to generate from peXXigen.c.
- (pepigen.c): Ditto.
- (pepigen.lo): List dependencies for pepigen.lo.
-
- 2001-02-11 H.J. Lu <hjl@gnu.org>
- * elflink.h (elf_bfd_final_link): Use file_align for SYMTAB
- alignment.
+ * doc/Makefile.am (install): Depend on install-info.
+ * doc/Makefile.in: Regenerate.
- 2001-02-11 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
- * elf32-mips.c (mips_elf_create_dynamic_relocation): Undo patch
- from 2000-10-13. Do not add the symbol's value for R_MIPS_REL32
- relocations against dynsym symbols.
- * elf32-mips.c (elf_mips_howto_table): Fix the comment on
- the R_MIPS_26 relocation.
- (mips_elf_calculate_relocation): Use (p + 4) instead of p for
- the R_MIPS_26 relocation.
- (mips_elf_perform_relocation): Fix the comment on the R_MIPS16_26
- relocation.
- * elf64-mips.c (mips_elf64_howto_table_rel): Fix the comment on
- the R_MIPS_26 relocation.
- (mips_elf64_howto_table_rela): Likewise.
- * elf32-mips.c (struct mips_elf_link_hash_entry): Added no_fn_stub
- member to mark symbols that have non-CALL relocations against
- them.
- (mips_elf_link_hash_newfunc): Initialize no_fn_stub.
- (mips_elf_calculate_relocation): Handle R_MIPS_CALL16 like
- R_MIPS_GOT16.
- (_bfd_mips_elf_check_relocs): Set no_fn_stub for a symbol if a
- non-CALL relocation against it is encountered.
- (_bfd_mips_elf_copy_indirect_symbol): Merge no_fn_stub as well.
- (_bfd_mips_elf_adjust_dynamic_symbol): Only create a stub if
- no_fn_stub is not set.
- * elf32-mips.c (mips_elf_output_extsym): Get the output section
- information from the real symbol for indirect ones.
- Check no_fn_stub to find out if a symbol has a function stub
- indeed.
+2002-01-26 Egor Duda <deo@logos-m.ru>
- 2001-02-09 Jakub Jelinek <jakub@redhat.com>
- * elf64-sparc.c (sparc64_elf_copy_private_bfd_data): New function.
+ * elf.c (elfcore_grok_win32pstatus): Copy only as much information
+ as possible to avoid stack corruption.
- 2001-02-09 Mark Kettenis <kettenis@gnu.org>
- * elf32-sparc.c (_bfd_sparc_elf_howto_table): Treat R_SPARC_UA32
- similar to R_SPARC_32.
- * elf64-sparc.c (sparc64_elf_howto_table): Likewise.
+2002-01-26 Richard Henderson <rth@redhat.com>
- 2001-02-08 Richard Henderson <rth@redhat.com>
- * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Respect weakness
- before visibility. Locally defined protected symbols are not
- dynamic.
+ * elf64-alpha.c (elf64_alpha_check_relocs): Don't set reltext
+ for non-allocated sections.
- 2001-02-07 Jakub Jelinek <jakub@redhat.com>
- * elflink.h (is_global_symbol_definition): Rename to
- is_global_data_symbol_definition and have it reject function
- symbols.
- (elf_link_is_defined_archive_symbol): Use renamed function.
+2002-01-25 Mark Kettenis <kettenis@gnu.org>
- 2001-02-07 Todd Vierling <tv@wasabisystems.com>
- * libbfd-in.h (bfd_target_vector): Change extern array to pointer.
- * libbfd.h (bfd_target_vector): Likewise.
- * targets.c (bfd_target_vector): Rename to _bfd_target_vector and
- make static; create pointer reference named bfd_target_vector.
- (_bfd_target_vector_entries): Calculate this based on the array
- typed _bfd_target_vector.
+ * elf.c (elfcore_write_prstatus): Make sure we pass the address of
+ prstat.pr_reg even if it is a struct.
- 2001-02-06 H.J. Lu <hjl@gnu.org>
- * elfxx-ia64.c (elfNN_ia64_dynamic_symbol_p): Only hidden and
- internal symbols are not dynamic.
- * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Likewise.
+2002-01-25 Steve Ellcey <sje@cup.hp.com>
- 2001-02-06 Kazu Hirata <kazu@hxi.com>
- * elf-m10200.c: Fix formatting.
+ * bfd/elfxx-ia64.c: Reset AIX vector function overrides for HP-UX.
- 2001-02-01 Kazu Hirata <kazu@hxi.com>
- * elf-m10300.c: Fix formatting.
+2002-01-25 Philipp Thomas <pthomas@suse.de>
-2001-06-10 Philip Blundell <philb@gnu.org>
+ * coffgen.c (coff_print_symbol): Don't mark info message
+ for translation.
- * configure.in: Set version to 2.11.1.
- * configure: Regenerate.
+2002-01-25 Nick Clifton <nickc@redhat.com>
-2001-06-09 Philip Blundell <philb@gnu.org>
+ * po/fr.po: Updated translation.
+ * po/es.po: Updated translation.
- * elf32-arm.h (elf32_arm_plt0_entry): Correct error in last
- change.
- (elf32_arm_plt_entry): Likewise.
+2002-01-25 Philipp Thomas <pthomas@suse.de>
-2001-06-07 Alan Modra <amodra@bigpond.net.au>
+ * coff-alpha.c (alpha_relocate_section): Unify warning message
+ for GP relative relocations without GP defined.
+ * coff-mips.c (mips_relocate_section): Likewise.
- * Most files: Update copyright notices.
+2002-01-25 Alan Modra <amodra@bigpond.net.au>
-2001-05-29 Andreas Jaeger <aj@suse.de>
+ * elf-eh-frame.c (_bfd_elf_eh_frame_section_offset): Avoid
+ unsigned overflow when new_offset < old_offset.
- * elf64-x86-64.c (elf64_x86_64_check_relocs): Handle R_X86_64_64.
- (elf64_x86_64_relocate_section): Likewise.
+2002-01-24 Philipp Thomas <pthomas@suse.de>
-2001-05-28 Andreas Jaeger <aj@suse.de>
+ * bfd.c (_bfd_abort): Fix typo.
- * elf64-x86-64.c (elf64_86_64_size_info): Remove, we can use the
- generic version since we want a hashsize of 4.
- (elf_backend_size_info): Likewise.
+2002-01-23 Richard Henderson <rth@redhat.com>
-2001-05-28 Nicolas Pitre <nico@cam.org>
+ * elf64-alpha.c (elf64_alpha_adjust_dynamic_symbol): Don't suppress
+ plt entries for undefweak symbols.
- * elf32-arm.h: Fix PLT generation for big endian ARM.
+2002-01-23 Steve Ellcey <sje@cup.hp.com>
-2001-05-28 Jeff Sturm <jsturm@one-point.com>
+ * bfd/targets.c (bfd_elf32_ia64_hpux_big_vec): Add to
+ DEFAULT_VECTOR.
+ (bfd_elf64_ia64_hpux_big_vec): Ditto.
+ (bfd_elf32_h8300_vec): Ditto.
- * reloc.c: Add BFD_RELOC_SPARC_UA16 and BFD_RELOC_SPARC_UA64.
- * bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
- * elf32-sparc.c: Enable BFD_RELOC_SPARC_UA16, BFD_RELOC_SPARC_UA32
- and BFD_RELOC_SPARC_UA64 mapping
- * elf64-sparc.c: Likewise.
+2002-01-23 Alan Modra <amodra@bigpond.net.au>
-2001-05-23 Alan Modra <amodra@one.net.au>
-
- Merge from mainline.
- 2001-05-17 Alan Modra <amodra@one.net.au>
- * elf32-hppa.c (hppa_build_one_stub): Add an assert to check
+ * elf64-ppc.c: Remove stale part of ABI comment.
+ (NO_OPD_RELOCS): Define.
+ (ppc64_elf_check_relocs): Use it.
+ (ppc64_elf_relocate_section): Here too.
+ (build_one_stub): Don't point function syms at the stub. Instead,
+ hijack plt.offset.
+ (ppc64_elf_relocate_section): Check whether REL24 relocs should
+ really go to the stub. Make all dynamic relocs in opd against
+ locals.
+ (ppc64_elf_finish_dynamic_symbol): Allow for non-standard use of
plt.offset.
- 2001-05-16 Alan Modra <amodra@one.net.au>
- * section.c (asection): Add linker_has_input field.
- (STD_SECTION): Adjust initialization to suit.
- * ecoff.c (bfd_debug_section): Likewise.
- * bfd-in2.h: Regenerate.
-
- 2001-05-07 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
- * ecoff.c (bfd_debug_section): Fix initialization.
-
- 2001-05-12 Peter Targett <peter.targett@arccores.com>
- * cpu-arc.c (arch_info_struct): Add entry 'base' representing old
- name for 'arc5' core versions.
- (bfd_arc_arch): Make bfd_mach_arc_6 default.
- * elf32-arc.c (arc_elf_object_p): Make E_ARC_MACH_ARC6 default
- architecture.
- (arc_elf_final_write_processing): Make bfd_mach_arc_6 default.
-
- 2001-05-08 Ian Lance Taylor <ian@zembu.com>
- * coff-i386.c (coff_i386_reloc): Don't dump core if output_bfd is
- NULL or is not COFF.
- (coff_i386_rtype_to_howto): Don't dump core if output section
- owner is not COFF.
-
- 2001-04-13 Roger Sayle <roger@metaphorics.com>
- * coff-i386.c (TARGET_SYM): SEC_READONLY is an applicable section
- flag on pe-i386 targets.
-
- 2001-04-26 H.J. Lu <hjl@gnu.org>
- * elf32-i386.c (elf_i386_check_relocs): Verify if r_symndx is
- valid.
-
- 2001-04-05 David Mosberger <davidm@hpl.hp.com>
- * elf32-i386.c (elf_i386_fake_sections): Treat ".reloc" as an
- ordinary "progbits" section.
-
-2001-05-04 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (SREL16, SREL32, SREL64): Set pcrel_offset true.
-
-2001-04-30 Andreas Jaeger <aj@suse.de>, Andreas Schwab <schwab@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Correct test for
- R_X86_64_GOTPCREL, don't use assignments instead of comparisons.
-
-2001-04-27 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_finish_dynamic_sections): Only swap
- out handled entries.
- (elf64_x86_64_finish_dynamic_symbol): Set up GOT entries.
- (elf64_x86_64_relocate_section): Fix GOTPCREL calculation.
- (elf64_x86_64_relocate_section): Merge entries for GOTPCREL and
- GOT32.
-
-2001-04-30 Alan Modra <amodra@one.net.au>
-
- * elf32-hppa.c (final_link_relocate): Branch to .+8 for
- calls to undefined weak symbols.
-
-2001-04-19 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_plt0_entry): Fix instructions.
- (elf64_x86_64_plt_entry): Likewise.
- (elf64_x86_64_finish_dynamic_sections): Fix PLT0 generation.
- (elf64_x86_64_finish_dynamic_symbol): Fix PLT generation.
-
-2001-03-31 Philip Blundell <philb@gnu.org>
-
- From 2001-03-26 H.J. Lu <hjl@gnu.org>
- * elf32-gen.c (elf32_generic_link_add_symbols): New. Check
- if there are any relocations for generic ELF.
- (bfd_elf32_bfd_link_add_symbols): Defined to
- elf32_generic_link_add_symbols.
- * elf64-gen.c (elf64_generic_link_add_symbols): New. Check
- if there are any relocations for generic ELF.
- (bfd_elf64_bfd_link_add_symbols): Defined to
- elf64_generic_link_add_symbols.
-
-2001-03-21 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c (elf32_hppa_set_gp): Check sec->output_section
- non-NULL before attempting to dereference.
-
-2001-03-20 Andreas Schwab <schwab@suse.de>
-
- * elf32-m68k.c (elf_m68k_relocate_section): Don't need the
- relocation value when resolving a reference from a debugging
- section.
-
-2001-03-16 Philip Blundell <philb@gnu.org>
-
- * configure: Regenerate.
-
-2001-03-16 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c (elf32_hppa_link_hash_entry): Add maybe_pic_call.
- (hppa_link_hash_newfunc): Init it.
- (hppa_type_of_stub): Only use non-PIC to PIC call stub if caller
- section appears to be non-PIC.
- (final_link_relocate): Likewise.
- (elf32_hppa_adjust_dynamic_symbol): Set maybe_pic_call for any
- possible candidate function, and set pic_call for those that will
- only have a .plt entry for the PIC call stub.
- (hppa_handle_PIC_calls): Set maybe_pic_call.
-
- * elf32-hppa.c: Correct field selector in stub comments.
- (clobber_millicode_symbols): Formatting fix.
-
-2001-03-11 Philip Blundell <philb@gnu.org>
-
- * configure.in: Set version to 2.11.
-
- * elf32-arm.h (elf32_arm_finish_dynamic_symbol): Don't make PLT
- entries that could serve as a definition for a weak symbol.
-
-2001-03-07 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Fix handling of
- some relocation values.
-
-2001-02-28 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_relocate_section): Add relocation
- to addend.
-
-2001-02-26 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (x86_64_elf_howto_table): Fix order of entries.
-
-2001-02-21 David Mosberger <davidm@hpl.hp.com>
-
- * cpu-ia64-opc.c (elf64_ia64_operands}: Fix typo: error string for
- C8 said "1" instead of "8". Clarify error string for IMM22:
- "signed integer" instead of just "integer".
-
-2001-02-20 Andreas Jaeger <aj@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_finish_dynamic_symbol): Don't make
- PLT entries that could serve as a definition for a weak symbol.
-
-2001-02-18 David O'Brien <obrien@FreeBSD>
-
- * configure.in: Recognize FreeBSD/arm, FreeBSD/PowerPC, and treat
- FreeBSD/i386-CURRENT differently until I can figure out the needed
- corefile changes.
- * configure: Regenerate.
- * config.bfd: Recognize FreeBSD/x86-64, FreeBSD/ia64, FreeBSD/arm,
- FreeBSD/PowerPC, and FreeBSD/sparc64.
-
-2001-02-14 Philip Blundell <pb@futuretv.com>
-
- From 2001-02-06 H.J. Lu <hjl@gnu.org>
- * bfd/peicode.h (coff_swap_filehdr_in): Remove the e_magic
- checking.
- (pe_bfd_object_p): Rewrite with external_PEI_DOS_hdr and
- external_PEI_IMAGE_hdr.
-
-2001-02-14 Bo Thorsen <bo@suse.de>
-
- * elf64-x86-64.c: Small formatting fixes and rearrangements of code.
- (elf64_86_64_size_info): Struct added to fix a problem
- with the hashtable string entries.
- (elf64_x86_64_adjust_dynamic_symbol): Add generation of .got.plt.
- (elf64_x86_64_size_dynamic_sections): A FIXME removed.
- (elf64_x86_64_size_dynamic_sections): Fix a dynamic entry and
- remove the FIXME for this.
- (elf64_x86_64_adjust_dynamic_symbol): Fix check for unneeded .plt
- section. Also removed the FIXME for it.
- (x86_64_elf_howto_table): Use bfd_elf_generic_reloc.
- (ELF_DYNAMIC_INTERPRETER): Fix the name of the dynamic linker.
- (elf64_x86_64_finish_dynamic_sections): Enable .got.plt writing.
-
-2001-02-14 Philip Blundell <pb@futuretv.com>
-
- From 2001-02-08 H.J. Lu <hjl@gnu.org>
- * elf32-i386.c (elf_i386_check_relocs): Reserve R_386_32
- relocation entries for weak definitions when building DSO with
- -Bsymbolic.
-
-2001-02-13 Richard Henderson <rth@redhat.com>
-
- * elfxx-ia64.c (elfNN_ia64_final_link): Set __gp if required
- and not user provided.
-
-2001-02-13 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c (elf32_hppa_set_gp): Handle weak $global$. If
- $global$ referenced but not defined, set its value here.
-
-2001-02-09 Bo Thorsen <bo@suse.de>
-
- * elf64-x86-64.c (elf64_x86_64_check_relocs): Set .rela.got section
- alignment to 3.
- (elf64_x86_64_check_relocs): Write R_X86_64_GOTPCREL GOT entry
- and relocation.
- (elf64_x86_64_relocate_section): Fix formatting.
- (elf64_x86_64_relocate_section): Fix addend for relocation of
- R_X86_64_(8|16|32|PC8|PC16|PC32).
-
-Mon Feb 12 17:44:39 CET 2001 Jan Hubicka <jh@suse.cz>
-
- * elf64-x86-64.c (x86_64_elf_howto): Fix name of R_X86_64_GOTPCREL.
-
-2001-02-10 Nick Clifton <nickc@redhat.com>
-
- * elf32-v850.c (v850_elf_reloc): Do not convert reloc addend to PC
- rel, it will be handled later on.
-
-2001-02-09 David Mosberger <davidm@hpl.hp.com>
-
- * elfxx-ia64.c (is_unwind_section_name): New function. Returns
- true if section name is an unwind table section name.
- (elfNN_ia64_additional_program_headers): Count each unwind section
- separately.
- (elfNN_ia64_modify_segment_map): Install one unwind program header
- for each unwind separate section. Note: normally the linker
- script merges the unwind sections that go into a single segment,
- so this still generates at most one unwind program header per
- segment.
-
- * elfxx-ia64.c (elfNN_ia64_section_from_shdr): Accept any section
- name for SHT_IA_64_UNWIND, not just .IA_64.unwind.
- (elfNN_ia64_fake_sections): Mark sections with names that start
- with .IA_64.unwind but not with .IA_64.unwind_info as an IA-64
- unwind section.
-
- * elfxx-ia64.c (elfNN_ia64_final_write_processing): New function.
- Use it to make sh_info in unwind section point to the text section
- it applies to.
+2002-01-22 Richard Henderson <rth@redhat.com>
-2001-02-07 Mark Elbrecht <snowball3@bigfoot.com>
+ * elf64-alpha.c (INSN_UNOP): Encode with RB as $sp.
- * coffgen.c (coff_find_nearest_line): If stabs info is successfully
- found, do not attempt to find dwarf2 info before returning.
+2002-01-22 Alan Modra <amodra@bigpond.net.au>
-2001-01-30 Alan Modra <alan@linuxcare.com.au>
+ * elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Correct sign of
+ TOC_BASE_OFF adjustment.
- * elf64-hppa.c (elf64_hppa_elf_get_symbol_type): New function.
- (elf_backend_get_symbol_type): Define.
- (elf64_hppa_object_p): Set architecture and machine from elf
- header flags.
-
-2001-01-30 Curtis L. Janssen <cljanss@ca.sandia.gov>
-
- * elf64-alpha.c (elf64_alpha_find_nearest_line): Query dwarf2
- before mdebug.
-
-2001-01-26 Richard Henderson <rth@redhat.com>
-
- * elfxx-ia64.c (elfNN_ia64_dynamic_symbol_p): Return false
- for non-default visibility.
- * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Likewise, but
- delete ugly macro and replace with pretty function.
-
-2001-01-25 Mark Elbrecht <snowball3@bigfoot.com>
-
- * coff-go32.c: Update copyright.
- * coff-stgo32.c: Likewise.
- * coff-go32.c (COFF_LONG_FILENAMES): Define.
- * coff-stgo32.c (COFF_LONG_FILENAMES): Likewise.
- * coff-go32.c (COFF_SECTION_ALIGNMENT_ENTRIES): Remove .bss entry.
- * coff-stgo32.c (COFF_SECTION_ALIGNMENT_ENTRIES): Likewise.
-
-2001-01-25 Kazu Hirata <kazu@hxi.com>
-
- * bfd-in2.h: Rebuild.
- * libbfd.h: Likewise.
-
-2001-01-23 H.J. Lu <hjl@gnu.org>
-
- * bfd-in2.h: Rebuild.
-
-2001-01-23 H.J. Lu <hjl@gnu.org>
-
- * vms-misc.c (_bfd_vms_next_record): Return -1 if PRIV(vms_buf)
- is NULL or PRIV(vms_rec) is outside of the buffer.
-
-2001-01-23 Kazu Hirata <kazu@hxi.com>
-
- * coff64-rs6000.c: Fix formatting.
- * coff-arm.c: Likewise.
- * coffgen.c: Likewise.
- * cofflink.c: Likewise.
- * coff-mcore.c: Likewise.
- * coff-mips.c: Likewise.
- * coff-pmac.c: Likewise.
- * coff-ppc.c: Likewise.
- * coff-rs6000.c: Likewise.
- * elf32.c: Likewise.
- * elf32-fr30.c: Likewise.
- * elf32-i370.c: Likewise.
- * elf32-i860.c: Likewise.
- * elf32-m32r.c: Likewise.
- * elf32-m68k.c: Likewise.
- * elf32-mcore.c: Likewise.
- * elf32-ppc.c: Likewise.
- * elf32-sh.c: Likewise.
- * elf32-v850.c: Likewise.
- * elf64-alpha.c: Likewise.
- * elf64-sparc.c: Likewise.
- * elflink.c: Likewise.
- * elflink.h: Likewise.
- * elf-m10200.c: Likewise.
- * elf-m10300.c: Likewise.
- * elfxx-ia64.c: Likewise.
-
- * aoutx.h: Fix formatting.
- * bfd.c: Likewise.
- * bfd-in2.h: Likewise.
- * bfd-in.h: Likewise.
- * cpu-i386.c: Likewise.
- * cpu-m68hc11.c: Likewise.
- * dwarf2.c: Likewise.
- * elf64-x86-64.c: Likewise.
- * format.c: Likewise.
- * freebsd.h: Likewise.
- * hash.c: Likewise.
- * hp300hpux.c: Likewise.
- * hppabsd-core.c: Likewise.
- * hpux-core.c: Likewise.
-
-2001-01-22 Bo Thorsen <bo@suse.de>
-
- * elf64-x86-64.c: Added PIC support for X86-64.
- (elf64_x86_64_link_hash_newfunc): Function added.
- (elf64_x86_64_link_hash_table_create): Likewise.
- (elf64_x86_64_check_relocs): Likewise.
- (elf64_x86_64_gc_mark_hook): Likewise.
- (elf64_x86_64_gc_sweep_hook): Likewise.
- (elf64_x86_64_adjust_dynamic_symbol): Likewise.
- (elf64_x86_64_size_dynamic_sections): Likewise.
- (elf64_x86_64_discard_copies): Likewise.
- (elf64_x86_64_finish_dynamic_symbol): Likewise.
- (elf64_x86_64_finish_dynamic_sections): Likewise.
- (elf64_x86_64_relocate_section): Add relocation of PIC sections.
-
-2001-01-21 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
-
- * Makefile.am (install-data-local): Make use of $(DESTDIR).
+ * Makefile.am: Run "make dep-am".
* Makefile.in: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+
+2002-01-22 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * configure.host (hppa*64*-*-hpux*, hppa*64*-*-linux*): Add new
+ host defines.
+
+2002-01-21 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf32-cris.c (cris_elf_relocate_section) <case R_CRIS_32_GOTREL>:
+ Check for and emit error if sgot is NULL at this point.
+
+2002-01-21 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * config.bfd (ia64*-*-netbsd*): New target.
+
+2002-01-21 Thomas Klausner <wiz@danbala.ifoer.tuwien.ac.at>
+
+ * som.c (som_write_space_strings): Comment typo fix.
+
+2002-01-21 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (struct ppc_link_hash_entry): Add is_func and
+ is_func_descriptor fields.
+ (link_hash_newfunc): Init them.
+ (ppc64_elf_check_relocs): Only R_PPC24_REL24 syms starting with a
+ dot are candidates for plt entries. When processing .opd relocs,
+ set function descriptor strings to point inside function code
+ string, and set new ppc_link_hash_entry fields.
+ (ppc64_elf_gc_sweep_hook): Don't sweep R_PPC64_REL24 relocs.
+ (ppc64_elf_adjust_dynamic_symbol): Remove most code dealing with
+ function descriptors. It's now done in..
+ (func_desc_adjust): New.
+ (ppc64_elf_func_desc_adjust): New.
+ (define elf_backend_always_size_sections): Define.
+ (ppc64_elf_hide_symbol): New.
+ (define elf_backend_hide_symbol): Define.
+ (allocate_dynrelocs): Remove code looking up function descriptors
+ as that has been done earlier.
+ (ppc64_elf_size_dynamic_sections): Use htab shortcut to elf hash
+ table.
+ (ppc64_elf_finish_dynamic_symbol): Likewise. Remove code looking
+ up function descriptor.
+ (build_one_stub): Look up the function code sym. Check for
+ invalid plt offsets.
+ (ppc64_elf_relocate_section): Tweak calls to undefined weak syms.
+ Convert R_PPC64_TOC relocs to R_PPC64_RELATIVE in shared libs.
+
+ * elf-bfd.h (elf_backend_data <elf_backend_hide_symbol>): Add
+ boolean param.
+ (_bfd_elf_link_hash_hide_symbol): Likewise.
+ * elflink.h (elf_link_add_object_symbols): Adjust call to
+ elf_backend_hide_symbol.
+ (elf_fix_symbol_flags): Likewise.
+ (elf_link_assign_sym_version): Likewise. Use bfd_malloc rather
+ than bfd_alloc.
+ * elf.c (_bfd_elf_link_hash_hide_symbol): Add "force_local" param.
+ Set ELF_LINK_FORCED_LOCAL and call _bfd_elf_strtab_delref.
+ * elf32-hppa.c (elf32_hppa_hide_symbol): Likewise.
+ (clobber_millicode_symbols): Adjust to suit new hide_symbol.
+ * elf32-cris.c (elf_cris_hide_symbol): Add "force_local" param
+ and adjust to suit.
+ * elf32-mips.c (_bfd_mips_elf_hide_symbol): Likewise, and call
+ _bfd_elf_link_hash_hide_symbol rather than duplicating code.
+ * elfxx-ia64.c (elfNN_ia64_hash_hide_symbol): Likewise.
-2001-01-21 Kazu Hirata <kazu@hxi.com>
-
- * coff-a29k.c: Fix formatting.
-
-2001-01-19 H.J. Lu <hjl@gnu.org>
-
- * elf32-i386.c (elf_i386_check_relocs): Report files with bad
- relocation section names.
- (elf_i386_relocate_section): Report files with bad relocation
- section names and return false.
-
-2001-01-17 Bo Thorsen <bo@suse.de>
-
- * targets.c: Alphabetize list of xvecs.
-
-2001-01-14 Alan Modra <alan@linuxcare.com.au>
-
- * config.bfd: Add linux target variant for elfxx-hppa.
- * configure.in: Recognize bfd_elf32_hppa_linux_vec and
- bfd_elf64_hppa_linux_vec.
- * configure: Regenerate.
- * elf64-hppa.c: Include elf64-target.h again to support linux
- target variant.
- (elf64_hppa_post_process_headers): Set ELFOSABI_LINUX for linux.
- * elf32-hppa.c: Include elf32-target.h again to support linux
- target variant.
- (elf32_hppa_post_process_headers): New function.
- (elf_backend_post_process_headers): Define.
- * targets.c (bfd_target_vector): Add bfd_elf64_hppa_linux_vec and
- bfd_elf32_hppa_linux_vec.
-
- * elf32-hppa.c (elf32_hppa_link_hash_table): Add text_segment_base,
- and data_segment_base fields.
- (elf32_hppa_link_hash_table_create ): Init them.
- (elf32_hppa_check_relocs): Update comments.
- (hppa_record_segment_addr): New function.
- (elf32_hppa_relocate_section): Call it.
- (final_link_relocate): Handle R_PARISC_SEGREL32.
- (elf32_hppa_final_link): New function.
- (bfd_elf32_bfd_final_link): Define to call it.
- (hppa_unwind_entry_compare): New function.
- * cache.c (bfd_open_file): Create files in write+read mode.
-
- * elf-hppa.h (elf_hppa_howto_table): Set bitsize value for
- SEGREL32 and numerous other relocs. Change duplicate
- R_PARISC_NONE relocs to R_PARISC_UNIMPLEMENTED.
-
- * opncls.c (bfd_fdopenr): Add parens like the comment says around
- O_ACCMODE.
-
- * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Don't create
- .plt entries for DT_INIT and DT_FINI.
- (elf32_hppa_finish_dynamic_sections): Remove special handling of
- DT_INIT and DT_FINI.
-
- * elf64-hppa.c (elf64_hppa_finish_dynamic_symbol): Use 16-bit
- offsets for stub .plt access if wide mode. Check offset in range.
-
-2001-01-13 Nick Clifton <nickc@redhat.com>
-
- * elf32-fr30.c (fr30_elf_howto_table): Remove spurious blank
- line.
-
- * coffcode.h (coff_canonicalize_reloc): Remove spurious blank
- line.
-
-2001-01-12 Alan Modra <alan@linuxcare.com.au>
-
- * configure.in ([bfd_elf64_x86_64_vec]): Set target64.
- * configure: Regenerate.
-
-2001-01-11 Peter Targett <peter.targett@arccores.com>
-
- * bfd-in2.h (bfd_architecture): Add bfd_mach_arc_5,
- bfd_mach_arc_6, bfd_mach_arc_7, bfd_mach_arc_8 for ARC variants.
- * cpu-arc.c (arch_info_struct): Add entries for variants.
- (bfd_arc_arch) Set default to bfd_mach_arc_5.
- (arc_get_mach) Don't assume machine names prefixed arc- before
- testing.
- * elf32-arc.c (arc_elf_object_p): Set machine number based on new
- selections.
- (arc_elf_final_write_processing) Likewise.
- (ELF_MACHINE_CODE) Use EM_ARC.
-
-2001-01-10 Nick Clifton <nickc@redhat.com>
-
- * coff-arm.c (LOCAL_LABEL_PREFIX): Change definition to "".
-
-2001-01-07 Philip Blundell <philb@gnu.org>
-
- * README: Replace `bug-gnu-utils@gnu.org' with
- `bug-binutils@gnu.org'.
-
-2001-01-04 Kazu Hirata <kazu@hxi.com>
-
- * som.c: Fix formatting.
-
-2001-01-03 Kazu Hirata <kazu@hxi.com>
-
- * ecoffswap.h: Fix formatting.
- * elf-bfd.h: Likewise.
- * elfarm-nabi.c: Likewise.
- * elfarm-oabi.c: Likewise.
- * elfcode.h: Likewise.
- * elfcore.h: Likewise.
- * elflink.c: Likewise.
- * elflink.h: Likewise.
- * elfxx-ia64.c: Likewise.
- * elfxx-target.h: Likewise.
- * libbfd.c: Likewise
- * linker.c: Likewise.
- * lynx-core.c: Likewise.
-
-2001-01-02 Kazu Hirata <kazu@hxi.com>
-
- * pc532-mach.c: Fix formatting.
- * pe-arm.c: Likewise.
- * pe-i386.c: Likewise.
- * pe-mips.c: Likewise.
- * pe-ppc.c: Likewise.
- * pe-sh.c: Likewise.
- * pei-mips.c: Likewise.
- * pei-sh.c: Likewise.
- * peicode.h: Likewise.
- * ppcboot.c: Likewise.
- * ptrace-core.c: Likewise.
-
-2001-01-01 Kazu Hirata <kazu@hxi.com>
-
- * reloc.c: Fix formatting.
- * riscix.c: Likewise.
- * rs6000-core.c: Likewise.
- * xcoff-target.h: Likewise.
-
-2000-12-29 Hans-Peter Nilsson <hp@bitrange.com>
-
- * elfcode.h (elf_object_p): Also restore the bfd mach field on
- error, by calling bfd_default_set_arch_mach with incoming
- values.
-
-2000-12-26 Kazu Hirata <kazu@hxi.com>
-
- * vaxnetbsd.c: Fix formatting.
- * versados.c: Likewise.
- * vms-gsd.c: Likewise.
- * vms-hdr.c: Likewise.
- * vms-misc.c: Likewise.
-
-2000-12-25 Alexandre Oliva <aoliva@redhat.com>
-
- * archive.c (coff_write_armap): Don't write more than symbol_count
- `archive_member_file_ptr's.
-
-2000-12-25 Kazu Hirata <kazu@hxi.com>
-
- * vms-tir.c: Fix formatting.
-
-2000-12-23 Kazu Hirata <kazu@hxi.com>
-
- * vms.c: Fix formatting.
- * vms.h: Likewise.
-
-2000-12-21 Santeri Paavolainen <santtu@ssh.com>
-
- * vms-hdr.c: Include alloca.h if HAVE_ALLOCA_H is defined.
-
- * peicode.h (pe_ILF_object_p): Add const to import of TARGET_LITTLE_SYM.
-
- * elf32-m32r.c (m32r_elf_generic_reloc): Add cast to avoid (void *)
- arithmetic.
-
- * elf32-fr30.c: Add casts to avoid (void *) arithmetic.
-
- * coffcode.h (styp_to_sec_flags): Add empty statement after label.
-
-2000-12-21 Richard Sandiford <rsandifo@redhat.com>
-
- * libbfd.c (bfd_get_bits): Added
- (bfd_put_bits): Likewise
- * bfd-in.h: Declared the above.
- * bfd-in2.h: Regenerated.
-
-2000-12-20 Kazu Hirata <kazu@hxi.com>
-
- * targets.c: Fix formatting.
- * tekhex.c: Likewise.
- * trad-core.c: Likewise.
-
-2000-12-19 Kazu Hirata <kazu@hxi.com>
-
- * sco5-core.c: Fix formatting.
- * section.c: Likewise.
- * sparclinux.c: Likewise.
- * sparclynx.c: Likewise.
- * sparcnetbsd.c: Likewise.
- * srec.c: Likewise.
- * stabs.c: Likewise.
- * stab-syms.c: Likewise.
- * sunos.c: Likewise.
- * syms.c: Likewise.
- * sysdep.h: Likewise.
-
-2000-12-18 Nick Clifton <nickc@redhat.com>
-
- * coff-arm.c (EXTRA_S_FLAGS): Only define if not already
- defined.
- * epoc-pe-arm.c (EXTRA_S_FLAGS): Define.
- * epoc-pei-arm.c (EXTRA_S_FLAGS): Define.
-
-2000-12-18 Nick Clifton <nickc@redhat.com>
-
- * vms-misc.c (_bfd_vms_get_record): Add default case to
- file_format switch.
-
-2000-12-15 Miloslav Trmac <mitr@volny.cz>
-
- * elfcore.h (elf_core_file_p): Move to the start of the program
- headers before attempting to read them.
-
-2000-12-14 Kazu Hirata <kazu@hxi.com>
-
- * peigen.c: Fix formatting.
- * som.c: Likewise.
- * som.h: Likewise.
-
-2000-12-13 Kazu Hirata <kazu@hxi.com>
-
- * peigen.c: Fix formatting.
-
-2000-12-12 Jim Wilson <wilson@redhat.com>
-
- * elfxx-ia64.c (get_dyn_sym_info): Cast %p argument to void *.
-
-2000-12-08 Mark Salter <msalter@redhat.com>
-
- * binary.c (binary_set_section_contents): Ignore sections
- with zero size.
-
-2000-12-12 Kazu Hirata <kazu@hxi.com>
-
- * m68klinux.c: Fix formatting.
- * m68knetbsd.c: Likewise.
- * mipsbsd.c: Likewise.
- * netbsd-core.c: Likewise.
- * netbsd.h: Likewise.
- * newsos3.c: Likewise.
- * nlm32-alpha.c: Likewise.
- * nlm32-i386.c: Likewise.
- * nlm32-ppc.c: Likewise.
- * nlm32-sparc.c: Likewise.
- * nlmcode.h: Likewise.
- * nlmswap.h: Likewise.
- * nlm-target.h: Likewise.
- * ns32knetbsd.c: Likewise.
-
-2000-12-10 Fred Fish <fnf@be.com>
-
- * elflink.h (elf_link_output_extsym): Don't complain about undefined
- symbols in shared objects if allow_shlib_undefined is true.
-
-2000-12-12 Nick Clifton <nickc@redhat.com>
-
- * cpu-sh.c: Fix formattng.
- * elf.c: Fix formattng.
- * elf32-mips.c: Fix formattng.
- * elf32-sh.c: Fix formattng.
- * elf64-alpha.c: Fix formattng.
-
-2000-12-09 Nick Clifton <nickc@redhat.com>
-
- * elf32-mips.c (_bfd_mips_elf_find_nearest_line): Pass
- dwarf2_find_line_info as last parameter to invocation of
- _bfd_dwarf2_find_nearest_line.
- * elf32-arm.h (elf32_arm_find_nearest_line): Pass
- dwarf2_find_line_info as last parameter to invocation of
- _bfd_dwarf2_find_nearest_line.
-
-2000-12-08 Mark Elbrecht <snowball3@bigfoot.com>
-
- * Makefile.am (BFD32_BACKENDS): Move dwarf2.lo from here...
- (BFD_LIBS): ...to here.
- (BFD32_BACKENDS_CFILES): Move dwarf2.c from here...
- (BFD_LIBS_CFILES): ...to here.
- * Makefile.in: Regenerate.
- * configure.in: Remove dwarf.lo from the elf shell variable.
- * configure: Regenerate.
- * libcoff-in.h (coff_tdata): Add pointer dwarf2_find_line_info.
- * libcoff.h: Regenerate.
- * coffgen.c (coff_find_nearest_line): Call
- _bfd_dwarf2_find_nearest_line.
- * dwarf2.c (_bfd_dwarf2_find_nearest_line): Add parameter. Update
- accordingly.
- (read_abbrevs): Likewise
- (decode_line_info): Likewise.
- (parse_comp_unit): Likewise.
- (comp_unit_find_nearest_line): Likewise.
- * libbfd-in.h (_bfd_dwarf2_find_nearest_line): Update prototype.
- * libbfd.h: Regenerate.
- * elf.c (_bfd_elf_find_nearest_line): Update call.
- * elf-bfd.h (elf_obj_tdata): Change dwarf2_find_line_info to type PTR.
- * dwarf2.c (concat_filename): Use IS_ABSOLUTE_PATH.
- * coffcode.h (STYP_XCOFF_DEBUG, STYP_DEBUG_INFO): New macros.
- (sec_to_styp_flags): Use them. Handle DWARF2 sections.
- (styp_to_sec_flags): Handle DWARF2 sections.
- * elf32-arm.h (elf32_arm_find_nearest_line): Add parameter to call
- to _bfd_find_nearest_line.
- * elf32-mips.c (_bfd_mips_elf_find_nearest_line): Add parameter to
- call to _bfd_find_nearest_line.
-
-2000-12-08 Kazu Hirata <kazu@hxi.com>
-
- * coffgen.c: Fix formatting.
- * elf-m10300.c: Likewise.
- * elf32-i386.c: Likewise.
- * elf32-i960.c: Likewise.
- * elf32-m68k.c: Likewise.
- * elf32-mcore.c: Likewise.
- * elf32-ppc.c: Likewise.
- * elf32-sh.c: Likewise.
- * elf32-sparc.c: Likewise.
- * elf32-v850.c: Likewise.
- * elf64-alpha.c: Likewise.
- * elf64-hppa.c: Likewise.
- * elf64-mips.c: Likewise.
- * elf64-sparc.c: Likewise.
-
-2000-12-07 Kazu Hirata <kazu@hxi.com>
-
- * elf32-ppc.c: Fix formatting.
- * elf64-x86-64.c: Likewise.
-
-2000-12-06 Ulf Carlsson <ulfc@engr.sgi.com>
-
- From Ralf Baechle <ralf@gnu.org>
-
- * elf32-mips.c (elf32_mips_merge_private_bfd_data): Always permit
- BFDs containing no sections or empty .text, .data or .bss sections
- to be merged, regardless of their flags.
-
-2000-12-06 Kazu Hirata <kazu@hxi.com>
-
- * elf32-m32r.c: Fix formatting.
- * elf32-m68hc11.c: Likewise.
- * elf32-m68hc12.c: Likewise.
- * elf32-m68k.c: Likewise.
- * elf32-mcore.c: Likewise.
- * elf32-pj.c: Likewise.
- * elf32-ppc.c: Likewise.
-
-2000-12-05 Kazu Hirata <kazu@hxi.com>
-
- * elf32-fr30.c: Fix formatting.
- * elf32-hppa.c: Likewise.
- * elf32-i370.c: Likewise.
- * elf32-i386.c: Likewise.
- * elf32-i860.c: Likewise.
- * elf32-i960.c: Likewise.
-
-2000-12-03 Kazu Hirata <kazu@hxi.com>
-
- * elf32-arm.h: Fix formatting.
- * elf32-avr.c: Likewise.
- * elf32-cris.c: Likewise.
- * elf32-d10v.c: Likewise.
- * elf32-d30v.c: Likewise.
- * elf-hppa.h: Likewise.
- * elf-m10200.c: Likewise.
- * elf-m10300.c: Likewise.
-
-2000-12-01 Chris Demetriou <cgd@sibyte.com>
-
- * aoutx.h (NAME(aout,machine_type)): Add bfd_mach_mips32 and
- bfd_mach_mips32_4k. Update FIXME comment.
- * archures.c (bfd_mach_mips32): New constant.
- (bfd_mach_mips4K, bfd_mach_mips32_4k) Rename the former to
- the latter, renumber it.
- * bfd-in2.h (bfd_mach_mips32): New constant.
- (bfd_mach_mips4K, bfd_mach_mips32_4k) Rename the former to
- the latter, renumber it.
- * cpu-mips.c (I_mips32): New constant.
- (I_mips4K, I_mips32_4k): Rename the former to the latter.
- (arch_info_struct): Add bfd_mach_mips32 entry, replace
- bfd_mach_mips4K entry with bfd_mach_mips32_4k entry.
- * elf32-mips.c (elf_mips_isa): Add E_MIPS_ARCH_32 case.
- (elf_mips_mach): Likewise. Also, replace E_MIPS_MACH_MIPS32
- with E_MIPS_MACH_MIPS32_4K.
- (_bfd_mips_elf_final_write_processing): Replace
- bfd_mach_mips4K with bfd_mach_mips32_4k case, add
- bfd_mach_mips32 case.
- (_bfd_mips_elf_merge_private_bfd_data): Generalize ISA mixing
- comparison with support for MIPS32.
- (_bfd_mips_elf_print_private_bfd_data): Print ISA name for
- MIPS32.
-
- * aoutx.h (NAME(aout,machine_type)): Add cases for
- bfd_mach_mips5 and bfd_mach_mips64.
- * archures.c (bfd_mach_mips5, bfd_mach_mips64): New constants.
- * bfd-in2.h (bfd_mach_mips5, bfd_mach_mips64): Likewise.
- * cpu_mips.c (I_mips5, I_mips64): New definitions.
- (arch_info_struct): Add entries for bfd_mach_mips5 and
- bfd_mach_mips64.
- * elf32-mips.c (elf_mips_isa, elf_mips_mach,
- _bfd_mips_elf_print_private_bfd_data): Add cases for
- E_MIPS_ARCH_5 and E_MIPS_ARCH_64.
- (_bfd_mips_elf_final_write_processing): Add cases for
- bfd_mach_mips5 and bfd_mach_mips64.
-
- * bfd/aoutx.h (NAME(aout,machine_type)): Add a
- bfd_mach_mips_sb1 case.
- * bfd/archures.c (bfd_mach_mips_sb1): New constant.
- * bfd/bfd-in2.h (bfd_mach_mips_sb1): New constant.
- * bfd/cpu-mips.c (I_sb1): New constant.
- (arch_info_struct): Add entry for bfd_mach_mips_sb1.
- * bfd/elf32-mips.c (elf_mips_mach): Add case for
- E_MIPS_MACH_SB1.
- (_bfd_mips_elf_final_write_processing): Add case for
- bfd_mach_mips_sb1.
-
-2000-12-01 Joel Sherrill <joel@OARcorp.com>
-
- * config.bfd (arm-*-rtems*, a29k-*rtems*): New targets.
- (sparc*-*-rtemself*, sparc*-*-rtemsaout*): New targets.
- (sparc*-*-rtems*): Switched from a.out to ELF.
-
-2000-11-30 Jan Hubicka <jh@suse.cz>
-
- * Makefile.am (BFD64_BACKENDS): Add elf64-x86-64.lo
- BFD64_BACKENDS_CFILES): Add elf64-x86-64.c
- (elf64-x86-64.lo): Add dependencies.
- * archures.c (DESCRIPTION): Add bfd_mach_x86_64,
- bfd_mach_x86_64_intel_syntax.
- * elf.c (prep_headers): Use EM_x86_64 for 64bit output.
- * config.bfd (x86_64): Add.
- * configure.in: Add support for bfd_elf64_x86_64_vec.
- * cpu-i386.c (bfd_x86_64_arch_intel_syntax, bfd_x86_64_arch): Add.
- (bfd_i386_arch, i8086_ar): Link in.
- * elf64-x86-64.c: New file.
- * reloc.c (ENUMDOC): Add BFD_RELOC_X86_64*.
- * targets.c (bfd_elf64_x86_64_vec): Add.
- (bfd_target_vect): Add bfd_elf64_x86_64_vec.
-
-2000-11-30 Kazu Hirata <kazu@hxi.com>
-
- * xcofflink.c: Fix formatting.
-
-2000-11-28 Kazu Hirata <kazu@hxi.com>
-
- * aoutx.h: Fix formatting.
- * bfd-in.h: Likewise.
- * bfd-in2.h: Likewise.
- * cache.c: Likewise.
- * cisco-core.c: Likewise.
- * coff64-rs6000.c: Likewise.
- * coffcode.h: Likewise.
- * coffswap.h: Likewise.
- * corefile.c: Likewise.
- * elf32-mips.c: Likewise.
-
-2000-11-27 Kazu Hirata <kazu@hxi.com>
-
- * aout-adobe.c: Fix formatting.
- * coff64-rs6000.c: Likewise.
- * coffgen.c: Likewise.
- * cofflink.c: Likewise.
-
-2000-11-27 Philip Blundell <pb@futuretv.com>
-
- * libcoff-in.h (coff_tdata): Add `strings_written' flag.
- (obj_coff_strings_written): New accessor macro for above.
- * libcoff.h: Regenerate.
- * cofflink.c (_bfd_coff_final_link): Say that we wrote the
- strings.
- * coffcode.h (coff_write_object_contents): No need to write out
- the string table if it's already been done.
-
-2000-11-22 Philip Blundell <pb@futuretv.com>
-
- * cofflink.c (_bfd_coff_generic_relocate_section): Don't object to
- weak undefined symbols.
-
-2000-11-24 Nick Clifton <nickc@redhat.com>
-
- * archures.c (bfd_mach_arm_5TE): Define.
- (bfd_mach_arm+XScale): Define.
- * bfd-in2.h: Regenerate.
-
- * coff-arm.c (coff_arm_reloc_type_lookup): Accept
- BFD_RELOC_ARM_PCREL_BLX.
-
- * coffcode.h (coff_set_flags): Set flags for 5t, 5te and
- XScale machine numbers.
-
- * config.bfd (xscale-elf): Add target.
- (xscale-coff): Add target.
-
- * cpu-arm.c: Add xscale machine name.
- Add v5t, v5te and XScale machine numbers.
-
-2000-11-23 Kazu Hirata <kazu@hxi.com>
-
- * aix386-core.c: Fix formatting.
-
-2000-11-22 Jim Wilson <wilson@redhat.com>
-
- * coff-ia64.c (howto_table): Use EMPTY_HOWTO.
- (in_reloc_p): Add ATTRIBUTE_UNUSED to unused parameters.
- * cpu-ia64-opc.c (ins_rsvd, ext_rsvd, ins_const, ext_const): Likewise.
- (ins_imms_scaled): Initialize sign_bit at function entry.
- (elf64_ia64_operands): Add missing initializers.
- * elfxx-ia64.c (elfNN_ia64_reloc, elfNN_ia64_reloc_type_lookup,
- elfNN_ia64_info_to_howto, elfNN_ia64_fake_sections,
- elfNN_ia64_add_symbol_hook, elfNN_ia64_is_local_label_name,
- elfNN_ia64_local_hash_table_init, get_fptr, get_pltoff,
- elfNN_ia64_adjust_dynamic_symbol): Add ATTRIBUTE_UNUSED for unused
- parameters.
- (elfNN_ia64_info_to_howto): Initialize free_relocs, free_contents,
- and free_extsyms at function entry.
- (elfNN_add_symbol_hook): Add unsigned cast to bfd_get_gp_size result.
- (elfNN_ia64_create_dynamic_sections): Delete unused local h.
- (get_got): Delete unused local srel.
- (elfNN_ia64_check_relocs): Initialize dynrel_type when declared.
- (elfNN_ia64_relocate_section): Delete unused local dynindx.
-
-2000-11-21 Kazu Hirata <kazu@hxi.com>
-
- * coff-a29k.c: Fix formatting.
- * coff-h8500.c: Likewise.
- * coff-i960.c: Likewise.
- * coff-ppc.c: Likewise.
- * coff-rs6000.c: Likewise.
- * coff-stgo32.c: Likewise.
- * coff-tic54x.c: Likewise.
- * coff-w65.c: Likewise.
- * cpu-h8500.c: Likewise.
- * cpu-hppa.c: Likewise.
- * cpu-ns32k.c: Likewise.
- * ecoff.c: Likewise.
- * ecofflink.c: Likewise.
-
-2000-11-21 Nick Clifton <nickc@redhat.com>
-
- * elf32-sh.c (sh_elf_reloc_loop): Fix compile time warning, and
- remove possibility of infinite loop.
-
-2000-11-20 Kazu Hirata <kazu@hxi.com>
-
- * aix386-core.c: Fix formatting.
- * aout-adobe.c: Likewise.
- * aout-arm.c: Likewise.
- * aout-encap.c: Likewise.
- * aout-ns32k.c: Likewise.
- * aout-target.h: Likewise.
- * aout-tic30.c: Likewise.
- * aoutf1.h: Likewise.
- * aoutx.h: Likewise.
- * archive.c: Likewise.
- * bfd-in.h: Likewise.
- * bfd-in2.h: Likewise.
- * bfd.c: Likewise.
- * bout.c: Likewise.
-
-2000-11-17 H.J. Lu <hjl@gnu.org>
-
- * elfxx-ia64.c (elfNN_ia64_size_dynamic_sections): Don't create
- pltoff entries for DT_INIT and DT_FINI.
- (elfNN_ia64_final_link): Don't set DT_INIT/FINI entries.
- (elfNN_ia64_finish_dynamic_sections): Don't fill in DT_INIT/FINI
- entries.
-
-2000-11-16 Richard Henderson <rth@redhat.com>
-
- * elfxx-ia64.c (elfNN_ia64_check_relocs): Handle IPLT relocs.
- (allocate_dynrel_entries): Likewise.
- (elfNN_ia64_relocate_section): Likewise. Set REL addends correctly.
- (set_pltoff_entry): Likewise.
- (ia64_howto_table): Remove R_IA64_SEGBASE, and R_IA64_EPLT[ML]SB
- (elfNN_ia64_reloc_type_lookup): Likewise.
- (elfNN_ia64_install_value): Likewise.
- (elfNN_ia64_relocate_section): Likewise.
- * reloc.c (BFD_RELOC_IA64_SEGBASE): Remove.
- (BFD_RELOC_IA64_EPLTMSB, BFD_RELOC_IA64_EPLTLSB): Remove.
-
-2000-11-16 Kazu Hirata <kazu@hxi.com>
-
- * cpu-a29k.c: Fix formatting.
- * cpu-alpha.c: Likewise.
- * cpu-arm.c: Likewise.
- * cpu-avr.c: Likewise.
- * cpu-d10v.c: Likewise.
- * cpu-h8500.c: Likewise.
- * cpu-hppa.c: Likewise.
- * cpu-i370.c: Likewise.
- * cpu-i386.c: Likewise.
- * cpu-i960.c: Likewise.
- * cpu-ia64-opc.c: Likewise.
- * cpu-ia64.c: Likewise.
- * cpu-m32r.c: Likewise.
- * cpu-m68hc11.c: Likewise.
- * cpu-m68hc12.c: Likewise.
- * cpu-m68k.c: Likewise.
- * cpu-m88k.c: Likewise.
- * cpu-mips.c: Likewise.
- * cpu-ns32k.c: Likewise.
- * cpu-pj.c: Likewise.
- * cpu-powerpc.c: Likewise.
- * cpu-sh.c: Likewise.
- * cpu-sparc.c: Likewise.
- * cpu-tic54x.c: Likewise.
- * cpu-v850.c: Likewise.
- * cpu-vax.c: Likewise.
- * cpu-w65.c: Likewise.
- * cpu-we32k.c: Likewise.
- * cpu-z8k.c: Likewise.
- * dwarf1.c: Likewise.
- * dwarf2.c: Likewise.
-
-2000-11-15 Kazu Hirata <kazu@hxi.com>
-
- * coff-arm.c: Fix formatting.
- * coff-ppc.c: Likewise.
- * coff-rs6000.c: Likewise.
- * coff-sh.c: Likewise.
- * coff-sparc.c: Likewise.
- * coff-tic30.c: Likewise.
- * coff-tic54x.c: Likewise.
- * coff-tic80.c: Likewise.
- * coff-w65.c: Likewise.
- * coff-we32k.c: Likewise.
- * coff-z8k.c: Likewise.
-
-2000-11-15 Richard Henderson <rth@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_check_relocs): Create the reloc
- section with the same ALLOC|LOAD flags as the source section.
-
-2000-11-14 Jakub Jelinek <jakub@redhat.com>
-
- * elf64-alpha.c (elf64_alpha_relax_opt_call): Only check bits used
- by STO_ALPHA constants.
-
-2000-11-14 Kazu Hirata <kazu@hxi.com>
-
- * coff-pmac.c: Fix formatting.
- * coff-ppc.c: Likewise.
-
-2000-11-13 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_add_object_symbols): Also add indirect
- symbols for common symbols with the default version.
-
-2000-11-09 Philip Blundell <pb@futuretv.com>
-
- * section.c (STD_SECTION): Set gc_mark flag.
-
-2000-11-11 Kazu Hirata <kazu@hxi.com>
-
- * coff-i960.c: Likewise.
- * coff-m68k.c: Likewise.
- * coff-m88k.c: Likewise.
- * coff-mcore.c: Likewise.
- * coff-mips.c: Likewise.
-
-2000-11-11 Bernd Schmidt <bernds@cygnus.co.uk>
-
- * elf32-sh.c (sh_elf_relocate_section): Ignore R_SH_NONE relocs.
-
-2000-11-10 Kazu Hirata <kazu@hxi.com>
-
- * coff-h8300.c: Fix formatting.
- * coff-h8500.c: Likewise.
- * coff-i386.c: Likewise.
- * coff-i860.c: Likewise.
- * coff-i960.c: Likewise.
- * coff-ia64.c: Likewise.
-
-2000-11-09 Kazu Hirata <kazu@hxi.com>
-
- * archive.c: Fix formatting.
- * archures.c: Likewise.
-
-2000-11-07 Richard Henderson <rth@redhat.com>
-
- * elfxx-ia64.c (elf64_ia64_final_link): New local unwind_output_sec.
- Set it before bfd_elf64_bfd_final_link call. Use it after the call.
- * section.c (bfd_set_section_contents): Call memcpy if
- section->contents set and location not equal to contents plus offset.
-
-2000-11-08 Kazu Hirata <kazu@hxi.com>
-
- * bfd-in.h: Fix formatting.
- * bfd-in2.h: Likewise.
- * bfd.c: Likewise.
- * binary.c: Likewise.
- * bout.c: Likewise.
- * coff-a29k.c: Likewise.
- * coff-alpha.c: Likewise.
- * coff-apollo.c: Likewise.
- * coff-aux.c: Likewise.
-
-2000-11-07 Kazu Hirata <kazu@hxi.com>
-
- * aix386-core.c: Fix formatting.
- * aoutf1.h: Likewise.
- * aoutx.h: Likewise.
- * archures.c: Likewise.
- * armnetbsd.c: Likewise.
-
-2000-11-07 Alan Modra <alan@linuxcare.com.au>
-
- * coff-h8300.c (special): Adjust reloc address.
-
-2000-11-06 Steve Ellcey <sje@cup.hp.com>
-
- * archures.c (bfd_mach_ia64_elf64, bfd_mach_ia64_elf32): Add defines
- to differentiate elf32 and elf64 on ia64.
- * bfd-in2.h: Regenerate.
- * config.bfd: Add target for "ia64*-*-hpux*".
- * configure.in: Add bfd_elf32_ia64_big_vec to selvecs switch.
- * configure: Regenerate.
- * cpu-ia64.c (bfd_ia64_elf32_arch): Add elf32 arch info structure.
- * targets.c: Add bfd_target bfd_elf32_ia64_big_vec.
-
- * Makefile.am: Make elf32-ia64.c and elf64-ia64.c derived objects
- from elfxx-ia64.c. Add depenency rules for making elf32-ia64.lo.
- * Makefile.in: Regnerate.
- * elf64-ia64.c: Deleted.
- * elfxx-ia64.c: New file, paramaterized version of elf64-ia64.c.
-
-2000-11-06 Kazu Hirata <kazu@hxi.com>
-
- * aout-adobe.c: Fix formatting.
- * aout-arm.c: Likewise.
- * aout-cris.c: Likewise.
- * aout-encap.c: Likewise.
- * aout-ns32k.c: Likewise.
- * aout-target.h: Likewise.
- * aout-tic30.c: Likewise.
-
-2000-11-05 Philip Blundell <philb@gnu.org>
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Always permit
- BFDs containing no sections to be merged, regardless of their flags.
-
-2000-11-04 Philip Blundell <philb@gnu.org>
-
- * elf32-arm.h (elf32_arm_relocate_section): Suppress error message
- if a relocation for an undefined symbol also results in an
- overflow.
-
-2000-11-06 Christopher Faylor <cgf@cygnus.com>
-
- * config.bfd: Add support for Sun Chorus.
-
-2000-11-05 David O'Brien <obrien@FreeBSD.org>
-
- * configure.in: Recognize alpha-*-freebsd*.
- * configure: Regenerate.
-
-2000-11-02 Luciano Gemme <ishitawa@yahoo.com>
-
- * srec.c (CHUNK): Rename to DEFAULT_CHUNK.
- (Chunk): New global variable set by a parameter in objcopy.c.
- (S3Forced): New global variable set by a parameter in
- objcopy.c.
- (srec_set_section_contents): If S3Forced is true, always generate
- S3 records.
- (srec_write_section): Use 'Chunk' to limit maximum length of S
- records.
-
-2000-11-02 Per Lundberg <plundis@chaosdev.org>
-
- * config.bfd: Add support for i[3456]86-chaosdev-storm-chaos.
- * Makefile.in: Regenerate.
- * bfd-in2.h: Regenerate.
- * po/bfd.pot: Regenerate.
-
-2000-10-31 Philip Blundell <philb@gnu.org>
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Only handle
- EF_SOFT_FLOAT if it is defined.
-
-2000-10-27 Philip Blundell <philb@gnu.org>
-
- * elf32-arm.h (elf32_arm_copy_private_bfd_data): Don't refuse
- attempts to mix PIC code with non-PIC, just mark the output as
- being position dependent.
- (elf32_arm_merge_private_bfd_data): Likewise. Print an error
- message for EF_SOFT_FLOAT mismatches. Display diagnostics for
- all mismatches, not just the first one.
-
-2000-10-25 Chris Demetriou <cgd@sibyte.com>
-
- * ieee.c (ieee_archive_p): Plug one of many possible
- memory leaks in error handling.
-
-2000-10-20 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-sparc.c (elf32_sparc_merge_private_bfd_data,
- elf32_sparc_object_p, elf32_sparc_final_write_processing):
- Support v8plusb.
- * elf64-sparc.c (sparc64_elf_merge_private_bfd_data,
- sparc64_elf_object_p): Support v9b.
- * archures.c: Declare v8plusb and v9b machines.
- * bfd-in2.h: Ditto.
- * cpu-sparc.c: Ditto.
-
-2000-10-16 Geoffrey Keating <geoffk@shoggoth.cygnus.com>
-
- * elf64-sparc.c (sparc64_elf_relocate_section): Clear the location
- of a GOT reloc.
-
- * elf32-ppc.c (SYMBOL_REFERENCES_LOCAL): New macro.
- (SYMBOL_CALLS_LOCAL): New macro.
- (ppc_elf_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL.
- (ppc_elf_check_relocs): Use SYMBOL_REFERENCES_LOCAL.
- (ppc_elf_finish_dynamic_symbol): Use SYMBOL_REFERENCES_LOCAL.
- (ppc_elf_relocate_section): Use flag variable to determine
- whether the relocation refers to a local symbol.
- Test whether a PLTREL24 reloc will produce a reloc by looking
- to see whether a PLT entry was made.
-
-2000-10-14 Geoffrey Keating <geoffk@shoggoth.cygnus.com>
-
- * elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Don't make PLT
- entries that could serve as a definition for a weak symbol.
-
-2000-10-13 Ulf Carlsson <ulfc@engr.sgi.com>
-
- From Ralf Baechle <ralf@gnu.org>
-
- * elf32-mips.c (mips_elf_create_dynamic_relocation): New argument
- local_p. Add symbol value only for non-R_MIPS_REL32 relocations
- against local symbols.
- (_bfd_mips_elf_finish_dynamic_sections): Undo patch from 2000-10-01.
-
-2000-10-12 Alan Modra <alan@linuxcare.com.au>
-
- * section.c (struct sec): Add kept_section.
- (struct bfd_comdat_info): Remove sec, we can use above.
- (STD_SECTION): Add initializer.
- (bfd_make_section_anyway): Init here too.
-
- * bfd-in2.h: Regenerate.
-
- * elflink.h (elf_link_add_object_symbols): Remove unnecessary
- zeroing of `flags'.
- (elf_link_input_bfd): Set all asection->symbol->value's here, and
- fudge values for discarded link-once section symbols.
-
- * elf64-hppa.c: Include alloca-conf.h
-
-2000-10-11 Alan Modra <alan@linuxcare.com.au>
-
- * elf.c (swap_out_syms): Revert 2000-10-07 changes.
-
- * ieee.c (ieee_make_empty_symbol): Oops, bfd_zalloc needs another arg.
-
-2000-10-10 Alan Modra <alan@linuxcare.com.au>
-
- * ieee.c (ieee_make_empty_symbol): Use bfd_zalloc, not bfd_zmalloc.
-
-2000-10-10 Tom Rix <trix@redhat.com>
-
- * section.c (bfd_make_section_anyway): Release newsect ptr when
- newsect->symbol fails to alloc. Use bfd_release instead of free.
-
-2000-10-09 Richard Henderson <rth@cygnus.com
-
- * elf64-ia64.c (elf64_ia64_unwind_entry_compare_bfd): New.
- (elf64_ia64_unwind_entry_compare): New.
- (elf64_ia64_final_link): Sort the .IA_64.unwind section.
-
-2000-10-07 Alan Modra <alan@linuxcare.com.au>
-
- * elflink.h (size_dynamic_sections): Don't create various tags if
- .dynstr is excluded from the link. Don't set first dynsym entry
- if dynsymcount is zero.
- (elf_bfd_final_link): Don't try to swap out dynamic syms if
- .dynsym excluded from the link. Don't try to write any dynamic
- sections excluded from the link.
-
- * elf.c (swap_out_syms): Handle global section symbols.
-
-2000-10-05 DJ Delorie <dj@redhat.com>
-
- * peigen.c (_bfd_pei_swap_scnhdr_out): note extended relocs
- * coffcode.h (coff_set_alignment_hook): read extended reloc count
- (coff_write_relocs): write extended reloc count
- (coff_write_object_contents): account for extended relocs
-
-2000-10-05 Jim Wilson <wilson@cygnus.com>
-
- * elf-bfd.h (struct elf_backend_data): Add elf_backend_section_flags
- field.
- * elf.c (_bfd_elf_make_section_from_shdr): Call the
- elf_backend_section_flags function.
- * elf64-ia64.c (elf64_ia64_section_from_shdr): Delete flag conversion
- code.
- (elf64_ia64_section_flags): New function containing flag conversion
- code.
- (elf_backend_section_flags): Define to elf64_ia64_section_flags.
- * elfxx-target.h (elf_backend_section_flags): Define.
- (elfNN_bed): Initialize elf_backend_section_flags field.
-
-2000-10-02 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c (elf32_hppa_check_relocs): Correct call to
- _bfd_elf32_gc_record_vtable. Correct a comment.
-
-2000-10-01 Ulf Carlsson <ulfc@engr.sgi.com>
-
- From Ralf Baechle <ralf@gnu.org>
-
- * elf32-mips.c (_bfd_mips_elf_finish_dynamic_sections): Mark gld
- produces binaries with got[1] = 0x80000001 to differenciate them
- for the dynamic linker from the broken binaries produced by old
- versions.
-
-2000-09-30 Petr Sorfa <petrs@sco.com>
-
- * elf.c (elfcore_grok_pstatus): Check for size of pxstatus_t.
- (elfcore_grok_lwpstatus): Check for size of lwpxstatus_t.
- * configure.in: Add check for pxstatus_t and lwpxstatus_t.
- * configure: Regenerate.
-
-2000-09-27 Hans-Peter Nilsson <hp@axis.com>
-
- Define two bfd_targets for absence and presence of leading
- underscore on symbols. Make sure to only link same kind.
- * elf32-cris.c (cris_elf_object_p,
- cris_elf_final_write_processing, cris_elf_print_private_bfd_data,
- cris_elf_merge_private_bfd_data): New.
- (elf_backend_object_p, elf_backend_final_write_processing,
- bfd_elf32_bfd_print_private_bfd_data,
- bfd_elf32_bfd_merge_private_bfd_data): Define.
- <Target vector definition>: Include elf32-target.h twice with
- different macro settings:
- (TARGET_LITTLE_SYM): First as bfd_elf32_cris_vec, then as
- bfd_elf32_us_cris_vec.
- (TARGET_LITTLE_NAME): First as "elf32-cris", then "elf32-us-cris".
- (elf_symbol_leading_char): First as 0, then '_'.
- (INCLUDED_TARGET_FILE): Define for second include of elf32-target.h.
- * config.bfd (cris-*-*): Add bfd_elf32_us_cris_vec to targ_selvecs.
- * configure.in (bfd_elf32_cris_vec, cris_aout_vec): New vector.
- * configure: Regenerate.
- * targets.c: Declare bfd_elf32_us_cris_vec.
- * po/bfd.pot: Regenerate.
-
-2000-09-29 Momchil Velikov <velco@fadata.bg>
-
- * elf32-arm.h (arm_add_to_rel): Correctly adjust the addend for
- R_ARM_THM_PC22 relocations.
-
-2000-09-29 NIIBE Yutaka <gniibe@chroot.org>
-
- * elflink.h (elf_link_add_object_symbols): Don't bfd_release runpath.
-
-2000-09-29 Momchil Velikov <velco@fadata.bg>
-
- * elf.c (elf_fake_sections): Do not mark the section SHT_NOBITS if
- is has the SEC_HAS_CONTENTS flag set.
-
-2000-09-28 Örjan Friberg <orjanf@axis.com>
- Hans-Peter Nilsson <hp@axis.com>
-
- * aout-cris.c (N_TXTADDR): Define.
-
-2000-09-28 John David Anglin <dave@hiauly1.hia.nrc.ca>
-
- * som.c: Include alloca-conf.h.
- * Makefile.am: "make dep-am"
- * Makefile.in: Regenerate.
-
-2000-09-27 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c (plt_stub): New.
- (PLT_STUB_ENTRY): Define.
- (elf32_hppa_link_hash_table): Change multi_subspace to packed
- boolean. Add need_plt_stub, has_12bit_branch and has_17bit_branch.
- (elf32_hppa_link_hash_table_create): Init to suit.
- (elf32_hppa_check_relocs): Set has_12bit_branch and
- has_17bit_branch as appropriate.
- (elf32_hppa_adjust_dynamic_symbol): Set need_plt_stub for
- non-local functions.
- (elf32_hppa_size_dynamic_sections): Correct setting of reltext.
- Add space for plt_stub as needed.
- (elf32_hppa_finish_dynamic_symbol): Point .plt entries for global
- functions at plt_stub.
- (elf32_hppa_finish_dynamic_sections): Write plt_stub.
- (elf32_hppa_create_dynamic_sections): Leave .plt executable.
-
- * elf32-hppa.h (elf32_hppa_size_stubs): Add group_size param.
- * elf32-hppa.c (elf32_hppa_size_stubs): Likewise. Use it instead
- of fixed size, and if negative, disable handling of input sections
- before stub section. Set up default stub group size depending
- on detected branch relocs.
- (hppa_build_one_stub): Use lrsel and rrsel for import stubs to
- ensure different offsets from sym_value aren't rounded to
- different 2k blocks. Use lrsel and rrsel for other stubs too for
- consistency rather than necessity.
- (elf32_hppa_check_relocs): Handle R_PARISC_DIR14F.
- (final_link_relocate): Likewise.
- (elf32_hppa_relocate_section): Likewise.
-
- * elf-hppa.h (elf_hppa_howto_table): Add R_PARISC_DIR14F reloc.
- (_bfd_elf_hppa_gen_reloc_type): Generate them.
- (elf_hppa_final_link_relocate): Handle them.
- (elf_hppa_relocate_insn): Likewise.
- (_bfd_elf_hppa_gen_reloc_type): Add missing e_ldsel and e_rdsel cases.
-
-2000-09-26 Hans-Peter Nilsson <hp@axis.com>
-
- * elfcode.h (elf_object_p): Preserve and clear abfd section
- information. Restore at error.
-
-2000-09-26 Paul Sokolovsky <Paul.Sokolovsky@technologist.com>
-
- * peigen.c (_bfd_pei_swap_aouthdr_in): If some DataDirectory
- is empty, make sure that its rva also 0. NT loader dislikes
- having otherwise.
-
-2000-09-26 Steve Ellcey <sje@cup.hp.com>
-
- * som.c (som_bfd_derive_misc_symbol_info): Make weak symbols
- global by default.
-
-2000-09-21 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c (elf32_hppa_check_relocs): Fix weak sym handling in
- currently unused RELATIVE_DYNAMIC_RELOCS code.
- (hppa_discard_copies): Likewise.
- (elf32_hppa_size_stubs): Size `input_list' array correctly. Correct
- comments. Don't check non-code output sections for stub grouping.
-
-2000-09-20 Alan Modra <alan@linuxcare.com.au>
-
- * section.c (bfd_get_unique_section_name): Return NULL if
- bfd_malloc fails.
-
-2000-09-19 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- * elf32-m68k.c (elf_cpu32_plt0_entry): Change the PLT entry 0
- instruction sequence to actually work.
- (elf_m68k_finish_dynamic_sections): Change the patch-in offset
- accordingly.
-
-2000-09-18 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-sh.c (sh_elf_relocate_section): Use
- _bfd_final_link_relocate to apply the relocation against a section
- symbol, when doing relocatable links.
-
-2000-09-18 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c (elf32_hppa_stub_hash_entry): Rename input_section
- to id_sec.
- (stub_hash_newfunc): Here too.
- (hppa_add_stub): And here.
- (elf32_hppa_link_hash_table): Remove stub_section_created,
- reloc_section_created, first_init_sec and first_fini_sec. Add
- stub_group.
- (elf32_hppa_link_hash_table_create): Init to suit.
- (hppa_get_stub_entry): Add support for grouping stub sections.
- (hppa_add_stub): Likewise. Remove sec_count param and init/fini
- section code. Index stub vars by section->id.
- (elf32_hppa_size_stubs): Likewise. Remove duplicated function
- exit paths. Zap allocation of above removed vars. Refine
- link-once test.
-
- * elf32-hppa.h (elf32_hppa_size_stubs): Add output_bfd param.
- * elf32-hppa.c (elf32_hppa_size_stubs): Likewise.
- (hppa_get_stub_entry): Pass in pointer to elf32_hppa_link_hash_table
- rather than pointer to bfd_link_info.
- (hppa_add_stub): Likewise.
- (final_link_relocate): Likewise.
-
-2000-09-17 David Huggins-Daines <dhd@linuxcare.com>
-
- (elf32_hppa_size_stubs): Don't try to build stubs for discarded
- link-once sections.
-
-2000-09-16 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-sh.c (ELF_MAXPAGESIZE): Define to 128, to match
- ld/emulparams/shelf.sh.
-
-2000-09-10 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): New function.
- * bfd-in.h (bfd_m68k_elf32_create_embedded_relocs): Add declaration.
- * bfd-in2.h: Regenerate.
-
-2000-09-15 Kenneth Block <Kenneth.Block@compaq.com>
-
- * bfd/elf64-alpha.c (elf64_alpha_relax_with_lituse): ld performs
- LITUSE relocations incorrectly if -relax is specified on the ld
- command line and the displacement field of the load or store
- instruction is non-zero. (Patch by paul.winalski@compaq.com)
-
-2000-09-15 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c (hppa_add_stub): Dont set first_init_sec and
- first_fini_sec here.
- (elf32_hppa_size_stubs): Instead correctly find the first .init
- and .fini section here.
-
-2000-09-15 David Huggins-Daines <dhd@linuxcare.com>
-
- * elf32-hppa.c (clobber_millicode_symbols): New function.
- (elf32_hppa_size_dynamic_sections): Call it.
-
-2000-09-14 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.c (elf32_hppa_link_hash_entry): Make pic_call
- packed. Add plabel, plt_abs packed booleans.
- (hppa_link_hash_newfunc): Init new fields.
- (PLABEL_PLT_ENTRY_SIZE): Define.
- (hppa_stub_name): Use size_t len vars.
- (hppa_add_stub): Likewise.
- (elf32_hppa_build_stubs): Likewise.
- (hppa_build_one_stub): Kill some compiler warnings.
- (elf32_hppa_check_relocs): Always generate a plt entry for PLABELs
- if dynamic linking. Munge the local plt offsets into
- local_got_refcounts. Set h->plabel for all global PLABELs. Use
- size_t len vars. Add assert for plabel addend.
- (elf32_hppa_gc_sweep_hook): Sweep local plt entries too.
- (elf32_hppa_hide_symbol): New function.
- (elf_backend_hide_symbol): Define.
- (elf32_hppa_adjust_dynamic_symbol): Don't throw away plt entries
- with h->plabel set. Don't make plt entries to have dynamic syms
- when they have been forced local. If plt entry is used by a
- plabel, make it PLABEL_PLT_ENTRY_SIZE.
- (elf32_hppa_size_dynamic_sections): Set plt_abs for init fns.
- Set up .plt offsets for local syms.
- (elf32_hppa_relocate_section): Initialise plt entries for local
- syms. Leave weak undefined plabels zero. Make global plabel
- relocs against function symbol, and leave the addend zero.
- Use *ABS* DIR32 relocs instead of SEGREL32 for dynamic got relocs.
- (elf32_hppa_finish_dynamic_symbol): Set up IPLT relocs for
- non-dynamic syms. Init extra plt for plabels. Use *ABS* DIR32
- relocs instead of SEGREL32 for dynamic got relocs.
- (elf32_hppa_finish_dynamic_sections): Reserve one more .got entry.
- (elf_backend_got_header_size): Adjust.
- (elf32_hppa_set_gp): Calculate an "ideal" LTP.
-
- * elf32-hppa.c (LONG_BRANCH_VIA_PLT): Define.
- (hppa_type_of_stub): Use it instead of #if 0
- (hppa_discard_copies): Use it here too.
- (elf32_hppa_size_dynamic_sections): And here.
-
- * elf32-hppa.c (elf32_hppa_link_hash_table): Remove `offset' field.
- (elf32_hppa_link_hash_table_create): And here.
- (hppa_build_one_stub): And here. Instead keep track of stub
- offset using _raw_size.
- (elf32_hppa_size_stubs): Likewise.
- (elf32_hppa_build_stubs): Likewise.
- (hppa_size_one_stub): Likewise. Resize reloc section too.
-
- * elf32-hppa.c (hppa_add_stub): Correct first_init_sec and
- first_fini_sec handling. Don't search for reloc section or set
- hplink->reloc_section_created here.
- (elf32_hppa_size_stubs): Instead search for reloc sections, and
- set reloc_section_created here.
- (hppa_handle_PIC_calls): Set ELF_LINK_HASH_NEEDS_PLT.
- (elf32_hppa_size_dynamic_sections): Make a .plt entry for DT_INIT
- and DT_FINI.
- (elf32_hppa_finish_dynamic_sections): Set DT_INIT and DT_FINI.
-
- * elf32-hppa.c (hppa_build_one_stub): Replace `elf_hash_table (info)'
- with `hplink->root.'.
- (elf32_hppa_check_relocs): Likewise.
- (elf32_hppa_gc_sweep_hook): Likewise.
- (elf32_hppa_adjust_dynamic_symbol): Likewise.
- (hppa_handle_PIC_calls): Likewise.
- (elf32_hppa_size_dynamic_sections): Likewise.
- (elf32_hppa_set_gp): Likewise.
- (elf32_hppa_relocate_section): Likewise.
- (elf32_hppa_finish_dynamic_symbol): Likewise.
- (elf32_hppa_finish_dynamic_sections): Likewise.
-
- From David Huggins-Daines <dhd@linuxcare.com>
- * elf32-hppa.c (hppa_type_of_stub): Generate import stubs for
- defined weak symbols in shared links.
- (final_link_relocate): Calls to defined weak symbols in shared
- objects must go via import stubs, as the target might not be known
- at link time.
-
-2000-09-14 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-sh.c (sh_elf_howto_table): Moved R_SH_GOT32, R_SH_PLT32,
- R_SH_COPY, R_SH_GLOB_DAT, R_SH_JMP_SLOT, R_SH_RELATIVE,
- R_SH_GOTOFF, R_SH_GOTPC) to the range from 160 to 167. Replaced
- the original entries with EMPTY_HOWTOs, and added new ones to fill
- in the gap.
- (sh_elf_info_to_howto): Make sure the new gap isn't used.
- (sh_elf_relocate_section): Likewise.
-
-2000-09-13 Anders Norlander <anorland@acc.umu.se>
-
- * cpu-mips.c (arch_info_struct): Add mips:4K
- * bfd-in2.h (bfd_mach_mips4K): New define.
- * archures.c: Add bfd_mach_mips4K to comment.
- * elf32-mips.c (_bfd_mips_elf_final_write_processing): Return
- E_MIPS_ARCH_2 for bfd_mach_mips4K.
-
-2000-09-13 Marco Franzen <marcof@thyron.com>
-
- * som.c (som_write_symbol_strings): Do not used fixed buffers,
- use size_t as a counter.
- (som_write_space_strings): Similarly.
-
-2000-09-12 Jason Eckhardt <jle@cygnus.com>
-
- * elf32-i860.c (elf32_i860_relocate_pc26): New function
- and prototype.
- (elf32_i860_relocate_section): Invoke new function from here.
-
-2000-09-11 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- * elf.c (_bfd_elf_make_section_from_shdr): Make debug_sec_names
- static.
-
-2000-09-10 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): Emit 8 NULs for
- target section name instead of dumping core when the target symbol is
- undefined.
-
-2000-09-09 Kazu Hirata <kazu@hxi.com>
-
- * riscix.c: Remove DEFUN.
-
-2000-09-08 Nick Clifton <nickc@redhat.com>
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Do not
- initialise flags in output bfd if the input bfd is the default
- architecture with the default flags.
-
-2000-09-08 Kazu Hirata <kazu@hxi.com>
-
- * archive.c: Fix formatting.
- * coff-arm.c: Likewise.
- * doc/chew.c: Likewise.
-
-2000-09-08 Alan Modra <alan@linuxcare.com.au>
-
- * section.c (bfd_get_unique_section_name): Put a dot before the
- numeric suffix.
-
-2000-09-07 Kazu Hirata <kazu@hxi.com>
-
- * doc/chew.c: Remove all uses of DEFUN and DEFUN_VOID.
- * elf.c: Fix formatting.
-
-2000-09-07 Alexandre Oliva <aoliva@redhat.com>
-
- * config.bfd (sh-*-linux*): Added.
- * configure.in (bfd_elf32_shlin_vec, bfd_elf32_shblin_vec): New.
- * targets.c: Declare them.
- * elf32-sh-lin.c: New file.
- * Makefile.am: Compile it.
- * elf32-sh.c: Don't override defines from elf32-sh-lin.c.
- * configure, Makefile.in: Rebuilt.
-
-2000-09-06 Geoffrey Keating <geoffk@cygnus.com>
-
- * xcofflink.c (xcoff_link_input_bfd): Include the .tocbss
- pseduo-section when determining where the TOC ends.
-
- * coff-rs6000.c (_bfd_xcoff_swap_aux_out): Use bfd_h_put_16 to
- output x_tvndx as it is only two bytes wide.
-
- * coff-rs6000.c (xcoff_howto_table): A modifiable branch-absolute
- reloc is 26 or 32 bits wide.
-
- * coff-rs6000.c (_bfd_xcoff_rtype2howto): The bitsize is irrelevant
- for relocs that don't change anything. Also look at the full
- 6 bits of bitsize.
-
-2000-09-06 Philip Blundell <philb@gnu.org>
-
- * config.bfd (arm*-*-uclinux*): New target.
-
-2000-09-06 Alexandre Oliva <aoliva@redhat.com>
-
- * configure: Rebuilt with new libtool.m4.
-
-2000-09-06 Alan Modra <alan@linuxcare.com.au>
-
- * section.c (bfd_get_unique_section_name): Avoid c++ reserved
- word for variable name.
- * bfd-in2.h: Regenerate.
-
-2000-09-05 Nick Clifton <nickc@redhat.com>
-
- * config.in: Regenerate.
- * libbfd.h: Regenerate.
- * po/bfd.pot: Regenerate.
- * doc/bfdint.texi: Remove CVS date string - it foils compares with
- local versions.
-
-2000-09-05 Steven Johnson <sbjohnson@ozemail.com.au>
-
- * cpu-powerpc.c (arch_info_struct): Added MPC860 Family entry.
-
-2000-09-05 Alan Modra <alan@linuxcare.com.au>
-
- Shared library and PIC support.
- * elf32-hppa.c (PLT_ENTRY_SIZE): New.
- (GOT_ENTRY_SIZE): New.
- (ELF_DYNAMIC_INTERPRETER): New.
- (STUB_SUFFIX): Define.
- (LONG_BRANCH_PIC_IN_SHLIB): Define.
- (RELATIVE_DYNAMIC_RELOCS): Define.
- (enum elf32_hppa_stub_type): New.
- (struct elf32_hppa_stub_hash_entry): Rename offset to
- stub_offset. Add a number of new fields.
- (struct elf32_hppa_link_hash_entry): New.
- (struct elf32_hppa_link_hash_table): Add numerous fields. Remove
- global_value.
- (elf32_hppa_hash_table): Rename to hppa_link_hash_table.
- (elf32_hppa_stub_hash_lookup): Rename to hppa_stub_hash_lookup.
- (elf32_hppa_stub_hash_newfunc): Rename to stub_hash_newfunc. Init
- new fields.
- (hppa_link_hash_newfunc): New function.
- (elf32_hppa_link_hash_table_create): Use above function. Init new
- fields.
- (elf32_hppa_stub_name): Rename to hppa_stub_name. Pass in reloc
- instead of addend, and remove sym_name from args. Don't use
- symbol name for local syms, instead use sym index.
- (elf32_hppa_size_of_stub): Rename to hppa_type_of_stub, and return
- stub type rather than size. Pass in hash and handle import stub
- case. Also pass in reloc instead of offset so we can calculate
- PCREL22F and PCREL12F branches properly.
- (elf32_hppa_build_one_stub): Rename to hppa_build_one_stub. Build
- import and export stubs too.
- (elf32_hppa_size_one_stub): Rename to hppa_size_one_stub. Handle
- import and export stub sizing.
- (elf32_hppa_check_relocs): New function.
- (elf32_hppa_adjust_dynamic_symbol): New function.
- (hppa_discard_copies): New function.
- (elf32_hppa_size_dynamic_sections): New function.
- (elf_backend_size_dynamic_sections): Define.
- (elf32_hppa_finish_dynamic_symbol): New function.
- (elf_backend_finish_dynamic_symbol): Define.
- (elf32_hppa_size_stubs): Stash params in link hash table, and move
- some local vars into the link hash table too. For shared links,
- trundle over function syms, generating export stubs. Handle
- PCREL22F branches. Break out stub creation code from here..
- (hppa_add_stub): .. to here. New function.
- (elf32_hppa_final_link): Rename to elf32_hppa_set_gp, and don't
- call the bfd linker. Use elf_gp to record global pointer.
- Calculate a value from sections if $global$ is missing.
- (bfd_elf32_bfd_final_link): Define as _bfd_elf32_gc_common_final_link.
- (elf32_hppa_gc_mark_hook): New function.
- (elf_backend_gc_mark_hook): Define.
- (elf32_hppa_gc_sweep_hook): New function.
- (elf_backend_gc_sweep_hook): Define.
- (elf32_hppa_bfd_final_link_relocate): Rename to final_link_relocate.
- Add rel to args, and remove howto, input_bfd, offset, addend,
- sym_name as we can recalculate these locally. Handle calls to
- dynamic objects, extra PIC relocs, PCREL22F branches. Change
- handling of undefined weak syms. Check that stubs are in range.
- Only look for import stubs on PCREL17F and PCREL22F relocs. Add
- message on hitting a DPREL21L reloc that needs fixing. Subtract
- off PC for PCREL14F. Break out code that does a stub lookup from
- here..
- (hppa_get_stub_entry): ..to here. New function.
- (elf32_hppa_relocate_insn): Merge into final_link_relocate.
- (elf32_hppa_relocate_section): Handle got and plt relocs, dynamic
- relocs, etc. etc.
- (elf32_hppa_finish_dynamic_sections): New function.
- (elf_backend_finish_dynamic_sections): Define.
- (elf_backend_final_write_processing) Define.
- (hppa_handle_PIC_calls): New function.
- (elf32_hppa_build_stubs): Call it. Pass link_info to
- hppa_build_one_stub.
- (elf32_hppa_create_dynamic_sections): New function
- to create .plt and .got then set .plt flags correctly.
- (elf_backend_create_dynamic_sections): Define.
- (elf32_hppa_object_p): New function.
- (elf_backend_object_p): Define.
- (elf32_hppa_elf_get_symbol_type): New function.
- (elf_backend_get_symbol_type): Define.
- (elf_backend_can_gc_sections): Define.
- (elf_backend_want_got_plt): Define.
- (elf_backend_plt_alignment): Set to 2.
- (elf_backend_plt_readonly): Define.
- (elf_backend_want_plt_sym): Define.
- (elf_backend_got_header_size): Reserve one entry.
-
- * elf32-hppa.h (elf32_hppa_build_stubs): Don't pass stub bfd.
- (elf32_hppa_size_stubs): Pass in multi_subspace.
- (elf32_hppa_set_gp): Declare.
-
- * section.c (SEC_HAS_GOT_REF): Define new flag for asection.
- (bfd_get_unique_section_name): New function.
- * bfd_in2.h: Regenerate.
-
- * elf64-hppa.c (elf64_hppa_check_relocs): Handle R_PARISC_PCREL12F.
- (elf64_hppa_size_dynamic_sections): Remove the FIXME at bfd_zalloc
- comment.
+2002-01-18 Alan Modra <amodra@bigpond.net.au>
- From David Huggins-Daines <dhd@linuxcare.com>
- * elf64-hppa.c (elf64_hppa_check_relocs): Fix a warning.
- (elf64_hppa_mark_exported_functions): Set dyn_h->st_shndx.
- (elf64_hppa_link_output_symbol_hook): Test dyn_h->st_shndx has
- been updated in finish_dynamic_symbol before modifying function
+ * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Test for a
+ dynamic function descriptor symbol, not the associated function
symbol.
- * elf-hppa.h (elf_hppa_howto_table): Restructure into groups of
- eight entries. Replace NULL with bfd_elf_generic_reloc. Add
- R_PARISC_GNU_VTENTRY, R_PARISC_GNU_VTINHERIT and R_PARISC_PCREL12F.
- (_bfd_elf_hppa_gen_reloc_type): Handle R_PARISC_GNU_VT*. Add some
- comments. Handle format == 12 for R_HPPA_PCREL_CALL.
- (elf_hppa_final_link_relocate): Handle R_PARISC_PCREL12F.
- (elf_hppa_relocate_insn): Likewise. Reformat some comments.
- (elf_hppa_final_write_processing): Expose it for ARCH_SIZE == 32.
-
- From David Huggins-Daines <dhd@linuxcare.com>
- * elf-hppa.h (elf_hppa_is_local_label_name): Accept the SysV/ELF
- style of local labels as well.
-
-2000-09-03 Philip Blundell <philb@gnu.org>
-
- * elf32-arm.h (elf32_arm_relocate_section): Don't try to relocate
- references to undefined symbols in debugging sections.
+2002-01-17 Eric Christopher <echristo@redhat.com>
-2000-09-02 H.J. Lu <hjl@gnu.org>
+ * elf32-mips.c (mips_elf_calculate_relocation): Fix typo.
- * reloc.c (BFD_RELOC_SH_COPY, BFD_RELOC_SH_GLOB_DAT,
- BFD_RELOC_SH_JMP_SLOT, BFD_RELOC_SH_RELATIVE,
- BFD_RELOC_SH_GOTPC): Move them from the MIPS section to the SH
- section.
+2002-01-17 Nick Clifton <nickc@cambridge.redhat.com>
-2000-09-02 Jason Eckhardt <jle@cygnus.com>
-
- * elf32-i860.c (bfd_elf32_bfd_is_local_label_name): Define macro.
- (elf32_i860_is_local_label_name): New function and prototype.
-
-2000-09-02 Nick Clifton <nickc@redhat.com>
-
- * configure.in: Increase version number to 2.10.91.
- * configure: Regenerate.
- * aclocal.m4: Regenerate.
- * config.in: Regenerate.
* po/bfd.pot: Regenerate.
-
-2000-09-02 Daniel Berlin <dberlin@redhat.com>
-
- * elf.c (_bfd_elf_make_section_from_shdr): Add
- .gnu.linkobce.wi. to the list of debug section names.
-
-2000-09-02 Nick Clifton <nickc@redhat.com>
-
- * dwarf2.c (find_debug_info): New function: Locate a section
- containing dwarf2 debug information.
- (bfd_dwarf2_find_nearest_line): Find all sections containing
- debug information and include them in the stash.
-
-2000-09-01 Niibe Yutaka <gniibe@m17n.org>, Kaz Kojima <kkojima@rr.iij4u.or.jp>, Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-sh.c (R_SH_GOT32, R_SH_PLT32, R_SH_COPY, R_SH_GLOB_DAT,
- R_SH_JMP_SLOT, R_SH_RELATIVE, R_SH_GOTOFF, R_SH_GOTPC): New.
- (sh_reloc_map): Add new relocs.
- (sh_elf_check_relocs, sh_elf_link_hash_newfunc,
- sh_elf_link_hash_table_create, sh_elf_adjust_dynamic_symbol,
- sh_elf_size_dynamic_sections, sh_elf_finish_dynamic_symbol,
- sh_elf_finishe_dynamic_sections, sh_elf_discard_copies): New
- functions.
- (ELF_DYNAMIC_INTERPRETER, PLT_ENTRY_SIZE): Define.
- (elf_sh_plt0_entry_be, elf_sh_plt0_entry_le,
- elf_sh_plt_entry_be, elf_sh_plt_entry_le,
- elf_sh_pic_plt_entry_be, elf_sh_pic_plt_entry_le):
- New array constants.
- (elf_sh_plt0_entry, elf_sh_plt_entry, elf_sh_pic_plt_entry):
- New variables.
- (elf_sh_sizeof_plt, elf_sh_plt_plt0_offset,
- elf_sh_plt0_linker_offset, elf_sh_plt0_gotid_offset,
- elf_sh_plt_temp_offset, elf_sh_plt_symbol_offset,
- elf_sh_plt_reloc_offset): Define.
- (elf_sh_pcrel_relocs_copied, elf_sh_link_hash_entry,
- elf_sh_link_hash_table): New structs.
- (sh_elf_link_hash_traverse, sh_elf_hash_table): New macros.
- (sh_elf_relocate_section, sh_elf_check_relocs): Handle new
- relocation types.
- (elf_backend_create_dynamic_sections,
- bfd_elf32_bfd_link_hash_table_create,
- elf_backend_adjust_dynamic_symbol,
- elf_backend_size_dynamic_sections,
- elf_backend_finish_dynamic_symbol,
- elf_backend_finish_dynamic_sections, elf_backend_want_got_plt,
- elf_backend_plt_readonly, elf_backend_want_plt_sym,
- elf_backend_got_header_size, elf_backend_plt_header_size):
- Define.
- * reloc.c (BFD_RELOC_SH_COPY, BFD_RELOC_SH_GLOB_DAT,
- BFD_RELOC_SH_JMP_SLOT, BFD_RELOC_SH_RELATIVE, BFD_RELOC_SH_GOTPC):
- New relocs.
- * bfd-in2.h, libbfd.h: Rebuilt.
-
-2000-09-01 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-i386.c (elf_i386_finish_dynamic_symbol): Revert 2000-08-27
- change.
-
-2000-08-31 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * elf32-sh.c (sh_elf_merge_private_data): If ibfd's elf header flags
- not initialized, set them to indicate the SH1 instruction set.
-
-2000-08-31 Alexandre Oliva <aoliva@redhat.com>
-
- * acinclude.m4: Include libtool and gettext macros from the
- top level.
- * aclocal.m4, configure: Rebuilt.
-
-2000-08-29 Michael Snyder <msnyder@seadog.cygnus.com>
-
- * elf.c: Eliminate references to __sparcv9 macro; replace with
- autoconf variables HAVE_PSINFO32_T etc.
- * configure.in: Auto-configure HAVE_PSINFO_32_T, HAVE_PRPSINFO32_T,
- HAVE_PSTATUS32_T, HAVE_PRSTATUS32_T, HAVE_PRSTATUS32_T_PR_WHO.
- * config.in: Ditto.
- * acinclude.m4 (BFD_HAVE_SYS_PROCFS_TYPE) define _SYSCALL32 so it can
- detect the above typedefs. (BFD_HAVE_SYS_PROCFS_TYPE_MEMBER): Ditto.
- * aclocal.m4: Ditto.
- * configure: Regenerate.
-
-2000-08-27 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-i386.c (elf_i386_check_relocs): Keep info on relocs copied
- for any shared link, not just shared -Bsymbolic.
- (elf_i386_size_dynamic_sections): Call elf_i386_discard_copies on
- any shared link, and pass link info to it.
- (elf_i386_size_dynamic_sections): Update comment.
- (elf_i386_discard_copies): Modify to discard relocs for symbols
- that have been forced local.
- (elf_i386_finish_dynamic_symbol): Don't copy relocs for symbols
- that have been forced local.
-
-2000-08-24 Denis Chertykov <denisc@overta.ru> & Nick Clifton <nickc@redhat.com>
-
- * elflink.h (elf_link_add_object_symbols): Allow common
- symbols to have an alignment of 1 if explicitly requested, and
- not overridden by other definitions.
-
-2000-08-22 Doug Kwan <dkwan@transmeta.com>
-
- * coff-w65.c (CREATE_LITTLE_COFF_TARGET): Fix typo.
- * coffcode.h (coff_set_flags): Add detection of w65 architecture.
-
-2000-08-22 H.J. Lu <hjl@gnu.org>
-
- * elf-bfd.h (elf_link_hash_table): Add runpath.
-
- * bfd-in.h (bfd_elf_get_runpath_list): New prototype.
- * bfd-in2.h: Rebuilt.
-
- * elf.c (_bfd_elf_link_hash_table_init): Initialize the
- "runpath" field to NULL.
- (bfd_elf_get_runpath_list): New function.
-
- * elflink.h (elf_link_add_object_symbols): Record DT_RPATH and
- DT_RUNPATH entries.
-
-2000-08-22 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-sh.c (sh_elf_relocate_section) [R_SH_IND12W,
- R_SH_DIR8WPN, R_SH_DIR8WPZ, R_SH_DIR8WPL]: Handle them
- explicitly. Improve validation of r_type.
-
-2000-08-21 H.J. Lu <hjl@gnu.org>
-
- * elf32-i386.c (elf_i386_size_dynamic_sections): Zero out the
- dynamic allocated content space. Add a comment to remind us that
- one day this ought to be fixed.
- * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
- * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise.
- * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
-
-2000-08-21 Jason Eckhardt <jle@cygnus.com>
-
- * elf32-i860.c (elf32_i860_relocate_pc16): Just write the immediate
- field with the newly relocated value instead of adding it to the
- existing immediate field.
- (elf32_i860_relocate_splitn): Likewise.
- (elf32_i860_relocate_highadj): Likewise.
-
-2000-08-16 Jason Eckhardt <jle@cygnus.com>
-
- * elf32-i860.c (elf32_i860_relocate_pc16): Implemented function (it
- was previously just a stub).
-
-2000-08-16 Alexandre Oliva <aoliva@redhat.com>
-
- * elflink.c (_bfd_elf_create_got_section): Don't abort().
- Formatting fixes.
- (_bfd_elf_create_dynamic_sections): Likewise.
-
-2000-08-16 Andrew Macleod <amacleod@cygnus.com>
-
- * elf64-sparc.c (sparc64_elf_relocate_section): Set relocation address
- for undefined symbols to be the beginning of the section.
-
- * elf64-sparc.c (sparc64_elf_adjust_dynamic_symbol): Don't allocate
- four extra entries at the beginning of the .rela.plt section.
- (sparc64_elf_finish_dynamic_symbol): Adjust the offset in the .rela.plt
- section to account for the four reserved entries in the .plt section.
-
-2000-08-15 Geoffrey Keating <geoffk@cygnus.com>
-
- * xcofflink.c (_bfd_ppc_xcoff_relocate_section): Add ori r0,r0,0
- to the list of NOPs we recognize after a branch-and-link.
- Use the ori NOP when one is needed.
-
- * coff-rs6000.c (_bfd_xcoff_slurp_armap): Finish implementation
- for large archives.
-
-2000-08-14 Jim Wilson <wilson@cygnus.com>
-
- * elf64-ia64.c (elf64_ia64_merge_private_bfd_data): Handle
- EF_IA_64_REDUCEDFP, EF_IA_64_CONS_GP, and EF_IA_64_NOFUNCDESC_CONS_GP.
- (elf64_ia64_print_private_bfd_data): Likewise. Also handle
- EF_IA_64_ABSOLUTE.
-
-2000-08-11 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-sh.c (sh_elf_set_mach_from_flags): Make it static.
-
-2000-08-10 Jason Eckhardt <jle@cygnus.com>
-
- * elf32-i860.c (elf32_i860_relocate_section): New function.
- (i860_final_link_relocate): New function.
- (elf32_i860_relocate_splitn): New function.
- (elf32_i860_relocate_pc16): New function.
- (elf32_i860_relocate_highadj): New function.
- (elf32_i860_howto): Minor adjustments to some relocations.
- (elf_info_to_howto_rel): Define.
- (elf_backend_relocate_section): Define.
-
-2000-08-10 Nick Clifton <nickc@cygnus.com>
-
- * elf32-arm.h: Fix formatting.
-
-2000-08-10 Bernd Schmidt <bernds@cygnus.co.uk>
-
- * elf32-sh.c (sh_elf_reloc_loop): Make LAST_SYMBOL_SECTION static.
-
-2000-08-08 Jason Eckhardt <jle@cygnus.com>
-
- * elf32-i860.c (elf32_i860_howto_table): Updated some fields.
-
-2000-08-07 Kazu Hirata <kazu@hxi.com>
-
- * ieee.c (ieee_write_debug_part): Rewrite a comment.
- * elf64-ia64.c: Fix a typo.
-
-2000-08-05 Jason Eckhardt <jle@cygnus.com>
-
- * elf32-i860 (elf32_i860_howto_table): New structure.
- (lookup_howto): New function.
- (elf32_i860_reloc_type_lookup): New function.
- (elf32_i860_info_to_howto_rela): New function.
- (elf_code_to_howto_index): New structure.
- (elf_info_to_howto): Re-define as elf32_i860_info_to_howto_rela.
- (bfd_elf32_bfd_reloc_type_lookup): Re-define as
- elf32_i860_reloc_type_lookup.
-
-2000-08-04 Rodney Brown <RodneyBrown@pmsc.com>
-
- * som.c (struct fixup_format): Constify `format'.
- (som_hppa_howto_table): Use SOM_HOWTO macro.
- (try_prev_fixup, hppa_som_reloc): Decorate unused parameter.
- (som_bfd_reloc_type_lookup): Likewise.
- (compare_subspaces): Remove unused `count1', `count2'.
- (som_begin_writing): Remove unused `total_reloc_size'.
- (som_bfd_derive_misc_symbol_info): Decorate unused parameter.
- (som_print_symbol, som_bfd_is_local_label_name): Likewise.
- (som_set_reloc_info): Constify `cp'. Remove unused `addend'.
- (som_find_nearest_line): Decorate unused parameter(s).
- (som_sizeof_headers, som_get_symbol_info, som_write_armap): Likewise.
- (som_bfd_link_split_section): Likewise.
-
-2000-08-03 Nick Clifton <nickc@cygnus.com>
-
- * section.c: Restore backed out code.
- * elf.c: Restore backed out code.
- (copy_private_bfd_data): Fix bug preventing stipped dynamic
- binaries from working.
- * bfd-in2.h: Regenerate.
-
-2000-08-03 H.J. Lu <hjl@gnu.org>
-
- * section.c: Back out the change made by Nick Clifton
- <nickc@cygnus.com> on 2000-07-31. It breaks stripping dynamic
- binaries.
- * bfd-in2.h: Likewise.
- * elf.c: Likewise.
-
-2000-08-03 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-sh.c (sh_elf_reloc_loop): Warning removal.
-
-2000-07-31 Jason Eckhardt <jle@cygnus.com>
-
- * reloc.c (BFD_RELOC_860_*): New bfd relocs for i860.
- * bfd-in2.h, libbfd.h: Regenerate.
-
-2000-07-31 Nick Clifton <nickc@cygnus.com>
-
- * section.c (struct sec): Add new boolean field 'segment_mark'.
- (STD_SECTION): Initialise new field to zero.
-
- * bfd-in2.h: Regenerate.
-
- * elf.c (copy_private_bfd_data): Reorganise section to segment
- mapping to cope with moved sections requiring new segments,
- and overlapping segments.
- (SEGMENT_END): New macro: Return the end address of a segment.
- (IS_CONTAINED_BY_VMA): New macro: Determine if a segment
- contains a section by comparing their VMA addresses.
- (IS_CONTAINED_BY_LMA): New macro: Determine if a segment
- contains a section by comparing their LMA addresses.
- (INCLUDE_SECTION_IN_SEGMENT): New macro: Determine if a
- section should be included in a segment.
- (SEGMENT_AFTER_SEGMENT): New macro: Determine if one segment
- follows another in memory.
- (SEGMENT_OVERLAPS_SEGMENT): New macro: Determine if two
- segments overlap.
-
-2000-07-22 Jason Eckhardt <jle@cygnus.com>
-
- * cpu-i860.c: Added comments.
-
- * elf32-i860.c (TARGET_LITTLE_SYM): Defined to
- bfd_elf32_i860_little_vec.
- (TARGET_LITTLE_NAME): Defined to "elf32-i860-little".
- (ELF_MAXPAGESIZE): Changed to 4096.
-
- * targets.c (bfd_elf32_i860_little_vec): Declaration of
- new target.
- (bfd_target_vector): Added bfd_elf32_i860_little_vec.
-
- * config.bfd (i860-stardent-sysv4*, i860-stardent-elf*): Added
- config for little endian elf32 i860.
- (targ_defvec): Define for the new config above
- as "bfd_elf32_i860_little_vec".
- (targ_selvecs): Define for the new config above
- as "bfd_elf32_i860_vec bfd_elf32_i860_little_vec"
-
- * configure.in (bfd_elf32_i860_little_vec): Added recognition
- of new target vec.
-
- * configure: Regenerated.
-
-2000-07-27 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_merge_symbol): Take one more argument,
- dt_needed, to indicate if the symbol comes from a DT_NEEDED
- entry. Don't overide the existing weak definition if dt_needed
- is true.
- (elf_link_add_object_symbols): Pass dt_needed to
- elf_merge_symbol ().
-
-2000-07-27 Nick Clifton <nickc@cygnus.com>
-
- * elflink.h (elf_link_size_reloc_section): Zeroes the section's
- allocated contents.
-
-2000-07-25 Geoffrey Keating <geoffk@cygnus.com>
-
- * configure.host (*-*-aix*): AIX has 'long long' always.
-
- * coff-rs6000.c (xcoff_write_one_armap_big): New procedure.
- (xcoff_write_armap_big): Write both 32-bit and 64-bit armaps.
- (xcoff_write_archive_contents_big): Don't update the offset
- of the symbol table, xcoff_write_armap will do it.
-
-2000-07-23 Ulf Carlsson <ulfc@engr.sgi.com>
-
- * elf32-mips.c (_bfd_mips_elf_check_relocs): Use abfd instead
- of dynobj for SGI_COMPAT checks.
-
-2000-07-21 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): New function.
- * bfd-in.h (bfd_m68k_coff_create_embedded_relocs): Add declaration.
- * bfd-in2.h: Regenerate.
-
-2000-07-21 Nick Clifton <nickc@cygnus.com>
-
- * elf32-mips.c (_bfd_mips_elf_check_relocs): Detect out of
- range symbol indices in relocs and issue an error message.
-
-2000-07-20 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Don't check
- info->new_dtags when setting DT_FLAGS_1. It will only be set
- by the new linker options. It shouldn't break anything.
-
-2000-07-20 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set DT_FLAGS_1
- only if info->new_dtags is true.
-
-2000-07-20 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set
- DT_RUNPATH and DT_FLAGS only if info->new_dtags is true.
-
-2000-07-20 Hans-Peter Nilsson <hp@axis.com>
-
- * Makefile.am (ALL_MACHINES): Add cpu-cris.lo.
- (ALL_MACHINES_CFILES): Add cpu-cris.c.
- (BFD32_BACKENDS): Add aout-cris.lo and elf32-cris.lo.
- (BFD32_BACKENDS_CFILES): Add aout-cris.c and elf32-cris.c.
- (cpu-cris.lo, aout-cris.lo, elf32-cris.lo): New rules.
- * Makefile.in: Rebuild.
- * aclocal.m4: Rebuild.
- * aoutx.h (NAME(aout,machine_type)): Add case for bfd_arch_cris.
- * archures.c (enum bfd_architecture): Add bfd_arch_cris.
- (bfd_cris_arch): Declare.
- (bfd_archures_list): Add bfd_cris_arch.
- * bfd-in2.h: Rebuild.
- * config.bfd: (cris-*-*): New target.
- * configure.in (bfd_elf32_cris_vec, cris_aout_vec): New vectors.
- * configure: Rebuild.
- * elf.c (prep_headers): Add bfd_arch_cris.
- * libbfd.h: Rebuild.
- * libaout.h (enum machine_type): Add M_CRIS.
- * reloc.c: Add CRIS relocations.
- * targets.c (bfd_elf32_cris_vec, cris_aout_vec): Declare.
- (bfd_target_vect): Add bfd_elf32_cris_vec and cris_aout_vec.
- * cpu-cris.c, aout-cris.c, elf32-cris.c: New files.
- * po/POTFILES.in, po/bfd.pot: Regenerate.
-
-2000-07-19 H.J. Lu <hjl@gnu.org>
-
- * elf32-arm.h (elf32_arm_size_dynamic_sections): Also set
- DF_TEXTREL if DT_TEXTREL is set.
+ * po/fr.po: Regenerate.
+
+2002-01-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (elf_backend_data <elf_backend_section_from_bfd_section>):
+ Remove "Elf_Internal_Shdr *" param.
+ (_bfd_mips_elf_section_from_bfd_section): Ditto.
+ * elf32-mips.c (_bfd_mips_elf_section_from_bfd_section): Ditto.
+ * elf32-m32r.c (_bfd_m32r_elf_section_from_bfd_section): Ditto.
+ * elf32-v850.c (v850_elf_section_from_bfd_section): Ditto.
+ * elf64-mmix.c (mmix_elf_section_from_bfd_section): Ditto.
+ * elfxx-ia64.c (elfNN_hpux_backend_section_from_bfd_section): Ditto.
+ * elf.c (_bfd_elf_section_from_bfd_section): Allow backend
+ function to override special sections. Remove hdr arg from
+ backend call, and don't loop.
+
+2002-01-16 Eric Christopher <echristo@redhat.com>
+
+ * elf32-mips.c (mips_elf_calculate_relocation): Set require_jalxp
+ on R_MIPS_26 and target is 16bit. Add R_MIPS16_GPREL to list of
+ relocations requiring gp0 and gp.
+
+2002-01-16 Richard Earnshaw <rearnsha@arm.com>
+
+ * elf32-arm.h (elf32_arm_merge_private_bfd_data): Handle
+ EF_ARM_VFP_FLOAT.
+ (elf32_arm_print_private_bfd_data): Likewise.
+
+2002-01-16 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * po/tr.po: Import new version.
+
+2002-01-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_howto_raw): Remove stale FIXMEs.
+ (ppc64_elf_reloc_type_lookup): Use proper CTOR reloc.
+ (ORI_R0_R0_0): Correct.
+
+2002-01-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.c (_bfd_elf_create_dynamic_sections): Don't set SEC_CODE
+ when plt_not_loaded.
+ * elf64-ppc.c (ppc64_elf_create_dynamic_sections): No need to
+ clear .plt SEC_CODE here. Create .stub and correct .glink flags.
+ (PLT_INITIAL_ENTRY_SIZE): Set to 24.
+ (ppc64_elf_glink_code): Delete.
+ (PPC64_ELF_GLINK_SIZE): Delete.
+ (ADDIS_R12_R2, STD_R2_40R1, LD_R11_0R12, LD_R2_0R12, MTCTR_R11,
+ BCTR, ADDIS_R12_R12_1, LD_R2_40R1, NOP, LI_R0_0, B_DOT, LIS_R0_0,
+ ORI_R0_R0_0): Define.
+ (PLT_CALL_STUB_SIZE, GLINK_CALL_STUB_SIZE): Define.
+ (struct ppc_link_hash_table): Add sstub and plt_overflow.
+ (ppc64_elf_link_hash_table_create): Init them.
+ (ppc64_elf_check_relocs <R_PPC64_REL24>): Refcount .plt entry.
+ Don't copy to shared lib.
+ (ppc64_elf_check_relocs): Call bfd_set_error on errors.
+ (ppc64_elf_gc_sweep_hook <R_PPC64_REL24>): Sweep plt refcount.
+ (allocate_dynrelocs <plt>): Don't change function sym here. Make
+ room for .stub and .glink code.
+ (ppc64_elf_size_dynamic_sections): Handle .stub. Make entry for
+ DT_PPC64_GLINK.
+ (ppc64_elf_final_link): Rename to ppc64_elf_set_toc. Don't call
+ bfd_elf64_bfd_final_link.
+ (bfd_elf64_bfd_final_link): Don't define.
+ (ppc64_elf_size_stubs): New.
+ (build_plt_stub): New.
+ (build_one_stub): New.
+ (ppc64_elf_build_stubs): New.
+ (ppc64_elf_relocate_section <toc relocs>): Remove assert.
+ (ppc64_elf_relocate_section): Don't copy R_PPC64_REL24 relocs.
+ (ppc64_elf_finish_dynamic_symbol): Don't build stubs here. Set
+ DT_PPC64_GLINK entry. Tweak DT_PLTGOT, DT_JMPREL, DT_PLTRELSZ in
+ case output sections not separate. Adjust DT_RELASZ to not
+ include plt relocs. Set reserved got entry. Set got and plt
+ entry size.
+ (elf_backend_got_header_size): Set to 8.
+ * elf64-ppc.h: New file.
+
+2002-01-16 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-arm.h (elf32_arm_size_dynamic_sections): When removing
+ sections, use bfd_section_list_remove.
* elf32-i370.c (i370_elf_size_dynamic_sections): Likewise.
- * elf32-i386.c (elf_i386_size_dynamic_sections): Likewise.
- * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
- * elf32-mips.c (_bfd_mips_elf_size_dynamic_sections): Likewise.
- * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
- * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise.
- * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
- * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
- * elf64-ia64.c (elf64_ia64_size_dynamic_sections): Likewise.
- * elf64-sparc.c (sparc64_elf_size_dynamic_sections): Likewise.
-
- * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Also
- set DF_SYMBOLIC for symbolic link. Also set DT_RUNPATH if
- DT_RPATH is set.
- Set the DT_FLAGS and DT_FLAGS_1 entries if necessary.
-
-2000-07-19 H.J. Lu <hjl@gnu.org>
-
- * bfd-in.h (bfd_elf_set_dt_needed_soname): New.
- * bfd-in2.h: Rebuild.
-
- * elf-bfd.h (elf_obj_tdata): Add dt_soname.
- (elf_dt_soname): New.
-
- * elf.c (bfd_elf_set_dt_needed_soname): New.
-
- * elflink.h (elf_link_add_object_symbols): Add the DT_NEEDED
- entry if the shared object loaded by DT_NEEDED is used to
- resolve the reference in a regular object.
-
-2000-07-19 H.J. Lu <hjl@gnu.org>
-
- * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_CONFIG,
- DT_DEPAUDIT and DT_AUDIT as strings.
-
-2000-07-19 Nick Clifton <nickc@cygnus.com>
-
- * format.c: Fix formatting.
-
-2000-07-19 H.J. Lu <hjl@gnu.org>
-
- * elf.c (_bfd_elf_print_private_bfd_data): Fix DT_CHECKSUM.
-
-2000-07-19 H.J. Lu <hjl@gnu.org>
-
- * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_BIND_NOW,
- DT_INIT_ARRAY, DT_FINI_ARRAY, DT_INIT_ARRAYSZ, DT_FINI_ARRAYSZ,
- DT_RUNPATH, DT_FLAGS, DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ,
- DT_PLTPADSZ, DT_MOVEENT, DT_MOVESZ, DT_FEATURE, DT_POSFLAG_1,
- DT_SYMINSZ, DT_SYMINENT, DT_CONFIG, DT_DEPAUDIT, DT_AUDIT,
- DT_PLTPAD, DT_MOVETAB, DT_SYMINFO, DT_RELACOUNT, DT_RELCOUNT,
- DT_FLAGS_1, DT_USED and DT_CHECKSUM.
-
-2000-07-18 Andrew Cagney <cagney@b1.cygnus.com>
-
- * elf.c (bfd_elf_get_sign_extend_vma, bfd_elf_get_arch_size): Move
- renamed functions from here...
- (assign_section_numbers): Use renamed functions.
- (prep_headers): Use renamed functions.
-
- * bfd.c (bfd_get_sign_extend_vma, bfd_get_arch_size): ...To here.
- * bfd-in.h (bfd_get_sign_extend_vma, bfd_get_arch_size): Update.
- * bfd-in2.h: Regenerate.
-
-2000-07-18 Ulf Carlsson <ulfc@engr.sgi.com>
-
- * elf32-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Add
- parenthesis in if statement.
-
-2000-07-17 Koundinya K <kk@ddeorg.soft.net>
-
- Enable the support for Traditional MIPS.
- * elf32-mips.c (IRIX_COMPAT): Recognize bfd_elf32_tradbigmips_vecand
- return ict_none appropriately for traditional mips targets.
- (STUB_LW): Change 0x8f998000 to 0x8f998010 for traditional mips.
- (STUB_MOVE): Conditionalize for traditonal mips.
- (STUB_LI16): Likewise.
- (_bfd_mips_elf_modify_segment_map): Conditionalize to avoid making
- room for RTPROC header.
- (_bfd_mips_elf_modify_segment_map): For a normal mips executable set
- the permission for the PT_DYNAMIC as read, write and execute.
- (mips_elf_calculate_relocation): Check for the symbol _DYNAMIC_LINKING
- for traditonal mips.
- (_bfd_mips_elf_create_dynamic_sections): Add the symbol
- _DYNAMIC_LINKING for traditonal mips.
- (_bfd_mips_elf_create_dynamic_sections): Add the symbol __RLD_MAP
- in case of traditonal mips.
- (_bfd_mips_elf_adjust_dynamic_symbol): Create a stub only if a PLT
- entry is required. For a function if PLT is not required then set the
- corresponding hash table entry to 0.
- (_bfd_mips_elf_size_dynamic_sections): Add DT_DEBUG entry for
- traditonal mips.
- (_bfd_mips_elf_finish_dynamic_symbol): for a undefined symbol in a
- shared object set the value to 0.
- (_bfd_mips_elf_finish_dynamic_symbol): Check for the symbol
- _DYNAMIC_LINKING for traditonal mips.
- (_bfd_mips_elf_finish_dynamic_symbol): Check for the symbol __RLD_MAP
- for traditonal mips.
-
-2000-07-15 H.J. Lu <hjl@gnu.org>
-
- * aoutx.h (translate_to_native_sym_flags): Handle BSF_LOCAL.
-
-2000-07-12 Charles Wilson <cwilson@ece.gatech.edu>
-
- * libbfd.c (bfd_seek): fix 'seek beyond EOF' error when writing
- out a structure that is BFD_IN_MEMORY.
-
-2000-07-11 Alan Modra <alan@linuxcare.com.au>
-
- * elf64-hppa.c (get_dyn_name): Pass in section pointer instead of
- bfd pointer. Print section id instead of bfd pointer for local
- syms. Prefix addend with `+' for global syms as well as local.
- Correct calculation of name component lengths.
- (elf64_hppa_check_relocs): Update call to get_dyn_name.
-
- From David Huggins-Daines <dhd@linuxcare.com>
- * elf-hppa.h (elf_hppa_relocate_section): Update calls here too.
- * elf64-hppa.c (elf64_hppa_check_relocs): Fix some warnings.
- (elf64_hppa_modify_segment_map): Likewise.
-
-2000-07-11 Andrew Cagney <cagney@b1.cygnus.com>
-
- * elf.c (bfd_elf_get_sign_extend_vma): Return tendency of VMA
- addresses to be "naturally" sign extended. Return -1 if unknown.
- * bfd-in.h (bfd_elf_get_sign_extend_vma): Add declaration.
- * bfd-in2.h: Regenerate.
-
-2000-07-11 Andrew Cagney <cagney@b1.cygnus.com>
-
- * ecoffswap.h (ecoff_get_off, ecoff_put_off): Add ECOFF_SIGNED_32
- and ECOF_SIGNED_64 to list ways to extract an offset.
- (ecoff_swap_fdr_in, ecoff_swap_fdr_out, ecoff_swap_pdr_in,
- ecoff_swap_pdr_out, ecoff_swap_ext_in, ecoff_swap_ext_out):
- Update.
- * elf64-mips.c (ECOFF_SIGNED_64): Define instead of ECOFF_64.
- * elf32-mips.c (ECOFF_SIGNED_32): Define instead of ECOFF_32.
-
-2000-07-11 Andrew Cagney <cagney@b1.cygnus.com>
-
- * elfcode.h (elf_object_p): Use bfd_set_start_address and not
- bfd_get_start_address.
- (elf_swap_ehdr_in): Sign extend e_entry when applicable.
- (elf_swap_ehdr_out): Ditto.
-
-2000-07-10 Alexander Aganichev <AAganichev@hypercom.com>
-
- * archures.c (bfd_default_scan): Add set of bfd_mach_ cases for
- compatibility with older binutils.
-
-2000-07-10 Alan Modra <alan@linuxcare.com.au>
-
- * section.c (bfd_make_section_anyway): Start section_id at 0x10.
- (STD_SECTION): Avoid negative ids, instead use 0 to 3.
-
- From Ryan Bradetich <rbradetich@uswest.net>
- * dwarf1.c (parse_die): Cure signed/unsigned char warnings.
- (parse_line_table): Ditto.
- (_bfd_dwarf1_find_nearest_line): Ditto.
- * syms.c (cmpindexentry): Remove extra `*' from params.
-
-2000-07-09 Koundinya K <kk@ddeorg.soft.net>
-
- * elf32-mips.c (sort_dynamic_relocs): New Function.
- (_bfd_mips_elf_finish_dynamic_sections): Call sort_dynamic_relocs
- via qsort to sort the dynamic relocations in increasing r_symndx
- value.
-
-2000-07-09 Alan Modra <alan@linuxcare.com.au>
-
- * elf64-hppa.c (elf64_hppa_dyn_hash_table_init): Add
- ATTRIBUTE_UNUSED to unused args.
- (get_opd): Likewise.
- (get_plt): Likewise.
- (get_dlt): Likewise.
- (get_stub): Likewise.
- (elf64_hppa_adjust_dynamic_symbol): Likewise.
- (elf64_hppa_link_output_symbol_hook): Likewise.
- (elf64_hppa_check_relocs): Delete unused var.
- (elf64_hppa_size_dynamic_sections): Likewise.
- (elf64_hppa_finalize_opd): Likewise.
- (elf64_hppa_finalize_dynreloc): Likewise.
- (elf64_hppa_modify_segment_map): Likewise.
- (elf64_hppa_finish_dynamic_sections): Likewise.
-
- * elf-hppa.h (elf_hppa_final_write_processing): Add
- ATTRIBUTE_UNUSED to unused args.
- (elf_hppa_final_link_relocate): Likewise.
- (elf_hppa_record_segment_addrs): Add paretheses.
- (elf_hppa_relocate_section): Constify dyn_name.
-
- From David Huggins-Daines <dhd@linuxcare.com>
- * config.bfd: Add hppa*64*-*-linux-gnu 64-bit target, and
- rearrange case statement so that it gets preferred to 32-bit ones.
-
- * elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Use
- asection->id instead of address of asection structure.
- (elf32_hppa_size_stubs): Likewise.
-
- * elf32-hppa.c (elf32_hppa_size_stubs): Use just one stub section
- for .init* and .fini*.
-
- * elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Mask pointers
- and addends used in stub names to 32 bits.
- (elf32_hppa_size_stubs): Likewise.
-
- * elf-hppa.h (elf_hppa_final_link_relocate): Don't sum addend
- twice for R_PARISC_GPREL64. Use bfd_put_32 for R_PARISC_PCREL32,
- not bfd_put_64. Fix minor comment typo and formatting.
-
- Changes to create multiple linker stubs, positioned immediately
- before the section where they are required.
- * elf32-hppa.c: Don't include hppa_stubs.h.
- (elf32_hppa_stub_hash_entry): Add a pointer to the stub section.
- (elf32_hppa_stub_hash_table): Delete.
- (elf32_hppa_link_hash_entry): Delete.
- (elf32_hppa_link_hash_table): Use plain bfd_hash_table for
- stub_hash_table, and store the struct here rather than a pointer.
- Delete output_symbol_count. Add offset array. Change
- global_value to a bfd_vma.
- (elf32_hppa_stub_hash_lookup): Use table instead of table->root.
- (elf32_hppa_stub_hash_traverse): Delete.
- (elf32_hppa_name_of_stub): Delete.
- (elf32_hppa_link_hash_lookup): Delete.
- (elf32_hppa_link_hash_traverse): Delete.
- (elf32_hppa_stub_hash_table_init): Delete.
- (elf32_hppa_size_of_stub): Pass input section and offset rather
- than location and calculate location here. Don't pass name as all
- stubs are now the same size.
- (elf32_hppa_stub_hash_newfunc): Init new fields.
- (elf32_hppa_link_hash_table_create): Likewise, and stub_hash_table
- too.
- (elf32_hppa_bfd_final_link_relocate): Cast enums to int before
- comparing against ints. Rewrite stub handling code.
- (elf32_hppa_relocate_section): Make r_type and r_symndx unsigned.
- Case enums to int before comparing against ints. Remove
- bfd_reloc_dangerous case.
- (elf32_hppa_build_one_stub): Rewrite.
- (elf32_hppa_size_one_stub): New function.
- (elf32_hppa_build_stubs): Rewrite.
- (elf32_hppa_size_stubs): Pass in linker call-back functions.
- Rewrite stub-handling specific code.
-
- * elf32-hppa.h (elf32_hppa_size_stubs): Update prototype.
-
- * elf64-hppa.c (elf64_hppa_dyn_hash_entry): Fix a comment typo.
-
- * hppa_stubs.h: Delete.
- * Makefile.am (SOURCE_HFILES): Remove hppa_stubs.h
- (elf32-hppa.lo): Remove hppa_stubs.h from dependencies.
- * Makefile.in: Regenerate.
-
- * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Handle e_nlsel and
- e_nlrsel.
-
- * libhppa.h (hppa_field_adjust): Correct e_nsel case.
-
- * elf32-hppa.c (elf32_hppa_relocate_section): Mention the offset
- and section name for bfd_reloc_notsupported error message.
- (elf32_hppa_bfd_final_link_relocate): Print reasons for returning
- bfd_reloc_notsupported.
- (elf32_hppa_relocate_section): Add ATTRIBUTE_UNUSED to output_bfd.
-
- * elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Handle
- undefined weak symbols for all relocs.
- (elf32_hppa_size_of_stub): Adjust calculation by 8 since branch
- offsets are relative to one past the delay slot.
- (elf32_hppa_size_stubs): Account for reloc addend when calculating
- branch destination. Put addend into stub name too.
- (elf32_hppa_bfd_final_link_relocate): Account for reloc addend and
- adjust by 8 when deciding whether a linker stub is needed. Put
- addend into stub name as for above.
-
- * elf32-hppa.c (hppa_elf_relocate_insn): Change signed/unsigned on
- various args and vars.
- (elf32_hppa_bfd_final_link_relocate): Here too.
- (elf32_hppa_size_stubs): Rename index -> indx. Use e_indx for
- inner block var to avoid shadowing.
-
- * elf32-hppa.h (_bfd_elf32_hppa_gen_reloc_type): Make `field' arg
- unsigned.
- * elf64-hppa.h (_bfd_elf64_hppa_gen_reloc_type): Ditto.
- * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Ditto.
- (elf_hppa_fake_sections): Rename local var to avoid shadowing.
-
- * libhppa.h: Change practically all unsigned ints to plain ints.
- Remove tests on gcc version. Instead use ATTRIBUTE_UNUSED for
- prototypes.
-
- From Ryan Bradetich <rbradetich@uswest.net>
- * libhppa.h (hppa_opcode_type): New enum to replace #define's.
- * elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Modify to
- suit above.
- From David Huggins-Daines <dhd@linuxcare.com>
- * elf-hppa.h (elf_hppa_relocate_insn): Update the opcode constants
- to the new OP_* ones.
-
- * elf32-hppa.c (elf32_hppa_size_stubs): Consolidate freeing on
- error exit. Bail out earlier on plabel relocs that we aren't
- interested in. Don't tell elf32_hppa_stub_hash_lookup to copy
- string, and then don't free our copy.
- (elf32_hppa_build_one_stub): Make insn unsigned int.
-
- * libhppa.h (bfd_hppa_insn2fmt): 22 bit branches are only
- available with BL, not BE and BLE.
-
- * elf32-hppa.c (hppa_elf_relocate_insn): Add some more example
- code for elf arg relocs.
- (elf32_hppa_bfd_final_link_relocate): Replace boolean is_local
- argument with elf_link_hash_entry h. Handle undefined weak
- symbols. Move $global$ lookup from here...
- (elf32_hppa_relocate_section): ...to here. Return correct error
- message for non-handled relocs.
- (elf32_hppa_size_of_stub): Correctly test branch range. Previous
- wrong test was -0x3ffff to +0x40000.
-
- * elf-hppa.h (elf_hppa_final_link_relocate): R_PARISC_DIR17R,
- R_PARISC_DIR17F, and R_PARISC_DIR21L are for absolute branches;
- Handle them as such.
- (elf_hppa_relocate_insn): Fix a typo.
-
- * libhppa.h (GET_FIELD, GET_BIT, MASK, CATENATE, ELEVEN): Delete.
- (assemble_3, assemble_6, assemble_12, assemble_16, assemble_16a,
- assemble_17, assemble_21): Delete.
- Supply defines for all 64 possible opcodes.
- (bfd_hppa_insn2fmt): Add bfd argument, and use to select wide mode
- formats. Handle COMICLR.
- (hppa_rebuild_insn): Delete bfd argument. Handle formats 10, -11,
- -10, -16, 16, 22.
-
- * elf32-hppa.c (hppa_elf_relocate_insn): Complete rewrite.
- (elf32_hppa_bfd_final_link_relocate): Major rewrite.
- (elf32_hppa_build_one_stub): Modify hppa_elf_relocate_insn calls
- to suit.
- (elf32_hppa_size_stubs): Don't free stub_name twice. Read in all
- the local syms - did this code get deleted accidentally? Ignore
- undefined and undefweak syms.
-
- * elf-hppa.h (elf_hppa_final_link): Move hppa_info to outermost
- block. Use it instead of elf64_hppa_hash_table (info).
- (elf_hppa_final_link_relocate): Use hppa_info instead of
- elf64_hppa_hash_table (info).
-
- * libhppa.h (re_assemble_3, re_assemble_12, re_assemble_16,
- re_assemble_17, re_assemble_21, re_assemble_22): Don't mask insn.
- (hppa_rebuild_insn): Mask immediate bits here instead.
- * elf-hppa.h (elf_hppa_relocate_insn): Mask here too.
-
-2000-07-08 Alan Modra <alan@linuxcare.com.au>
-
- * section.c (struct sec): Add id field. Tidy comment formatting.
- (bfd_make_section_anyway): Set id.
- (STD_SECTION): Init id too.
- Change CONST to const throughout.
- * archures.c (bfd_arch_info): Tidy comment.
- (bfd_arch_list): Change a CONST to const.
- * libbfd-in.h: Tidy comments and replace CONST with const.
- * elf-bfd.h: Likewise.
- * libbfd.h: Regenerate.
- * bfd-in2.h: Regenerate.
- * libcoff.h: Regenerate.
-
-2000-07-07 DJ Delorie <dj@redhat.com>
-
- * archive.c (_bfd_write_archive_contents): Add an informative
- comment.
-
-2000-07-06 Kazu Hirata <kazu@hxi.com>
-
- * srec.c: Fix formatting.
-
-2000-06-05 DJ Delorie <dj@redhat.com>
-
- * MAINTAINERS: new
-
-2000-07-04 Alexandre Oliva <aoliva@redhat.com>
-
- * coff-arm.c (coff_arm_relocate_section): Do not ignore the symbol
- value of PC-relative offsets.
-
-2000-07-03 Jim Wilson <wilson@cygnus.com>
-
- * elf64-alpha.c (alpha_elf_size_info): New.
- (elf_backend_size_info): Define to alpha_elf_size_info.
- * elfcode.h (elf_size_info): Change hash bucket size to 4.
-
-2000-07-03 Ulf Carlsson <ulfc@engr.sgi.com>
-
- * elf32-mips.c: Include elf32-target.h again for the traditional
- MIPS targets.
-
-2000-07-03 Marek Michalkiewicz <marekm@linux.org.pl>
-
- * elf32-avr.c (bfd_elf32_bfd_reloc_type_lookup):
- Add ATTRIBUTE_UNUSED to unused arguments to avoid warnings.
- (avr_info_to_howto_rela): Likewise.
- (elf32_avr_gc_mark_hook): Likewise.
- (elf32_avr_gc_sweep_hook): Likewise.
- (elf32_avr_relocate_section): Likewise.
-
-2000-07-03 Mark Elbrecht <snowball3@bigfoot.com>
-
- * cofflink.c (_bfd_coff_write_global_sym): Turn a weak symbol into
- an external symbol for a non-shared, non-relocatable link.
-
-2000-07-03 Nick Clifton <nickc@redhat.com>
-
- * cofflink.c (IS_EXTERNAL): New macro: Return true if the symbol
- is an external symbol.
- (IS_WEAK_EXTERNAL): New macro: Return true if the symbol is a weak
- external symbol.
-
-2000-07-03 Kazu Hirata <kazu@hxi.com>
-
- * reloc16.c: Fix formatting.
-
-2000-07-01 Koundinya K <kk@ddeorg.soft.net>
-
- * config.bfd: Change targ_defvec and targ_selvecs for mips*-*-sysv4*
- to add a new target for traditional mips i.e
- bfd_elf32_tradbigmips_vec and bfd_elf32_tradlittlemips_vec.
- * configure.in: Likewise.
- * configure: Rebuild.
- * targets.c (bfd_elf32_tradbigmips_vec): Declare and put in
- bfd_target_vector.
- (bfd_elf32_tradlittlemips_vec): Likewise.
- * elfxx-target.h: Add macro INCLUDED_TARGET_FILE which is more a test
- to see that elfNN_bed does not get redefined even if the target file
- is included twice for a chip. See elf32-mips.c.
+ * elflink.h (elf_link_add_object_symbols): When removing all
+ sections, use bfd_section_list_clear.
-2000-07-01 Alan Modra <alan@linuxcare.com.au>
-
- * Makefile.am (DEP): Fix 2000-06-22. grep after running dep.sed
- (CLEANFILES): Add DEPA.
- * Makefile.in: Regenerate.
-
-2000-06-30 DJ Delorie <dj@cygnus.com>
-
- * peicode.h (coff_swap_filehdr_in): can't use e_magic because we
- can't assume the PE header is at 0x80.
-
-2000-06-29 Mark Elbrecht <snowball3@bigfoot.com>
-
- * syms.c (_bfd_stab_section_find_nearest_line): Use IS_ABSOLUTE_PATH.
-
-2000-06-28 Mark Elbrecht <snowball3@bigfoot.com>
-
- * go32stub.h: Update stub.
-
-2000-06-26 Marek Michalkiewicz <marekm@linux.org.pl>
-
- * archures.c (bfd_mach_avr5): Define.
- * bfd-in2.h (bfd_mach_avr5): Define.
- * cpu-avr.c (arch_info_struct): Rename bfd_mach_avr4 to
- bfd_mach_avr5, add bfd_mach_avr4. Update comments.
- (compatible): Update comment. Add missing test.
- * elf32-avr.c (avr_final_link_relocate): Support 8K wrap
- for avr2 and avr4. Simplify 8K wrap code.
- (bfd_elf_avr_final_write_processing): Recognize bfd_mach_avr5.
- (elf32_avr_object_p): Recognize E_AVR_MACH_AVR5.
-
-2000-06-26 Kazu Hirata <kazu@hxi.com>
-
- * coff-h8300.c: Fix formatting.
- * cpu-h8300.c: Likewise.
-
-2000-06-24 Alexandre Oliva <aoliva@redhat.com>
-
- * elf32-arm.h (elf32_arm_final_link_relocate): Print `(local)'
- for local symbols whose names are unknown.
-
-2000-06-22 Alan Modra <alan@linuxcare.com.au>
-
- * Makefile.am (DEP): grep for leading `/' in DEP1, and fail if we
- find one.
- * Makefile.in: Regenerate.
- * doc/Makefile.in: Regenerate.
-
-2000-06-20 H.J. Lu <hjl@gnu.org>
-
- * Makefile.am: Rebuild dependency.
- * Makefile.in: Rebuild.
-
-2000-06-20 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
-
- * elf32-mips.c (_bfd_mips_elf_copy_indirect_symbol): New function.
- (elf_backend_copy_indirect_symbol): Map to the new function.
-
-2000-06-20 Alan Modra <alan@linuxcare.com.au>
-
- * archive.c (normalize): Correct pointer comparison when checking
- for backslashes.
- (bfd_bsd_truncate_arname): Likewise.
- (bfd_gnu_truncate_arname): Likewise.
-
-2000-06-20 Ulf Carlsson <ulfc@engr.sgi.com>
-
- * elf-bfd.h (struct elf_obj_tdata): Define per BFD Irix 5 virtual
- sections elf_{text,data}_{section,symbol}.
- * elf32-mips.c: mips_elf_{text,data}_{section,symbol}{,_ptr}: Remove.
- (_bfd_mips_elf_hide_symbol): New function.
- (elf_backend_hide_symbol): Map to the new function.
- (_bfd_mips_elf_add_symbol_hook): Change to use new per BFD
- definitions of mips_elf_{text,data}_{section,symbol}.
- (mips_elf_local_relocation_p): Try to find the direct symbol
- based on new check_forced argument.
- (mips_elf_calculate_relocation): Use new version of
- mips_elf_local_relocation_p.
- (mips_elf_relocate_section): Likewise.
- (_bfd_mips_elf_relocate_section): Likewise.
- (mips_elf_sort_hash_table): Only assert that have enough GOT
- space.
- (mips_elf_got16_entry): Match all 32 bits to the existing GOT
- entry if the relocation based on the new external argument.
- (mips_elf_create_dynamic_relocation): Assert that we have a
- section contents allocated where we can swap out the dynamic
- relocations.
- (mips_elf_calculate_relocation): Find the real hash-table entry
- correctly by using h->root.root.type. Only create a dynamic
- relocation entry if the symbol is defined in a shared library.
- Create an external GOT entry for the GOT16 relocation if the
- symbol was forced local.
- (_bfd_mips_elf_finish_dynamic_symbol): Don't assert there is a
- dynamic index if the symbol was forced local.
-
-2000-06-20 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
-
- * elf32-mips.c: Fix typos in comments.
-
-2000-06-19 Mark Kettenis <kettenis@gnu.org>
-
- * rs6000-core.c: Wrap definition of `union VmInfo' within #ifdef
- CORE_VERSION_1.
-
-2000-06-18 Stephane Carrez <stcarrez@worldnet.fr>
-
- * Makefile.in, bfd-in2.h, libbfd.h, configure: Rebuild.
- * Makefile.am (ALL_MACHINES, ALL_MACHINES_CFILES, BFD32_BACKENDS,
- BFD32_BACKENDS_CFILES): Add 68hc12, 68hc11 files.
- * configure.in (bfd_elf32_m68hc12_vec): Recognize.
- (bfd_elf32_m68hc11_vec): Likewise.
- * config.bfd (targ_cpu): Recognize 68hc12 and 68hc11.
- Supports 68hc11 & 68hc12 at the same time.
- * targets.c (bfd_elf32_m68hc12_vec): Declare and put in
- bfd_target_vector.
- (bfd_elf32_m68hc11_vec): Likewise.
- * elf.c (prep_headers): Recognize bfd_arch_m68hc12 and 68hc11.
- * archures.c (bfd_m68hc12_arch): Define and register in global list
- (bfd_m68hc11_arch): Likewise.
- * reloc.c (BFD_RELOC_M68HC11_HI8, BFD_RELOC_M68HC11_LO8,
- BFD_RELOC_M68HC11_3B): Define.
- * cpu-m68hc12.c, elf32-m68hc12.c: New files for 68hc12 support.
- * cpu-m68hc11.c, elf32-m68hc11.c: New files for 68hc11 support.
-
-2000-06-18 Ulf Carlsson <ulfc@engr.sgi.com>
-
- * elf_bfd.h (struct elf_backend_data): Add info argument to
- elf_backend_hide_symbol.
- (_bfd_elf_link_hash_hide_symbol): Likewise.
- * elf.c (_bfd_elf_link_hash_hide_symbol): Likewise.
- * elf64-ia64.c (elf64_ia64_hash_hide_symbol): Likewise.
- * elflink.h (elf_link_add_object_symbols): Likewise.
- (elf_link_assign_sym_version): Likewise.
-
-2000-06-18 H.J. Lu <hjl@gnu.org>
-
- * coff-i386.c (coff_i386_reloc): Don't return in case of
- output_bfd == (bfd *) NULL if COFF_WITH_PE is defined.
- Compensate PE relocations when linking with non-PE object
- files to generate a non-PE executable.
-
-2000-06-17 Ulf Carlsson <ulfc@engr.sgi.com>
-
- * elf32-mips.c (mips_elf_calculate_relocation): Explicitly write
- GOT entries if we're doing a static link or -Bsymbolic link.
-
-2000-06-15 Ulf Carlsson <ulfc@engr.sgi.com>
-
- * elflink.h (elf_link_adjust_relocs): Check for and call backend
- specifific swap_reloc_{in,out} and swap_reloca_{in,out} if
- available.
- (elf_link_output_relocs): Likewise.
- (elf_reloc_link_order): Likewise.
-
-2000-06-16 Nicholas Duffek <nsd@redhat.com>
-
- * archures.c (enum bfd_architecture): #define constants for
- PowerPc and RS6000 machine numbers.
- * bfd-in2.h: Regenerate.
- * coffcode.h (coff_set_arch_mach_hook): #ifdef XCOFF64, set arch
- to bfd_arch_powerpc instead of bfd_arch_rs6000. Refer to PowerPc
- and RS6000 machine numbers using #defined constants from
- archures.c.
- * cpu-powerpc.c (arch_info_struct): Refer to PowerPc and RS6000
- machine numbers using #defined constants from archures.c. Add
- entries for EC603e, 630, A35, RS64II, RS64III, 7400. Specify
- 64-bit words in 620 entry.
- * cpu-rs6000.c (arch_info_struct): Create with entries for RS1,
- RSC, and RS2.
- (bfd_rs6000_arch): Change default machine to 0 (bfd_mach_rs6k).
-
-2000-06-16 Nicholas Duffek <nsd@cygnus.com>
-
- * coffcode.h (coff_mkobject_hook): Set xcoff_tdata.xcoff64.
- * libcoff-in.h (struct xcoff_tdata): Define xcoff64 field.
- * libcoff.h (struct xcoff_tdata): Define xcoff64 field.
-
-2000-06-16 Nicholas Duffek <nsd@redhat.com>
-
- * bfd-in.h (bfd_family_coff): Define.
- * bfd-in2.h: Regenerate.
- * coffgen.c (coff_count_linenumbers, coff_symbol_from,
- coff_find_nearest_line): Check COFFness using bfd_family_coff()
- instead of bfd_target_coff_flavour.
- * cofflink.c (_bfd_coff_final_link): Likewise.
- * cpu-ns32k.c (do_ns32k_reloc): Don't strcmp() target name to
- exclude XCOFF files.
- * reloc.c (bfd_perform_relocation, bfd_install_relocation):
- Likewise.
- * targets.c (enum bfd_flavour): Add bfd_target_xcoff_flavour.
- * xcoff-target.h (TARGET_SYM): Use bfd_target_xcoff_flavour.
- * xcofflink.c (XCOFF_XVECP): Delete.
- (bfd_xcoff_link_record_set, bfd_xcoff_import_symbol,
- bfd_xcoff_export_symbol, bfd_xcoff_link_count_reloc,
- bfd_xcoff_record_link_assignment,
- bfd_xcoff_size_dynamic_sections): Replace XCOFF_XVECP() with
- check for bfd_target_xcoff_flavour.
-
-2000-06-16 Nicholas Duffek <nsd@redhat.com>
-
- * rs6000-core.c: Support 64-bit core files, support pre-4.3 core
- files on AIX 4.3.
- (read_hdr): New function.
- (rs6000coff_core_p): Store mstsave or __context64 struct instead
- of trying to extract individual registers. Set abfd->arch_info
- to match the architecture that created the core file.
- (rs6000coff_get_section_contents): Delete.
- * xcoff-target.h (rs6000coff_get_section_contents): Delete.
-
-2000-06-14 H.J. Lu <hjl@gnu.org>
-
- * vms-misc.c (_bfd_vms_next_record): Return -1 if PRIV(vms_rec)
- is NULL.
-
-2000-06-13 H.J. Lu <hjl@gnu.org>
+2002-01-15 Nick Clifton <nickc@cambridge.redhat.com>
+ * po/sv.po: New file: Swedish translation.
+ * configure.in (ALL_LINGUAS): Add sv.
* configure: Regenerate.
-2000-06-13 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * peicode.h (pe_ILF_object_p): Use TARGET_LITTLE_SYM instead of
- armpei_little_vec.
-
-2000-06-08 David O'Brien <obrien@FreeBSD.org>
-
- * configure.in (VERSION): Update to show this is the CVS mainline.
-
-2000-06-07 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-d10v.c: Include elf/d10v.h
- (enum reloc_type): Delete.
- * elf32-d30v.c: Include elf/d30v.h
- (enum reloc_type): Delete.
-
- * Makefile.am: Run "make dep-am" to regenerate dependencies.
- * Makefile.in: Regenerate.
-
- * elf32-i386.c (elf_howto_table): Remove EMPTY_HOWTOs.
- (elf32_i386_vtinherit_howto, elf32_i386_vtentry_howto): Delete and
- move HOWTOs into elf_howto_table.
- (R_386_standard, R_386_ext_offset): Define.
- (R_386_ext, R_386_vt_offset, R_386_vt): Define.
- (elf_i386_reloc_type_lookup): Modify calculation of index into
- elf_howto_table since we've removed the padding.
- (elf_i386_info_to_howto_rel): Likewise.
- (elf_i386_relocate_section): Likewise.
-
-2000-06-06 Michael Snyder <msnyder@seadog.cygnus.com>
-
- * elf.c (elf_grok_pr_status): Eliminate reference to prgregset_t.
-
-2000-06-05 H.J. Lu <hjl@gnu.org>
-
- * elflink.c (_bfd_elf_link_record_dynamic_symbol): Don't flag
- an error when seeing an undefined symbol with hidden/internal
- attribute. It is handled in *_relocate_section ().
-
-2000-06-05 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_fix_symbol_flags): Follow the link for the
- indirect symbol for the ELF_LINK_NON_ELF bit.
- (elf_link_output_extsym): Don't output the indirect symbol even
- if the ELF_LINK_NON_ELF bit is set.
-
-2000-06-01 J.T. Conklin <jtc@redback.com>
-
- * config.bfd (i[3456]86-*-netbsdelf*): New target.
- (i[3456]86-*-netbsdaout*): New target.
- (i[3456]86-*-netbsd*): Add bfd_elf32_i386_vec to targ_selvecs.
- (i[3456]86-*-openbsd*): Likewise.
-
-2000-05-30 Andrew Cagney <cagney@b1.cygnus.com>
+2002-01-15 Jakub Jelinek <jakub@redhat.com>
- * trad-core.c: From hpux-core.c, include <dirent.h> or
- <sys/ndir.h> when possible.
+ * elflink.h (elf_link_input_bfd): Back out 2002-01-07 change.
+ * elf.c (merge_sections_remove_hook): New function.
+ (_bfd_elf_merge_sections): Pass it as 3rd argument to
+ _bfd_merge_sections.
+ * libbfd-in.h (_bfd_merge_sections): Add 3rd argument.
+ * libbfd.h: Rebuilt.
+ * merge.c (_bfd_merge_sections): Add remove_hook argument.
+ Call remove_hook if a SEC_EXCLUDE section is encountered.
-2000-05-31 Nick Clifton <nickc@cygnus.com>
+2002-01-15 Nick Clifton <nickc@cambridge.redhat.com>
- * opintl.h (_(String)): Explain why dgettext is used instead
- of gettext.
+ * elf32-xstormy16.c (xstormy16_reloc_map): Add new field 'table'.
+ (xstormy16_reloc_map): Initialise new field with correct howto
+ table.
+ (xstormy16_reloc_type_lookup): Use 'table' field to locate correct
+ howto entry.
-2000-05-31 Ulrich Drepper <drepper@redhat.com>
+2002-01-10 Michael Snyder <msnyder@redhat.com>
- * elf.c (_bfd_elf_slurp_version_tables): Correct reading of version
- definitions. We must not assume they are sorted in the file
- according to their index numbers.
+ * elf.c (elfcore_write_prstatus): Use long instead of pid_t;
+ (elfcore_write_pstatus): Use long instead of pid_t;
+ * elf-bfd.h: Change prototypes to use long instead of pid_t;
-2000-05-31 Alan Modra <alan@linuxcare.com.au>
+2002-01-09 Jason Thorpe <thorpej@wasabisystems.com>
- * elf-hppa.h: (elf_hppa_final_link_relocate): Use e_rsel field
- selector for R_PARISC_PCREL17R. R_PARISC_DIR17R and
- R_PARISC_DIR17F are for absolute branches; Handle them as such.
+ * elf.c: Update copyright years.
+ (elfcore_grok_netbsd_note): Use NT_NETBSDCORE_PROCINFO
+ and NT_NETBSDCORE_FIRSTMACH. Improve a comment.
-2000-05-30 Nick Clifton <nickc@cygnus.com>
+2002-01-08 Michael Snyder <msnyder@redhat.com>
- * cpu-i960.c (scan_960_mach): Accept 80960KA, 80960KB,
- 80960CA, 80960MC as valid machine names.
+ Add capability to write corefile note sections, for gdb.
+ * elf.c (elfcore_write_note): New function.
+ (elfcore_write_prpsinfo): New function.
+ (elfcore_write_prstatus): New function.
+ (elfcore_write_pstatus): New function.
+ (elfcore_write_prfpreg): New function.
+ (elfcore_write_prxfpreg): New function.
+ * elf-bfd.h: Add prototypes for above functions.
-2000-05-30 H.J. Lu <hjl@gnu.org>
+2002-01-08 Alexandre Oliva <aoliva@redhat.com>
- * elflink.c (_bfd_elf_link_record_dynamic_symbol): Clear the
- visibility bits if the symbol is undefined. Correctly handle
- weak undefined symbols with hidden and internal attributes.
+ * elf.c (elf_fake_sections): Propagate errors from
+ elf_backend_fake_section.
- * elflink.h (elf_link_add_object_symbols): Always turn the
- symbol into local if it has the hidden or internal attribute.
+2002-01-07 Jason Thorpe <thorpej@wasabisystems.com>
-2000-05-29 Philip Blundell <philb@gnu.org>
-
- * ppcboot.c: Add packed attribute if compiling with GCC.
-
-2000-05-29 Anatoly Vorobey <mellon@pobox.com>
-
- * elf.c (_bfd_elf_link_hash_table_init): Initialize dynlocal.
-
-2000-05-26 Michael Snyder <msnyder@seadog.cygnus.com>
-
- * elf.c (elfcore_grok_prstatus, elfcore_grok_pstatus,
- elfcore_grok_psinfo): Add code to allow debugging a 32-bit
- corefile on a 64-bit (Sparc Solaris) host. Also clean up
- a few old comments.
-
-2000-05-26 Alan Modra <alan@linuxcare.com.au>
-
- * Makefile.am: Update dependencies with "make dep-am"
+ * Makefile.am (BFD32_BACKENDS): Add elf32-sh-nbsd.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-sh-nbsd.c.
+ (elf32-sh-nbsd.lo): New rule.
* Makefile.in: Regenerate.
-
- * sysdep.h (gettext, dgettext, dcgettext, textdomain,
- bindtextdomain): Replace defines with those from intl/libgettext.h
- to quieten gcc warnings.
-
-2000-05-26 Eli Zaretskii <eliz@is.elta.co.il>
-
- * aoutx.h (find_nearest_line): Use IS_ABSOLUTE_PATH.
-
- * archive.c (normalize, bfd_bsd_truncate_arname,
- bfd_gnu_truncate_arname) [HAVE_DOS_BASED_FILE_SYSTEM]: Support
- file names with backslashes.
-
- * cache.c (bfd_open_file) [__MSDOS__]: Don't unlink the file
- before opening it.
-
- * sysdep.h: Include filenames.h.
-
-2000-05-26 Alan Modra <alan@linuxcare.com.au>
-
- * opncls.c (bfd_close_all_done): Mask file perms with 0777 not 0x777.
-
-2000-05-26 Jakub Jelinek <jakub@redhat.com>
-
- * elf64-sparc.c (sparc64_elf_relax_section): New.
- (sparc64_elf_relocate_section): Optimize tail call into branch always
- if possible.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- (elf32_sparc_relax_section): New.
-
-2000-05-26 Jakub Jelinek <jakub@redhat.com>
-
- * elf64-sparc.c: Add ATTRIBUTE_UNUSED to unused function parameters.
- Remove unusued variables.
- (sparc64_elf_relocate_section): Change r_symndx type to unsigned long.
- (sparc64_elf_merge_private_bfd_data): Fix shared library case from
- previous fix, so that shared libs really don't influence targets
- extension mask and memory model.
-
-2000-05-23 H.J. Lu <hjl@gnu.org>
-
- * elf64-alpha.c (elf64_alpha_relocate_section): Check
- h->root.other not h->other.
- * elf32-mips.c (mips_elf_calculate_relocation): Likewise.
-
- * elf32-ppc.c (ppc_elf_relocate_section): Fix a typo.
-
-2000-05-23 H.J. Lu <hjl@gnu.org>
-
- * elf32-i386.c (elf_i386_relocate_section): Don't allow the
- undefined symbol with the non-default visibility attributes.
- * elf-hppa.h (elf_hppa_relocate_section): Likewise.
- * elf32-arm.h (elf32_arm_relocate_section): Likewise.
- * elf32-i370.c (i370_elf_relocate_section): Likewise.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
- * elf32-mips.c (mips_elf_calculate_relocation): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
- * elf64-ia64.c (elf64_ia64_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
-
-2000-05-22 Richard Henderson <rth@cygnus.com>
-
- * elf64-ia64.c (ia64_howto_table): Add PCREL60B, PCREL21BI,
- PCREL22, PCREL64I. Zero size of special relocs.
- (elf64_ia64_reloc_type_lookup): Likewise.
- (USE_BRL, oor_brl, oor_ip): New.
- (elf64_ia64_relax_section): New.
- (elf64_ia64_check_relocs): Handle PCREL60B, PCREL22, PCREL64I.
- (elf64_ia64_install_value): Likewise, plus PCREL21BI.
- (elf64_ia64_relocate_section): Likewise.
- (bfd_elf64_bfd_relax_section): New.
- * reloc.c (BFD_RELOC_IA64_PCREL21BI): New.
- (BFD_RELOC_IA64_{PCREL22,PCREL60B,PCREL64I}): New.
- * bfd-in2.h, libbfd.h: Regenerate.
-
-2000-05-22 Nick Clifton <nickc@cygnus.com>
-
- * configure.in : Add peigen.lo to MIPS PE targets.
+ * config.bfd (sh*le-*-netbsdelf*): New target.
+ (sh*-*-netbsdelf*): New target.
+ * configure.in: Include netbsd-core.lo for native sh*-*-netbsd*.
+ (bfd_elf32_shnbsd_vec): New vector.
+ (bfd_elf32_shlnbsd_vec): New vector.
* configure: Regenerate.
+ * elf32-sh-nbsd.c: New file.
+ * targets.c: Update copyright years.
+ (_bfd_target_vector): Add bfd_elf32_shlnbsd_vec and
+ bfd_elf32_shnbsd_vec.
-2000-05-22 Momchil Velikov <velco@fadata.bg>
-
- * libbfd.c (_bfd_generic_verify_endian_match): Compare endianess
- only if it is known for both input and output bfds. Separate
- error message strings as in some languages, it may be necessary
- to change more than one place in the string to change between
- 'big' and 'little'.
-
- * elf32-ppc.c (ppc_elf_merge_private_bfd_data): Remove inline
- endianess checks, call _bfd_generic_verify_endian_match() instead.
-
- * elf32-mips.c (_bfd_mips_elf_merge_private_bfd_data): Likewise.
-
- * elf32-mcore.c (mcore_elf_merge_private_bfd_data): Likewise.
-
- * elf32-arm.h (elf32_arm_merge_private_bfd_data): Likewise. Verify
- endianess before checking bfd flavours.
-
-2000-05-22 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_output_extsym): Clear the visibility
- field for symbols not defined locally.
-
-2000-05-18 Alan Modra <alan@linuxcare.com.au>
-
- * libhppa.h (re_assemble_3, re_assemble_12, re_assemble_16,
- re_assemble_17, re_assemble_21, re_assemble_22): Don't mask insn.
- (hppa_rebuild_insn): Mask immediate bits here instead.
- * elf-hppa.h (elf_hppa_relocate_insn): Mask here too.
-
-2000-05-18 Momchil Velikov <velco@fadata.bg>
-
- * elflink.h (elf_bfd_final_link, elf_link_input_bfd): When emiting
- relocs for an executable, ensure that they are virtual addresses.
-
-2000-05-18 Jeffrey A Law (law@cygnus.com)
-
- * config.bfd (hppa*64*-*-hpux11*): New target triplet.
-
-2000-05-17 S. Bharadwaj Yadavalli <sby@scrugs.lkg.dec.com>
- Rick Gorton <gorton@scrugs.lkg.dec.com>
-
- * elflink.h: Add emitrelocations support: when enabled, relocation
- information and relocation sections are put into final output
- executables. If the emitrelocations flag is set, do the following:
- (elf_bfd_final_link): Emit relocation sections.
- (elf_link_input_bfd): Compute relocation section contents.
- (elf_gc_sections): Don't clean relocation sections.
-
-2000-05-16 Catherine Moore <clm@cygnus.com>
-
- * som.c (som_decode_symclass): Recognize weak symbols.
-
-2000-05-16 Szabolcs Szakacsits <szaka@F-Secure.com>
-
- * peigen.c (pe_print_idata): Undo part of 2000-05-12 change that
- read idata section only from dataoff.
- (pe_print_edata): Correctly check for valid eat_member.
-
-2000-05-16 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * elf32-sh.c (sh_elf_relax_delete_bytes): Handle R_SH_SWITCH8.
-
-2000-05-14 Philip Blundell <philb@gnu.org>
-
- * config.bfd (armeb-*-elf, arm*b-*-linux-gnu*): New targets.
-
-2000-05-12 Alan Modra <alan@linuxcare.com.au>
-
- * targets.c (bfd_target_vector): #ifdef BFD64 rs6000coff64_vec
-
- * peigen.c (pe_print_idata): Look for .idata section and print
- info even if data directory has zero entries. Read idata section
- starting from dataoff, and adjust all data offsets to suit. Cast
- all bfd_vma vars to unsigned long before passing to fprintf.
- * peigen.c (pe_print_edata): Similarly, look for .edata section
- and print info even if data directory has zero entries. Cast
- all bfd_vma vars to unsigned long before passing to fprintf.
-
- From Szabolcs Szakacsits <szaka@F-Secure.com>
- * peigen.c (pe_print_idata): Use bfd_section_size rather than data
- directory size which may be bogus.
- * peigen.c (pe_print_edata): Similarly.
-
-2000-05-09 Alan Modra <alan@linuxcare.com.au>
-
- * elf.c (bfd_section_from_shdr): Don't set use_rela_p if rela
- section is empty.
- (copy_private_bfd_data): Allow for space possibly taken up by elf
- headers when calculating segment physical address from lma.
-
-2000-05-08 Alan Modra <alan@linuxcare.com.au>
-
- * versados.c (versados_scan): Init stringlen and pass_2_done.
-
- * trad-core.c (trad_unix_core_file_p): Return
- bfd_error_wrong_format rather than bfd_error_file_truncated.
-
- * peigen.c (_bfd_pei_swap_aouthdr_out): Pass ImageBase to
- add_data_entry. DataDirectory virtual address is relative.
- (pe_print_idata): Account for relative DataDirectory virtual
- addresses. Don't trash datasize inside POWERPC_LE_PE code.
- (pe_print_edata): Similarly.
-
- From Szabolcs Szakacsits <szaka@F-Secure.com>
- * peigen.c (dir_names): Add Delay Import Directory.
- (pe_print_idata): Always search for bfd section containing
- idata address rather than looking up section name. Print this
- section name rather than .idata.
- (pe_print_edata): Similarly. Also print some fields as %08lx.
- (_bfd_pe_print_private_bfd_data_common): Print Reserved1 field as
- Win32Version.
-
-2000-05-05 Clinton Popetz <cpopetz@cygnus.com>
-
- * xcoff.h: Rename to xcoff-target.h
- * Makefile.am: Change all instances of xcoff.h to xcoff-target.h
- * coff-rs6000.c: Ditto.
- * coff64-rs6000.c: Ditto.
- * coff-pmac.c: Ditto.
- * Makefile.in: Regenerate.
-
-2000-05-05 Clinton Popetz <cpopetz@cygnus.com>
-
- * coffcode.h (coff_set_arch_mach_hook, coff_set_flags):
- Change U802TOC64MAGIC to U803XTOCMAGIC.
-
-2000-05-04 Michael Snyder <msnyder@seadog.cygnus.com>
-
- * elf.c (bfd_elf_get_arch_size): New function, return 32 | 64 | -1.
- * bfd-in.h: Prototype bfd_elf_get_arch_size.
- * bfd-in2.h: Prototype bfd_elf_get_arch_size.
-
-2000-05-04 Alan Modra <alan@linuxcare.com.au>
-
- * libhppa.h (HPPA_R_CONSTANT): Cast argument to bfd_signed_vma.
+2002-01-07 Aldy Hernandez <aldyh@redhat.com>
-2000-05-03 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+ * coff-rs6000.c (READ20): Use bfd_scan_vma.
- * elflink.h (elf_link_add_object_symbols): Reset dynindx for
- hidden and internal symbols.
- (elf_fix_symbol_flags): Clear NEEDS_PLT for symbols with
- visibility.
- * elflink.c (_bfd_elf_link_record_dynamic_symbol): Do not
- assign a PLT or GOT entry to symbols with hidden and
- internal visibility.
+2002-01-07 Geoffrey Keating <geoffk@redhat.com>
-2000-05-03 Mark Elbrecht <snowball3@bigfoot.com>
+ * elflink.h (elf_link_input_bfd): Don't ask for the merged offset
+ of a symbol in a section that will be deleted.
- * bfd/coff-go32.c (COFF_SECTION_ALIGNMENT_ENTRIES): Add entry for
- the .bss section.
- * bfd/coff-stgo32.c (COFF_SECTION_ALIGNMENT_ENTRIES): Likewise.
+2002-01-07 Nick Clifton <nickc@cambridge.redhat.com>
-2000-05-02 H.J. Lu <hjl@gnu.org>
-
- * elf.c (prep_headers): Use ELFOSABI_NONE instead of
- ELFOSABI_SYSV.
-
-2000-05-02 Alan Modra <alan@linuxcare.com.au>
-
- * targets.c (bfd_target_vector): Restore bfd_elf32_hppa_vec.
- * Makefile.am (BFD32_BACKENDS): Restore elf32-hppa.lo. Regenerate
- dependencies.
- * Makefile.in: Regenerate.
-
-2000-05-01 Jim Wilson <wilson@cygnus.com>
-
- * Makefile.am (BFD32_BACKENDS): Add efi-app-ia32.lo.
- (BFD32_BACKENDS_CFILES): Add efi-app-ia32.c.
- (BFD64_BACKENDS): Delete coff-ia64.lo. Add efi-app-ia64.lo.
- (BFD64_BACKENDS_CFILES): Delete coff-ia64.c. Add efi-app-ia64.c.
- * Makefile.in: Rebuild.
-
-2000-05-02 Alan Modra <alan@linuxcare.com.au>
-
- * config.bfd: Re-enable elf32-hppa. It now compiles, even if it
- doesn't work very well.
-
- * elf-hppa.h (elf_hppa_internal_shdr): Define.
- (elf_hppa_fake_sections): hdr is elf_hppa_internal_shdr.
- Set hdr->s_type to 1 if ARCH_SIZE == 32.
- (_bfd_elf_hppa_gen_reloc_type): Add prototype.
- (elf_hppa_info_to_howto): Likewise.
- (elf_hppa_info_to_howto_rel): Likewise.
- (elf_hppa_reloc_type_lookup): Likewise.
- (elf_hppa_is_local_label_name): Likewise.
- (elf_hppa_fake_sections): Likewise.
- (elf_hppa_final_write_processing): Likewise.
- (elf_hppa_howto_table): Fully initialise all entries.
- (_bfd_elf_hppa_gen_reloc_type): Add ATTRIBUTE_UNUSED to args.
- (elf_hppa_info_to_howto): Likewise.
- (elf_hppa_info_to_howto_rel): Likewise.
- (elf_hppa_reloc_type_lookup): Likewise.
- (elf_hppa_final_write_processing, elf_hppa_add_symbol_hook,
- elf_hppa_unmark_useless_dynamic_symbols,
- elf_hppa_remark_useless_dynamic_symbols,
- elf_hppa_record_segment_addrs, elf_hppa_final_link,
- elf_hppa_relocate_section, elf_hppa_final_link_relocate,
- elf_hppa_relocate_insn): Compile only if ARCH_SIZE == 64 until
- elf32-hppa.c mess is cleaned up.
- (elf_hppa_final_link_relocate): Make insn and r_type unsigned
- int. Delete r_field. In case R_PARISC_PCREL21L, don't set
- r_field then call hppa_field_adjust inline func with variable
- r_field arg, instead call hppa_field_adjust with fixed arg.
- In case R_PARISC_PCREL22F, don't set r_field.
- (elf_hppa_relocate_insn): Change args and return type to unsigned
- int. Call re_assemble_* funcs to do the work.
-
- * elf32-hppa.c (hppa_elf_relocate_insn): Don't assume 32 bit when
- sign extending.
-
- * libhppa.h (HPPA_R_CONSTANT): Don't assume 32 bit when sign
- extending.
- (sign_extend): Mask first before sign extending.
- (low_sign_extend): Rewrite without condition expression.
- (ones, dis_assemble_3, dis_assemble_12, dis_assemble_16,
- dis_assemble_17, dis_assemble_21, dis_assemble_22): Delete.
- (assemble_3, assemble_6, assemble_12, assemble_16, assemble_16a,
- assemble_17, assemble_21, sign_unext, low_sign_unext): Return
- result as function return value rather than through pointer arg.
- Accept unsigned int args, and return unsigned int.
- (re_assemble_3): New. Combines function of dis_assemble_3 with
- re-assembly of opcode and immediate.
- (re_assemble_12): Likewise.
- (re_assemble_16): Likewise.
- (re_assemble_17): Likewise.
- (re_assemble_21): Likewise.
- (re_assemble_22): Likewise.
- (hppa_field_adjust): Rewrite and document, paying attention to
- size of types and signed/unsigned issues.
- (get_opcode): Shift before masking.
- (FDLW): Rename to FLDW.
- (bfd_hppa_insn2fmt): Change arg to unsigned int. Delete fmt.
- (hppa_rebuild_insn): Change args and return value to unsigned
- int. Make use of re_assemble_*. Correct case 11.
-
- * dep-in.sed: Handle ../opcodes/.
- * Makefile.am (SOURCE_HFILES): Add elf-hppa.h, elf32-hppa.h,
- elf64-hppa.h, hppa_stubs.h, xcoff.h.
- (BFD32_BACKENDS_CFILES): Restore elf32-hppa.c.
- Remove elf64-hppa.lo, cpu-ia64.lo, elf64-ia64.lo, elfarm-oabi.lo,
- elfarm-nabi.lo dependencies outside of auto-dependency area.
- Regenerate dependencies.
- * Makefile.in: Regenerate.
-
- * configure.in (TRAD_HEADER): Test non-null before
- AC_DEFINE_UNQUOTED.
+ * po/es.po: New file: Spanish translation.
+ * configure.in (ALL_LINGUAS): Add es.
* configure: Regenerate.
- * reloc.c: Fix mis-spelling in comment.
-
-2000-05-01 Alan Modra <alan@linuxcare.com.au>
-
- * coff-sh.c (bfd_coff_small_swap_table): Fix Fri Apr 28 change.
- * vms.c (vms_openr_next_archived_file): Return NULL.
-
-2000-04-28 Clinton Popetz <cpopetz@cygnus.com>
-
- * coffcode.h Copy changes mistakenly done to libcoff.h in
- 4/24/2000 patch.
-
-2000-04-29 Andreas Jaeger <aj@suse.de>
-
- * libbfd-in.h: Correctly check GCC version.
- * bfd-in.h: Likewise.
- * libhppa.h: Likewise.
+2002-01-06 Steve Ellcey <sje@cup.hp.com>
+
+ * elfxx-ia64.c (is_unwind_section_name): Add target vector as
+ argument so we can handle HP-UX specially.
+ (elfNN_ia64_hpux_vec): New for use in is_unwind_section_name.
+ (elfNN_hpux_backend_section_from_bfd_section): New for support
+ of SHN_IA_64_ANSI_COMMON.
+ (elfNN_ia64_relax_section): Add support for SHN_IA_64_ANSI_COMMON.
+ (is_unwind_section_name): Add special HP-UX support.
+ (elfNN_ia64_section_from_shdr): Add support for more sections.
+ (elfNN_ia64_fake_sections): Modify is_unwind_section_name call and
+ add support for more sections.
+ (elfNN_ia64_additional_program_headers): Modify
+ is_unwind_section_name call.
+ (elfNN_ia64_modify_segment_map): Remove assumption that there is
+ only one unwind section in segment.
+
+2002-01-06 Alan Modra <amodra@bigpond.net.au>
+
+ * syms.c (_bfd_generic_make_empty_symbol): New function.
+ * libbfd-in.h (_bfd_nosymbols_make_empty_symbol): Define as
+ _bfd_generic_make_empty_symbol.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
-
-2000-04-28 Clinton Popetz <cpopetz@cygnus.com>
-
- * Makefile.am (BFD64_BACKENDS, BFD64_BACKENDS_CFILES): Add
- coffdu-rs6000.{lo,c}.
- (coff-pmac.lo, coff-rs6000.lo, coff64-rs6000.lo): Add dependency
- on xcoff.h
- * Makefile.in: Regenerate.
- * xcoff.h: New file.
- * coff-pmac.c: Use xcoff.h instead of coff-rs6000.c.
- * coff-rs6000.c: Move all declarations and defines that are
- common to the xcoff backends into xcoff.h
- * coff64-rs6000.c: Ditto,
-
-2000-04-28 Clinton Popetz <cpopetz@cygnus.com>
-
- * coff-mips.c (mips_ecoff_backend_data): Add initialization of
- _bfd_coff_force_symnames in strings and
- _bfd_coff_debug_string_prefix_length to their default values.
- * coff-sh.c: (bfd_coff_small_swap_table): Ditto.
-
-2000-04-28 Clinton Popetz <cpopetz@cygnus.com>
-
- * coff-alpha.c (alpha_ecoff_backend_data): Add initialization of
- _bfd_coff_force_symnames in strings and
- _bfd_coff_debug_string_prefix_length to their default values.
-
-2000-04-27 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-m68k.c (elf_m68k_gc_sweep_hook): Return if dynobj NULL.
- Check local_got_refcounts before dereferencing.
-
- * elf32-ppc.c (ppc_elf_relocate_section): Check splt != NULL
- before deciding we don't need R_PPC_PLT32 relocation.
- (ppc_elf_gc_sweep_hook): Check local_got_refcounts before
- dereferencing.
-
- * elflink.h (elf_gc_common_finalize_got_offsets): Fix comment.
-
- * elf32-i386.c (elf_i386_check_relocs): Reference count .got and
- .plt entries.
- (elf_i386_gc_sweep_hook): Garbage collect .got and .plt entries.
- (elf_i386_adjust_dynamic_symbol): Recognize unused .plt entries.
- (elf_i386_relocate_section): Allow for .plt to go missing.
- (elf_i386_finish_dynamic_symbol): Use same test to decide if we
- can use a relative reloc for got as elf_i386_relocate_section.
- (bfd_elf32_bfd_final_link): Define to use gc form of final link.
-
-2000-04-26 Clinton Popetz <cpopetz@cygnus.com>
-
- * config.bfd: Remove extraneous bfd_powerpc_64_arch.
-
-2000-04-24 Clinton Popetz <cpopetz@cygnus.com>
-
- * Makefile.am (coff64-rs6000.lo): New rule.
- * Makefile.in: Regenerate.
- * coff-rs6000.c (xcoff_mkobject, xcoff_copy_private_bfd_data,
- xcoff_is_local_label_name, xcoff_rtype2howto,
- xcoff_reloc_type_lookup, xcoff_slurp_armap, xcoff_archive_p,
- xcoff_read_ar_hdr, xcoff_openr_next_archived_file, xcoff_write_armap,
- xcoff_write_archive_contents): No longer static, and prefix with _bfd_.
- (NO_COFF_SYMBOLS): Define.
- (xcoff64_swap_sym_in, xcoff64_swap_sym_out, xcoff64_swap_aux_in,
- xcoff64_swap_aux_out): New functions; handle xcoff symbol tables
- internally.
- (MINUS_ONE): New macro.
- (xcoff_howto_tabl, xcoff_reloc_type_lookup): Add 64 bit POS
- relocation.
- (coff_SWAP_sym_in, coff_SWAP_sym_out, coff_SWAP_aux_in,
- coff_SWAP_aux_out): Map to the new functions.
- * coff64-rs6000.c: New file.
- * libcoff.h (bfd_coff_backend_data): Add new fields
- _bfd_coff_force_symnames_in_strings and
- _bfd_coff_debug_string_prefix_length.
- (bfd_coff_force_symnames_in_strings,
- bfd_coff_debug_string_prefix_length): New macros for above fields.
- * coffcode.h (coff_set_arch_mach_hook): Handle XCOFF64 magic.
- Set machine to 620 for XCOFF64. Use bfd_coff_swap_sym_in instead
- of using coff_swap_sym_in directly.
- (FORCE_SYMNAMES_IN_STRINGS): New macro, defined for XCOFF64.
- (coff_set_flags) Set magic for XCOFF64.
- (coff_compute_section_file_positions): Add symbol name length to
- string section length if bfd_coff_debug_string_prefix_length is
- true.
- (coff_write_object_contents): Don't do reloc overflow for XCOFF64.
- (coff_slurp_line_table): Use bfd_coff_swap_lineno_in instead of
- using coff_swap_lineno_in directly.
- (bfd_coff_backend_data): Add _bfd_coff_force_symnames_in_strings
- and _bfd_coff_debug_string_prefix_length fields.
- * coffgen.c (coff_fix_symbol_name, coff_write_symbols): Force
- symbol names into strings table when
- bfd_coff_force_symnames_in_strings is true.
- * coffswap.h (MAX_SCNHDR_NRELOC, MAX_SCNHDR_NLNNO, GET_RELOC_VADDR,
- SET_RELOC_VADDR): New macros.
- (coff_swap_reloc_in, coff_swap_reloc_out): Use above macros.
- (coff_swap_aux_in, coff_swap_aux_out): Remove RS6000COFF_C
- code.
- (coff_swap_aouthdr_in, coff_swap_aouthdr_out): Handle XCOFF64
- changes within RS6000COFF_C specific code.
- (coff_swap_scnhdr_out): Use PUT_SCNHDR_NLNNO, PUT_SCNHDR_NRELOC,
- MAX_SCNHDR_NRELOC, and MAX_SCNHDR_NLNNO.
- * reloc.c (bfd_perform_relocation, bfd_install_relocation):
- Extend existing hack on target name.
- * xcofflink.c (XCOFF_XVECP): Extend existing hack on
- target name.
- * coff-tic54x.c (ticof): Keep up to date with new fields
- in bfd_coff_backend_data.
- * config.bfd: Add bfd_powerpc_64_arch to targ_arch and define
- targ_selvecs to include rs6000coff64_vec for rs6000.
- * configure.in: Add rs6000coff64_vec case.
- * cpu-powerpc.c: New bfd_arch_info_type.
-
-2000-04-24 Jeffrey A Law (law@cygnus.com)
-
- * config.bfd: Only disable elf32-hppa vectors, not all of the
- BSD and OSF configuration support. Provide (disabled) clauses
- for PA64 support.
- * configure.in: Add clause for PA64 support.
- * configure: Rebuilt.
-
- * targets.c (bfd_target_vector): Add bfd_elf64_hppa_vec.
- (bfd_elf64_hppa_vec): Declare.
-
- * Makefile.am (BFD64_BACKENDS): Add elf64-hppa.lo
- (BFD64_BACKENDS_CFILES): Add elf64-hppa.c
- (elf64-hppa.lo): Add dependencies.
- * Makefile.in: Rebuilt.
-
- * elf64-hppa.c, elf64-hppa.h: New files with PA64 support.
-
-2000-04-24 Jason Eckhardt <jle@cygnus.com>
-
- * libhppa.h (dis_assemble_16): New function.
- (pa_arch): Added pa20w element.
-
-2000-04-24 Ulrich Drepper <drepper@cygnus.com>
-
- * elf-bfd.h: Add prototypes for bfd_elf32_write_relocs,
- bfd_elf32_slurp_reloc_table, bfd_elf64_write_relocs, and
- bfd_elf64_slurp_reloc_table.
-
- * elfcode.h (elf_write_relocs, elf_slurp_reloc_table): New
- definitions to get external names.
- (elf_write_relocs): Renamed from write_relocs and make global.
- (elf_slurp_reloc_table): Make global.
- (_bfd_elf,size_info): Use elf_write_relocs instead of write_relocs.
-
- * archive.c (hpux_uid_gid_encode): New function.
- (bfd_ar_hdr_from_filesystem): Use it if HPUX_LARGE_AR_IDS is
- defined and the ID is greater than 99999.
- (bfd_generic_stat_arch_elt): If HPUX_LARGE_AR_IDS is defined decode
- special uid/gid fields into 32 bit values.
-
-2000-04-21 Matthew Green <mrg@cygnus.com>
-
- * config.bfd: Add NetBSD/sparc64 support.
-
-Fri Apr 21 13:20:53 2000 Richard Henderson <rth@cygnus.com>
- David Mosberger <davidm@hpl.hp.com>
- Timothy Wall <twall@cygnus.com>
- Jim Wilson <wilson@cygnus.com>
-
- * Makefile.am (ALL_MACHINES): Add cpu-ia64.lo.
- (ALL_MACHINES_CFILES): Add cpu-ia64.c.
- (BFD64_BACKENDS): Add elf64-ia64.lo.
- (BFD64_BACKENDS_CFILES): Add elf64-ia64.c.
- (cpu-ia64.lo, elf64-ia64.lo): New rules.
- * Makefile.in: Rebuild.
- * archures.c (enum bfd_architecture): Add bfd_arch_ia64.
- (bfd_ia64_arch): Declare.
- (bfd_archures_list): Add bfd_ia64_arch.
- * bfd-in2.h: Rebuild.
- * config.bfd: (ia64*-*-linux-gnu*, ia64*-*-elf*): New targets.
- * configure: Rebuild.
- * configure.host: (ia64-*-linux*): New host.
- * configure.in (bfd_elf64_ia64_little_vec, bfd_elf64_ia64_big_vec,
- bfd_efi_app_ia64_vec, bfd_efi_app_ia64_vec): New vectors.
- * elf.c (prep_headers): Add bfd_arch_ia64.
- * libbfd.h: Rebuild.
- * reloc.c: Add IA-64 relocations.
- * targets.c (bfd_elf64_ia64_little_vec, bfd_elf64_ia64_big_vec):
- Declare.
- (bfd_target_vect): Add bfd_elf64_ia64_little_vec.
- * cpu-ia64-opc.c, cpu-ia64.c, elf64-ia64.c: New files.
-
-2000-04-21 Richard Henderson <rth@cygnus.com>
-
- * elf32-d30v.c (bfd_elf_d30v_reloc): Don't modify section
- contents when performing a partial link.
- (bfd_elf_d30v_reloc_21): Likewise.
-
-2000-04-20 H.J. Lu <hjl@gnu.org>
-
- * elf32-i386.c (elf_i386_relocate_section): Restrict 1998-12-10
- patch to symbols defined by a shared object.
- * elf32-ppc.c (ppc_elf_relocate_section): Similarly.
-
-2000-04-19 Michael Sokolov <msokolov@ivan.Harhan.ORG>
-
- K&R compiler fixes.
- * dwarf2.c (concat_filename): Avoid string literal concatenation.
- * ieee.c (ieee_get_symtab): Don't initialise union in struct.
-
-Mon Apr 17 19:14:36 2000 David Mosberger <davidm@hpl.hp.com>
-
- * Makefile.am (BFD64_BACKENDS): Mention coff-ia64.lo.
- (BFD64_BACKENDS_CFILES): Mention coff-ia64.c
- (coff-ia64.lo): Add dependency.
- * Makefile.in: Regenerate.
- * coff-ia64.c: New file.
- * efi-app-ia32.c: Ditto.
- * efi-app-ia64.c: Ditto.
- * coffcode.h (coff_set_arch_mach_hook): Handle IA64MAGIC.
- (coff_set_flags): Ditto.
- (coff_write_object_contents) [IA64]: Set magic number to ZMAGIC.
- * config.bfd (i[3456]86-*-linux-gnu*): Mention bfd_efi_app_ia32_vec.
- * configure.in (elf): Handle bfd_efi_app_ia32 and bfd_efi_app_ia64_vec.
- * configure: Regenerate.
- * libpei.h (GET_OPTHDR_IMAGE_BASE): New macro.
- (PUT_OPTHDR_IMAGE_BASE): Ditto.
- (GET_OPTHDR_SIZE_OF_STACK_RESERVE): Ditto.
- (PUT_OPTHDR_SIZE_OF_STACK_RESERVE): Ditto.
- (GET_OPTHDR_SIZE_OF_STACK_COMMIT): Ditto.
- (PUT_OPTHDR_SIZE_OF_STACK_COMMIT): Ditto.
- (GET_OPTHDR_SIZE_OF_HEAP_RESERVE): Ditto.
- (PUT_OPTHDR_SIZE_OF_HEAP_RESERVE): Ditto.
- (GET_OPTHDR_SIZE_OF_HEAP_COMMIT): Ditto.
- (PUT_OPTHDR_SIZE_OF_HEAP_COMMIT): Ditto.
- (GET_PDATA_ENTRY): Ditto.
- * peigen.c (_bfd_pei_swap_aouthdr_in) [COFF_WITH_PEP64]: Don't read
- data_start. Use above macros to read fields that are 64 bit wide for
- COFF_WITH_PEP64. Don't truncate entry and text_start to 32 bits.
- (_bfd_pei_swap_aouthdr_out) [PEI_FORCE_MINIMUM_ALIGNMENT]: Force
- FileAlignment and SectionAlignment to minimum alignment if they
- are zero.
- (_bfd_pei_swap_aouthdr_out) [PEI_DEFAULT_TARGET_SUBSYSTEM]: Set
- Subsystem to default PEI_DEFAULT_TARGET_SUBSYSTEM.
- (_bfd_pei_swap_aouthdr_out) [COFF_WITH_PEP64]: Don't set data_start.
- Use above macros to write fields that are 64 bit wide for
- COFF_WITH_PEP64.
- (pe_print_pdata): Set PDATA_ROW_SIZE to 3*8 for COFF_WITH_PEP64,
- 5*4 otherwise. This should be right for IA-32 and IA-64, but may
- be wrong for platforms. Use PDATA_ROW_SIZE instead of hardcoded
- value of 20 bytes. Modify printing for COFF_WITH_PEP64 to print
- begin address, end address, and unwind info address only. Use
- GET_PDATA_ENTRY() to read .pdata entries. Use fprintf_vma() to
- print addresses.
- (tbl): Add SECTION, REL32, RESERVED1, MIPS_JMPADDR16, DIR64, and
- HIGH3ADJ relocation names.
- (_bfd_pe_print_private_bfd_data): Print Subsystem name in legible form.
- * targets.c: Declare bfd_efi_app_ia32_vec and
- bfd_efi_app_ia64_vec.
- (bfd_target_vector): Mention bfd_efi_app_ia32_vec and
- bfd_efi_app_ia64_vec.
-
-2000-04-17 Timothy Wall <twall@cygnus.com>
-
- * bfd-in2.h: Add prototypes for tic54x load page access.
- * bfd-in.h: Regenerate.
- * coff-tic54x.c: Add load page functions; allow bfd_arch_unknown
- in customized _set_arch_mach function.
- * coffcode.h (coff_set_alignment_hook): Set section load page if
- the appropriate macro is defined.
- (write_object_contents): Read section load page.
-
-2000-04-13 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-hppa.h: Update copyright date.
-
- * elf32-fr30.c (fr30_elf_i20_reloc): Don't use U suffix.
- * elf32-mips.c (_bfd_mips_elf_relocate_section): And here.
-
- * elf32-d30v.c (MAX32): Don't use LL suffix.
- (MIN32): Define in terms of MAX32.
- (bfd_elf_d30v_reloc): Make relocation a bfd_signed_vma.
-
- * coff-a29k.c (SIGN_EXTEND_HWORD): Replace with more concise
- expression.
-
- * peicode.h (pe_ILF_build_a_bfd): Remove UL from hex constants.
-
-2000-04-12 Alan Modra <alan@linuxcare.com.au>
-
- * dep-in.sed: Match space before file name, not after.
- * Makefile.am: Regenerate dependencies.
- * Makefile.in: Regenerate.
-
- * reloc.c (_bfd_relocate_contents): In complain_overflow_bitfield
- case, allow address wrap-around stupidly removed 2000-03-17. Sign
- extend without an if statement.
-
-2000-04-11 Alan Modra <alan@linuxcare.com.au>
-
- * coff-mips.c (mips_gprel_reloc): Test for 16 bit range using
- signed quantites.
- * elf32-mips.c (gprel16_with_gp): Likewise.
- * elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Test range
- here using -0x40000, not (int)0xfffc0000.
- (elf32_hppa_size_of_stub): Likewise.
-
-2000-04-11 Timothy Wall <twall@cygnus.com>
-
- * coff-tic54x.c: Now builds with all targets.
- * Makefile.am: Add coff/tic54x.h to coff-tic54x.o dependencies.
- * Makefile.in: Regenerate.
- * coffcode.h (coff_set_arch_mach_hook): Eliminate warning on
- unitialized variable.
-
-Fri Apr 7 15:56:57 2000 Andrew Cagney <cagney@b1.cygnus.com>
-
- * configure.in (WARN_CFLAGS): Set to -W -Wall by default. Add
- --enable-build-warnings option.
- * Makefile.am (AM_CFLAGS, WARN_CFLAGS): Add definitions.
- * Makefile.in, configure: Re-generate.
-
-2000-04-07 Nick Clifton <nickc@cygnus.com>
-
- * reloc.c: Add BFD_RELOC_ARM_PCREL_BLX and
- BFD_RELOC_THUMB_PCREL_BLX.
-
- * elf32-arm.h (elf32_arm_final_link_relocate): Handle
- R_ARM_XPC25 and R_ARM_THM_PC22.
-
- * elfarm-nabi.c (elf32_arm_howto_): Fix definitions of
- R_ARM_XPC25 and R_ARM_THM_XPC22.
- (elf32_arm_reloc_map): Make BFD_RELOC_{ARM|THUMB}_PCREL_BLX to
- R_ARM_[XPC25|THM_XPC22].
-
- * elfarm-oabi.c: Define OLD_ARM_ABI and change include from
- elf/arm-oabi.h to elf/arm.h
-
- * Makefile.am: Fix dependency for elfarm-oabi.c
- * Makefile.in: Regenerate.
-
+ * hppabsd-core.c (hppabsd_core_make_empty_symbol): Delete function.
+ (hppabsd_core_get_symtab_upper_bound): Don't define.
+ (hppabsd_core_get_symtab): Likewise.
+ (hppabsd_core_print_symbol): Likewise.
+ (hppabsd_core_get_symbol_info): Likewise.
+ (hppabsd_core_bfd_is_local_label_name): Likewise.
+ (hppabsd_core_get_lineno): Likewise.
+ (hppabsd_core_find_nearest_line): Likewise.
+ (hppabsd_core_bfd_make_debug_symbol): Likewise.
+ (hppabsd_core_read_minisymbols): Likewise.
+ (hppabsd_core_minisymbol_to_symbol): Likewise.
+ (hppabsd_core_vec): Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols).
+ Formatting fixes.
+ * hpux-core.c: Similarly.
+ * irix-core.c: Similarly.
+ * osf-core.c: Similarly.
+ * sco5-core.c: Similarly.
+ * binary.c (binary_make_empty_symbol): Remove function, define as
+ _bfd_generic_make_empty_symbol.
+ * ihex.c (ihex_make_empty_symbol): Likewise.
+ * mmo.c (mmo_make_empty_symbol): Likewise.
+ * ppcboot.c (ppcboot_make_empty_symbol): Likewise.
+ * srec.c (srec_make_empty_symbol): Likewise.
+ * versados.c (versados_make_empty_symbol): Likewise.
+ * vms.c (_bfd_vms_make_empty_symbol): Remove.
+ (vms_make_empty_symbol): Define as _bfd_generic_make_empty_symbol.
+ * vms-gsd.c (_bfd_vms_slurp_gsd): Call bfd_make_empty_symbol
+ rather than _bfd_vms_make_empty_symbol.
+ * vms-misc.c (new_symbol): Likewise.
+
+2002-01-05 Alan Modra <amodra@bigpond.net.au>
+
+ * section.c (bfd_section_init): Remove unnecessary initialisations.
+ (bfd_section_list_clear): New function.
+ (bfd_section_list_remove, bfd_section_list_insert): New macros.
+ (_bfd_strip_section_from_output): Use them.
+ * coffcode.h (coff_set_alignment_hook): Likewise.
+ * elf32-mips.c (_bfd_mips_elf_final_link): Likewise.
+ * elf64-mips.c (mips_elf64_final_link): Likewise.
+ * elf64-mmix.c (mmix_elf_final_link): Likewise.
+ * sunos.c (sunos_add_dynamic_symbols): Likewise.
+ * xcofflink.c (_bfd_xcoff_bfd_final_link): Likewise.
* bfd-in2.h: Regenerate.
- * libbfd.h: Regenerate.
-
-2000-04-06 Michael Snyder <msnyder@seadog.cygnus.com>
-
- * elfcore.h (elf_core_file_p): preserve value of tdata at entry,
- and restore it on failure. Release newly allocated tdata on
- failure.
-
-Fri Apr 7 11:33:47 2000 Jim Wilson <wilson@cygnus.com>
-
- * dwarf2.c (struct dwarf2_debug): New field dwarf_line_size.
- (decode_line_info): Set it. Report error if unit->line_offset is
- equal to or larger than it.
-
-2000-04-07 Timothy Wall <twall@cygnus.com>
-
- * targets.c: Added vecs for tic54x.
- * reloc.c: Added relocs for tic54x.
- * libbfd.h: Regenerated.
- * configure: Add TI COFF vecs for tic54x.
- * configure.in: Ditto.
- * config.bfd (targ_cpu): Recognize new tic54x target.
- * coffcode.h (coff_slurp_symbol_table): Additions for TI COFF handling.
- * bfd-in2.h: Add tic54x target and relocations.
- * Makefile.am, Makefile.in: Add tic54x target.
- * archures.c (bfd_archures_list): Add tic54x target.
- * coff-tic54x.c: New.
- * cpu-tic54x.c: New.
-
-2000-04-06 Michael Snyder <msnyder@seadog.cygnus.com>
- * elfcore.h (elf_core_file_p): call backend_object_p which
- thereby gets an opportunity to update the arch/machine type.
-
-2000-04-06 Timothy Wall <twall@cygnus.com>
-
- * coffcode.h (coff_slurp_symbol_table): Handle C_STATLAB storage
- class. Handle SEC_CLINK and SEC_BLOCK flags.
- * section.c: Add SEC_CLINK and SEC_BLOCK flags.
- * bfd-in2.h: Add SEC_CLINK and SEC_BLOCK flags.
-
-2000-04-06 Nick Clifton <nickc@cygnus.com>
-
- * elf32-arm.h (elf32_arm_set_private_flags): Only check for
- EF_INTERWORK if this is an unknown EABI.
- (elf32_arm_merge_private_bfd_data): Check EABI version
- numbers. Only check EF_xxx flags if the EABI version number
- is unknown.
- (elf32_arm_check_private_bfd_data): Only check EF_xxx flags
- if the EABI version number is unknown.
- (elf32_arm_print_private_bfd_data): Only decode EF_xxx flags
- if the EABI version number is unknown.
-
-Wed Apr 5 22:04:20 2000 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * reloc.c (_bfd_relocate_contents): Add BFD_RELOC_SH_LOOP_START and
- BFD_RELOC_SH_LOOP_END.
- * elf32-sh.c (sh_elf_howto_tab): Change special_func to
- sh_elf_ignore_reloc for all entries that sh_elf_reloc used to ignore.
- Add entries for R_SH_LOOP_START and R_SH_LOOP_END.
- (sh_elf_reloc_loop): New function.
- (sh_elf_reloc): No need to test for always-to-be-ignored relocs
- any more.
- (sh_rel): Add entries for BFD_RELOC_SH_LOOP_{START,END}.
- (sh_elf_relocate_section): Handle BFD_RELOC_SH_LOOP_{START,END}.
- * bfd-in2.h, libbfd.h: Regenerate.
-
-2000-04-04 Alan Modra <alan@linuxcare.com.au>
-
- * po/bfd.pot: Regenerate.
-
- * Makefile.am: Remove extraneous mkdep comment.
- (MKDEP): Use gcc -MM rather than mkdep.
- (DEP): Quote when passing vars to sub-make. Add warning
- message to end.
- (DEP1): Rewrite for "gcc -MM".
- (CLEANFILES): Add DEP2.
- Update dependencies.
- * Makefile.in: Regenerate.
-
-2000-04-03 Kevin Buettner <kevinb@redhat.com>
-
- * configure.in: Added corefile support for AIX 4.3. In particular,
- AIX_CORE_DUMPX_CORE will be defined in addition to AIX_CORE when
- compiling rs6000-core.c.
+ * netbsd-core.c (netbsd_core_file_p): Use bfd_make_section_anyway
+ rather than doing our own section handling. Clean up after errors
+ with bfd_release and bfd_section_list_clear. Handle unexpected
+ flags.
+ * aoutf1.h (sunos4_core_file_p): Likewise.
+ * aix386-core.c (aix386_core_file_p): Likewise.
+ * cisco-core.c (cisco_core_file_validate): Likewise.
+ * ptrace-core.c (ptrace_unix_core_file_p): Likewise.
+ * trad-core.c (trad_unix_core_file_p): Likewise.
+
+ * hppabsd-core.c (hppabsd_core_core_file_p): Clean up after errors
+ with bfd_release and bfd_section_list_clear.
+ * hpux-core.c (hpux_core_core_file_p): Likewise.
+ * irix-core.c (irix_core_core_file_p): Likewise.
+ * lynx-core.c (lynx_core_file_p): Likewise.
+ * osf-core.c (osf_core_core_file_p): Likewise.
+ * rs6000-core.c (rs6000coff_core_p): Likewise.
+ * sco5-core.c (sco5_core_file_p): Likewise.
+
+ * elf32-mips.c (_bfd_mips_elf_lo16_reloc): Simplify, and perform
+ sign extension adjustments without conditionals.
+
+2002-01-04 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Don't crash if
+ CIE at .eh_frame start is removed due to no FDEs referencing it.
+
+2002-01-04 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * config.bfd (x86_64-*-netbsd*): New target.
+ * configure.in (x86_64-*-netbsd*): Set COREFILE
+ to netbsd-core.lo.
* configure: Regenerated.
-2000-04-03 H.J. Lu <hjl@gnu.org>
-
- * cache.c (bfd_open_file): Unlink the output file only if
- it has non-zero size.
-
-2000-04-01 Ken Block USG <block@zk3.dec.com>
-
- * elf64-alpha.c (elf64_alpha_relocate_section): Don't emit
- relative relocations for non-loaded sections in shared objects.
- (elf64_alpha_check_relocs): Similarly.
-
-Mon Apr 3 13:37:15 2000 Hans-Peter Nilsson <hp@axis.com>
-
- * aoutx.h (NAME(aout,reloc_type_lookup)): Add BFD_RELOC_8 and
- BFD_RELOC_16 to switch for extended relocs.
- (MY_swap_ext_reloc_in): New.
- (MY_swap_ext_reloc_out): New.
- (NAME(aout,slurp_reloc_table)): Use MY_swap_ext_reloc_in rather
- than NAME(aout,swap_ext_reloc_in) for extended relocs.
- (NAME(aout,squirt_out_relocs)): Similarly use
- MY_swap_ext_reloc_out.
- (aout_link_reloc_link_order): Use MY_put_ext_reloc if defined.
-
-2000-04-03 Kazu Hirata <kazu@hxi.com>
-
- * coff-h8300.c (h8300_reloc16_extra_cases): Add bsr:16 -> bsr:8 to
- the R_PCRWORD_B case.
-
-2000-03-31 Thomas de Lellis <tdel@wrs.com>
-
- * srec.c : Set CHUNK size to 16 bytes to prevent download failures
- on some targets.
- * ihex.c : Ditto.
-
-Wed Mar 30 15:28:00 2000 Donald Lindsay <dlindsay@cygnus.com>
-
- * elf32-m32r.c (m32r_elf_generic_reloc): new function. All
- HOWTO references to bfd_elf_generic_reloc, that have
- partial_inplace == true, now use the new function. The function
- is based on the recent rewrite of m32r_elf_lo16_reloc(), and
- extends its fixes to the R_M32R_{16,24,32} relocs.
- The new logic in m32r_elf_lo16_reloc() has been removed, and
- it instead calls the new routine to obtain that functionality.
-
-2000-03-27 Alan Modra <alan@linuxcare.com.au>
-
- * elf32-avr.c (elf32_avr_gc_mark_hook, elf32_avr_gc_sweep_hook,
- elf32_avr_check_relocs, avr_final_link_relocate,
- elf32_avr_relocate_section, bfd_elf_avr_final_write_processing,
- elf32_avr_object_p): Add prototypes.
- (elf32_avr_gc_mark_hook): Add default for h->root.type.
- (bfd_elf_avr_final_write_processing): Make static.
-
-2000-03-27 Denis Chertykov <denisc@overta.ru>
-
- * cpu-avr.c: New file. BFD support routines for AVR architecture.
- * archures.c (bfd_architecture): Add AVR architecture.
- (bfd_archures_list): Add reference to AVR architecture info.
- * elf.c (prep_headers): Handle bfd_arch_avr.
- * reloc.c: Add various AVR relocation enums.
- * targets.c (bfd_elf32_avr_vec): Declare and add to target vector
- list.
- * Makefile.am: Add support for AVR elf.
- * configure.in: Likewise.
- * config.bfd: Likewise.
- * Makefile.in: Regenerate.
- * configure: This too.
- * bfd-in2.h: And this.
- * libbfd.h: And this.
-
-2000-03-24 H.J. Lu <hjl@gnu.org>
-
- * elf64-alpha.c (elf64_alpha_merge_ind_symbols): Add prototype.
- (elf64_alpha_find_reloc_at_ofs): Likewise.
-
-2000-03-17 Alan Modra <alan@linuxcare.com.au>
-
- * reloc.c (bfd_check_overflow): In case complain_overflow_bitfield,
- flag an overflow if the bitfield is outside -2**n to 2**n-1. The
- allowable range used to be -2**(n-1) to 2**n-1.
- * reloc.c (_bfd_relocate_contents): Same here. Also replace
- "boolean overflow" with "bfd_reloc_status_type flag".
-
-2000-03-14 Doug Evans <dje@casey.transmeta.com>
-
- * elf32-m32r.c (m32r_elf_lo16_reloc): Rewrite.
-
-2000-03-14 Kazu Hirata <kazu@hxi.com>
-
- * reloc16.c (bfd_coff_reloc16_relax_section): Count the total number
- of shrinks properly, including the last reloc.
-
-2000-03-13 Kazu Hirata <kazu@hxi.com>
-
- * coff-h8300.c (h8300_reloc16_extra_cases): Fix the sanity
- check for R_MOVL2.
-
-2000-03-11 Alan Modra <alan@linuxcare.com.au>
-
- * ieee.c (ieee_archive_p): Return bfd_error_wrong_format on
- a format mismatch rather than an "error" from bfd_read such as
- bfd_error_file_truncated.
-
-2000-03-10 Geoff Keating <geoffk@cygnus.com>
-
- * elf32-mips.c (_bfd_mips_elf_relocate_section): Do proper
- sign-extension and big-endian compensation for
- R_MIPS_64 even in ld -r.
-
-2000-03-10 Geoffrey Keating <geoffk@cygnus.com>
+2002-01-03 Tom Rix <trix@redhat.com>
- * elf32-mips.c (mips_elf_next_relocation): Rename from
- mips_elf_next_lo16_relocation, and generalize to look
- for any relocation type.
- (elf_mips_howto_table): Make R_MIPS_PC16 pcrel_offset.
- (elf_mips_gnu_rel_hi16): Howto for R_MIPS_GNU_REL_HI16.
- (elf_mips_gnu_rel_lo16): Howto for R_MIPS_GNU_REL_LO16.
- (elf_mips_gnu_rel16_s2): Howto for R_MIPS_GNU_REL16_S2.
- (elf_mips_gnu_pcrel64): Howto for R_MIPS_PC64.
- (elf_mips_gnu_pcrel32): Howto for R_MIPS_PC32.
- (bfd_elf32_bfd_reloc_type_lookup): Add new relocs.
- (mips_rtype_to_howto): Likewise.
- (mips_elf_calculate_relocation): Handle new relocs.
- (_bfd_mips_elf_relocate_section): REL_HI16/REL_LO16 relocs
- are paired. The addend for R_MIPS_GNU_REL16_S2
- is shifted right two bits.
+ * xcofflink.c (_bfd_xcoff_bfd_final_link): Update .pad section ordering
+ for recent bfd_make_section_anyway change.
-2000-03-10 Alan Modra <alan@linuxcare.com.au>
+2002-01-03 Nick Clifton <nickc@cambridge.redhat.com>
- * reloc.c (bfd_perform_relocation): Undo emacs formatting of
- comment, and ensure it doesn't happen again.
- (bfd_install_relocation): Same here.
- (_bfd_relocate_contents): Don't bother assigning unused signmask
- shift result. Fix typos in comments.
- Remove trailing whitespace throughout file.
-
-2000-03-07 Doug Evans <dje@casey.transmeta.com>
-
- * reloc.c (reloc_howto_struct): Fix partial_inplace comment.
- * bfd-in2.h: Rebuild.
-
-2000-03-06 Nick Clifton <nickc@cygnus.com>
-
- * peicode.h (struct pe_ILF_vars): Add sym_ptr_table and
- sym_ptr_ptr fields.
- (SIZEOF_ILF_SYM_PTR_TABLE): Define.
- (SIZEOF_ILF_STRINGS): Redefine.
- (pe_ILF_make_a_symbol-reloc): New function. Creates a symbol
- relative reloc, as opposed to a section relative reloc.
- (pe_ILF_make_a_symbol): Set the class of local symbols to C_STAT
- not C_LABEL.
- Add length of symbol's prefix to string pointer.
- Store a pointer to the symbol in the symbol pointer table.
- (pe_ILF_build_a_bfd): Do not build .idata$2 or .idata$7.
- Initialise the symbol pointer table.
- Store the hint in the Hint/Name table.
- Make the jump reloc be symbol realtive, not section relative.
- Create an import symbol for imported code.
-
-2000-03-06 Catherine Moore <clm@cygnus.com>
-
- * elf.c (swap_out_syms): Check for null type_ptr.
-
-2000-03-01 Hans-Peter Nilsson <hp@axis.com>
-
- * aout-target.h (MY(write_object_contents)): Remove unused
- and unusable "#if CHOOSE_RELOC_SIZE".
- * pc532-mach.c (MY(write_object_contents)): Ditto.
- * netbsd.h (MY(write_object_contents)): Ditto.
- * hp300hpux.c (MY(write_object_contents)): Ditto.
- * freebsd.h (MY(write_object_contents)): Ditto.
- * aout-tic30.c (tic30_aout_write_object_contents): Ditto.
-
-2000-02-29 H.J. Lu <hjl@gnu.org>
-
- * peicode.h (jtab): Make it static.
-
- * coff-sh.c (sh_align_load_span): Declared if COFF_WITH_PE is
- defined and COFF_IMAGE_WITH_PE is not defined.
- (_bfd_sh_align_load_span): Defined as sh_align_load_span if
- COFF_WITH_PE is defined and COFF_IMAGE_WITH_PE is not defined.
-
-2000-03-01 Nick Clifton <nickc@cygnus.com>
-
- * coff-arm.c (bfd_arm_process_before_allocation): Make
- 'symndx' signed to prevent compile time warning.
-
- * coff-mcore.c: Remove unused prototype for pe_object_p.
-
- * coff-sh.c: Add "#ifndef COFF_IMAGE_WITH_PE" around static
- functions that are not used when COFF_IMAGE_WITH_PE is
- defined.
- (struct sh_opcode): Change type of 'flags' field to unsigned
- long so that it can hold the USESAS flag.
-
- * coffcode.h (styp_to_sec_flags): Initialise 'target_name'.
-
- * elf-m10300.c (mn10300_elf_relax_section): Initialise
- 'sym_sec'.
-
- * elf32-i370.c: Add ATTRIBUTE_UNUSED to unused function
- parameters.
- Remove unusued variables and code.
- (elf_backend_add_symbol_hook): Fix prototype.
-
- * elf32-m68k.c (elf_m68k_gc_sweep_hook): Initialise 'sgot' and
- 'srelgot'.
-
- * elf32-mcore.c (mcore_elf_relocate_section): Initialise
- 'oldinst'.
-
- * elf32-mips.c: Add ATTRIBUTE_UNUSED to unused function
- parameters.
- Remove unusued variables and code.
- (elf_backend_add_symbol_hook): Fix prototype.
-
- * elf32-sh.c (sh_elf_set_mach_from_flags): Use 'flags'.
-
- * elflink.h (elf_bfd_link_add_symbols): Add ATTRIBUTE_UNUSED
- to unused function parameter.
-
- * pe-mips.c: Add ATTRIBUTE_UNUSED to unused function
- parameters.
- Use EMPTY_HOWTO to initialise empty howto slots.
- Remove unused variables.
-
- * peicode.h (pe_ILF_build_a_bfd): Initialise id6.
-
-2000-03-01 H.J. Lu <hjl@gnu.org>
-
- * aoutx.h (aout_link_input_section_std): Pass "true" to
- the undefined_symbol callback.
- (aout_link_input_section_ext): Likewise.
- * bout.c (get_value): Likewise.
- * coff-a29k.c (coff_a29k_relocate_section): Likewise.
- * coff-alpha.c (alpha_ecoff_get_relocated_section_conten):
- Likewise.
- (alpha_relocate_section): Likewise.
- * coff-arm.c (coff_arm_relocate_section): Likewise.
- * coff-i960.c (coff_i960_relocate_section): Likewise.
- * coff-mcore.c (coff_mcore_relocate_section): Likewise.
- * coff-mips.c (mips_relocate_section): Likewise.
- * coff-ppc.c (coff_ppc_relocate_section): Likewise.
- * coff-sh.c (sh_relocate_section): Likewise.
- * coff-tic80.c (coff_tic80_relocate_section): Likewise.
- * cofflink.c (_bfd_coff_generic_relocate_section): Likewise.
- * elf-m10200.c (mn10200_elf_relocate_section): Likewise.
- * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
- * elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
- * elf32-fr30.c (fr30_elf_relocate_section): Likewise.
- * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
- * elf32-i370.c (i370_elf_relocate_section): Likewise.
- * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
- * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
- * elf32-sh.c (sh_elf_relocate_section): Likewise.
- * elf32-v850.c (v850_elf_relocate_section): Likewise.
- * elflink.c (_bfd_elf_link_record_dynamic_symbol): Likewise.
- * elflink.h (elf_link_output_extsym): Likewise.
- * pe-mips.c (coff_pe_mips_relocate_section): Likewise.
- * reloc.c (bfd_generic_get_relocated_section_conten): Likewise.
- * reloc16.c (_bfd_ppc_xcoff_relocate_section): Likewise.
-
- * elf-hppa.h (elf_hppa_relocate_section): Pass "false" to the
- undefined_symbol callback when building shared library with
- -Bsymbolic and undefined symbols are allowed. Otherwise, pass
- "true".
- * elf32-arm.h (elf32_arm_relocate_section): Likewise.
- * elf32-i386.c (elf_i386_relocate_section): Likewise.
- * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
- * elf32-mips.c (mips_elf_calculate_relocation): Likewise.
- (elf32_mips_get_relocated_section_content): Likewise.
- * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
- * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
- * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
- * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
-
-2000-02-28 Nick Clifton <nickc@cygnus.com>
-
- * Makefile.am: Add rules to build pe[i]-{sh|mips}.lo objects.
- * Makefile.in: Regenerate.
-
- * configure.in: Add support for mips and sh pe vectors.
- * configure: regenerate.
-
- * config.bfd: Add support for arm-wince, mips-pe and sh-pe
- targets.
-
- * targets.c: Add mips and sh pe vectors.
-
- * libpei.h (coff_final_link_postscript): Only define if not
- already defined.
-
- * coffcode.h: Add support for WinCE magic numbers.
-
- * peigen.c (pe_print_reloc): Update comment and rearrange
- appending of newline character.
-
- * peicode.h: Add support for Image Library Format.
- (pe_ILF_vars): Structure containing data used by ILF code.
- (pe_ILF_make_a_section): New function. Create a section based
- on ILF data.
- (pe_ILF_make_a_reloc): New function. Create a reloc based on
- ILF data.
- (pe_ILF_make_a_symbol): New function. Create a symbol based
- on ILF data.
- (pe_ILF_save_relocs): New function. Store the relocs created
- by pe_ILF_make_a_reloc in a section.
- (pe_ILF_build_a_bfd): New function. Create a BFD describing
- an ILF object.
- (pe_ILF_object_p): New function. Return a bfd_target pointer
- for an ILF object.
- (pe_bfd_object_p): If an ILF object is detected call
- pe_ILF_object_p on it.
-
- * coff-arm.c: Add support for WinCE relocs which are different
- from normal ARM COFF relocs.
- * pe-arm.c: Unset TARGET_UNDERSCORE for a WinCE target.
-
- * coff-sh.c: Add support for sh-pe target.
- * pe-sh.c: New file. Support code for sh-pe target.
- * pei-sh.c: New file. Support code for sh-pe target.
-
- * pe-mips.c: New file. Support code for mips-pe target.
- * pei-mips.c: New file. Support code for mips-pe target.
-
-2000-02-27 Jakub Jelinek <jakub@redhat.com>
-
- * elf32-sparc.c (elf32_sparc_merge_private_bfd_data): Don't bump
- architecture if the object causing the bump is dynamic.
- * elf64-sparc.c (sparc64_elf_merge_private_bfd_data): Likewise,
- and also don't it for memory ordering.
- (sparc64_elf_write_relocs): Take src_rela out of the loop.
-
-2000-02-27 Ian Lance Taylor <ian@zembu.com>
-
- * dwarf2.c (read_abbrevs): Use _raw_size directly rather than
- calling bfd_get_section_size_before_reloc.
- (decode_line_info): Likewise.
- (_bfd_dwarf2_find_nearest_line): Likewise.
-
-2000-02-27 Eli Zaretskii <eliz@is.elta.co.il>
-
- * Makefile.am (stamp-lib): Use $(LIBTOOL) --config to get the
- name of the libtool directory.
- * Makefile.in: Rebuild.
-
-Fri Feb 25 18:39:26 2000 Rodney Brown (RodneyBrown@pmsc.com)
-
- * som.c (SOM_HOWTO): Define.
- (som_hppa_howto_table): Use it.
-
-2000-02-25 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
-
- * config.bfd: Enable 64 bit support for GNU/Linux/sparc.
-
- * config.bfd: Enable 64 bit support for Solaris7+/sparc.
-
-2000-02-24 Catherine Moore <clm@cygnus.com>
-
- * som.c (som_misc_symbol_info): Add field
- secondary_def.
- (som_bfd_derive_misc_symbol_info): Initialize
- secondary_def.
- (som_build_and_write_symbol_table): Keep track
- of secondary_def field.
- (som_slurp_symbol_table): Set BSF_WEAK symbol flag
- if secondary_def field is set.
- (som_bfd_ar_write_symbol_stuff): Initialize
- secondary_def.
-
-2000-02-23 Stephane Carrez <stcarrez@worldnet.fr>
-
- * dwarf2.c (read_address): Read 16-bits addresses.
- (parse_comp_unit): Accept addr_size == 2.
-
-2000-02-23 Alan Modra <alan@spri.levels.unisa.edu.au>
-
- * bfd-in.h: Update copyright date.
-
-2000-02-23 Linas Vepstas <linas@linas.org>
-
- * cpu-i370.c: New file.
- * elf32-i370.c: New file.
- * archures.c (enum bfd_architecture): Add bfd_arch_i370.
- (bfd_i370_arch): New.
- (bfd_archures_list): Add bfd_i370_arch.
- * elf.c (prep_headers): Add bfd_arch_i370.
- * Makefile.am: Add support for IBM 370 elf.
- * config.bfd: Likewise.
- * configure.in: Likewise.
- * libbfd.h (bfd_reloc_code_real_names): Likewise.
- * reloc.c (bfd_reloc_code_type): Likewise.
- * targets.c: Likewise.
-
- * Makefile.in: Regenerate.
- * configure: Regenerate.
- * bfd-in2.h: Regenerate.
-
-2000-02-22 Ian Lance Taylor <ian@zembu.com>
-
- * elf32-i386.c (elf_i386_info_to_howto_rel): Give a warning for
- invalid relocation types, and change them to R_386_NONE.
-
-2000-02-22 H.J. Lu <hjl@gnu.org>
-
- * elflink.h (elf_link_add_object_symbols): If a version symbol is
- not defined, don't add a second ELF_VER_CHR.
-
- * elflink.h (elf_bfd_final_link): Call output_extsym for global
- symbols converted to local symbols even when stripping all
- symbols.
- (elf_link_output_extsym): Process global symbols converted to
- local symbols even if they are being stripped.
-
-2000-02-21 Alan Modra <alan@spri.levels.unisa.edu.au>
-
- * archures.c (bfd_octets_per_byte): Return unsigned int.
- (bfd_arch_mach_octets_per_byte): Ditto.
- * libbfd.c (bfd_read, bfd_seek): Quell signed vs. unsigned
- comparison warning.
- * section.c (bfd_get_section_size_before_reloc): Quell signed
- vs. unsigned comparison warning.
- (bfd_get_section_size_after_reloc): Same here. Fix parentheses too.
- * trad-core.c (trad_unix_core_file_p): Correct 2000-01-27
- change. What was I thinking?
- * bfd-in2.h: Regenerate.
-
- * elflink.h (elf_gc_sweep): Skip non-elf input bfds.
- (elf_gc_sections): Same here.
- (elf_gc_common_finalize_got_offsets): And here.
-
-2000-02-21 Ian Lance Taylor <ian@zembu.com>
-
- ELF HPPA doesn't work at present; remove it until it does.
- * config.bfd: Comment out setting targ_defvec to
- bfd_elf32_hppa_vec.
- * Makefile.am: Rebuild dependencies.
- (BFD32_BACKENDS): Remove elf32-hppa.lo.
- (BFD32_BACKENDS_CFILES): Remove elf32-hppa.c.
- (SOURCE_HFILES): Remove elf32-hppa.h and hppa_stubs.h.
- * Makefile.in: Rebuild.
- * targets.c (bfd_target_vector): Comment out bfd_elf32_hppa_vec.
-
-2000-02-18 Geoff Keating <geoffk@cygnus.com>
-
- * coffcode.h (coff_set_arch_mach_hook): Use free(), because there
- is no bfd_free(). Revert bfd_free part of previous change.
-
-2000-02-18 Geoff Keating <geoffk@cygnus.com>
-
- * coffcode.h (coff_set_arch_mach_hook): Don't use variable-size
- arrays.
- (coff_compute_section_file_positions): Use bfd_free to pair
- bfd_malloc.
- (coff_write_object_contents): Likewise.
-
- * coff-rs6000.c (xcoff_howto_table_16): New variable.
- (xcoff_rtype2howto): Handle 16-bit variants of 32-bit relocs.
-
-2000-02-18 Ulrich Drepper <drepper@cygnus.com>
-
- * coff-rs6000.c (XCOFFARMAGBIG): New macro.
- (xcoff_ar_file_hdr_big): New structure.
- (SIZEOF_AR_FILE_HDR_BIG): New macro.
- (xcoff_ar_hdr_big): New structure.
- (SIZEOF_AR_HDR_BIG): New macro.
- (xcoff_big_format_p): New macro.
- (xcoff_ardata_big): New macro.
- (arch_xhdr_big): New macro.
- (xcoff_slurp_armap): Handle large archives.
- (xcoff_archive_p): Detect large archives.
- (xcoff_read_ar_hdr): Handle large archives.
- (xcoff_openr_next_archived_file): Handle large archives.
- (xcoff_generic_stat_arch_elt): Handle large archives.
- (xcoff_write_armap_old): Rename from xcoff_write_armap.
- (xcoff_write_armap_big): New function.
- (xcoff_write_armap): New function, dispatch to _old or _big.
- (xcoff_write_archive_contents_old): Rename from
- xcoff_write_archive_contents.
- (xcoff_write_archive_contents_big): New function.
- (xcoff_write_archive_contents): New function, dispatch to _old or
- _big.
-
-2000-02-18 Richard Henderson <rth@cygnus.com>
-
- * elf-bfd.h (struct elf_link_hash_table): Remove copy_indirect
- and hide_symbol members.
- (elf_link_hash_copy_indirect): Remove.
- (elf_link_hash_hide_symbol): Remove.
- (struct elf_backend_data): Add elf_backend_copy_indirect_symbol
- and elf_backend_hide_symbol.
- (_bfd_elf_link_hash_copy_indirect): Declare.
- (_bfd_elf_link_hash_hide_symbol): Declare.
- * elf.c (_bfd_elf_link_hash_copy_indirect): Remove table argument.
- (_bfd_elf_link_hash_hide_symbol): Likewise.
- (_bfd_elf_link_hash_table_init): Don't init killed members.
- * elflink.h (elf_link_add_object_symbols): Use the bed function
- pointers not elf_link_hash_{copy_indirect,hide_symbol}.
- (elf_link_assign_sym_version): Likewise.
- * elfxx-target.h (elf_backend_copy_indirect_symbol): Default.
- (elf_backend_hide_symbol): Likewise.
- (elfNN_bed): Update for new members.
-
-2000-02-17 Kevin Buettner <kevinb@redhat.com>
-
- * rs6000-core.c (CORE_DATA_SIZE_FIELD, CORE_COMM_FIELD, SAVE_FIELD,
- STACK_END_ADDR): Define for new core file format.
- (LOADER_OFFSET_FIELD, LOADER_REGION_SIZE, CORE_DUMP): New defines
- for handling the vagaries of the various core file structures used
- by AIX over the years.
- (rs6000coff_core_p, rs6000coff_core_file_matches_executable,
- Rs6kCorData): Use above defines to adapt code to use AIX 4.3's
- core_dumpx structure.
-
-Thu Feb 17 00:04:48 2000 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * archures.c (bfd_mach_sh2, bfd_mach_sh_dsp): New macros.
- (bfd_mach_sh3_dsp): Likewise.
- (bfd_mach_sh4): Reinstate.
- (bfd_default_scan): Recognize 7410, 7708, 7729 and 7750.
- * bfd-in2.h: Regenerate.
- * coff-sh.c (struct sh_opcode): flags is no longer short.
- (USESAS, USESAS_REG, USESR8, SETSAS, SETSAS_REG): New macros.
- (sh_opcode41, sh_opcode42): Integrate as sh_opcode41.
- (sh_opcode01, sh_opcode02, sh_opcode40): Add sh-dsp opcodes.
- (sh_opcode41, sh_opcode4, sh_opcode80): Likewise.
- (sh_opcodes): No longer const.
- (sh_dsp_opcodef0, sh_dsp_opcodef): New arrays.
- (sh_insn_uses_reg): Check for USESAS and USESR8.
- (sh_insn_sets_reg, sh_insns_conflict): Check for SETSAS.
- (_bfd_sh_align_load_span): Return early for SH4.
- Modify sh_opcodes lookup table for sh-dsp / sh3-dsp.
- Take into account that field b of a parallel processing insn
- could be mistaken for a separate insn.
- * cpu-sh.c (arch_info_struct): New array elements for
- sh2, sh-dsp and sh3-dsp.
- Reinstate element for sh4.
- (SH2_NEXT, SH_DSP_NEXT, SH3_DSP_NEXT): New macros.
- (SH4_NEXT): Reinstate.
- (SH3_NEXT, SH3E_NEXT): Adjust.
- * elf-bfd.h (_sh_elf_set_mach_from_flags): Declare.
- * elf32-sh.c (sh_elf_set_private_flags): New function.
- (sh_elf_copy_private_data, sh_elf_set_mach_from_flags): Likewise.
- (sh_elf_merge_private_data): New function.
- (elf_backend_object_p, bfd_elf32_bfd_set_private_bfd_flags): Define.
- (bfd_elf32_bfd_copy_private_bfd_data): Define.
- (bfd_elf32_bfd_merge_private_bfd_data): Change to
- sh_elf_merge_private_data.
-
-2000-02-13 Richard Henderson <rth@cygnus.com>
-
- * elf-bfd.h (struct elf_link_hash_table): Add copy_indirect and
- hide_symbol members.
- (elf_link_hash_copy_indirect): New.
- (elf_link_hash_hide_symbol): New.
- * elflink.h (elf_link_add_object_symbols): Break out copy from
- indirect new new symbol to elf.c.
- (elf_link_assign_sym_version): Break out privatization of
- non-exported symbol to elf.c.
- * elf.c (_bfd_elf_link_hash_copy_indirect): New.
- (_bfd_elf_link_hash_hide_symbol): New.
- (_bfd_elf_link_hash_table_init): Init copy_indirect and hide_symbol.
-
-2000-02-13 Ian Lance Taylor <ian@zembu.com>
-
- * section.c (_bfd_strip_section_from_output): Add info parameter.
- If it passed as non-NULL, use it to check whether any input BFD
- has an input section which uses this output section. Change all
- callers.
- * bfd-in2.h: Rebuild.
-
- * bfd-in.h: Move declarations of bfd_get_elf_phdr_upper_bound and
- bfd_get_elf_phdrs in from bfd-in2.h, correcting patch of
- 1999-11-29.
- * bfd-in2.h: Rebuild.
-
-2000-02-10 Timothy Wall <twall@cygnus.com>
-
- * coffswap.h (coff_swap_sym_in): Add hook SWAP_SYM_IN_POST to
- allow final modifications of swapped-in symbol.
- (coff_swap_sym_out): Ditto with SWAP_SYM_OUT_POST.
- * coffcode.h (coff_write_relocs): Use macro
- SECTION_RELATIVE_ABSOLUTE_SYMBOL_P if defined to determine whether
- symbol index should be set to -1.
-
-Thu Feb 10 20:07:50 GMT 2000 Toshiyasu Morita (toshi.morita@sega.com)
-
- * coff-sh.c (USES1_REG, USES2_REG, SETS1_REG, SETS2_REG,
- USESF1_REG, USESF2_REG, SETSF1_REG, SETSF2_REG): New macros.
- * (sh_insn_sets_reg, sh_insn_sets_freg): New prototypes.
- * (sh_insn_sets_reg, sh_insn_uses_or_sets_reg, sh_insns_sets_freg,
- sh_insns_uses_or_sets_freg): New functions.
- * (sh_insn_uses_reg, sh_insn_uses_freg): Use new macros.
- * (sh_insns_conflict): Use new functions and new macros to
- detect conflicts when two instructions both set same integer registers,
- both set same fp register, and both set special register.
-
-2000-02-09 Timothy Wall <twall@cygnus.com>
-
- * coffgen.c (coff_real_object_p): Set arch/mach info prior to
- swapping in sections, so that the swapping routines have access to
- the arch/mach info.
-
-2000-02-08 Mark Elbrecht <snowball3@bigfoot.com>
-
- * coff-go32.c: Update comment. Update copyright.
-
-2000-01-27 Thomas de Lellis <tdel@windriver.com>
-
- * syms.c (bfd_decode_symclass)
- Two new class characters were added - 'V' and 'v'. The
- meaning of 'W' is now restricted to just weak non-object
- symbols. This allows differentiation between, for example,
- weak functions vs weak objects. nm for example now dumps:
- 'W' = weak global
- 'w' = weak unresolved
- 'V' = weak global object
- 'v' = weak unresolved object
-
- (bfd_is_undefined_symclass): New function. Return true if the
- given symbol class represents and undefined/unresolved symbol.
-
- (bfd_symbol_info): Use bfd_is_undefined_symclass to check for
- unresolved symbols.
-
- * bfd-in2.h: Add prototype for bfd_is_undefined_symbol().
-
- * elf32-arm.h (elf32_arm_get_symbol_type): If a symbol has the
- STT_ARM_16BIT flag set, but it is not attached to a data object
- return STT_ARM_16BIT so that it will be treated as code by the
- disassembler.
-
-2000-01-27 Alan Modra <alan@spri.levels.unisa.edu.au>
-
- * coff-i386.c (i3coff_object_p): Remove prototype.
- Update copyright.
-
- * elflink.c (_bfd_elf_link_record_dynamic_symbol): Add const
- to name. Update copyright.
-
- * trad-core.c (trad_unix_core_file_p): Cast core_regsec
- assignment to avoid warning. Update copyright.
-
-2000-01-24 Robert Lipe (robertl@sco.com)
-
- * coffcode.h (coff_write_object_contents): Get buff via bfd_malloc
- instead of using GNU C extension.
-
-2000-01-21 Nick Clifton <nickc@cygnus.com>
-
- * libbfd.c (bfd_read): Do not attempt to get a negativly sized
- amount from a bfd_in_memory structure.
- (bfd_seek): Do not allow seeks past the end of a bfd_in_memory
- structure.
-
-2000-01-14 Nick Clifton <nickc@cygnus.com>
-
- * linker.c (default_indirect_link_order): oops - fix incorrectly
- applied patch from Tim Wall.
-
-2000-01-13 Timothy Wall (twall@tiac.net>
-
- * coffcode.h: Use bfd_coff_xxx instead of the macro XXX (where xxx
- = scnhsz, filhsz, relsz, aoutsz, etc)
-
- * coffswap.h: Ditto.
-
-2000-01-13 Nick Clifton <nickc@cygnus.com>
-
- * elf32-arm.h (elf32_thumb_to_arm_stub): Fix offset in branch to
- interwork thumb to arm stub.
-
-2000-01-13 Timothy Wall (twall@tiac.net>
-
- * archures.c (bfd_octets_per_byte): New function: Return
- target byte size.
- (bfd_arch_mach_octets_per_byte): New function: Return target
- byte size.
-
- * section.c: Distinguish between octets and bytes for usage of
- _cooked_size, _raw_size, and output_offset. Clarify
- description of bfd_set_section_contents.
-
- * bfd-in2.h: Regenerate.
-
- * coffgen.c: Indicate that the offset parameter is in bytes, not
- octets.
-
- * cofflink.c (bfd_coff_link_input_bfd): Use bfd_octets_per_byte
- where appropriate to get the octet offset when calling
- bfd_set_section_contents.
- (bfd_coff_reloc_link_order): Ditto.
-
- * linker.c (bfd_generic_reloc_link_order): Ditto.
- (_bfd_default_link_order): Ditto.
-
- * reloc.c (bfd_perform_relocation): Distinguish between octets
- and bytes. Use octets when indexing into octet data; use bytes
- when calculating target addresses.
- (bfd_install_relocation): Ditto.
-
- * srec.c (srec_write_section): Ditto.
-
-2000-01-13 Nick Clifton <nickc@cygnus.com>
-
- * coff-mcore.c (COFF_DEFAULT_SECTION_ALIGNMENT_POWER): Change from
- 3 to 2. This allows 4 byte sized sections, which is necessary for
- dlltool to build functioning DLLs.
-
-2000-01-10 Philip Blundell <pb@futuretv.com>
-
- * config.bfd (arm*-*-linux-gnu*): Match instead of arm*-*-linux-gnu.
- (arm*-*-conix*): New target.
-
-2000-01-10 Egor Duda <deo@logos-m.ru>
+ * elf32-arm.h (elf32_arm_final_link_relocate): Handle
+ R_ARM_THM_PC11 reloc.
- * config.bfd: Include elf32_i386 vector to target list for cygwin
- and mingw.
+2002-01-02 Nick Clifton <nickc@cambridge.redhat.com>
- * config.in: Undefine HAVE_WIN32_PSTATUS_T.
- * configure.in: Test for structure win32_pstatus_t in
- <sys/procfs.h>
+ * configure.in (LINGUAS): Add ja.
* configure: Regenerate.
+ * po/ja.po: Import from translation project's web site.
- * elf.c (elfcore_grok_win32pstatus): New function: process
- win32_pstatus_t notes in elf core file.
- (elfcore_grok_note): Detect win32_pstatus notes.
-
-2000-01-03 Martin v. Loewis <loewis@informatik.hu-berlin.de>
+2002-01-02 Nick Clifton <nickc@cambridge.redhat.com>
- * elflink.c (_bfd_elf_link_record_dynamic_symbol): Process symbol
- visibility.
- * elflink.h (elf_link_add_object_symbols): Combine visibilities.
- * elf.c (bfd_elf_print_symbol): Interpret st_other as visibility.
+ * elf32-arm.h (elf32_arm_merge_private_bfd_data): Reformat error
+ messages to ease translation into other languages.
-For older changes see ChangeLog-9899
+For older changes see ChangeLog-0001
Local Variables:
mode: change-log
diff --git a/contrib/binutils/bfd/ChangeLog-0001 b/contrib/binutils/bfd/ChangeLog-0001
new file mode 100644
index 0000000..3000c03
--- /dev/null
+++ b/contrib/binutils/bfd/ChangeLog-0001
@@ -0,0 +1,9592 @@
+2001-12-31 Jakub Jelinek <jakub@redhat.com>
+
+ * elflink.h (elf_bfd_final_link): Check if dynobj is not NULL
+ before looking for .eh_frame_hdr section.
+ * elf-eh-frame.c (_bfd_elf_write_section_eh_frame_hdr): If
+ .eh_frame_hdr section is being stripped from output, don't do
+ anything.
+
+2001-12-27 Tom Rix <trix@redhat.com>
+
+ * coff-rs6000.c (xcoff_generate_rtinit): Clean data_buffer alloc/free.
+ * coff64-rs6000.c (xcoff64_generate_rtinit): Same.
+ (xcoff_write_archive_contents_big): Rewrite.
+ (xcoff_write_armap_big): Rewrite.
+ (xcoff_write_one_armap_big): Delete.
+ * libxcoff.h : Clean up.
+
+2001-12-21 Tom Rix <trix@redhat.com>
+
+ * xcofflink.c (bfd_xcoff_link_generate_rtinit): New function.
+ Interface to linker for generation of __rtinit.
+ * libxcoff.h (struct xcoff_backend_data_rec): Add new ops to xcoff
+ backend to generate special linker symbol __rtinit.
+ * coff-rs6000.c (bfd_xcoff_backend_data, bfd_pmac_xcoff_backend_data)
+ : Add new rtinit ops
+ * coff64-rs6000.c (bfd_xcoff_aix5_backend_data,
+ bfd_xcoff_backend_data): Same.
+ * bfd-in.h: Add bfd_xcoff_link_generate_rtinit.
+ * bfd-in2.h : Regenerate.
+
+2001-12-21 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-sparc.c (_bfd_sparc_elf_howto_table): Fix dst_mask for
+ R_SPARC_DISP32. Support R_SPARC_PLT32.
+ (sparc_reloc_map): Add BFD_RELOC_16_PCREL and BFD_RELOC_SPARC_PLT32.
+ (elf32_sparc_check_relocs): Handle R_SPARC_PLT32.
+ (elf32_sparc_relocate_section): Likewise.
+ * elf64-sparc.c (sparc64_elf_howto_table): Fix dst_mask for
+ R_SPARC_DISP32. Support R_SPARC_PLT32 and R_SPARC_PLT64.
+ (sparc_reloc_map): Add BFD_RELOC_16_PCREL, BFD_RELOC_64_PCREL
+ and BFD_RELOC_SPARC_PLT32.
+ (sparc64_elf_check_relocs): Handle R_SPARC_PLT32 and R_SPARC_PLT64.
+ (sparc64_elf_relocate_section): Likewise.
+ * reloc.c (bfd_reloc_code_type): Add BFD_RELOC_SPARC_PLT32.
+ * bfd-in2.h, libbfd.h: Rebuilt.
+
+2001-12-20 Tom Rix <trix@redhat.com>
+
+ * coffcode.h (coff_compute_section_file_positions): Add special AIX
+ loader alignment of text section.
+
+2001-12-20 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * config.bfd (mips-dec-netbsd*): Delete alias for mips*el-*-netbsd*.
+
+ * config.bfd (arm-*-netbsdelf*): Add target.
+ * configure.in: Include netbsd-core.lo for native arm-*-netbsd*.
+ * configure: Regenerate.
+
+2001-12-20 Alan Modra <amodra@bigpond.net.au>
+
+ * elfcode.h (elf_slurp_symbol_table): Test elf_elfsections for NULL,
+ as can happen with a core file, before dereferencing.
+
+2001-12-19 Michael Snyder <msnyder@redhat.com>
+
+ * elf32-i386.c (elf_i386_grok_psinfo): Fix copy-and-paste error:
+ target is i386 (not mips), and size of descdata is 124 (not 128).
+
+2001-12-19 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): If new_size
+ is 0, temporarily grow it to minimal CIE size.
+ (_bfd_elf_write_section_eh_frame): If input .eh_frame section would
+ end up empty, build a fake minimal CIE.
+
+2001-12-19 Steve Ellcey <sje@cup.hp.com>
+
+ * config.bfd (bfd_elf32_ia64_hpux_big_vec): New vector for
+ ia64*-*-hpux* target.
+ (bfd_elf64_ia64_hpux_big_vec): Likewise.
+ * targets.c: Ditto.
+ * configure.in: Ditto.
+ * configure: Regenerate
+ * elfxx-ia64.c (elfNN_ia64_final_write_processing): Replace use of
+ alloca with bfd_malloc.
+ (get_local_sym_hash): Likewise.
+ (elfNN_hpux_post_process_headers): New function.
+ #include elfNN-target.h again with values for IA64 HP-UX vector.
+
+2001-12-18 Michael Snyder <msnyder@redhat.com>
+
+ * elf.c (assign_file_positions_for_segments): Don't sort PT_NOTE
+ sections of corefiles. Also it makes no sense to sort if count == 1.
+
+2001-12-18 H.J. Lu <hjl@gnu.org>
+
+ * elf.c (_bfd_elf_copy_private_bfd_data): Also copy GP.
+
+2001-12-18 H.J. Lu <hjl@gnu.org>
+
+ * elf.c (_bfd_elf_copy_private_bfd_data): Update comments.
+
+2001-12-18 H.J. Lu <hjl@gnu.org>
+
+ * elf-bfd.h (_bfd_elf_copy_private_bfd_data): New. Prototype.
+ (_bfd_mips_elf_copy_private_bfd_data): Removed.
+
+ * elf.c (_bfd_elf_copy_private_bfd_data): New. Copy e_flags in
+ the ELF header.
+
+ * elf32-i370.c (??_elf_copy_private_bfd_data): Removed.
+ (bfd_elf??_bfd_copy_private_bfd_data): Removed.
+ * elf32-m32r.c: Likewise.
+ * elf32-m68k.c: Likewise.
+ * elf32-mcore.c: Likewise.
+ * elf32-mips.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-v850.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-sparc.c: Likewise.
+ * elfxx-ia64.c: Likewise.
+
+ * elf64-mips.c (bfd_elf64_bfd_copy_private_bfd_data): Removed.
+
+ * elfxx-target.h (bfd_elfNN_bfd_copy_private_bfd_data): Defined
+ to _bfd_elf_copy_private_bfd_data.
+
+2001-12-18 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * elf32-s390 (elf_s390_check_relocs): Pass addend to
+ gc_record_vtentry.
+ * elf64-s390 (elf_s390_check_relocs): Likewise.
+ Fix by Andreas Jaeger <aj@suse.de>.
+
+2001-12-18 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * configure.host: Correctly match all NetBSD/mips
+ hosts.
+
+2001-12-18 matthew green <mrg@eterna.com.au>
+
+ * config.bfd (m68*-*-netbsdelf*): New target.
+ (m68*-*-netbsd): Also include bfd_elf32_m68k_vec.
+ (m68*-*-netbsdaout*): New alias for m68*-*-netbsd.
+
+2001-12-18 Jakub Jelinek <jakub@redhat.com>
+
+ * elflink.h (size_dynamic_sections): Skip anonymous version tag.
+ (elf_link_assign_sym_version): Don't count anonymous version tag.
+
+2001-12-18 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-eh-frame.c (struct cie): Add make_lsda_relative.
+ (struct eh_cie_fde): Add lsda_encoding, lsda_offset,
+ make_lsda_relative.
+ (read_value, write_value): New.
+ (_bfd_elf_discard_section_eh_frame): Inicialize
+ lsda_encoding, lsda_offset and make_lsda_relative.
+ (_bfd_elf_eh_frame_section_offset): If make_lsda_relative,
+ request no dynamic reloc for LSDA field of FDE.
+ (_bfd_elf_write_section_eh_frame): Handle make_lsda_relative.
+ If a non-DW_EH_PE_absptr value is 0, don't adjust it by base
+ or pcrel. Fix address computation for DW_EH_PE_pcrel relocs.
+ Update LSDA field if LSDA encoding is DW_EH_PE_pcrel, because
+ . might have changed due to deleted FDE or CIEs.
+
+2001-12-18 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-strtab.c (struct elf_strtab_hash_entry): Add u.next.
+ (last_eq): Remove.
+ (_bfd_elf_strtab_finalize): Don't use a hash table for last
+ character chains, instead use an array.
+
+2001-12-18 Jason Thorpe <thorpej@wasabisystems.com>
+
+ * elf.c (elfcore_netbsd_get_lwpid): New function.
+ (elfcore_grok_netbsd_procinfo): New function.
+ (elfcore_grok_netbsd_note): New function.
+ (elfcore_read_notes): Call elfcore_grok_netbsd_note to process
+ NetBSD ELF core file notes.
+
+2001-12-18 Alan Modra <amodra@bigpond.net.au>
+
+ * elfcode.h (struct bfd_preserve): New.
+ (elf_object_p): Replace preserved_* vars with instance of above.
+ Save and restore arch_info pointer rather than arch, mach so that
+ more cases can be restored. Save and restore new section_tail,
+ section_htab structure, and init appropriately. Move "rest of
+ section header" code so that i_shdrp needs no NULL initialisation.
+ Free old section_htab on success.
+ * elfcore.h (elf_core_file_p): Likewise.
+
+2001-12-17 Tom Rix <trix@redhat.com>
+
+ * coffcode.h (sec_to_styp_flags): Add STYP_EXCEPT and STYP_TYPCHK for
+ xcoff.
+
+2001-12-17 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-bfd.h (elf_discarded_section): Define.
+ * elflink.h (elf_link_input_bfd): Use it.
+ (elf_reloc_symbol_deleted_p): Likewise.
+
+ * elf64-alpha.c (elf64_alpha_relocate_section): Don't warn about
+ overflows for pc relative relocs against discarded sections.
+
+2001-12-17 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf32-mips.c (_bfd_mips_elf_relocate_section): Formatting.
+ * elf64-mips.c: Add most of the fixes and tweaks done in elf32-mips.c
+ over the last months. Add some code for mips16 handling.
+ (mips_elf64_check_mips16_stubs): New function.
+ (mips_elf64_stub_section_p): Likewise.
+ (mips_elf64_calculate_relocation): Change interface to support mips16.
+ (mips_elf64_perform_relocation): Likewise.
+
+2001-12-17 Alan Modra <amodra@bigpond.net.au>
+
+ Support for more than 64k ELF sections.
+ * elf-bfd.h (elf_size_info <swap_symbol_out>): Add shndx param.
+ (bfd_elf32_swap_symbol_in): Likewise.
+ (bfd_elf32_swap_symbol_out): Likewise.
+ (bfd_elf64_swap_symbol_in): Likewise.
+ (bfd_elf64_swap_symbol_out): Likewise.
+ (elf_reloc_cookie): Add locsym_shndx field. Make locsyms a PTR.
+ (elf_obj_tdata): Add num_elf_sections, symtab_shndx_hdr and
+ symtab_shndx_section.
+ (elf_numsections): Define.
+ (elf_symtab_shndx): Define.
+ * elf.c (setup_group): Use elf_numsections rather than header e_shnum.
+ (bfd_elf_find_section): Likewise.
+ (bfd_section_from_elf_index): Likewise.
+ (bfd_section_from_shdr): Likewise. Handle SHT_SYMTAB_SHNDX.
+ (bfd_section_from_r_symndx): Read symbol shndx extension, and
+ translate st_shndx for > SHN_HIRESERVE.
+ (assign_section_numbers): Skip reserved sections. Assign
+ symtab_shndx_section and elf_numsections. Exclude reserved
+ sections from e_shnum. Set up symtab_shndx_hdr.
+ (_bfd_elf_compute_section_file_positions): Handle symtab_shndx_hdr.
+ (map_sections_to_segments): Don't map eh_frame_hdr unless required.
+ (assign_file_positions_except_relocs): Use elf_numsections rather
+ than header e_shnum. Skip reserved sections and symtab_shndx_section.
+ (prep_headers): Set name for symtab_shndx_hdr.
+ (_bfd_elf_assign_file_positions_for_relocs): Use elf_numsections.
+ (_bfd_elf_write_object_contents): Likewise. Skip reserved sections.
+ (_bfd_elf_section_from_bfd_section): Check bfd_{abs,com,und}_section
+ first. Use elf_section_data if available. Use elf_numsections.
+ Start scan at index 1.
+ (copy_private_bfd_data ): Comment fixes.
+ (MAP_ONESYMTAB): Define above SHN_HIOS.
+ (MAP_DYNSYMTAB): Likewise.
+ (MAP_STRTAB): Likewise.
+ (MAP_SHSTRTAB): Likewise.
+ (MAP_SYM_SHNDX): New define.
+ (_bfd_elf_copy_private_symbol_data): Handle symtab_shndx_section.
+ (swap_out_syms): Swap out SHT_SYMTAB_SHNDX section too.
+ * elfcode.h (elf_swap_symbol_in): Add shndx param, and handle shndx
+ extension.
+ (elf_swap_symbol_out): Likewise.
+ (elf_object_p): Set elf_numsections, and use instead of e_shnum.
+ Initialialise reserved elf_elfsections to point at shdr[0]. Remove
+ redundant bfd_release calls.
+ (elf_slurp_symbol_table): Read symbol shndx extension, and use with
+ elf_swap_symbol_in. Translate st_shndx for > SHN_HIRESERVE too.
+ * elflink.h (elf_link_is_defined_archive_symbol): Read symbol shndx
+ extension, and use with elf_swap_symbol_in.
+ (elf_link_record_local_dynamic_symbol): Likewise.
+ (elf_link_add_object_symbols): Likewise. Also translate st_shndx
+ for elf sections > SHN_HIRESERVE.
+ (NAME(bfd_elf,size_dynamic_sections)): Adjust elf_swap_symbol_out
+ call.
+ (struct elf_final_link_info): Add locsym_shndx and symshndxbuf.
+ (elf_bfd_final_link): Allocate the above, and tidy code allocating
+ other buffers. Use elf_numsections instead of e_shnum. Adjust
+ elf_swap_symbol_out calls.
+ (elf_link_output_sym): Swap out symbol shndx extension too.
+ (elf_link_flush_output_syms): And flush them to disk.
+ (elf_link_output_extsym): Use SHN_BAD. Adjust elf_swap_symbol_out
+ calls.
+ (elf_gc_mark): Read symbol shndx extension, and use with
+ elf_swap_symbol_in.
+ (elf_link_input_bfd): Likewise, Translate st_shndx for elf sections
+ > SHN_HIRESERVE too. Use SHN_BAD.
+ (elf_reloc_symbol_deleted_p): Use symbol shndx extensions with
+ elf_swap_symbol_in. Translate st_shndx > SHN_HIRESERVE too.
+ (elf_bfd_discard_info): Read symbol shndx extension. Don't attempt
+ to continue after a bfd error.
+ * elf-m10200.c (mn10200_elf_relax_section): Only read local syms.
+ Stash them immediately to symtab_hdr->contents rather than later
+ in multiple places. Clean up afterwards. Read symbol shndx
+ extension, and use with swap_symbol_in. Translate SHN_UNDEF,
+ SHN_ABS, SHN_COMMON and elf sections > SHN_HIRESERVE to bfd
+ sections too. Remove dead code.
+ (mn10200_elf_relax_delete_bytes): Use symbol shndx extension
+ when swapping in symbols. Tidy code adjusting global syms.
+ Don't swap in global syms.
+ (mn10200_elf_symbol_address_p): Likewise. Remove extsyms param.
+ (mn10200_elf_get_relocated_section_contents): Read symbol shndx
+ extension, and use with swap_symbol_in. Rename "size" -> "amt"
+ to maximize code in common with other files. Translate st_shndx
+ for > SHN_HIRESERVE too. Remove dead code.
+ * elf-m10300.c (mn10300_elf_relax_section): Only read local syms.
+ Stash them immediately to symtab_hdr->contents rather than later
+ in multiple places. Clean up afterwards. Read symbol shndx
+ extension, and use with swap_symbol_in. Remove dead code.
+ (mn10300_elf_relax_delete_bytes): As for elf-m10200.c.
+ (mn10300_elf_symbol_address_p): Likewise.
+ (mn10300_elf_get_relocated_section_contents): Likewise.
+ * elf32-h8300.c (elf32_h8_relax_section): As for elf-m10300.c.
+ (elf32_h8_relax_delete_bytes): Likewise.
+ (elf32_h8_symbol_address_p): Likewise.
+ (elf32_h8_get_relocated_section_contents): Likewise.
+ * elf32-hppa.c (elf32_hppa_size_stubs): Read symbol shndx
+ extension, and use with swap_symbol_in.
+ * elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
+ * elf32-i370.c (i370_elf_finish_dynamic_sections): Adjust call to
+ bfd_elf32_swap_symbol_out.
+ * elf32-m32r.c (m32r_elf_get_relocated_section_contents): Translate
+ elf sections > SHN_HIRESERVE too.
+ * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Only read
+ local syms. Read symbol shndx extension, and use with swap_symbol_in.
+ * elf32-mips.c (_bfd_mips_elf_final_write_processing): Use
+ elf_numsections rather than header e_shnum.
+ * elf32-sh.c (sh_elf_relax_section): As for elf-m10300.c.
+ (sh_elf_relax_delete_bytes): Likewise.
+ (sh_elf_get_relocated_section_contents): Likewise. Only read local
+ symbols.
+ * elf32-v850.c (v850_elf_symbol_processing): Use an unsigned int to
+ hold section index. Use elf_numsections rather than e_shnum.
+ Rename "index" -> "indx" to avoid shadowing warning.
+ (v850_elf_add_symbol_hook): Likewise.
+ * elf64-alpha.c (elf64_alpha_relax_section): Only read local syms.
+ Read symbol shndx extension, and use with swap_symbol_in.
+ * elf32-xstormy16.c (xstormy16_elf_relax_section): Likewise.
+ Translate SHN_COMMON and elf sections > SHN_HIRESERVE too.
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Likewise.
+ (elfNN_ia64_aix_add_symbol_hook): Use elf_numsections.
+
+ * elf-m10300.c (mn10300_elf_gc_mark_hook): Remove unnecessary checks
+ before calling bfd_section_from_elf_index on local syms.
+ * elf32-arm.h (elf32_arm_gc_mark_hook): Likewise.
+ * elf32-avr.c (elf32_avr_gc_mark_hook): Likewise.
+ * elf32-cris.c (cris_elf_gc_mark_hook): Likewise.
+ * elf32-d10v.c (elf32_d10v_gc_mark_hook): Likewise.
+ * elf32-fr30.c (fr30_elf_gc_mark_hook): Likewise.
+ * elf32-hppa.c (elf32_hppa_gc_mark_hook): Likewise.
+ * elf32-i386.c (elf_i386_gc_mark_hook): Likewise.
+ * elf32-m32r.c (m32r_elf_gc_mark_hook): Likewise.
+ * elf32-m68k.c (elf_m68k_gc_mark_hook): Likewise.
+ * elf32-mcore.c (mcore_elf_gc_mark_hook): Likewise.
+ * elf32-mips.c (_bfd_mips_elf_gc_mark_hook): Likewise.
+ * elf32-openrisc.c (openrisc_elf_gc_mark_hook): Likewise.
+ * elf32-ppc.c (ppc_elf_gc_mark_hook): Likewise.
+ * elf32-s390.c (elf_s390_gc_mark_hook): Likewise.
+ * elf32-sh.c (sh_elf_gc_mark_hook): Likewise.
+ * elf32-sparc.c (elf32_sparc_gc_mark_hook): Likewise.
+ * elf32-v850.c (v850_elf_gc_mark_hook): Likewise.
+ * elf32-xstormy16.c (xstormy16_elf_gc_mark_hook): Likewise.
+ * elf64-mips.c (mips_elf64_gc_mark_hook): Likewise.
+ * elf64-mmix.c (mmix_elf_gc_mark_hook): Likewise.
+ * elf64-ppc.c (ppc64_elf_gc_mark_hook): Likewise.
+ * elf64-s390.c (elf_s390_gc_mark_hook): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_gc_mark_hook): Likewise.
+
+2001-12-17 Alan Modra <amodra@bigpond.net.au>
+
+ Hash bfd sections for fast lookup and create.
+ * bfd.c (struct _bfd): Add section_htab, section_tail.
+ * libbfd-in.h (_bfd_delete_bfd): Declare.
+ (bfd_section_hash_newfunc): Declare.
+ * opncls.c (_bfd_new_bfd): Free memory on failure. Init
+ section_htab and section_tail.
+ (_bfd_delete_bfd): New function.
+ (bfd_openr): Use it.
+ (bfd_fdopenr): Likewise.
+ (bfd_openstreamr): Likewise.
+ (bfd_openw): Likewise.
+ (bfd_close): Likewise.
+ (bfd_close_all_done): Likewise.
+ (bfd_release): Comment.
+ * section.c (struct section_hash_entry): New.
+ (bfd_section_hash_newfunc): New function.
+ (section_hash_lookup): Define.
+ (bfd_section_init): New function, split out from
+ bfd_make_section_anyway.
+ (bfd_get_section_by_name): Lookup via hash table.
+ (bfd_get_unique_section_name): Likewise.
+ (bfd_make_section_old_way): Rewrite to use hash table.
+ (bfd_make_section_anyway): Likewise.
+ (bfd_make_section): Likewise. Return NULL for attempts to make
+ BFD_{ABS,COM,UND,IND}_SECTION_NAME.
+ (_bfd_strip_section_from_output): Adjust section_tail if needed.
+ * configure.in: Bump bfd version.
+ * configure: Regenerate.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+
+2001-12-15 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf64-mips.c (mips_elf64_link_hash_entry): New link hash.
+ (mips_elf64_high): New Function.
+ (mips_elf64_higher): Likewise.
+ (mips_elf64_highest): Likewise.
+ (mips_elf64_info_to_howto_rel): Likewise.
+ (mips_elf64_info_to_howto_rela): Likewise.
+ (mips_elf64_write_rel): Likewise.
+ (mips_elf64_write_rela): Likewise.
+ (mips_elf64_link_hash_newfunc): Likewise.
+ (mips_elf64_hi16_reloc): Likewise.
+ (mips_elf64_higher_reloc): Likewise.
+ (mips_elf64_highest_reloc): Likewise.
+ (mips_elf64_gprel16_reloc): Likewise.
+ (mips_elf64_gprel16_reloca): Likewise.
+ (mips_elf64_literal_reloc): Likewise.
+ (mips_elf64_gprel32_reloc): Likewise.
+ (mips_elf64_shift6_reloc): Likewise.
+ (mips_elf64_got16_reloc): Likewise.
+ (mips_elf64_assign_gp): Likewise.
+ (mips_elf64_final_gp): Likewise.
+ (gprel16_with_gp): Likewise.
+ (mips_elf64_additional_program_headers): Likewise.
+ (mips_elf64_link_hash_table_create): Likewise.
+ (mips_elf64_got_offset_from_index): Likewise.
+ (_mips_elf64_got_info): Likewise.
+ (mips_elf64_sign_extend): Likewise.
+ (mips_elf64_overflow_p): Likewise.
+ (mips_elf64_global_got_index): Likewise.
+ (mips_elf64_sort_hash_table_f): Likewise.
+ (mips_elf64_sort_hash_table): Likewise.
+ (mips_elf64_swap_msym_out): Likewise.
+ (mips_elf64_create_local_got_entry): Likewise.
+ (mips_elf64_local_got_index): Likewise.
+ (mips_elf64_got_page): Likewise.
+ (mips_elf64_got16_entry): Likewise.
+ (mips_elf64_local_relocation_p): Likewise.
+ (mips_elf64_next_relocation): Likewise.
+ (mips_elf64_create_dynamic_relocation): Likewise.
+ (mips_elf64_calculate_relocation): Likewise.
+ (mips_elf64_obtain_contents): Likewise.
+ (mips_elf64_perform_relocation): Likewise.
+ (mips_elf64_relocate_section): Likewise.
+ (mips_elf64_create_dynamic_sections): Likewise.
+ (mips_elf64_adjust_dynamic_symbol): Likewise.
+ (mips_elf64_always_size_sections): Likewise.
+ (mips_elf64_size_dynamic_sections): Likewise.
+ (mips_elf64_finish_dynamic_symbol): Likewise.
+ (mips_elf64_finish_dynamic_sections): Likewise.
+ (mips_elf64_gc_mark_hook): Likewise.
+ (mips_elf64_gc_sweep_hook): Likewise.
+ (mips_elf64_create_got_section): Likewise.
+ (mips_elf64_record_global_got_symbol): Likewise.
+ (mips_elf64_create_msym_section): Likewise.
+ (mips_elf64_allocate_dynamic_relocations): Likewise.
+ (mips_elf64_check_relocs): Likewise.
+ (mips_elf64_output_extsym): Likewise.
+ (mips_elf64_swap_gptab_in): Likewise.
+ (mips_elf64_swap_gptab_out): Likewise.
+ (gptab_compare): Likewise.
+ (mips_elf64_final_link): Likewise.
+ (prev_reloc_addend): Remenber addend of previous parts of a combined
+ reloc.
+ (ELF_MIPS_GP_OFFSET): New define.
+ (STUB_LW,STUB_MOVE,STUB_JALR,STUB_LI16): Likewise.
+ (MIPS_FUNCTION_STUB_SIZE): Likewise.
+ (mips_elf64_howto_rel): Fix HOWTO defines.
+ (mips_elf64_howto_rela): Likewise.
+ (mips_elf64_swap_reloca_out): Fix signedness.
+ (mips_elf64_be_swap_reloc_in): Use ELF64* instead of ELF32*.
+ (mips_elf64_be_swap_reloca_in): Likewise.
+ (mips_elf64_be_swap_reloc_out): Likewise. Preserve extended type info.
+ (mips_elf64_be_swap_reloca_out): Likewise.
+
+2001-12-15 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-bfd.h (_bfd_elf_maybe_strip_eh_frame_hdr): New prototype.
+ * elf-eh-frame.c (struct eh_frame_hdr_info): Add strip.
+ (_bfd_elf_discard_section_eh_frame): Don't create .eh_frame_hdr
+ sec_info here. Free ehbuf.
+ (_bfd_elf_discard_section_eh_frame_hdr): Don't size the section
+ if hdr_info->strip.
+ (_bfd_elf_maybe_strip_eh_frame_hdr): New.
+ * elflink.h (size_dynamic_sections): Call it.
+
+2001-12-14 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_bfd_discard_info): Fix segfault when dynobj NULL.
+
+2001-12-13 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-bfd.h (enum elf_link_info_type): New.
+ (struct bfd_elf_section_data): Remove stab_info and merge_info
+ fields, add sec_info and sec_info_type.
+ (struct elf_obj_tdata): Add eh_frame_hdr field.
+ (_bfd_elf_discard_section_eh_frame): New prototype.
+ (_bfd_elf_discard_section_eh_frame_hdr): Likewise.
+ (_bfd_elf_eh_frame_section_offset): Likewise.
+ (_bfd_elf_write_section_eh_frame): Likewise.
+ (_bfd_elf_write_section_eh_frame_hdr): Likewise.
+ * Makefile.am (BFD32_BACKENDS): Add elf-eh-frame.lo.
+ (BFD32_BACKENDS_CFILES): Add elf-eh-frame.c.
+ (elf-eh-frame.lo): New.
+ * Makefile.in: Rebuilt.
+ * configure.in (elf): Add elf-eh-frame.lo.
+ * configure: Rebuilt.
+ * elf.c (_bfd_elf_print_private_bfd_data): Support PT_GNU_EH_FRAME.
+ (map_sections_to_segments): Create PT_GNU_EH_FRAME if requested.
+ (get_program_header_size): Take into account PT_GNU_EH_FRAME
+ segment.
+ (_bfd_elf_rela_local_sym): Use sec_info_type and sec_info.
+ (_bfd_elf_rel_local_sym): Likewise.
+ (_bfd_elf_section_offset): Likewise. Call
+ _bfd_elf_eh_frame_section_offset too.
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Use sec_info_type and
+ sec_info.
+ * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
+ * elf-eh-frame.c: New file.
+ * elflink.h (elf_link_add_object_symbols): Don't optimize SHF_MERGE
+ .stab sections. Set sec_info_type, use sec_info instead
+ of merge_info and stab_info.
+ (elf_link_create_dynamic_sections): Create .eh_frame_hdr section
+ if --eh-frame-hdr.
+ (elf_bfd_final_link): Write .eh_frame_hdr section.
+ (elf_link_sec_merge_syms): Use sec_info_type and sec_info.
+ (elf_link_input_bfd): Likewise.
+ Call _bfd_elf_write_section_eh_frame to write .eh_frame sections.
+ (elf_bfd_discard_info): Add output_bfd argument.
+ Call _bfd_elf_discard_section_eh_frame and
+ _bfd_elf_discard_section_eh_frame_hdr.
+ (elf_section_ignore_discarded_relocs): Use sec_info_type, not section
+ names.
+ * bfd-in.h (bfd_elf32_discard_info, bfd_elf64_discard_info): Adjust
+ prototypes.
+ * bfd-in2.h (bfd_elf32_discard_info, bfd_elf64_discard_info): Likewise.
+
+2001-12-12 Richard Henderson <rth@redhat.com>
+
+ * syms.c (_bfd_generic_read_minisymbols): Early return for
+ no symbols. Patch from FreeBSD folk; exact origin unknown.
+
+2001-12-11 Alan Modra <amodra@bigpond.net.au>
+
+ * elfcode.h (elf_swap_ehdr_out): Adjust value written for e_shnum
+ and e_shstrndx if out of range.
+ (elf_object_p): Read extended values for e_shnum and e_shstrndx
+ from the first section header. Allocate space in elf_elfsections
+ for reserved sections and set to NULLs.
+ (elf_write_shdrs_and_ehdr): Set overflow fields in first section
+ header. Skip reserved sections in elf_elfsections. Remove
+ duplicate size calculation.
+
+2001-12-07 Geoffrey Keating <geoffk@redhat.com>
+ Richard Henderson <rth@redhat.com>
+ Corinna Vinschen <vinschen@redhat.com>
+
+ * Makefile.am: Add support for xstormy16.
+ * archures.c: Add support for xstormy16.
+ * config.bfd: Add support for xstormy16.
+ * configure.in: Add support for xstormy16.
+ * reloc.c: Add support for xstormy16.
+ * targets.c: Add support for xstormy16.
+ * cpu-xstormy16.c: New file.
+ * elf32-xstormy16.c: New file.
+ * Makefile.in: Regenerated.
+ * bfd-in2.h: Regenerated.
+ * configure: Regenerated.
+ * libbfd.h: Regenerated.
+
+2001-12-07 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elf.c (assign_file_positions_for_segments): Combine sentance
+ fragments into a single sentance in order to permit better
+ translation into foreign languages.
+
+2001-12-07 Jim Blandy <jimb@redhat.com>
+
+ * elf32-s390.c (elf32_s390_grok_prstatus): New function.
+ (elf_backend_grok_prstatus): Define.
+
+2001-12-07 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-sparc.c (elf32_sparc_relocate_section): Revert
+ 2001-09-14 change.
+
+2001-12-07 Jakub Jelinek <jakub@redhat.com>
+
+ * elf.c (_bfd_elf_rela_local_sym): Only call
+ _bfd_merged_section_offset if merge_info is non-NULL.
+ (_bfd_elf_rel_local_sym, _bfd_elf_section_offset): New.
+ * elf-bfd.h (_bfd_elf_rel_local_sym, _bfd_elf_section_offset): New
+ prototypes.
+ * elf32-arm.h (elf32_arm_final_link_relocate): Use
+ _bfd_elf_section_offset.
+ (elf32_arm_relocate_section): Use _bfd_elf_rel_local_sym.
+ * elf32-i386.c (elf_i386_relocate_section): Use
+ _bfd_elf_section_offset and _bfd_elf_rel_local_sym.
+ * elf32-sh.c (sh_elf_relocate_section): Likewise.
+ * elf32-sparc.c (elf32_sparc_relocate_section): Use
+ _bfd_elf_section_offset.
+ * elf32-cris.c (cris_elf_relocate_section): Likewise.
+ * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
+ * elf32-i370.c (i370_elf_relocate_section): Likewise.
+ * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+ * elf32-mips.c (mips_elf_create_dynamic_relocation): Likewise.
+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+ * elf32-s390.c (elf_s390_relocate_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Likewise.
+
+2001-12-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-hppa.c (clobber_millicode_symbols): Don't do anything if
+ already forced local.
+
+2001-12-05 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elf32-arm.h (elf32_arm_merge_private_bfd_data): Combine
+ fragmented sentence parts into a whole sentence to permit
+ better translation into foreign languages.
+
+2001-12-06 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * configure: Regenerate.
+ * Makefile.in: Regenerate.
+
+2001-12-05 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * Makefile.am: split up BFD_LIBS like statements in BFD32_LIBS and
+ BFD64_LIBS, make the latter depending on the availability of BFD64.
+ Add archive64.c source file.
+ * archive64.c: New file implementing bfd_elf64_archive_slurp_armap
+ and bfd_elf64_archive_write_armap, code from elf64-mips.c
+ * archive.c (bfd_slurp_armap): Add ELF64 archive support.
+ * config.bfd (mips*-*-irix6*): Allow with BFD64 only.
+ (mips64*el-*-linux*): Likewise.
+ (mips*el-*-linux*): Likewise. Reorder entries.
+ * configure.in (bfd_libs): Define in dependency of BFD64 and
+ AC_SUBST it.
+ * elf64-mips.c (mips_elf64_slurp_armap): Remove, use
+ bfd_elf64_archive_slurp_armap instead.
+ (mips_elf64_write_armap): Remove, use bfd_elf64_archive_write_armap
+ instead.
+
+2001-12-04 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * config.bfd: Remove trailing blanks.
+ * elf32-mips.c (gprel16_with_gp): Remove superfluous casts.
+
+2001-12-04 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-d10v.c (elf_d10v_howto_table): Adjust bit-size of
+ R_D10V_10_PCREL_L, R_D10V_10_PCREL_R, R_D10V_18,
+ R_D10V_18_PCREL. Check 10_PCREL relocations as signed.
+ Disable pointless overflow checking of NONE and 32.
+
+2001-12-04 Alan Modra <amodra@bigpond.net.au>
+
+ * reloc.c (bfd_install_relocation): Correct reloc address test.
+ (bfd_perform_relocation): Formatting fix.
+ * bfd-in2.h: Regenerate for 2001-12-02 reloc.c change.
+
+2001-12-03 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * configure.in (LINGUAS): Add tr.
+ * configure: Regenerate.
+ * po/tr.po: Import from translation project's web site.
+
+2001-12-03 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-hppa.c (hppa_get_stub_entry): Remove debug message that
+ happens to trigger on undefined symbols.
+ (final_link_relocate): Return bfd_reloc_undefined for undefined
+ stubs.
+ (elf32_hppa_relocate_section): Don't say we can't handle a reloc
+ if we have already warned about an undefined symbol.
+
+2001-12-02 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf32-mips.c (NEWABI_P): New define.
+ (USE_REL): Remove, replaced by
+ (elf_backend_may_use_rel_p): New define.
+ (elf_backend_may_use_rela_p): Likewise.
+ (elf_backend_default_use_rela_p): Likewise.
+ (elf_mips_howto_table): Rename to elf_mips_howto_table_rel.
+ Fix some relocation definitions.
+ (elf_mips_howto_table_rela): New RELA relocation definitions for
+ NewABI support.
+ (mips32_64bit_reloc): Use the renamed elf_mips_howto_table_rel.
+ (bfd_elf32_bfd_reloc_type_lookup): Likewise.
+ (mips_rtype_to_howto): Likewise.
+ (_bfd_mips_elf_relocate_section): Likewise.
+ (_bfd_mips_elf_object_p): Typo.
+ (elf_backend_sign_extend_vma): Reordered together with many other
+ defines nearby to resemble the order of declaration in the header
+ file.
+
+2001-12-02 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * coff-mips.c (mips_bfd_reloc_type_lookup): Replace
+ BFD_RELOC_MIPS_GPREL by BFD_RELOC_GPREL16.
+ * pe-mips.c (mips_bfd_reloc_type_lookup): Likewise.
+ * elf32-mips.c (mips_reloc_map): Likewise. Replace
+ BFD_RELOC_MIPS_GPREL32 by BFD_RELOC_GPREL32.
+ * elf64-mips.c (mips_reloc_map): Likewise.
+ * reloc.c (BFD_RELOC_MIPS_GPREL): Remove.
+ (BFD_RELOC_MIPS_GPREL32): Remove.
+
+2001-11-30 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_add_default_symbol): New.
+ (elf_link_add_object_symbols): Call elf_add_default_symbol ()
+ to create an indirect symbol from the default for the symbol
+ with the default version if needed.
+
+2001-11-29 "Peter.Schauer" <Peter.Schauer@regent.e-technik.tu-muenchen.de>
+
+ * elf.c (elfcore_grok_prstatus): Do not overwite the core signal
+ if it has already been set by another thread.
+
+2001-11-28 Jakub Jelinek <jakub@redhat.com>
+
+ * elf64-alpha.c (ALPHA_ELF_GOT_ENTRY_RELOCS_XLATED): Defined.
+ (elf64_alpha_relocate_section): Translate local_got_entries
+ for STT_SECTION symbol to SHF_MERGE section the first time
+ we see it.
+ * elfxx-ia64.c (struct elfNN_ia64_local_hash_entry): Add
+ sec_merge_done.
+ (get_local_sym_hash): New, extracted from get_dyn_sym_info.
+ (get_dyn_sym_info): Use it.
+ (elfNN_ia64_relocate_section): Translate local dyn entries
+ for STT_SECTION symbol to SHF_MERGE section the first time
+ we see it.
+
+2001-11-27 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_bfd_discard_info): Skip if the input bfd isn't
+ ELF.
+
+2001-11-26 Jeffrey A Law (law@cygnus.com)
+
+ * stabs.c (_bfd_discard_section_stabs): Use PARAMS in function
+ prototypes.
+
+2001-11-24 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-hppa.c (elf32_hppa_size_stubs): Decrease default stub
+ group sizes to accommodate c++.
+
+2001-11-23 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-sparc.c (elf32_sparc_relocate_section): Don't clear
+ relocations in non-alloced sections against global symbols
+ defined in shared library being built.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+
+2001-11-23 Jakub Jelinek <jakub@redhat.com>
+
+ * elf.c (_bfd_elf_rela_local_sym): New.
+ * elflink.h (elf_link_input_bfd): Don't consider empty
+ merged sections as removed in relocation tests.
+ * elf-bfd.h (_bfd_elf_rela_local_sym): Add prototype.
+ * elf32-i386.c (elf_i386_relocate_section): Handle relocs
+ against STT_SECTION symbol of SHF_MERGE section.
+ * elf32-arm.h (elf32_arm_relocate_section): Likewise.
+ * elf32-avr.c (elf32_avr_relocate_section): Call
+ _bfd_elf_rela_local_sym.
+ * elf32-cris.c (cris_elf_relocate_section): Likewise.
+ * elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
+ * elf32-fr30.c (fr30_final_link_relocate): Likewise.
+ * elf32-h8300.c (elf32_h8_relocate_section): Likewise.
+ * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
+ * elf32-i370.c (i370_elf_relocate_section): Likewise.
+ * elf32-i860.c (elf32_i860_relocate_section): Likewise.
+ * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
+ * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+ * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
+ * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+ * elf32-s390.c (elf_s390_relocate_section): Likewise.
+ * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+ * elf32-v850.c (v850_elf_relocate_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
+ * elf64-mmix.c (mmix_elf_relocate_section): Likewise.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+ * elf-hppa.h (elf_hppa_relocate_section): Likewise.
+ * elf-m10200.c (mn10200_elf_relocate_section): Likewise.
+ * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
+ * elf32-sh.c (sh_elf_relocate_section): Likewise for
+ !partial_inplace relocs. Handle relocs against STT_SECTION
+ symbol of SHF_MERGE for partial_inplace relocs.
+
+2001-11-21 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * po/Make-in (distclean): Move SRC-POTFILES.in and
+ BLD-POTFILES.in to maintainer-clean target.
+
+2001-11-21 Alan Modra <amodra@bigpond.net.au>
+
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Test r_symndx rather
+ than sym_sec->output_section to detect relocs against discarded
+ sections.
+
+2001-11-19 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_link_input_bfd): Assert r_symndx != 0 when
+ discarding relocations.
+
+2001-11-19 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * section.c (bfd_is_const_section): New macro. Return true if the
+ given seciton is one of the special, constant, sections.
+ * bfd-in2.h: Regenerate.
+ * coffgen.c (coff_count_linenumbers): Use bfd_is_const_section.
+ (coff_write_native_symbol): Use bfd_is_const_section.
+
+2001-11-19 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-hppa.c (clobber_millicode_symbols): Dec dynstr refcount.
+
+ * elf32-hppa.c (elf32_hppa_size_stubs): Don't consider undefined
+ millicode syms as candidates for import stubs.
+
+ * elf32-hppa.c (PLABEL_PLT_ENTRY_SIZE): Delete.
+ (allocate_PIC_calls): Rename to allocate_plt_static.
+ (allocate_dynrelocs): Move most of code handling .plt entries to..
+ (allocate_plt_static): ..here. Don't drop plabel entries.
+
+2001-11-19 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * mmo.c: Adjust documentation tags to use texinfo 4 features.
+
+2001-11-16 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * section.c (bfd_is_const_section): New macro. Return true if the
+ section pointer refers to one of the special, constant sections.
+ * bfd-in2.h: Regenerate.
+
+ * coffgen.c (coff_count_linenumbers): Only update the line number
+ count in non-special sections.
+ (coff_write_native_symbol): Only update the line number file
+ position in non-special sections.
+
+2001-11-15 Daniel Jacobowitz <drow@mvista.com>
+
+ * elflink.h (elf_reloc_symbol_deleted_p): Catch all relocs against
+ local syms from discarded sections. Update comment.
+
+2001-11-15 Alan Modra <amodra@bigpond.net.au>
+
+ * po/SRC-POTFILES.in: Regenerate.
+
+ * elflink.h (elf_link_input_bfd): Complain about all relocs
+ against local syms from discarded sections. K&R fixes.
+ (elf_reloc_symbol_deleted_p): Don't try to swap in external syms.
+ K&R fixes.
+
+2001-11-15 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf64-sparc.c (sparc64_elf_relocate_section): Disregard
+ overflows in the .stab section.
+
+2001-11-14 Daniel Jacobowitz <drow@mvista.com>
+
+ * bfd-in.h (bfd_elf32_discard_info): Add prototype.
+ (bfd_elf64_discard_info): Likewise.
+ * bfd-in2.h: Regenerate.
+ * elf-bfd.h (struct elf_reloc_cookie): New.
+ (struct elf_backend_data): Add elf_backend_discard_info,
+ elf_backend_ignore_discarded_relocs, and elf_backend_write_section.
+ (_bfd_elf32_reloc_symbol_deleted_p): Add prototype.
+ (_bfd_elf64_reloc_symbol_deleted_p): Likewise.
+ * elf32-mips.c (_bfd_elf32_mips_discard_info): New.
+ (_bfd_elf32_mips_ignore_discarded_relocs): New.
+ (_bfd_elf32_mips_write_section): New.
+ (elf_backend_discard_info): Define.
+ (elf_backend_ignore_discarded_relocs): Define.
+ (elf_backend_write_section): Define.
+ * elfcode.h (elf_bfd_discard_info): Define.
+ (elf_reloc_symbol_deleted_p): Define.
+ * elflink.h (elf_link_input_bfd): Check
+ elf_section_ignore_discarded_relocs. Call
+ bed->elf_backend_write_section if available.
+ (elf_reloc_symbol_deleted_p): New.
+ (elf_bfd_discard_info): New.
+ (elf_section_ignore_discarded_relocs): New.
+ * elfxx-target.h (elf_backend_discard_info): Define.
+ (elf_backend_ignore_discarded_relocs): Define.
+ (elf_backend_write_section): Define.
+ (elfNN_bed): Add elf_backend_discard_info,
+ elf_backend_ignore_discarded_relocs, and
+ elf_backend_write_section.
+ * libbfd-in.h (_bfd_discard_section_stabs): Add prototype.
+ * libbfd.h: Regenerate.
+ * stabs.c (_bfd_discard_section_stabs): New.
+
+2001-11-14 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * elf32-s390.c (elf_s390_relocate_section): Use the "unresolved_reloc"
+ scheme to get rid of an ugly complicated test.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise.
+
+2001-11-14 Andreas Jaeger <aj@suse.de>
+
+ * cpu-i386.c (bfd_x86_64_arch_intel_syntax,bfd_x86_64_arch): Use
+ x86-64 for display.
+
+2001-11-14 Jakub Jelinek <jakub@redhat.com>
+
+ * dwarf2.c (struct line_head) [total_length]: Change type to
+ bfd_vma.
+ (struct dwarf2_debug): Add dwarf_str_buffer and dwarf_str_size.
+ (struct comp_unit): Add stash and offset_size.
+ (read_8_bytes): Return bfd_vma.
+ (read_indirect_string): New.
+ (read_attribute): Handle DW_FORM_strp.
+ (decode_line_info): Support 64-bit DWARF format.
+ (_bfd_dwarf2_find_nearest_line): Likewise.
+ (parse_comp_unit): Set offset_size and stash.
+
+2001-11-13 Keith Walker <keith.walker@arm.com>
+
+ * dwarf2.c (read_attribute_value): New function to handle
+ DW_FORM_indirect.
+ (read_attribute): Use it.
+
+2001-11-13 Geoffrey Keating <geoffk@redhat.com>
+
+ * dwarf2.c (decode_line_info): Properly deal with unknown standard
+ opcodes.
+
+2001-11-13 John Marshall <jmarshall@acm.org>
+ Alan Modra <amodra@bigpond.net.au>
+
+ * section.c (bfd_make_section_anyway): Don't increment section_id
+ and the BFD's section_count if adding the section failed.
+ * vms.c (vms_new_section_hook): Adjust for bfd_make_section_anyway
+ change.
+
+2001-11-12 Orjan Friberg <orjanf@axis.com>
+
+ * elf32-cris.c (cris_elf_grok_prstatus): Adjust values to match new
+ core dump format.
+
+2001-11-11 H.J. Lu <hjl@gnu.org>
+
+ * elf32-mips.c (_bfd_mips_elf_finish_dynamic_sections): Call
+ _bfd_elf_strtab_size instead of _bfd_stringtab_size.
+
+ * elf64-sparc.c (sparc64_elf_size_dynamic_sections): Change
+ dynstr type to `struct elf_strtab_hash *'.
+
+2001-11-11 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * elf-strtab.c (_bfd_elf_strtab_finalize): Make first variable i
+ size_t. Rename second i to j.
+
+2001-11-10 Jeffrey A Law (law@cygnus.com)
+
+ * binary.c: Include safe-ctype.h after bfd.h and sysdep.h.
+
+2001-11-10 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-arm.h (elf32_arm_final_link_relocate): Don't copy STN_UNDEF
+ relocs into shared libs.
+ * elf32-cris.c (cris_elf_relocate_section): Likewise.
+ * elf32-i370.c (i370_elf_relocate_section): Likewise.
+ * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+ * elf32-mips.c (mips_elf_calculate_relocation): Likewise.
+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+ * elf32-sh.c (sh_elf_relocate_section): Likewise.
+ * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
+
+ * elf.c (bfd_section_from_r_symndx): New function.
+ * elf-bfd.h (LOCAL_SYM_CACHE_SIZE): Define.
+ (struct sym_sec_cache): New.
+ (bfd_section_from_r_symndx): Declare.
+ (struct bfd_elf_section_data): Change local_dynrel type to PTR.
+ * elflink.h (elf_link_input_bfd): Don't test for removed linkonce
+ relocs when relocatable. Don't zero entire reloc, just zero the
+ addend and sym.
+ * elf32-hppa.c (struct elf32_hppa_link_hash_table): Add sym_sec.
+ (elf32_hppa_link_hash_table_create): Init it.
+ (elf32_hppa_check_relocs): Track dynamic relocs needed for local
+ syms on a per-section basis as we do for globals.
+ (elf32_hppa_gc_sweep_hook): Update for local_dynrel change.
+ (allocate_dynrelocs): Warning fix.
+ (elf32_hppa_size_dynamic_sections): Don't allocate relocs when
+ section has been discarded.
+ (elf32_hppa_relocate_section): Don't copy STN_UNDEF relocs
+ into shared libs.
+ * elf32-i386.c (struct elf_i386_link_hash_table): Add sym_sec.
+ (elf_i386_link_hash_table_create): Init it.
+ (elf_i386_check_relocs): Track dynamic relocs needed for local
+ syms on a per-section basis as we do for globals.
+ (elf_i386_gc_sweep_hook): Update for local_dynrel change.
+ Remove dead code.
+ (allocate_dynrelocs): Warning fix.
+ (elf_i386_size_dynamic_sections): Don't allocate relocs when
+ section has been discarded.
+ (elf_i386_relocate_section): Don't copy STN_UNDEF relocs
+ into shared libs.
+ * elf32-s390.c (struct elf_s390_link_hash_table): Add sym_sec.
+ (elf_s390_link_hash_table_create): Init it.
+ (elf_s390_check_relocs): Track dynamic relocs needed for local
+ syms on a per-section basis as we do for globals.
+ (elf_s390_gc_sweep_hook): Update for local_dynrel change.
+ Remove dead code.
+ (allocate_dynrelocs): Warning fix.
+ (elf_s390_size_dynamic_sections): Don't allocate relocs when
+ section has been discarded.
+ (elf_s390_relocate_section): Don't copy STN_UNDEF relocs
+ into shared libs.
+ * elf64-ppc.c (struct ppc_link_hash_table): Add sym_sec.
+ (ppc64_link_hash_table_create): Init it.
+ (ppc64_elf_check_relocs): Track dynamic relocs needed for local
+ syms on a per-section basis as we do for globals.
+ (ppc64_elf_gc_sweep_hook): Update for local_dynrel change.
+ (allocate_dynrelocs): Call the correct record_dynamic_dymbol
+ function. Warning fix.
+ (ppc64_elf_size_dynamic_sections): Don't allocate relocs when
+ section has been discarded.
+ (ppc64_elf_relocate_section): Don't copy STN_UNDEF relocs
+ into shared libs.
+ * elf64-s390.c (struct elf_s390_link_hash_table): Add sym_sec.
+ (elf_s390_link_hash_table_create): Init it.
+ (elf_s390_check_relocs): Track dynamic relocs needed for local
+ syms on a per-section basis as we do for globals.
+ (elf_s390_gc_sweep_hook): Update for local_dynrel change.
+ Remove dead code.
+ (allocate_dynrelocs): Warning fix.
+ (elf_s390_size_dynamic_sections): Don't allocate relocs when
+ section has been discarded.
+ (elf_s390_relocate_section): Don't copy STN_UNDEF relocs
+ into shared libs.
+
+2001-11-08 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * elf32-s390: Major rework that introduces all recent changes to
+ the s390 backends. Get a closer match to elf32-i386.
+ (elf_s390_relocate_section): Make use of dynamic section short-cuts.
+ Localise vars, and delay setting. Better error reporting, replace
+ BFD_ASSERT with abort. Check ELF_LINK_HASH_DEF_DYNAMIC to see if a
+ symbol is not defined in the regular object file and tread the weak
+ definition as the normal one. Don't discard relocs for undefweak or
+ undefined symbols and check !DEF_REGULAR as well as DEF_DYNAMIC in
+ test for avoided copy relocs. Reinstate fudge for unresolved relocs
+ in debugging sections.
+ (elf32_s390_adjust_dynamic_symbol): Handle nocopyreloc. Don't do copy
+ reloc processing for weakdefs. Remove redundant casts and aborts.
+ Delay setting of vars until needed. Move creation of dynamic symbols
+ and allocation of .plt and .rela.plt to allocate_dynrelocs. Replace
+ BFD_ASSERT with abort. Discard .plt entries for everything with
+ plt.refcount <= 0.
+ (elf_s390_check_relocs): Don't allocate space for dynamic relocs,
+ .got or .relgot here but do it in allocate_dynrelocs. Reference count
+ possible .plt and .got entries. Don't test input section SEC_READONLY
+ here to try to avoid copy relocs, and keep dyn_relocs regardless of
+ ELF_LINK_NON_GOT_REF. Don't set DF_TEXTREL here. Delay setting of
+ variables until needed. Remove separate switch stmt for creating .got
+ section. Initialise local_got_refcounts to 0. Cache pointer to
+ "sreloc" section in elf_section_data. Tweak condition under which .got
+ created. Report files with bad relocation section names.
+ (elf_s390_finish_dynamic_symbol): Don't copy relocs for symbols that
+ have been forced local. Use same test to decide if we can use a
+ relative reloc for got as elf_s390_relocate_section. Expand SHN_UNDEF
+ comment. Move expressions out of function calls. Replace BFD_ASSERT
+ with abort.
+ (elf_s390_finish_dynamic_sections): Migrate common code out of switch
+ statement. Replace BFD_ASSERT with abort.
+ (elf_s390_size_dynamic_sections): Call readonly_dynrelocs. Rename "i"
+ to "ibfd". Allocate space for local dyn relocs. Use DF_TEXTREL flag
+ instead of looking up section names for DT_TEXTREL. Replace
+ BFD_ASSERT with abort. Zero out the dynamic allocated content space.
+ Add a comment to remind us that one day this ought to be fixed.
+ (struct elf_s390_link_hash_entry): Rename "root" to "elf".
+ (struct elf_s390_link_hash_table): Likewise.
+ (elf_s390_link_hash_newfunc): Rename to link_hash_newfunc and get
+ rid of unnecessary casts.
+ (struct elf_s390_dyn_relocs): Add "sec", and "pc_count" fields.
+ Remove "section" field.
+ (elf_s390_gc_sweep_hook): Sweep dyn_relocs and local_dynrel.
+ Reference count possible .plt entries. Don't deallocate .got and
+ .relgot space here.
+ (struct elf_s390_pcrel_relocs_copied): Rename to elf_s390_dyn_relocs.
+ Update comment.
+ (struct elf_s390_link_hash_entry): Rename pcrel_relocs_copied to
+ dyn_relocs.
+ (elf_s390_discard_copies): Delete.
+ (elf_s390_link_hash_traverse): Delete.
+ (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link
+ rather than gc variety).
+ (struct elf_s390_link_hash_table): Add sgot, sgotplt, srelgot, splt,
+ srelplt, sdynbss, srelbss fields.
+ (elf_s390_link_hash_table_create): Init them.
+ (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
+ (allocate_dynrelocs): New function.
+ (create_got_section): New function.
+ (elf_backend_can_refcount): Define.
+ (elf_backend_copy_indirect_symbol): Define.
+ (elf_s390_copy_indirect_symbol): New function.
+ (elf_s390_create_dynamic_sections): New function.
+ (readonly_dynrelocs): New function.
+ * elf64-s390.c: Likewise.
+
+2001-11-07 Jakub Jelinek <jakub@redhat.com>
+
+ * Makefile.am (BFD32_BACKENDS): Add elf-strtab.lo.
+ (BFD32_BACKENDS_CFILES): Add elf-strtab.c.
+ (elf-strtab.lo): Add rule.
+ * Makefile.in: Rebuilt.
+ * configure.in (elf): Add elf-strtab.lo.
+ * configure: Rebuilt.
+ * elf-bfd.h (elf_strtab_hash): Forward declare.
+ (struct elf_link_hash_table): Change dynstr type to
+ struct elf_strtab_hash *.
+ (struct elf_obj_tdata): Change strtab_ptr type to
+ struct elf_strtab_hash *.
+ (_bfd_elf_strtab_init, _bfd_elf_strtab_free, _bfd_elf_strtab_add,
+ _bfd_elf_strtab_addref, _bfd_elf_strtab_delref,
+ _bfd_elf_strtab_clear_all_refs, _bfd_elf_strtab_size,
+ _bfd_elf_strtab_offset, _bfd_elf_strtab_emit,
+ _bfd_elf_strtab_finalize): New prototypes.
+ * elf-strtab.c: New file.
+ * elflink.h (elf_link_add_object_symbols): Use _bfd_elf_strtab_add
+ and _bfd_elf_strtab_size instead of _bfd_stringtab calls.
+ Call _bfd_elf_strtab_delref if DT_NEEDED entry is not needed or
+ when forcing dynamic symbol to local.
+ (elf_link_create_dynamic_sections): Call
+ _bfd_elf_strtab_init instead of elf_stringtab_init.
+ (elf_link_record_local_dynamic_symbol): Likewise, change
+ dynstr type. Use _bfd_elf_strtab functions instead of
+ _bfd_stringtab calls.
+ (size_dynamic_sections): Use _bfd_elf_strtab functions instead of
+ _bfd_stringtab calls. For DT_RUNPATH and Verdaux vda_name fields,
+ call _bfd_elf_strtab_addref. Call elf_finalize_dynstr.
+ (elf_adjust_dynstr_offsets, elf_finalize_dynstr): New functions.
+ (elf_fix_symbol_flags): Call _bfd_elf_strtab_delref when forcing
+ dynamic symbol to local.
+ (elf_link_assign_sym_version): Likewise.
+ (elf_bfd_final_link): Call _bfd_elf_strtab_emit instead of
+ _bfd_stringtab_emit.
+ * elflink.c (_bfd_elf_link_record_dynamic_symbol): Change dynstr
+ type. Call _bfd_elf_strtab functions instead of
+ _bfd_stringtab functions.
+ * elf64-sparc.c (sparc64_elf_size_dynamic_sections): Likewise.
+ * elf.c (_bfd_elf_init_reloc_shdr): Likewise.
+ (elf_fake_sections): Likewise.
+ (assign_section_numbers): Call _bfd_elf_strtab_clear_all_refs
+ on shstrtab hash table, call _bfd_elf_strtab_addref on each section
+ name in the output. Call _bfd_elf_strtab_finalize and
+ use _bfd_elf_strtab_offset to finalize sh_name section header fields.
+ (_bfd_elf_compute_section_file_positions): Use _bfd_elf_strtab_size
+ instead of _bfd_stringtab_size.
+ (prep_headers): Change shstrtab type.
+ Use _bfd_elf_strtab calls instead of _bfd_stringtab calls.
+
+2001-11-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_link_input_bfd <removed linkonce relocs>): Fix
+ bad symtab segfault. Formatting and warning fixes. Improve
+ error message for internationalisation.
+
+2001-11-06 H.J. Lu (hjl@gnu.org)
+
+ * elflink.h (elf_link_input_bfd): Complain about relocs against
+ discarded sections.
+
+2001-11-03 Alan Modra <amodra@bigpond.net.au>
+
+ * elfxx-target.h (elfNN_bed): Correct want_got_sym, want_dynbss order.
+
+2001-11-02 H.J. Lu <hjl@gnu.org>
+
+ * elf32-mips.c (mips_elf_calculate_relocation): Don't create
+ dynamic relocation for symbols defined in regular objects when
+ creating executables.
+
+2001-11-02 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * configure.in (ALL_LINGUAS): Add "fr".
+ * configure: Regenerate.
+ * po/fr.po: New file.
+
+ * coffgen.c (coff_object_p): Add comment to H.J.'s recent patch.
+
+2001-11-02 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * som.c (setup_sections): Initialize subspace_sections.
+
+2001-11-02 H.J. Lu (hjl@gnu.org)
+
+ * coffgen.c (coff_object_p): Return 0 if the header is too big.
+
+2001-11-02 Hans-Peter Nilsson <hp@axis.com>
+
+ * elfcore.h (elf_core_file_p): Preserve and clear abfd section
+ information. Save bfd arch and mach values. Restore on error.
+
+2001-11-02 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-hppa.c (hppa_handle_PIC_calls): Rename to mark_PIC_calls.
+ (allocate_PIC_calls): New function.
+ (allocate_dynrelocs): Don't allocate pic_call plt entries here.
+ (elf32_hppa_size_dynamic_sections): Call allocate_PIC_calls.
+ (elf32_hppa_finish_dynamic_symbol): Remove dead code.
+
+2001-11-02 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf32-cris.c (cris_elf_grok_prstatus): New function.
+ (cris_elf_grok_psinfo): New function.
+ (elf_backend_grok_prstatus): Define.
+ (elf_backend_grok_psinfo): Define.
+
+2001-11-01 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_relocate_section): Correct branch
+ prediction bits.
+
+2001-10-31 Chris Demetriou <cgd@demetriou.com>
+
+ * elf32-mips.c (_bfd_mips_elf_hi16_reloc): Handle PC-relative
+ relocations properly.
+
+2001-10-31 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_link_output_extsym): Don't clear the visibility
+ field for relocateable.
+
+2001-11-01 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-hppa.c (elf32_hppa_finish_dynamic_sections): Don't count
+ .plt relocs in DT_RELASZ.
+
+2001-10-29 NIIBE Yutaka <gniibe@m17n.org>
+
+ * config.bfd: Supports sh3/sh4/sh3eb/sh4eb-unknown-linux-gnu
+ targets.
+
+2001-10-31 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * targets.c: Fix typo: bfd_mmo_mmix_vec => bfd_mmo_vec.
+
+2001-10-30 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * Makefile.am (ALL_MACHINES): Add cpu-mmix.lo.
+ (BFD64_BACKENDS): Add elf64-mmix.lo and mmo.lo.
+ (BFD64_BACKENDS_CFILES): Add elf64-mmix.c and mmo.c.
+ Regenerate dependencies.
+ * configure.in (bfd_elf64_mmix_vec, bfd_mmo_vec): New vectors.
+ * config.bfd: [BFD64] (mmix-*-*): New case.
+ * cpu-mmix.c, mmo.c, elf64-mmix.c: New files.
+ * archures.c (enum bfd_architecture): Add bfd_arch_mmix.
+ (bfd_mmix_arch): Declare.
+ (bfd_archures_list): Add bfd_mmix_arch.
+ * targets.c (enum bfd_flavour): Add bfd_target_mmo_flavour.
+ (bfd_elf64_mmix_vec, bfd_mmo_vec): Declare.
+ (bfd_target_vect) [BFD64]: Add bfd_elf64_mmix_vec and
+ bfd_mmo_mmix_vec.
+ * reloc.c: Add MMIX relocations.
+ * bfd.c (struct _bfd, tdata): Add mmo_data.
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+ * configure: Rebuild.
+
+2001-10-30 Richard Earnshaw (rearnsha@arm.com)
+
+ * elf.c (_bfd_elf_make_section_from_shdr): Set the LMA based on the
+ p_paddr of the segment that contains it.
+ (copy_private_bfd_data): If the LMA for a segment is known, use it
+ for matching sections to segments.
+ (assign_file_positions_for_segments): Use the LMA when adjusting
+ for inter-section alignment padding.
+
+2001-10-29 Kazu Hirata <kazu@hxi.com>
+
+ * README: Fix a typo.
+
+2001-10-24 Richard Henderson <rth@redhat.com>
+
+ * peXXigen.c (_bfd_XX_print_private_bfd_data_common): Copy
+ timestamp to time_t for ctime.
+
+2001-10-24 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf32-cris.c (cris_reloc_type_lookup): Change loop to use
+ unsigned, increasing index.
+
+2001-10-23 H.J. Lu <hjl@gnu.org>
+
+ * elf32-mips.c (_bfd_mips_elf_modify_segment_map): Check
+ m != NULL before accessing it.
+
+2001-10-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_link_input_bfd): Zero the reloc instead of doing
+ bfd_reloc_type_lookup (bfd, BFD_RELOC_NONE) as bfd_reloc_type_lookup
+ doesn't accept BFD_RELOC_* on some targets, eg. hppa.
+
+ * elf32-hppa.c (elf32_hppa_link_hash_entry): Remove plt_abs.
+ (hppa_link_hash_newfunc): Likewise.
+ (elf32_hppa_finish_dynamic_symbol): Likewise.
+ (allocate_dynrelocs): Always allocate .got relocs if shared.
+ (elf32_hppa_relocate_section): Output them too. Similarly
+ consolidate .plt reloc code, and no longer initialise .plt
+ when a reloc is output.
+ (elf32_hppa_finish_dynamic_symbol): Only initialise .plt entries
+ when no reloc is output.
+
+ From Herbert Xu <herbert@gondor.apana.org.au>
+ * elf32-hppa.c (final_link_relocate): Call bfd_set_error for
+ unreachable branches.
+
+2001-10-22 H.J. Lu <hjl@gnu.org>
+
+ * configure.in (WIN32LIBADD): Use -L../libiberty for
+ mips*-*-linux*.
+ * configure: Rebuild.
+
+2001-10-21 H.J. Lu <hjl@gnu.org>
+
+ * configure.in (WIN32LIBADD): Include -L../libiberty/pic -liberty
+ if shared library is enabled only for Linux hosts.
+ * configure: Rebuild.
+
+2001-10-21 H.J. Lu <hjl@gnu.org>
+
+ * configure.in (WIN32LIBADD): Check if PICFLAG is defined in
+ ../libiberty/Makefile instead of $enable_shared.
+ * configure: Rebuild.
+
+2001-10-21 H.J. Lu <hjl@gnu.org>
+
+ * elf32-cris.c (cris_reloc_type_lookup): Use int for index. Cover
+ index 0.
+
+2001-10-20 H.J. Lu <hjl@gnu.org>
+
+ * configure.in (WIN32LIBADD): Include -L../libiberty/pic -liberty
+ if shared library is enabled.
+ * configure: Rebuild.
+
+2001-10-20 H.J. Lu <hjl@gnu.org>
+
+ * elf32-cris.c (cris_reloc_type_lookup): Allow index 0.
+
+2001-10-19 H.J. Lu <hjl@gnu.org>
+
+ * elfcode.h (elf_object_p): Don't clear D_PAGED if the section
+ size is empty.
+
+2001-10-18 H.J. Lu <hjl@gnu.org>
+
+ * elf32-i370.c (i370_elf_relocate_section): Ignore R_XXX_NONE.
+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+
+2001-10-18 Jakub Jelinek <jakub@redhat.com>
+
+ * section.c (_bfd_strip_section_from_output): Don't count
+ SEC_EXCLUDE sections as references. Set SEC_EXCLUDE.
+
+2001-10-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-m10200.c (mn10200_elf_relax_section): Cast assignment to
+ Elf_Internal_Shdr.contents now that it's no longer a PTR.
+ * elf-m10300.c (mn10300_elf_relax_section): Likewise.
+ * elf32-h8300.c (elf32_h8_relax_section): Likewise.
+ * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Likewise.
+ * elf32-sh.c (sh_elf_relax_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_relax_section): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Likewise.
+ * elf.c (setup_group): Warning fixes.
+ * elflink.h (elf_link_sort_relocs): Likewise.
+ * pdp11.c (slurp_reloc_table): Likewise.
+
+2001-10-16 Jeff Holcomb <jeffh@redhat.com>
+
+ * elflink.h (elf_link_sort_relocs): Remove unnecessary pointer
+ casts.
+
+2001-10-15 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_link_input_bfd): Set type to BFD_RELOC_NONE
+ for relocations against discarded link-once section.
+
+2001-10-15 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-i386.c (elf_i386_relocate_section): Report some detail on
+ bfd_reloc_outofrange and similar errors.
+
+ * elf.c (_bfd_elf_link_hash_copy_indirect): Test ind->root.type
+ rather than ind->weakdef.
+ * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Likewise.
+ * elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise.
+ * elf32-mips.c (_bfd_mips_elf_copy_indirect_symbol): Likewise.
+ * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise.
+
+2001-10-15 Alan Modra <amodra@bigpond.net.au>
+ H.J. Lu <hjl@gnu.org>
+
+ * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Merge dyn_reloc
+ counts for aliases instead of aborting.
+ * elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise.
+ * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.
+
+ * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Set plt.offset
+ to -1 for non-function symbols.
+ * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise.
+ * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
+ * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
+ * elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_adjust_dynamic_symbol): Likewise.
+ * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Refer to
+ plt.offset instead of plt.refcount when setting to -1.
+
+2001-10-12 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elf32-arm.h (elf32_arm_relocate_section): Treat R_ARM_THM_PC22
+ like R_ARM_PC24. Include reloc number in error message about
+ unresolvable relocs.
+
+2001-10-10 Jakub Jelinek <jakub@redhat.com>
+
+ * elflink.h (elf_link_sort_cmp2): Don't mix PLT and non-PLT
+ relocations against the same symbol in .rel{,a}.dyn section.
+
+2001-10-10 Kazu Hirata <kazu@hxi.com>
+
+ * aout-encap.c: Fix comment typos.
+ * aoutx.h: Likewise.
+ * archive.c: Likewise.
+ * bout.c: Likewise.
+ * coff64-rs6000.c: Likewise.
+ * coffcode.h: Likewise.
+ * coffgen.c: Likewise.
+ * cofflink.c: Likewise.
+ * coff-mips.c: Likewise.
+ * ecoff.c: Likewise.
+ * elf32-m32r.c: Likewise.
+ * libcoff-in.h: Likewise.
+ * libecoff.h: Likewise.
+ * libxcoff.h: Likewise.
+ * nlm32-i386.c: Likewise.
+ * pdp11.c: Likewise.
+ * section.c: Likewise.
+ * som.c: Likewise.
+ * som.h: Likewise.
+ * bfd-in2.h: Regenerate.
+ * libcoff.h: Likewise.
+
+2001-10-10 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (elf_map_symbols): Don't create new section symbols; Use
+ existing section syms. Update comments.
+ (copy_private_bfd_data): Formatting fixes.
+ (elfcore_grok_win32pstatus): Likewise.
+ (swap_out_syms): Likewise. Remove unnecessary level of braces.
+
+2001-10-09 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct bfd_elf_section_data): Rename "group" to
+ "group_name".
+ (elf_group_name): Define.
+ (elf_next_in_group): Define.
+ * elf.c: Make use of elf_group_name and elf_next_in_group throughout.
+ (setup_group): Don't use sec->lineno for SHT_GROUP section to store
+ first member section; Instead use elf_next_in_group.
+ (bfd_section_from_shdr): Likewise.
+ (set_group_contents): Likewise. Use elf_section_syms, not sec->symbol.
+
+2001-10-09 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct bfd_elf_section_data): Add "group" and
+ "next_in_group". Fix gp and gp_size comments.
+ * elf.c (union elf_internal_group): New.
+ (setup_group): New function.
+ (_bfd_elf_make_section_from_shdr): Set BFD flags for SHT_GROUP.
+ Call setup_group for SHF_GROUP sections.
+ (bfd_section_from_shdr): Build a BFD section for SHT_GROUP.
+ (elf_fake_sections): Set header type for SEC_GROUP, and header
+ flags for sections in a group.
+ (set_group_contents): New function.
+ (_bfd_elf_compute_section_file_positions): Call it.
+ (assign_section_numbers): Set sh_link for SHT_GROUP.
+
+ * elflink.h (gc_mark_hook): Handle section groups.
+ * elfxx-target.h: Add SEC_GROUP to applicable_flags.
+ * section.c (SEC_GROUP): Define.
+ (struct sec): Comment fixes.
+ * bfd-in2.h: Regenerate.
+
+ * elf.c (bfd_elf_print_symbol): Formatting fix; migrate expression
+ out of function args.
+ (_bfd_elf_canonicalize_reloc): Similarly.
+ (_bfd_elf_get_symtab): Here too.
+ (_bfd_elf_canonicalize_dynamic_symtab): And here.
+ * elfcode.h (elf_slurp_symbol_table): Don't recalculate size for
+ bfd_bread, and remove unnecessary cast.
+
+2001-10-08 Aldy Hernandez <aldyh@redhat.com>
+
+ * bfd/config.bfd (targ_cpu): Add arm9e-*-elf.
+
+2001-10-06 Stephane Carrez <Stephane.Carrez@worldnet.fr>
+
+ * dwarf2.c (comp_unit_find_nearest_line): Check for end of
+ compilation unit.
+
+2001-10-06 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd.c (bfd_assert): Report bfd version.
+ (_bfd_abort): Likewise.
+
+ * elflink.h (elf_link_input_bfd): Don't zero discarded link-once
+ section sym values. Instead replace any relocs against them with
+ relocs against STN_UNDEF, which has a zero value.
+
+ * elf32-arc.c (elf_arc_howto_table): Set partial_inplace for all
+ relocs.
+
+2001-10-05 Jeff Law <law@redhat.com>
+
+ * som.h (som_exec_data): New field "version_id".
+ * som.c (som_object_setup): Record the version_id if it
+ exists.
+ (som_prep_headers): Do not initialize version_id here.
+ (som_finish_writing): Initialize version_id here.
+
+2000-10-05 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf32-mips.c (elf_mips_howto_table): Fix some relocation howtos
+ according to the MIPS/SGI ELF64 ABI Draft.
+ (mips_elf_sort_hash_table): Typo.
+
+2001-10-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-mips.c (_bfd_mips_elf_copy_indirect_symbol): Comment typo.
+
+ * elf32-mips.c (_bfd_mips_elf_copy_indirect_symbol): Bail out after
+ copying flags if this is a weakdef.
+
+2001-10-04 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_link_hash_entry): Reorganise for better
+ packing.
+
+ * elf32-mips.c (mips_elf_record_global_got_symbol): Set got.offset
+ to 1 rather than 0 to avoid confusing copy_indirect_symbol.
+ (mips_elf_sort_hash_table_f): Compare got.offset against 1.
+
+ * Makefile.am (BFD_H_DEPS): Add symcat.h. Ensure everything
+ depends on $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS), not just those
+ backends we configure. Run "make dep-am".
+ (install-data-local): Install symcat.h.
+ * dep-in.sed: Remove symcat.h from dependencies.
+ * Makefile.in: Regenerate.
+
+2001-10-03 Vassili Karpov <malc@pulsesoft.com>
+
+ * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Handle nocopyreloc.
+
+2001-10-03 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf64-mips.c (elf_backend_may_use_rela_p): New define.
+ (elf_backend_default_use_rela_p): New define.
+
+2001-10-03 Alan Modra <amodra@bigpond.net.au>
+
+ * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Fix typos in last
+ change.
+
+ * configure.in (AC_OUTPUT <bfd-in3.h>): Remove version.h.
+ * configure: Regenerate.
+ * Makefile.am (BFD_H_FILES): Add version.h.
+ * Makefile.in: Regenerate.
+ * po/SRC-POTFILES.in: Regenerate.
+
+ * elflink.h (elf_fix_symbol_flags): Copy flags to weakdef using
+ elf_backend_copy_indirect_symbol so that backend has a chance to
+ copy other necessary fields.
+ * elf-bfd.h (struct elf_backend_data): Update description of
+ elf_backend_copy_indirect_symbol.
+ * elf.c (_bfd_elf_link_hash_copy_indirect): Bail out after
+ copying flags if this is a weakdef.
+ * elfxx-ia64.c (elfNN_ia64_hash_copy_indirect): Likewise.
+ (elfNN_ia64_aix_add_symbol_hook): Use elf_link_hash_lookup rather
+ than bfd_link_hash_lookup.
+ * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Don't do copy
+ reloc processing for weakdefs.
+ * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise.
+ * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
+
+2001-10-02 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (ppc64_elf_check_relocs): Use a local var and cast
+ result of ELF64_R_TYPE to enum before using in a switch.
+ (ppc64_elf_gc_mark_hook): Likewise.
+ (ppc64_elf_gc_sweep_hook): Likewise.
+ (ppc64_elf_reloc_type_class): Likewise.
+
+2001-10-02 Alan Modra <amodra@bigpond.net.au>
+
+ * version.h: New file.
+ * bfd-in.h: (BFD_VERSION): Substitute bfd_version.
+ (BFD_VERSION_DATE): Define.
+ (BFD_VERSION_STRING): Define.
+ * configure.in: AC_SUBST bfd_version, bfd_version_date and
+ bfd_version_string.
+ (AC_OUTPUT <bfd-in3.h>): Depend on version.h.
+ * bfd-in2.h: Regenerate.
+ * configure: Regenerate.
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+ * bfd-in.h: Include "symcat.h".
+ (CONCAT4): Redefine as for old CAT4.
+ * aout-arm.c: Use equivalent CONCAT* macro in place of CAT* macros.
+ Add warning regarding whitespace.
+ * aout-cris.c: Likewise.
+ * aout-ns32k.c: Likewise.
+ * aout-sparcle.c: Likewise.
+ * aout-tic30.c: Likewise.
+ * aout0.c: Likewise.
+ * armnetbsd.c: Likewise.
+ * demo64.c: Likewise.
+ * elf-bfd.h: Likewise.
+ * gen-aout.c: Likewise.
+ * host-aout.c: Likewise.
+ * hp300bsd.c: Likewise.
+ * hp300hpux.c: Likewise.
+ * i386aout.c: Likewise.
+ * i386bsd.c: Likewise.
+ * i386dynix.c: Likewise.
+ * i386freebsd.c: Likewise.
+ * i386linux.c: Likewise.
+ * i386lynx.c: Likewise.
+ * i386mach3.c: Likewise.
+ * i386netbsd.c: Likewise.
+ * libaout.h: Likewise.
+ * m68k4knetbsd.c: Likewise.
+ * m68klinux.c: Likewise.
+ * m68klynx.c: Likewise.
+ * m68knetbsd.c: Likewise.
+ * m88kmach3.c: Likewise.
+ * mipsbsd.c: Likewise.
+ * newsos3.c: Likewise.
+ * ns32knetbsd.c: Likewise.
+ * pc532-mach.c: Likewise.
+ * pdp11.c: Likewise.
+ * riscix.c: Likewise.
+ * sparclinux.c: Likewise.
+ * sparclynx.c: Likewise.
+ * sparcnetbsd.c: Likewise.
+ * sunos.c: Likewise.
+ * targets.c: Likewise.
+ * vaxnetbsd.c: Likewise.
+ * vms-hdr.c: Likewise.
+
+2001-10-01 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd-in.h: Remove comments regarding generated files.
+ * libbfd-in.h: Likewise.
+ * libcoff-in.h: Likewise.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Likewise.
+ * libcoff.h: Likewise.
+
+2001-09-30 kaz Kojima <kkojima@rr.iij4u.or.jp>
+ Hans-Peter Nilsson <hp@bitrange.com>
+
+ * elf32-sh.c (sh_elf_howto_table, R_SH_REL32): Make
+ partial_inplace, matching assembler output. Set src_mask to
+ all ones.
+ (sh_elf_relocate_section): Delete misplaced comment.
+ For relocatable linking against section symbol, call
+ _bfd_relocate_contents for partial_inplace relocs and adjust
+ rel->r_addend for others.
+ <case R_SH_DIR32, R_SH_REL32>: Fetch partial_inplace addend with
+ bfd_get_32, not at rel->r_addend.
+
+2001-09-30 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (_bfd_elf_link_hash_copy_indirect): Set ind refcounts to
+ the old dir refcount, so we indirectly set them to init_refcount.
+ Short-circuit asserts when we've just verified they are true.
+
+2001-09-29 Alan Modra <amodra@bigpond.net.au>
+
+ * section.c (struct sec): Remove kept_section.
+ (STD_SECTION): Remove kept_section initialisation.
+ (bfd_make_section_anyway): Here too.
+ * ecoff.c (bfd_debug_section): Remove kept_section initialisation.
+ * cofflink.c (_bfd_coff_link_input_bfd): Don't test kept_section.
+ * elflink.h (elf_link_input_bfd): Set discarded link-once section
+ symbols to zero, and remove all code involved with kept_section
+ and tracking section symbol values.
+ * bfd-in2.h: Regenerate.
+ * configure.in: Bump version number.
+ * configure: Regenerate.
+
+2001-09-29 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-ppc.c (struct ppc_dyn_relocs): New.
+ (IS_ABSOLUTE_RELOC): Define.
+ (struct ppc_link_hash_entry): New.
+ (struct ppc_link_hash_table): New.
+ (ppc_hash_table): Define.
+ (link_hash_newfunc): New function.
+ (ppc64_elf_link_hash_table_create): New function.
+ (create_got_section): New function.
+ (ppc64_elf_create_dynamic_sections): Call create_got_section. Stash
+ pointers to our dynamic sections in hash table.
+ (ppc64_elf_copy_indirect_symbol): New function.
+ (ppc64_elf_check_relocs): Remove DEBUG code. Use short-cuts to
+ dynamic sections. Localise vars. Modify code for refcounts
+ starting from zero. Don't allocate here, or force symbols dynamic.
+ Don't copy all relocs if shared, select ones we need. Add code
+ to track possible copy relocs for non-shared link.
+ (ppc64_elf_gc_mark_hook): Update comment.
+ (ppc64_elf_gc_sweep_hook): Sweep dynrelocs too.
+ (ppc64_elf_adjust_dynamic_symbol): Remove DEBUG code. Rewrite .plt
+ code for reference counting garbage collection. Don't create .plt
+ entries for functions that don't comply with ABI naming convention,
+ and don't allocate .plt space here. Use short-cuts to dynamic
+ sections. If possible, keep dynamic relocations instead of using
+ copy relocs. Remove confused comments.
+ (ppc_adjust_dynindx): Delete.
+ (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
+ (allocate_dynrelocs): New function.
+ (readonly_dynrelocs): New function.
+ (ppc64_elf_size_dynamic_sections): Rewrite. Allocate local .got
+ space here, and call allocate_dynrelocs to allocate space for
+ global .plt, .got and reloc sections. Use short-cuts to dynamic
+ sections. Call readonly_dynrelocs to determine whether we need
+ DT_TEXTREL. Don't generate section symbols here, the generic
+ ELF linker code does it for us.
+ (ppc64_elf_final_link): Call regular ELF backend linker rather than
+ gc variety, since we do our own .got handling.
+ (ppc64_elf_relocate_section): Remove DEBUG code. Make use of
+ dynamic section short-cuts. Localise vars, and delay setting.
+ Handle unknown relocs in main switch statement. Replace ugly
+ complicated tests for unresolvable relocs with a simple direct
+ scheme using "unresolved_reloc" var. Test ELF_ST_VISIBILITY
+ before allowing an undefined sym in a shared lib. Do R_*_DS tests
+ after main switch, when we've set addend. Do non-addend insn
+ tweaks before main swithc. Ignore input_section->vma when
+ calculating reloc offsets as it's always zero. Rewrite dynamic
+ reloc handling. Consolidate R_*_HA handling. Handle more relocs.
+ (ppc64_elf_finish_dynamic_symbol): Remove DEBUG code. Make use
+ of dynamic section short-cuts. Reorganise .plt handling code.
+ Remove confused comments. Take note of ELF_LINK_FORCED_LOCAL.
+ Move expressions out of swap_reloca_out function calls.
+ (ppc64_elf_reloc_type_class): New function.
+ (ppc64_elf_info_to_howto): Move common expression to local var.
+ (ppc64_elf_finish_dynamic_sections): Remove DEBUG code. Make use
+ of dynamic section short-cuts. Don't fiddle with section syms
+ here as the ELF linker does it for us.
+ (elf_backend_can_refcount): Define.
+ (bfd_elf64_bfd_link_hash_table_create): Define.
+ (elf_backend_copy_indirect_symbol): Define.
+ (elf_backend_reloc_type_class): Define.
+ (elf_backend_*, bfd_elf64_bfd_* defines): Sort.
+
+2001-09-29 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_link_local_dynamic_entry): Add init_refcount.
+ (struct elf_backend_data): Add can_refcount.
+ * elf.c (_bfd_elf_link_hash_newfunc): Get rid of a few casts. Set
+ got.refcount and plt.refcount from init_refcount.
+ (_bfd_elf_link_hash_table_init): Set up init_refcount.
+ (_bfd_elf_link_hash_copy_indirect): Reference got/plt.refcount
+ rather than got/plt.offset, and test for <= 0 rather than -1.
+ * elflink.h (size_dynamic_sections): Set init_refcount to -1.
+ * elfxx-target.h (elf_backend_can_refcount): Define.
+ (elfNN_bed): Init can_refcount.
+ * linker.c (_bfd_link_hash_newfunc): Get rid of a few casts.
+ (_bfd_generic_link_hash_newfunc): Likewise.
+ * elf32-cris.c (cris_elf_check_relocs): Modify for refcounts
+ starting from zero.
+ (elf_backend_can_refcount): Define.
+ * elf32-hppa.c (elf32_hppa_check_relocs): Modify for refcounts
+ starting from zero.
+ (elf32_hppa_copy_indirect_symbol): Make static to agree with
+ prototype.
+ (elf_backend_can_refcount): Define.
+ * elf32-i386.c (elf_i386_check_relocs): Modify for refcounts
+ starting from zero.
+ (allocate_dynrelocs): Set plt/got.offset rather than *.refcount.
+ (elf_i386_finish_dynamic_symbol): Expand SHN_UNDEF comment.
+ (elf_i386_finish_dynamic_sections): Use local var so line < 80 chars.
+ (elf_backend_can_refcount): Define.
+ (elf_i386_copy_indirect_symbol): Make static to agree with
+ prototype. Formatting fix.
+ * elf32-m68k.c (elf_m68k_check_relocs): Modify for refcounts
+ starting from zero.
+ (elf_backend_can_refcount): Define.
+ * elf32-ppc.c (ppc_elf_check_relocs): Modify for refcounts
+ starting from zero.
+ (elf_backend_can_refcount): Define.
+ * elf32-s390.c (elf_s390_check_relocs): Modify for refcounts
+ starting from zero.
+ (elf_backend_can_refcount): Define.
+ * elf64-s390.c (elf_s390_check_relocs): Modify for refcounts
+ starting from zero.
+ (elf_backend_can_refcount): Define.
+ * elf64-x86-64.c (elf64_x86_64_check_relocs): Modify for refcounts
+ starting from zero.
+ (elf_backend_can_refcount): Define.
+
+ * som.c (som_write_symbol_strings): Cast current_offset in
+ bfd_seek call to match param type.
+
+2001-09-28 J. Brobecker <brobecker@gnat.com>
+
+ * som.c (som_write_symbol_strings): Fix incorrect type of
+ current_offset to match the function definition. Fixes a build
+ failure on HPUX-11.00.
+
+2001-09-28 Richard Henderson <rth@redhat.com>
+
+ * elfxx-target.h [section_flags]: Add SEC_ARCH_BIT_0, SEC_SMALL_DATA,
+ SEC_MERGE, SEC_STRINGS.
+
+ * section.c (SEC_ARCH_BIT_0): New; replace unused SEC_BALIGN.
+ * bfd-in2.h: Rebuild.
+
+2001-09-28 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-x86-64.c (elf64_x86_64_reloc_type_lookup): Don't map bfd
+ reloc code using x86_64_reloc_map.
+
+ * elf32-hppa.c (elf32_hppa_check_relocs): Update comment since we
+ no longer allocate here. Localise some vars to blocks where they
+ are used.
+ (elf32_hppa_adjust_dynamic_symbol): Correct a comment. Delay
+ setting of vars until needed.
+ (allocate_dynrelocs): Don't create a .plt entry without a reloc
+ when symbol visibilty makes a function local.
+ (elf32_hppa_finish_dynamic_symbol): Move expressions out of
+ swap_reloca_out function calls.
+ (elf32_hppa_relocate_section): Likewies. Comment typo fix.
+ (elf32_hppa_finish_dynamic_sections): Migrate common code out of
+ switch statement.
+
+ * elf32-i386.c (elf_i386_check_relocs): Update comment since we
+ no longer allocate here. Localise some vars to blocks where they
+ are used. Remove separate switch stmt for creating .got sec.
+ (elf_i386_adjust_dynamic_symbol): Correct a comment. Remove
+ redundant casts and aborts. Delay setting of vars until needed.
+ (allocate_dynrelocs): Remove redundant casts and aborts.
+ (elf_i386_size_dynamic_sections): Move comment.
+ (elf_i386_finish_dynamic_symbol): Move expressions out of function
+ calls.
+ (elf_i386_relocate_section): Likewise. Comment typo fix.
+ (elf_i386_finish_dynamic_sections): Migrate common code out of
+ switch statement.
+ (elf_backend_* defines): Sort.
+
+ * elf32-i386.c (allocate_dynrelocs): Don't create a .plt entry
+ without a reloc when symbol visibilty makes a function local.
+
+2001-09-27 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elf32-arm.h (elf32_arm_merge_private_bfd_data): Fix detection of
+ conflicting float flags.
+
+2001-09-26 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-i386 (elf_i386_copy_indirect_symbol): New function.
+ (elf_backend_copy_indirect_symbol): Define.
+ (struct elf_i386_link_hash_entry): Rename "root" to "elf".
+ (struct elf_i386_link_hash_table): Likewise.
+ (link_hash_newfunc): Get rid of unnecessary casts.
+ (elf_i386_link_hash_table_create): Likewise.
+ (elf_i386_check_relocs): Initialise local_got_refcounts to 0.
+ Don't test input section SEC_READONLY here to try to avoid copy
+ relocs, and keep dyn_relocs regardleas of ELF_LINK_NON_GOT_REF.
+ (elf_i386_adjust_dynamic_symbol): Check output section SEC_READONLY
+ here to properly test whether we need copy relocs. Do so for weak
+ syms too.
+
+ * elf32-hppa (elf32_hppa_copy_indirect_symbol): New function.
+ (elf_backend_copy_indirect_symbol): Define.
+ (struct elf32_hppa_link_hash_table): Rename "root" to "elf".
+ (stub_hash_newfunc): Get rid of unnecessary casts.
+ (hppa_link_hash_newfunc): Likewise.
+ (elf32_hppa_check_relocs): Initialise local_got_refcounts to 0.
+ Don't test input section SEC_READONLY here to try to avoid copy
+ relocs, and keep dyn_relocs regardleas of ELF_LINK_NON_GOT_REF.
+ (elf32_hppa_adjust_dynamic_symbol): Check output section SEC_READONLY
+ here to properly test whether we need copy relocs. Do so for weak
+ syms too.
+
+2001-09-26 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd.c (_bfd_default_error_handlerl): Define using VPARAMS,
+ VA_OPEN, VA_FIXEDARG, VA_CLOSE.
+ (bfd_archive_filename): Cast bfd_malloc arg to the correct size.
+
+2001-09-25 Jakub Jelinek <jakub@redhat.com>
+
+ * elf64-sparc.c (sparc64_elf_build_plt): Fix .plt[32768+] slot
+ computation.
+
+2001-09-25 H.J. Lu <hjl@gnu.org>
+
+ * bfd-in2.h: Regenerated.
+
+2001-09-25 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-i386.c: Add comment re linker function names and ordering.
+ (elf_i386_link_hash_newfunc): Rename to link_hash_newfunc.
+ (elf_i386_grok_prstatus): Move before linker functions.
+ (elf_i386_grok_psinfo): Likewise.
+ (elf_i386_fake_sections): Move so that functions are ordered.
+ (elf_i386_reloc_type_class): Likewise. Comment function purpose.
+
+2001-09-25 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-hppa.c: Rename occurrences of "hplink" to "htab"
+ throughout file.
+
+ * elf32-hppa.c: (LONG_BRANCH_PIC_IN_SHLIB): Delete. Remove all
+ code handling this option.
+ (LONG_BRANCH_VIA_PLT): Likewise.
+ (RELATIVE_DYNRELOCS): Define as zero.
+ (struct elf32_hppa_dyn_reloc_entry): Add "sec", and
+ "pc_count" fields. Remove "section" field.
+ (elf32_hppa_link_hash_entry): Rename reloc_entries to dyn_relocs.
+ (elf32_hppa_check_relocs): Don't allocate space for dynamic
+ relocs here. Instead, record all needed dynamic relocs via
+ dyn_relocs and local_dynrel. Cache pointer to "sreloc" section
+ in elf_section_data.
+ (elf32_hppa_gc_sweep_hook): Sweep dyn_relocs and local_dynrel.
+ (allocate_plt_and_got_and_discard_relocs): Rename to
+ allocate_dynrelocs. Allocate rather than discarding dyn relocs.
+ (readonly_dynrelocs): New function.
+ (elf32_hppa_size_dynamic_sections): Mark output_bfd unused.
+ Call readonly_dynrelocs to determine need for DT_TEXTREL.
+ Rename "i" to "ibfd". Allocate space for local dyn relocs.
+ (elf32_hppa_relocate_section): Make use of cached sreloc.
+ (elf32_hppa_reloc_type_class): New function.
+ (elf_backend_reloc_type_class): Define.
+
+2001-09-25 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct bfd_elf_section_data): Add "local_dynrel"
+ and "sreloc" fields.
+ * elf32-i386.c (struct elf_i386_dyn_relocs): Add "sec", and
+ "pc_count" fields. Remove "section" field.
+ (elf_i386_check_relocs): Don't set DF_TEXTREL here. Don't
+ allocate space for dynamic relocs here. Instead, record all
+ needed dynamic relocs via dyn_relocs and local_dynrel. Cache
+ pointer to "sreloc" section in elf_section_data.
+ (elf_i386_gc_sweep_hook): Sweep dyn_relocs and local_dynrel.
+ (allocate_plt_and_got_and_discard_relocs): Rename to
+ allocate_dynrelocs. Allocate rather than discarding dyn relocs.
+ (readonly_dynrelocs): New function.
+ (elf_i386_size_dynamic_sections): Call readonly_dynrelocs.
+ Rename "i" to "ibfd". Allocate space for local dyn relocs.
+ (elf_i386_relocate_section): Make use of cached sreloc.
+
+2001-09-24 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (elf_backend_reloc_type_class): Pass in the entire
+ reloc rather than just the type.
+ (_bfd_elf_reloc_type_class): Likewise.
+ * elf.c (_bfd_elf_reloc_type_class): Likewise.
+ * elf32-arm.h (elf32_arm_reloc_type_class): Likewise.
+ * elf32-cris.c (elf_cris_reloc_type_class): Likewise.
+ * elf32-i386.c (elf_i386_reloc_type_class): Likewise.
+ * elf32-m68k.c (elf32_m68k_reloc_type_class): Likewise.
+ * elf32-ppc.c (ppc_elf_reloc_type_class): Likewise.
+ * elf32-s390.c (elf_s390_reloc_type_class): Likewise.
+ * elf32-sh.c (sh_elf_reloc_type_class): Likewise.
+ * elf32-sparc.c (elf32_sparc_reloc_type_class): Likewise.
+ * elf64-alpha.c (elf64_alpha_reloc_type_class): Likewise.
+ * elf64-s390.c (elf_s390_reloc_type_class): Likewise.
+ * elf64-sparc.c (sparc64_elf_reloc_type_class): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_reloc_type_class): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_reloc_type_class): Likewise.
+ * elflink.h: Formatting fixes.
+ (elf_link_sort_relocs): Make "count" and "size" bfd_size_type.
+ Call bfd_zmalloc rather than calloc. Remove unnecessary cast of
+ o->contents to PTR. Update call to elf_backend_reloc_type_class.
+
+2001-09-22 John Reiser <jreiser@BitWagon.com>
+
+ * elfcode.h (elf_object_p): Allow for no section header at all in
+ non-ET_REL files. Honor 0 for e_shnum, e_shstrndx, e_shoff.
+
+2001-09-21 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elfxx-ia64.c: Fix compile time warning messages.
+ * coff-mcore.c: Fix compile time warning messages.
+ * coff-ppc.c: Fix compile time warning messages.
+ * coffcode.h: Fix compile time warning messages.
+ * elf32-mips.c: Fix compile time warning messages.
+ * elf64-alpha.c: Fix compile time warning messages.
+ * libbfd.c: Fix compile time warning messages.
+ * bfd-in2.h: Regenerate.
+
+2001-09-21 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+ * aoutx.h: Formatting fixes.
+ * merge.c (_bfd_merged_section_offset): Break line at 80 chars.
+
+ * linker.c: Replace bfd_get_filename with bfd_archive_filename
+ in error message.
+
+2001-09-21 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd.c (bfd_archive_filename): New function.
+ * bfd-in2.h: Regenerate.
+ * aout-adobe.c: Replace bfd_get_filename with bfd_archive_filename
+ in error messages where the bfd is an input bfd.
+ * aout-cris.c: Likewise.
+ * coff-arm.c: Likewise.
+ * coff-mcore.c: Likewise.
+ * coff-ppc.c: Likewise.
+ * coff-rs6000.c: Likewise.
+ * coff-sh.c: Likewise.
+ * coff-tic54x.c: Likewise.
+ * coff-tic80.c: Likewise.
+ * coff64-rs6000.c: Likewise.
+ * coffcode.h: Likewise.
+ * coffgen.c: Likewise.
+ * cofflink.c: Likewise.
+ * ecofflink.c: Likewise.
+ * elf-hppa.h: Likewise.
+ * elf.c: Likewise.
+ * elf32-arm.h: Likewise.
+ * elf32-cris.c: Likewise.
+ * elf32-gen.c: Likewise.
+ * elf32-hppa.c: Likewise.
+ * elf32-i370.c: Likewise.
+ * elf32-i386.c: Likewise.
+ * elf32-m32r.c: Likewise.
+ * elf32-mcore.c: Likewise.
+ * elf32-mips.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-s390.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-sparc.c: Likewise.
+ * elf32-v850.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-gen.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-s390.c: Likewise.
+ * elf64-sparc.c: Likewise.
+ * elf64-x86-64.c: Likewise.
+ * elflink.h: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * ieee.c: Likewise.
+ * ihex.c: Likewise.
+ * libbfd.c: Likewise.
+ * pdp11.c: Likewise.
+ * pe-mips.c: Likewise.
+ * peicode.h: Likewise.
+ * srec.c: Likewise.
+ * xcofflink.c: Likewise.
+
+ * elf32-arm.h: Make _bfd_error_handler calls K&R compatible.
+
+ * elflink.c (_bfd_elf_create_linker_section): Better grammar for
+ error message.
+
+ * coff-mcore.c (coff_mcore_relocate_section): Internalionalise
+ error message.
+
+ * elf64-sparc.c (sparc64_elf_add_symbol_hook): Constify stt_types.
+ Consolidate error messages, and split long messages to two lines.
+
+2001-09-20 John Reiser <jreiser@BitWagon.com>
+
+ * elf32-i386.c (elf_i386_relocate_section): Coordinate info->symbolic
+ and info->allow_shlib_undefined.
+ * elf32-cris.c: Likewise.
+ * elf32-hppa.c: Likewise.
+ * elf32-m68k.c: Likewise.
+ * elf32-mips.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-s390.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-sparc.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-hppa.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-s390.c: Likewise.
+ * elf64-sparc.c: Likewise.
+ * elf64-x86-64.c: Likewise.
+ * elfxx-ia64.c: Likewise.
+
+2001-09-18 Bruno Haible <haible@clisp.cons.org>
+
+ * aoutx.h: Include "safe-ctype.h" instead of <ctype.h>.
+ (aout_link_write_symbols): Use ISDIGIT instead of isdigit.
+ * archive.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (_bfd_generic_read_ar_hdr_mag): Use ISDIGIT instead of isdigit.
+ * archures.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (bfd_default_scan): Use ISDIGIT instead of isdigit.
+ * bfd.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (bfd_scan_vma): Use ISXDIGIT/ISDIGIT/ISLOWER instead of
+ isxdigit/isdigit/islower.
+ * binary.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (mangle_name): Use ISALNUM instead of isalnum.
+ * cpu-v850.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (scan): Use ISDIGIT instead of isdigit.
+ * hosts/alphavms.h: Don't include <ctype.h>.
+ * ieee.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (ieee_object_p): Use TOUPPER instead of toupper.
+ * ihex.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (ihex_bad_byte): Use ISPRINT instead of isprint.
+ * merge.c: Don't include <ctype.h>.
+ * oasys.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (oasys_write_sections): Use ISDIGIT instead of isdigit.
+ * pdp11.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (aout_link_write_symbols): Use ISDIGIT instead of isdigit.
+ * ppcboot.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (mangle_name): Use ISALNUM instead of isalnum.
+ * som.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (som_set_reloc_info): Use ISUPPER/ISLOWER/ISDIGIT instead of
+ isupper/islower/isdigit.
+ (som_decode_symclass): Use TOUPPER instead of toupper.
+ * srec.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (srec_bad_byte): Use ISPRINT instead of isprint.
+ (srec_scan): Use ISSPACE instead of isspace.
+ * stabs.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (_bfd_link_section_stabs): Use ISDIGIT instead of isdigit.
+ * syms.c: Include "safe-ctype.h"
+ (islower, toupper): Remove macro definitions.
+ (bfd_decode_symclass): Use TOUPPER instead of toupper.
+ * vms-gsd.c: Don't include <ctype.h>.
+ * vms-hdr.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (_bfd_vms_write_hdr): Use ISLOWER/TOUPPER instead of
+ islower/toupper.
+ * vms-tir.c: Don't include <ctype.h>.
+
+2001-09-18 Alan Modra <amodra@bigpond.net.au>
+
+ * libbfd.c (bfd_bread): New function replacing bfd_read without
+ redundant params. Allow reads up to (size_t) -2 in length.
+ (bfd_bwrite): Similarly for bfd_write.
+ (real_read): Return a size_t.
+ (bfd_read): Call bfd_bread.
+ (bfd_write): Call bfd_bwrite.
+ (warn_deprecated): New function to annoy everybody.
+ (bfd_get_file_window): Don't call bfd_set_error unnecessarily.
+ * bfd-in.h (bfd_bread, bfd_bwrite, warn_deprecated): Declare.
+ (bfd_read, bfd_write): Define as macro.
+ * aix386-core.c: Replace calls to bfd_read with bfd_bread, and
+ likewise for bfd_write. Ensure function args are correct size by
+ using casts or local vars. In some cases, remove unnecessary
+ casts. Formatting fixes, in some cases removing a large expression
+ from function args by using a local var. Replace CONST with const.
+ Modify variable types to avoid warings. Use casts to avoid
+ warnings when using negative numbers in unsigned expressions.
+ * aout-adobe.c: Likewise.
+ * aout-arm.c: Likewise.
+ * aout-cris.c: Likewise.
+ * aout-encap.c: Likewise.
+ * aout-ns32k.c: Likewise.
+ * aout-target.h: Likewise.
+ * aout-tic30.c: Likewise.
+ * aoutf1.h: Likewise.
+ * aoutx.h: Likewise.
+ * archive.c: Likewise.
+ * archures.c: Likewise.
+ * bfd-in.h: Likewise.
+ * bfd.c: Likewise.
+ * binary.c: Likewise.
+ * bout.c: Likewise.
+ * cache.c: Likewise.
+ * cisco-core.c: Likewise.
+ * coff-a29k.c: Likewise.
+ * coff-alpha.c: Likewise.
+ * coff-arm.c: Likewise.
+ * coff-h8300.c: Likewise.
+ * coff-h8500.c: Likewise.
+ * coff-i386.c: Likewise.
+ * coff-i860.c: Likewise.
+ * coff-i960.c: Likewise.
+ * coff-ia64.c: Likewise.
+ * coff-m68k.c: Likewise.
+ * coff-m88k.c: Likewise.
+ * coff-mcore.c: Likewise.
+ * coff-mips.c: Likewise.
+ * coff-ppc.c: Likewise.
+ * coff-rs6000.c: Likewise.
+ * coff-sh.c: Likewise.
+ * coff-sparc.c: Likewise.
+ * coff-stgo32.c: Likewise.
+ * coff-tic30.c: Likewise.
+ * coff-tic54x.c: Likewise.
+ * coff-tic80.c: Likewise.
+ * coff-w65.c: Likewise.
+ * coff-z8k.c: Likewise.
+ * coff64-rs6000.c: Likewise.
+ * coffcode.h: Likewise.
+ * coffgen.c: Likewise.
+ * cofflink.c: Likewise.
+ * coffswap.h: Likewise.
+ * corefile.c: Likewise.
+ * cpu-arc.c: Likewise.
+ * cpu-h8300.c: Likewise.
+ * cpu-h8500.c: Likewise.
+ * cpu-i960.c: Likewise.
+ * cpu-ia64-opc.c: Likewise.
+ * cpu-ns32k.c: Likewise.
+ * cpu-pdp11.c: Likewise.
+ * cpu-pj.c: Likewise.
+ * cpu-sh.c: Likewise.
+ * cpu-w65.c: Likewise.
+ * cpu-z8k.c: Likewise.
+ * dwarf1.c: Likewise.
+ * dwarf2.c: Likewise.
+ * ecoff.c: Likewise.
+ * ecofflink.c: Likewise.
+ * ecoffswap.h: Likewise.
+ * elf-bfd.h: Likewise.
+ * elf-hppa.h: Likewise.
+ * elf-m10200.c: Likewise.
+ * elf-m10300.c: Likewise.
+ * elf.c: Likewise.
+ * elf32-arc.c: Likewise.
+ * elf32-arm.h: Likewise.
+ * elf32-avr.c: Likewise.
+ * elf32-cris.c: Likewise.
+ * elf32-fr30.c: Likewise.
+ * elf32-gen.c: Likewise.
+ * elf32-h8300.c: Likewise.
+ * elf32-hppa.c: Likewise.
+ * elf32-i370.c: Likewise.
+ * elf32-i386.c: Likewise.
+ * elf32-i860.c: Likewise.
+ * elf32-m32r.c: Likewise.
+ * elf32-m68k.c: Likewise.
+ * elf32-mcore.c: Likewise.
+ * elf32-mips.c: Likewise.
+ * elf32-openrisc.c: Likewise.
+ * elf32-pj.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-s390.c: Likewise.
+ * elf32-sh-lin.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-sparc.c: Likewise.
+ * elf32-v850.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-hppa.c: Likewise.
+ * elf64-mips.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-s390.c: Likewise.
+ * elf64-sparc.c: Likewise.
+ * elf64-x86-64.c: Likewise.
+ * elfarm-nabi.c: Likewise.
+ * elfcode.h: Likewise.
+ * elfcore.h: Likewise.
+ * elflink.c: Likewise.
+ * elflink.h: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * elfxx-target.h: Likewise.
+ * format.c: Likewise.
+ * hash.c: Likewise.
+ * hp300hpux.c: Likewise.
+ * hppabsd-core.c: Likewise.
+ * hpux-core.c: Likewise.
+ * i386aout.c: Likewise.
+ * i386dynix.c: Likewise.
+ * i386linux.c: Likewise.
+ * i386lynx.c: Likewise.
+ * i386mach3.c: Likewise.
+ * i386msdos.c: Likewise.
+ * i386os9k.c: Likewise.
+ * ieee.c: Likewise.
+ * ihex.c: Likewise.
+ * irix-core.c: Likewise.
+ * libaout.h: Likewise.
+ * libbfd-in.h: Likewise.
+ * libbfd.c: Likewise.
+ * libcoff-in.h: Likewise.
+ * libecoff.h: Likewise.
+ * libieee.h: Likewise.
+ * libnlm.h: Likewise.
+ * libpei.h: Likewise.
+ * libxcoff.h: Likewise.
+ * linker.c: Likewise.
+ * lynx-core.c: Likewise.
+ * m68klinux.c: Likewise.
+ * merge.c: Likewise.
+ * mipsbsd.c: Likewise.
+ * netbsd-core.c: Likewise.
+ * nlm.c: Likewise.
+ * nlm32-alpha.c: Likewise.
+ * nlm32-i386.c: Likewise.
+ * nlm32-ppc.c: Likewise.
+ * nlm32-sparc.c: Likewise.
+ * nlmcode.h: Likewise.
+ * nlmswap.h: Likewise.
+ * ns32k.h: Likewise.
+ * oasys.c: Likewise.
+ * opncls.c: Likewise.
+ * osf-core.c: Likewise.
+ * pc532-mach.c: Likewise.
+ * pdp11.c: Likewise.
+ * pe-mips.c: Likewise.
+ * peXXigen.c: Likewise.
+ * peicode.h: Likewise.
+ * ppcboot.c: Likewise.
+ * ptrace-core.c: Likewise.
+ * reloc.c: Likewise.
+ * reloc16.c: Likewise.
+ * riscix.c: Likewise.
+ * rs6000-core.c: Likewise.
+ * sco5-core.c: Likewise.
+ * section.c: Likewise.
+ * som.c: Likewise.
+ * sparclinux.c: Likewise.
+ * sparclynx.c: Likewise.
+ * srec.c: Likewise.
+ * stabs.c: Likewise.
+ * sunos.c: Likewise.
+ * syms.c: Likewise.
+ * targets.c: Likewise.
+ * tekhex.c: Likewise.
+ * trad-core.c: Likewise.
+ * versados.c: Likewise.
+ * vms-gsd.c: Likewise.
+ * vms-hdr.c: Likewise.
+ * vms-misc.c: Likewise.
+ * vms-tir.c: Likewise.
+ * vms.c: Likewise.
+ * vms.h: Likewise.
+ * xcofflink.c: Likewise.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * libcoff.h: Regenerate.
+
+ * bfd.c (struct _bfd): Make "where" and "origin" unsigned.
+ * bfd-in.h (file_ptr): Change from a long int to a bfd_signed_vma.
+ (ufile_ptr): Define.
+ (bfd_tell): Return a ufile_ptr.
+ * libbfd.c (bfd_tell): Likewise.
+ (bfd_seek): Use bfd_size_type locals. Don't call bfd_set_error
+ unnecessarily.
+ * aix386-core.c: Test != 0 for bfd_seek errors rather than < 0.
+ * aoutf1.h: Likewise.
+ * som.c: Likewise.
+ * cache.c (bfd_cache_lookup_worker): Guard against abfd->where
+ larger than unsigned long can represent.
+
+ * libbfd.c (bfd_malloc): Take a bfd_size_type arg. Error if
+ size overflows size_t.
+ (bfd_realloc): Likewise.
+ (bfd_zmalloc): Likewise.
+ * opncls.c (bfd_alloc): Likewise.
+ (bfd_zalloc): Likewise.
+ * libbfd-in.h (bfd_malloc, bfd_realloc, bfd_zmalloc): Update.
+ (bfd_alloc, bfd_zalloc): Update.
+
+ * libbfd.c (bfd_get_8): Mask with 0xff in case char is more than
+ 8 bits.
+ (bfd_get_signed_8): Likewise.
+ (H_PUT_64, H_PUT_32, H_PUT_16, H_PUT_8,
+ H_PUT_S64, H_PUT_S32, H_PUT_S16, H_PUT_S8,
+ H_GET_64, H_GET_32, H_GET_16, H_GET_8,
+ H_GET_S64, H_GET_S32, H_GET_S16, H_GET_S8): Define and use.
+ * libaout.h: Likewise define and use here.
+ * aout-adobe.c: Use H_GET_* and H_PUT_* macros.
+ * aout-arm.c: Likewise.
+ * aout-encap.c: Likewise.
+ * aout-ns32k.c: Likewise.
+ * aout-tic30.c: Likewise.
+ * aoutf1.h: Likewise.
+ * aoutx.h: Likewise.
+ * bout.c: Likewise.
+ * coff-alpha.c: Likewise.
+ * coff-h8300.c: Likewise.
+ * coff-h8500.c: Likewise.
+ * coff-i960.c: Likewise.
+ * coff-ia64.c: Likewise.
+ * coff-m88k.c: Likewise.
+ * coff-mips.c: Likewise.
+ * coff-ppc.c: Likewise.
+ * coff-rs6000.c: Likewise.
+ * coff-sh.c: Likewise.
+ * coff-sparc.c: Likewise.
+ * coff-stgo32.c: Likewise.
+ * coff-tic30.c: Likewise.
+ * coff-tic80.c: Likewise.
+ * coff-w65.c: Likewise.
+ * coff-z8k.c: Likewise.
+ * coff64-rs6000.c: Likewise.
+ * coffgen.c: Likewise.
+ * cofflink.c: Likewise.
+ * coffswap.h: Likewise.
+ * ecoff.c: Likewise.
+ * ecoffswap.h: Likewise.
+ * elf.c: Likewise.
+ * elf32-mips.c: Likewise.
+ * elf64-mips.c: Likewise.
+ * hp300hpux.c: Likewise.
+ * i386dynix.c: Likewise.
+ * i386lynx.c: Likewise.
+ * i386msdos.c: Likewise.
+ * i386os9k.c: Likewise.
+ * libpei.h: Likewise.
+ * nlm32-alpha.c: Likewise.
+ * nlm32-i386.c: Likewise.
+ * nlm32-ppc.c: Likewise.
+ * nlmcode.h: Likewise.
+ * nlmswap.h: Likewise.
+ * oasys.c: Likewise.
+ * pdp11.c: Likewise.
+ * pe-mips.c: Likewise.
+ * peXXigen.c: Likewise.
+ * peicode.h: Likewise.
+ * riscix.c: Likewise.
+ * sunos.c: Likewise.
+ * xcofflink.c: Likewise.
+ * elfcode.h: (put_word, get_word, put_signed_word, get_signed_word):
+ Rename to H_PUT_WORD, H_GET_WORD, H_PUT_SIGNED_WORD, H_GET_SIGNED_WORD.
+ * coff-rs6000.c (PUTWORD, PUTHALF, PUTBYTE): Don't define. Use
+ equivalent H_PUT_* macro instead.
+ (GETWORD, GETHALF, GETBYTE): Similarly.
+ * coff64-rs6000.c (PUTWORD, PUTHALF, PUTBYTE): Likewise.
+ (GETWORD, GETHALF, GETBYTE): Likewise.
+ * coffswap.h (PUTWORD, PUTHALF, PUTBYTE): Likewise.
+
+ * bfd-in.h (struct orl): Change "pos" to a union.
+ * archive.c (_bfd_compute_and_write_armap): Use it instead of casts.
+ (bsd_write_armap): Here too.
+ (coff_write_armap): And here.
+ * coff-rs6000.c (xcoff_write_armap_old): And here.
+ (xcoff_write_one_armap_big): And here.
+ (xcoff_write_armap_big): And here.
+ * ecoff.c (_bfd_ecoff_write_armap): And here.
+ * elf64-mips.c (mips_elf64_write_armap): And here.
+
+ * aoutf1.h (sunos_set_arch_mach): Make "mach" param an enum.
+ * elf-m10300.c (elf_mn10300_mach): Return an unsigned long.
+ * elf32-h8300.c (elf32_h8_mach): Likewise.
+ * elf32-mips.c (elf_mips_mach): Likewise.
+ * sparclynx.c (NAME(lynx,set_arch_mach)): Likewise.
+
+ * aix386-core.c (aix386_core_file_p): Remove redundant bfd_release
+ calls.
+ (aix386_core_vec): Typo fix.
+
+ * aout-arm.c: Include libaout.h and aout/aout64.h after N_TXTADDR
+ etc. to avoid redefined macro warning.
+ (MY(put_reloc)): Use bfd_vma for "value" rather than long.
+ (MY(fix_pcrel_26)): Likewise.
+ * aout-ns32k.c (MY(put_reloc)): Likewise.
+ * aout-cris.c (MY(swap_ext_reloc_out)): Likewise for r_addend.
+ * aoutx.h (NAME(aout,swap_ext_reloc_out)): Likewise.
+ * coff-arm.c (coff_arm_relocate_section): Likewise for my_offset.
+
+ * aout-encap.c: Include "file", not <file> for binutils headers.
+ (encap_object_p): Half baked attempt to fix compile errors in
+ code dealing with "magic".
+
+ * aout-ns32k.c: Include "file", not <file> for binutils headers.
+ (_bfd_ns32k_relocate_contents): get_data and put_data manipulate
+ bfd_vma's rather than longs.
+ * cpu-ns32k.c (ns32k_sign_extend): Delete.
+ (_bfd_ns32k_get_displacement): Return a bfd_vma, don't pass in offset.
+ (_bfd_ns32k_get_immediate): Likewise. Add code for 8 byte values,
+ remove case 3.
+ (_bfd_ns32k_put_displacement): Accept a bfd_vma, don't pass in offset.
+ Use unsigned comparisons.
+ (bfd_ns32k_put_immediate): Likewise, and add code for 8 byte values.
+ (do_ns32k_reloc): get_data and put_data operate on bfd_vma's.
+ (_bfd_do_ns32k_reloc_contents): Likewise.
+ * ns32k.h (_bfd_ns32k_get_displacement): Update prototype.
+ (_bfd_ns32k_get_immediate): Likewise.
+ (_bfd_ns32k_put_displacement): Likewise.
+ (_bfd_ns32k_put_immediate): Likewise.
+ (bfd_reloc_status_type): Likewise.
+
+ * aoutx.h (NAME(aout,find_nearest_line)): Rename 'p' to 'colon'
+ to avoid shadowing.
+ * pdp11.c (NAME(aout,find_nearest_line)): Likewise.
+ * coff-h8300.c (h8300_reloc16_extra_cases): Remove shadowing "value".
+ * coff-ppc.c (enum ref_category): Rename "data" to "tocdata" to
+ avoid shadowing.
+ (record_toc): Use a bfd_signed_vma for our_toc_offset.
+ * coffcode.h (coff_write_relocs): Rename "i" to avoid shadowing.
+ * elf.c (bfd_elf_get_bfd_needed_list): Rename "link" var to avoid
+ shadow warning.
+ (_bfd_elfcore_strndup): Likewise for "dup".
+ * elf32-cris.c (cris_elf_relocate_section): "symname" instead of
+ "name" to avoid shadowing.
+ * elf32-hppa.c (elf32_hppa_relocate_section): Remove duplicate
+ definition of "off".
+ * elf32-i386.c (elf_i386_relocate_section): Likewise.
+ * elf32-mips.c (_bfd_mips_elf_modify_segment_map): Remove duplicate
+ definition of "s".
+ (_bfd_mips_elf_final_link): Rename "i" to "j". Remove duplicate
+ "secpp".
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Rename inner "indx"
+ to avoid shadowing.
+ * elflink.h (elf_link_add_object_symbols): Rename "link" to "shlink"
+ to avoid shadowing.
+ (elf_link_input_bfd): Likewise.
+ (elf_bfd_final_link): Remove duplicate innermost "off" var.
+ * oasys.c (oasys_write_data): Rename innermost "p" to "sym".
+ * reloc16.c (bfd_coff_reloc16_relax_section): Rename "i" param to
+ "input_section".
+ * som.c (som_prep_for_fixups): Rename inner "i" to "j".
+ * sunos.c (sunos_add_dynamic_symbols): Localise "s" var.
+ (sunos_write_dynamic_symbol): Remove unused vars.
+ * syms.c (_bfd_stab_section_find_nearest_line): Remove duplicate
+ innermost "directory_name" and "file_name" vars.
+ * tekhex.c (first_phase): Rename local var "type" to "stype".
+ (tekhex_write_object_contents): Rename innermost "s" to "sym".
+ * vms-gsd.c (vms_secflag_by_name): Change "size" param to "hassize",
+ doing comparison at caller.
+ (vms_esecflag_by_name): Likewise.
+ * vms-tir.c (etir_sto): Rename innermost "psect" to "psect1".
+ * xcofflink.c (xcoff_link_input_bfd): Delete duplicate innermost "o".
+ (xcoff_write_global_symbol): Rename "p" param to "inf".
+
+ * cisco-core.c: Add missing prototypes.
+ (cisco_core_file_failing_command): Add ATTRIBUTE_UNUSED.
+ (cisco_core_file_failing_signal): Likewise.
+ (cisco_core_file_matches_executable_p): Likewise.
+ * hpux-core.c (hpux_core_core_file_failing_signal): Likewise.
+ * netbsd-core.c (netbsd_core_file_matches_executable_p): Likewise.
+ * osf-core.c (osf_core_core_file_matches_executable_p): Likewise.
+ * sco5-core.c (sco5_core_file_matches_executable_p): Likewise.
+
+ * coff-arm.c (coff_arm_link_hash_table): Use bfd_size_type for
+ thumb_glue_size and arm_glue_size.
+ * elf32-arm.h (elf32_arm_link_hash_table): Likewise here.
+
+ * coff64-rs6000.c: Group prototypes together.
+
+ * coffcode.h (coff_set_arch_mach): Add ATTRIBUTE_UNUSED.
+ (buy_and_read): Remove "seek" param. Change "size" to bfd_size_type.
+
+ * cpu-arc.c: Add missing prototypes.
+ * cpu-h8500.c: Likewise.
+ * cpu-i960.c: Likewise.
+ * cpu-pj.c: Likewise.
+ * cpu-sh.c: Likewise.
+ * cpu-w65.c: Likewise.
+ * cpu-z8k.c: Likewise.
+ * elf32-fr30.c: Likewise.
+ * elf32-h8300.c: Likewise.
+ * elf32-i370.c: Likewise.
+ * hpux-core.c: Likewise.
+ * versados.c: Likewise.
+
+ * cpu-h8300.c (bfd_default_scan_num_mach): Don't declare.
+ * cpu-h8500.c: Likewise.
+ * cpu-i960.c: Likewise.
+ * cpu-z8k.c: Likewise.
+
+ * cpu-ia64-opc.c: Correct comment.
+
+ * dwarf2.c (_bfd_dwarf2_find_nearest_line): Remove unused var.
+
+ * elf-bfd.h (elf_size_info): Change count param of write_out_phdrs
+ to unsigned.
+ (bfd_elf32_write_out_phdrs): Likewise.
+ (bfd_elf64_write_out_phdrs): Likewise.
+ (elf_linker_section_pointers): Change addend to bfd_vma.
+ (_bfd_elf_find_pointer_linker_section): Likewise.
+ (_bfd_elfcore_make_pseudosection): Change size param to size_t and
+ filepos to unsigned file_ptr.
+ (_bfd_elfcore_strndup): Change max param to size_t.
+ * elf.c (_bfd_elfcore_make_pseudosection): As above.
+ (_bfd_elfcore_strndup): Likewise.
+ (_bfd_elf_find_pointer_linker_section): Likewise.
+
+ * elf-hppa.h (elf_hppa_relocate_insn): Return an int, and change
+ insn and sym_value to ints.
+
+ * elf.c (elf_read): Make "offset" param a file_ptr, "size" a
+ bfd_size_type.
+ (elfcore_read_notes): Likewise.
+
+ * elf32-arm.h (elf32_arm_final_link_relocate): Change sym_flags
+ param from unsigned char to int.
+ (elf32_arm_relocate_section): If USE_REL, cast "rel" appropriately
+ for info_to_howto call.
+ (add_dynamic_entry): Define macro.
+ (elf32_arm_size_dynamic_sections): Use add_dynamic_entry.
+
+ * elf32-cris.c (add_dynamic_entry): Define macro.
+ (elf_cris_size_dynamic_sections): Use add_dynamic_entry.
+
+ * elf32-h8300.c (elf32_h8_final_write_processing): Make static.
+ (elf32_h8_object_p): Likewise.
+ (elf32_h8_merge_private_bfd_data): Likewise.
+ (elf32_h8_relax_section): Cast gap to int so signed comparisons work.
+
+ * elf32-hppa.c (add_dynamic_entry): Define macro.
+ (elf32_hppa_size_dynamic_sections): Use it.
+ * elf32-i370.c (add_dynamic_entry): Define macro.
+ (i370_elf_size_dynamic_sections): Use it.
+ (i370_noop): Make static.
+ * elf32-i386.c (add_dynamic_entry): Define macro.
+ (elf_i386_size_dynamic_sections): Use it.
+ * elf32-m68k.c (add_dynamic_entry): Define macro.
+ (elf_m68k_size_dynamic_sections): Use it.
+ * elf32-ppc.c (add_dynamic_entry): Define macro.
+ (ppc_elf_size_dynamic_sections): Use it.
+ * elf32-s390.c (add_dynamic_entry): Define macro.
+ (elf_s390_size_dynamic_sections): Use it.
+ * elf64-alpha.c (add_dynamic_entry): Define macro.
+ (elf64_alpha_size_dynamic_sections): Use it.
+ * elf64-hppa.c (add_dynamic_entry): Define macro.
+ (elf64_hppa_size_dynamic_sections): Use it.
+ * elf64-ppc.c (add_dynamic_entry): Define macro.
+ (ppc64_elf_size_dynamic_sections): Use it.
+ * elf64-s390.c (add_dynamic_entry): Define macro.
+ (elf_s390_size_dynamic_sections): Use it.
+ * elf64-sparc.c (add_dynamic_entry): Define macro.
+ (sparc64_elf_size_dynamic_sections): Use it.
+ * elf64-x86-64.c (add_dynamic_entry): Define macro.
+ (elf64_x86_64_size_dynamic_sections): Use it.
+ * elfxx-ia64.c (add_dynamic_entry): Define macro.
+ (elfNN_ia64_size_dynamic_sections): Use it.
+
+ * elf32-v850.c (SEXT24): Modify to avoid signed/unsigned warning.
+ (v850_elf_perform_relocation): Make "r_type" param unsigned.
+
+ * elf64-mips.c (mips_elf64_slurp_one_reloc_table): Just return
+ false if the first malloc fails rather than going via error_return.
+
+ * elf64-sparc.c (sparc64_elf_plt_entry_offset): Use a bfd_vma for
+ "index" param.
+ (sparc64_elf_plt_ptr_offset): Likewise, and for "max" param too.
+
+ * elflink.h (elf_link_input_bfd): s/ingored/ignored/ in error message.
+
+ * elfxx-ia64.c (global_sym_index): Return a long.
+
+ * ieee.c (get_symbol): Use int rather than char param.
+ (ieee_slurp_sections): Move "section" var to inner blocks.
+ (copy_expression): Don't init "value" to zero or worry about
+ clearing to zero after using.
+ (ieee_write_debug_part): Rename "output_buffer" to "obuff" to avoid
+ shadowing.
+
+ * ihex.c (ihex_write_record): Make "count" var a size_t, "addr" an
+ unsigned int.
+
+ * libbfd-in.h (BFD_ALIGN): Add cast to avoid signed/unsigned warning.
+ (bfd_write_bigendian_4byte_int): Pass an unsigned int value param.
+
+ * mipsbsd.c (mips_fix_jmp_addr): Add "error_message" param.
+
+ * pc532-mach.c (MYNSX): Delete.
+ (ns32kaout_bfd_reloc_type_lookup): Define prototype without MYNSX.
+ (write_object_contents): Correct prototype.
+
+ * peicode.h (pe_ILF_build_a_bfd): Use an unsigned int param rather
+ than unsigned short.
+
+ * section.c (bfd_set_section_contents): Remove redundant
+ "offset < 0" test. Check that "count" doesn't overflow size_t.
+ (bfd_get_section_contents): Likewise.
+
+ * som.c (som_fixup_formats): Add missing braces.
+ (som_reloc_addend): Pass a bfd_vma for "addend".
+
+ * srec.c (srec_write_record): Pass "type" as an unsigned int.
+ (srec_write_symbols): Remove an unnecessary var.
+
+ * targets.c (_bfd_target_vector): Sort entries. Sort externs
+ to match.
+ * configure.in: Sort to match. Bump version number.
+ * configure: Regenerate.
+
+ * tekhex.c (move_section_contents): Assert offset == 0.
+
+ * versados.c (new_symbol_string): Constify arg.
+ (process_esd): Use bfd_und_section_ptr rather than &bfd_und_section.
+ (versados_get_symbol_info): Make static.
+ (versados_print_symbol): Likewise.
+ (versados_get_reloc_upper_bound): Likewise.
+ (versados_canonicalize_reloc): Likewise.
+
+2001-09-18 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elflink.h (elf_link_input_bfd): Fix typo in error message.
+
+2001-09-17 H.J. Lu <hjl@gnu.org>
+
+ * dwarf1.c (parse_die): Take a new arg for the end of the
+ section. Return false if die is beyond the section.
+ (parse_functions_in_unit): Pass the end of the section to
+ parse_die ().
+ (_bfd_dwarf1_find_nearest_line): Likewise.
+
+2001-09-14 Michael Rauch <mrauch@netbsd.org>
+
+ * elf32-sparc.c (elf32_sparc_relocate_section): Treat R_SPARC_UA32
+ just like R_SPARC_32.
+
+2001-09-14 Kevin Lo <kevlo@openbsd.org>
+
+ * configure.bfd: Add arm-openbsd target.
+
+2001-09-14 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * config.bfd: Change machine triplets from mips*el*-* to mips*el-*.
+ Add support for mips64.
+
+2001-09-13 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-openrisc.c (ELF_MACHINE_ALT1): Define as EM_OPENRISC_OLD.
+
+2001-09-12 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf.c (prep_headers): Get the machine code from the elf
+ backend data.
+ * elf-m10200.c (ELF_MACHINE_CODE): Redefine to EM_MN10200.
+ (ELF_MACHINE_ALT1): Define to EM_CYGNUS_MN10200.
+ * elf-m10300.c (ELF_MACHINE_CODE): Redefine to EM_MN10300.
+ (ELF_MACHINE_ALT1): Define to EM_CYGNUS_MN10300.
+ * elf-arc.c (arc_elf_final_write_processing): Don't override
+ e_machine, it's now properly set in prep_headers.
+ * elf32-avr.c (elf32_avr_object_p): Accept both EM_AVR and
+ EM_AVR_OLD.
+ (ELF_MACHINE_ALT1): Define to EM_AVR_OLD.
+ * elf-d10v.c (ELF_MACHINE_CODE): Redefine to EM_D10V.
+ (ELF_MACHINE_ALT1): Define to EM_CYGNUS_D10V.
+ * elf-d30v.c (ELF_MACHINE_CODE): Redefine to EM_D30V.
+ (ELF_MACHINE_ALT1): Define to EM_CYGNUS_D30V.
+ * elf-fr30.c (ELF_MACHINE_CODE): Redefine to EM_FR30.
+ (ELF_MACHINE_ALT1): Define to EM_CYGNUS_FR30.
+ * elf-m32r.c (ELF_MACHINE_CODE): Redefine to EM_M32R.
+ (ELF_MACHINE_ALT1): Define to EM_CYGNUS_M32R.
+ * elf32-pj.c (ELF_MACHINE_ALT1): DEfine to EM_PJ_OLD.
+ * elf-v850.c (ELF_MACHINE_CODE): Redefine to EM_V850.
+ (ELF_MACHINE_ALT1): Define to EM_CYGNUS_V850.
+
+2001-09-11 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_section_flags): New.
+ (elf64_alpha_fake_sections): Map SEC_SMALL_DATA to SHF_ALPHA_GPREL.
+
+2001-09-11 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_relocate_section): Do not
+ apply HINT relocations against dynamic symbols.
+
+2001-09-11 H.J. Lu <hjl@gnu.org>
+
+ * linker.c (link_action): Change COMMON_ROW\defw from CREF to COM.
+
+2001-09-09 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c: Delete all unused ERIC_neverdef and rth_notdef code.
+
+ * elf64-alpha.c (elf64_alpha_relax_with_lituse): Nop out gpdisp
+ following a call to a near function.
+
+2001-09-08 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_relocate_section): Soft fail
+ relocation errors. Fail gp-relative relocations against
+ dynamic symbols.
+
+2001-09-08 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-i386.c (elf_i386_relocate_section): Check !DEF_REGULAR
+ as well as DEF_DYNAMIC in test for avoided copy relocs.
+ (allocate_plt_and_got_and_discard_relocs): Likewise.
+ * elf32-hppa.c (elf_i386_relocate_section): Likewise.
+ (allocate_plt_and_got_and_discard_relocs): Likewise.
+
+2001-09-07 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf32-mips.c (mips_elf_calculate_relocation): Fix overflow handling
+ of R_MIPS_PC16.
+
+2001-09-06 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf64-mips.c (mips_elf64_howto_table_rel): Fix relocation HOWTO
+ definitions.
+ (mips_elf64_howto_table_rel): Likewise.
+
+2001-09-05 Tom Rix <trix@redhat.com>
+
+ * xcofflink.c (bfd_xcoff_import_symbol): Handle import file XMC_XO
+ and syscall symbols.
+ (write_global_symbol) : Same.
+ (bfd_xcoff_export_symbol): Remove unused syscall param.
+ * libxcoff.h: Change prototype of bfd_xcoff_export symbol and
+ bfd_xcoff_import_symbol.
+ * bfd-in.h: Same.
+ * bfd-in2.h : Regenerate.
+
+2001-09-04 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (SKIP_HOWTO): New.
+ (elf64_alpha_howto_table): Use it to remove dead ECOFF relocs.
+ Fix sizes of 16-bit mem format relocs.
+ (elf64_alpha_reloc_map): Update to match.
+ (elf64_alpha_relax_with_lituse): Use GPREL16 as appropriate.
+ (elf64_alpha_relax_without_lituse): Likewise.
+ (elf64_alpha_check_relocs): Handle GPREL16.
+ (elf64_alpha_relocate_section): Likewise.
+ * reloc.c (BFD_RELOC_ALPHA_USER_*): Remove.
+ (BFD_RELOC_ALPHA_GPREL_HI16, BFD_RELOC_ALPHA_GPREL_LO16): New.
+ * bfd-in2.h, libbfd.h: Rebuild.
+
+2001-09-04 Jeff Law <law@redhat.com>
+
+ * elf32-h8300.c (elf32_h8_relax_section): New function.
+ (elf32_h8_relax_delete_bytes): Likewise.
+ (elf32_h8_symbol_address_p): Likewise.
+ (elf32_h8_get_relocated_section_contents): Likewise.
+ (bfd_elf32_bfd_relax_section): Define.
+ (bfd_elf32_bfd_get_relocated_section_contents): Likewise.
+
+ * elf32-h8300.c (special): New function.
+ (h8_elf_howto_table): Use it for SPECIAL_FUNCTION field in
+ all relocations.
+ (elf32_h8_final_link_relocate): Treat R_H8_DIR24A8 like 32bit
+ relocations. Fix problems with the true 24bit reloc R_H8_DIR24R8.
+ Fix minor problems with 8bit and 16bit PC relative relocations.
+
+2001-09-01 Andreas Jaeger <aj@suse.de>
+
+ * vms-tir.c: Add missing prototypes.
+ * vms-hdr.c: Likewise.
+ * vms-gsd.c: Likewise.
+ * vms-misc.c: Likewise.
+
+2001-08-31 H.J. Lu <hjl@gnu.org>
+
+ * elf32-mips.c (_bfd_mips_elf_check_relocs): Report filename
+ with bad relocation.
+
+2001-08-31 Eric Christopher <echristo@redhat.com>
+ Jason Eckhardt <jle@redhat.com>
+
+ * bfd/archures.c: Add mipsisa32 and mipsisa64. Remove mips32,
+ mips32_4k and mips64.
+ * bfd/aoutx.h: Remove bfd_mach_mips32, bfd_mach_mips32_4k,
+ bfd_mach_mips64. Add bfd_mach_mipsisa32, bfd_mach_mipsisa64.
+ * bfd/cpu-mips.c: Ditto.
+ * bfd/elf32-mips.c (_bfd_mips_elf_final_write_processing): Ditto.
+ * bfd/bfd-in2.h: Regenerate.
+
+2001-08-31 Jakub Jelinek <jakub@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_relocate_section): Duplicate memory
+ value into R_ALPHA_RELATIVE's addend.
+ (elf64_alpha_finish_dynamic_symbol): Likewise.
+
+2001-08-31 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elf32-arm.h (elf32_arm_relocate_section): Do not rightshift
+ recomputed addend during relocatable link if not USE_REL.
+
+ * elflink.h (elf_gc_propagate_vtable_entries_used): Fix off-by-one
+ error.
+
+2001-08-30 H.J. Lu <hjl@gnu.org>
+
+ * elf32-mips.c (mips_elf_calculate_relocation): Revert the last
+ 2 changes.
+ (_bfd_mips_elf_adjust_dynamic_symbol): Allocate dynamic
+ relocations for weak definitions.
+
+2001-08-30 H.J. Lu <hjl@gnu.org>
+
+ * Makefile.am (BFD32_BACKENDS): Add elf32-h8300.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-h8300.c.
+ * Makefile.in: Rebuild.
+
+2001-08-30 H.J. Lu <hjl@gnu.org>
+
+ * elf32-mips.c (mips_elf_calculate_relocation): Don't create
+ dynamic relocation for undefined weak symbols when creating
+ executables. Check h->root.root.type, instead of h->root.type.
+
+2001-08-29 Joel Sherrill <joel@OARcorp.com>
+
+ * config.bfd (i[3456]86-*-rtems*, m68*-*-rtems*): Change
+ default from coff to elf.
+
+2001-08-29 Jeff Law <law@redhat.com>
+
+ * elf32-h8300.c (h8_elf_howto_table): Add new PC relative
+ relocations.
+ (h8_reloc_map): Similarly.
+ (elf32_h8_final_link_relocate): Remove incorrect overflow tests.
+ Add support for PC relative relocations.
+
+ * elf32-h8300.c: Put all prototypes together.
+ (elf32_h8_info_to_howto): Parameter elf_reloc is used.
+ (elf32_h8_final_link_relocate): New function for linker.
+ (elf32_h8_relocate_section): Similarly.
+ (elf_backend_relocate_section): Define.
+
+ * cpu-h8300.c (h8300_scan, compatible): Prototype.
+ (h8300_scan): Handle architecture:machine encodings typically
+ found in linker scripts.
+ * elf.c (prep_headers): Do not try to do H8 machine recognition
+ here.
+ * elf32-h8300.c: Add some missing prototypes.
+ (elf32_h8_mach, elf32_h8_final_write_processing): New functions.
+ (elf32_h8_object_p): Similarly.
+
+2001-08-29 Tom Rix <trix@redhat.com>
+
+ * xcofflink.c (xcoff_link_add_symbols): Fix XTY_LD symbol that
+ does not follow a XTY_SD.
+
+2001-08-29 Alan Modra <amodra@bigpond.net.au>
+
+ * targmatch.sed: Delete case statements.
+ * config.bfd <powerpc-*-aix* entry>: Select 64 bit xcoff for
+ aix4.3 and above.
+
+2001-08-29 J"orn Rennecke <amylaar@redhat.com>
+
+ * Makefile.am (elf32-h8300.lo): New target.
+ * config.bfd (h8300*-*-elf): New case.
+ * configure.in (bfd_elf32_h8300_vec): New case.
+ * elf.c (prep_headers): Add case for bfd_arch_h8300.
+ * reloc.c (BFD_RELOC_H8_DIR16A8): New relocation.
+ (BFD_RELOC_H8_DIR16R8, BFD_RELOC_H8_DIR24A8): Likewise.
+ (BFD_RELOC_H8_DIR24R8, BFD_RELOC_H8_DIR32A16): Likewise.
+ * targets.c (bfd_target bfd_elf32_h8300_vec): New extern declaration.
+ * elf32-h8300.c: New file.
+ * Makefile.in, bfd-in2.h, libbfd.h, configure: Regenerated.
+
+2001-08-28 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * sparclynx.c: Add missing prototypes.
+ * coff-mcore.c: Add missing prototypes.
+ * elf32-pj.c: Add missing prototypes.
+ * nlm32-sparc.c: Add missing prototypes.
+ * oasys.c: Add missing prototypes.
+ * pdp11.c: Add missing prototypes.
+ * pe-mips.c: Add missing prototypes.
+ * riscix.c: Add missing prototypes.
+
+2001-08-27 Daniel Jacobowitz <drow@mvista.com>
+
+ * elf32-i386.c: Add missing prototypes.
+ * elf32-ppc.c: Likewise.
+ * elf32-sh-lin.c: Likewise.
+ * elfarm-nabi.c: Likewise.
+
+2001-08-27 Daniel Jacobowitz <drow@mvista.com>
+
+ * elf32-i386.c (elf_i386_grok_prstatus): New function.
+ (elf_i386_grok_psinfo): New function.
+ (elf_backend_grok_prstatus): Define.
+ (elf_backend_grok_psinfo): Likewise.
+ * elf32-ppc.c (ppc_elf_grok_prstatus): New function.
+ (ppc_elf_grok_psinfo): New function.
+ (elf_backend_grok_prstatus): Define.
+ (elf_backend_grok_psinfo): Likewise.
+ * elf32-sh-lin.c (elf32_shlin_grok_prstatus): New function.
+ (elf32_shlin_grok_psinfo): New function.
+ (elf_backend_grok_prstatus): Define.
+ (elf_backend_grok_psinfo): Likewise.
+ * elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): New function.
+ (elf32_arm_nabi_grok_psinfo): New function.
+ (elf_backend_grok_prstatus): Define.
+ (elf_backend_grok_psinfo): Likewise.
+
+2001-08-27 H.J. Lu <hjl@gnu.org>
+
+ * elf32-mips.c (mips_elf_create_dynamic_relocation): Add more
+ sanity check.
+ (mips_elf_calculate_relocation): Create dynamic relocation for
+ symbols with weak definition or the ELF_LINK_HASH_DEF_REGULAR
+ bit is not set.
+
+2001-08-27 H.J. Lu <hjl@gnu.org>
+
+ * elf32-mips.c (_bfd_mips_elf_hide_symbol): Add prototype.
+ (_bfd_mips_elf_copy_indirect_symbol): Likewise.
+ (_bfd_elf32_mips_grok_prstatus): Likewise.
+ (_bfd_elf32_mips_grok_psinfo): Likewise.
+ (_bfd_mips_elf_hide_symbol): Make it static and cast to
+ `struct mips_elf_link_hash_entry *'.
+ (_bfd_mips_elf_copy_indirect_symbol): Make it static.
+
+2001-08-27 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * mipsbsd.c: Add missing prototypes.
+ * hp300hpux.c: Add missing prototypes.
+ * i386aout.c: Add missing prototypes.
+ * i386lynx.c: Add missing prototypes.
+ * i386mach3.c: Add missing prototypes.
+ * i386msdos.c: Add missing prototypes.
+ * i386os9k.c: Add missing prototypes.
+
+2001-08-27 Linus Nordberg <linus@swox.se>
+ Torbjorn Granlund <tege@swox.com>
+ Staffan Ulfberg <staffanu@swox.se>
+ Alan Modra <amodra@bigpond.net.au>
+
+ * config.bfd: Add powerpc64 target. Add powerpc64 vectors to
+ targ64_selvecs for 32 bit powerpc targets.
+ * Makefile.am (BFD64_BACKENDS): Add elf64-ppc.lo.
+ (BFD64_BACKENDS_CFILES): Add elf64-ppc.c.
+ Run "make dep-am".
+ * Makefile.in: Regenerate.
+ * configure.in: Add elf64_powerpc vecs.
+ * configure: Regenerate.
+ * cpu-powerpc.c: Default to bfd_mach_ppc_620 entry for 64 bit.
+ * elf.c (prep_headers): EM_PPC64 for 64 bit ppc elf target.
+ * targets.c: Add bfd_elf64_powerpc_vec and bfd_elf64_powerpcle_vec.
+ * elf64-ppc.c: New file.
+ * reloc.c: Add powerpc64 relocs.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+
+2001-08-27 Andreas Schwab <schwab@suse.de>
+
+ * elf32-m68k.c (elf32_m68k_check_relocs): Set DF_TEXTREL if the
+ reloc is against read-only section.
+ (elf32_m68k_size_dynamic_sections): Use DF_TEXTREL flag instead of
+ looking up section names for DT_TEXTREL.
+ (elf32_m68k_reloc_type_class): New function.
+ (elf_backend_reloc_type_class): Define.
+
+2001-08-27 Andreas Jaeger <aj@suse.de>
+
+ * elf64-s390.c (elf_s390_check_relocs): Set DF_TEXTREL if the
+ reloc is against read-only section.
+ (elf_s390_size_dynamic_sections): Use DF_TEXTREL flag instead of
+ looking up section names for DT_TEXTREL.
+ (elf_s390_reloc_type_class): New.
+ (elf_backend_reloc_type_class): Define.
+
+ * elf32-s390.c (elf_s390_check_relocs): Set DF_TEXTREL if the
+ reloc is against read-only section.
+ (elf_s390_size_dynamic_sections): Use DF_TEXTREL flag instead of
+ looking up section names for DT_TEXTREL.
+ (elf_s390_reloc_type_class): New.
+ (elf_backend_reloc_type_class): Define.
+
+ * elf32-ppc.c (ppc_elf_check_relocs): Set DF_TEXTREL if the reloc
+ is against read-only section.
+ (ppc_elf_size_dynamic_sections): Use DF_TEXTREL flag instead of
+ looking up section names for DT_TEXTREL.
+ (ppc_elf_reloc_type_class): New.
+ (elf_backend_reloc_type_class): Define.
+
+2001-08-26 Andreas Jaeger <aj@suse.de>
+
+ * elf32-cris.c (cris_elf_check_relocs): Set DF_TEXTREL if the
+ reloc is against read-only section.
+ (elf_cris_size_dynamic_sections): Use DF_TEXTREL flag instead of
+ looking up section names for DT_TEXTREL.
+ (elf_cris_reloc_type_class): New.
+ (elf_backend_reloc_type_class): Define.
+
+ * elf32-sh.c (sh_elf_check_relocs): Set DF_TEXTREL if the reloc is
+ against read-only section.
+ (elf_backend_reloc_type_class): Define.
+ (sh_elf_reloc_type_class): New.
+ (sh_elf_size_dynamic_sections): Use DF_TEXTREL flag instead of
+ looking up section names for DT_TEXTREL.
+
+ * elf32-arm.h (elf32_arm_check_relocs): Set DF_TEXTREL if the
+ reloc is against read-only section.
+ (elf32_arm_size_dynamic_sections): Use DF_TEXTREL flag instead of
+ looking up section names for DT_TEXTREL.
+ (elf32_arm_reloc_type_class): New.
+ (elf_backend_reloc_type_class): Define.
+
+2001-08-25 Andreas Jaeger <aj@suse.de>
+
+ * oasys.c: Add missing prototypes.
+
+ * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Add unused
+ attribute for parameter.
+ * elf.c (_bfd_elf_reloc_type_class): Likewise.
+
+ * versados.c (get_4): Make static.
+ (get_10): Make static.
+ Add missing prototypes.
+ (process_esd): Fix call to versados_new_symbol.
+
+2001-08-25 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * coff-a29k.c: Add missing prototypes.
+ * coff-apollo.c: Add missing prototypes.
+ * coff-arm.c: Add missing prototypes.
+ * coff-i860.c: Add missing prototypes.
+ * coff-rs6000.c: Add missing prototypes.
+ * coff-tic80.c: Add missing prototypes.
+ * elf-m10200.c: Add missing prototypes.
+ * elf-m10300.c: Add missing prototypes.
+ * elf32-arm.h: Add missing prototypes.
+ * elf32-d10v.c: Add missing prototypes.
+ * elf32-m32r.c: Add missing prototypes.
+ * elf32-mcore.c: Add missing prototypes.
+ * elf32-openrisc.c: Add missing prototypes.
+ * elf32-sh.c: Add missing prototypes.
+ * elf32-sparc.c: Add missing prototypes.
+ * elf32-v850.c: Add missing prototypes.
+ * elfarm-nabi.c: Add missing prototypes.
+ * elfarm-oabi.c: Add missing prototypes.
+
+2001-08-25 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf32-mips.c (elf_mips_abi_name): Return the right ABI string for
+ E_MIPS_ABI_O64 and E_MIPS_ABI_EABI64
+
+2001-08-24 H.J. Lu <hjl@gnu.org>
+
+ * elf.c (_bfd_elf_merge_sections): Fail if not using an ELF
+ hash structure.
+
+2001-08-24 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elf-bfd.h (elf_hash_table): Revert definition.
+ (is_elf_hash_table): New macro.
+ * elflink.h (elf_link_add_object_symbols): Test
+ is_elf_hash_table before accessing ELF only fields in hash
+ structure.
+ (elf_link_create_dynamic_sections): Fail if not using an ELF
+ hash structure.
+ (elf_add_dynamic_entry): Fail if not using an ELF hash
+ structure.
+ (elf_link_record_local_dynamic_symbol): Fail if not using an
+ ELF hash structure.
+ (size_dynamic_sections): Fail if not using an ELF hash
+ structure.
+ (elf_adjust_dynamic_symbol): Fail if not using an ELF
+ hash structure.
+ (elf_bfd_final_link): Fail if not using an ELF hash
+ structure.
+
+2001-08-24 H.J. Lu <hjl@gnu.org>
+
+ * elf-bfd.h (elf_hash_table): Return NULL if the linker hash
+ table is not an ELF linker hash table.
+
+ * elf.c (_bfd_elf_link_hash_table_init): Set the linker hash
+ table type to bfd_link_elf_hash_table.
+
+ * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_create): Revert
+ the last change.
+
+ * linker.c (_bfd_link_hash_table_init): Set the linker hash
+ table type to bfd_link_generic_hash_table.
+
+2001-08-24 Alexandre Oliva <aoliva@redhat.com>
+
+ * bfd.c (bfd_alt_mach_code): New function.
+ * bfd-in2.h: Rebuilt.
+
+2001-08-24 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf-m10300.c (mn10300_elf_relocate_section): Test the right
+ `type' field in the hash entry when deciding whether to follow a
+ link.
+
+2001-08-24 Jakub Jelinek <jakub@redhat.com>
+
+ * elflink.h (elf_link_sort_cmp1): Sort RELATIVE relocs first, not
+ last.
+ (elf_link_sort_relocs): Adjust accordingly.
+
+ * elf64-alpha.c (struct alpha_elf_link_hash_entry): Add reltext flag.
+ (elf64_alpha_check_relocs): Set it if section this reloc is against
+ is read-only. Set DF_TEXTREL if a RELATIVE reloc is needed against
+ read-only section.
+ (elf64_alpha_calc_dynrel_sizes): Set DF_TEXTREL flag if relocation
+ is is against read-only section.
+ (elf64_alpha_size_dynamic_sections): Use DF_TEXTREL flag, don't
+ check section names.
+ (elf64_alpha_reloc_type_class): New.
+ (elf_backend_reloc_type_class): Define.
+
+2001-08-24 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * linker.c (_bfd_generic_link_add_archive_symbols): Replace alloca()
+ by bfd_malloc().
+
+2001-08-23 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c (elf64_x86_64_check_relocs): Set DF_TEXTREL if
+ the reloc is against read-only section.
+ (elf64_x86_64_size_dynamic_sections): Use DF_TEXTREL flag instead
+ of looking up section names for DT_TEXTREL.
+ (elf64_x86_64_reloc_type_class): New.
+ (elf_backend_reloc_type_class): Define.
+
+2001-08-23 H.J. Lu <hjl@gnu.org>
+
+ * syms.c (bfd_print_symbol_vandf): Add abfd to arg.
+ * bfd-in2.h (bfd_print_symbol_vandf): Regenerated.
+
+ * aoutx.h (NAME(aout,print_symbol)): Pass abfd to
+ bfd_print_symbol_vandf.
+ * coffgen.c (coff_print_symbol): Likewise.
+ * elf.c (bfd_elf_print_symbol): Likewise.
+ * ieee.c (ieee_print_symbol): Likewise.
+ * nlmcode.h (nlm_print_symbol): Likewise.
+ * oasys.c (oasys_print_symbol): Likewise.
+ * pdp11.c (NAME(aout,print_symbol)): Likewise.
+ * som.c (som_print_symbol): Likewise.
+ * srec.c (srec_print_symbol): Likewise.
+ * tekhex.c (tekhex_print_symbol): Likewise.
+ * versados.c (versados_print_symbol): Likewise.
+ * vms.c (vms_print_symbol): Likewise.
+
+ * elf.c (_bfd_elf_print_private_bfd_data): Replace fprintf_vma
+ with bfd_fprintf_vma.
+ (bfd_elf_print_symbol): Likewise.
+ * syms.c (bfd_print_symbol_vandf): Likewise.
+
+2001-08-23 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * aoutf1.h (sunos_write_object_contents): Silence compile time
+ warning.
+ * libaout.h (N_SET_DYNAMIC): Silence compile time warning.
+
+ * bout.c: Add missing function prototypes. Fix formatting.
+ * coff-z8k.c: Add missing function prototypes. Fix formatting.
+ * coff-w65.c: Add missing function prototypes. Fix formatting.
+ * coff-h8500.c: Add missing function prototypes. Fix formatting.
+ * coff-h8300.c: Add missing function prototypes. Fix formatting.
+ * coff-tic54x.c: Add missing function prototypes. Fix formatting.
+ * coff-tic30.c: Add missing function prototypes. Fix formatting.
+ * coff-m68k.c: Add missing function prototypes. Fix formatting.
+ * coff-rs6000.c: Add missing function prototypes. Fix formatting.
+ * coff-sh.c: Add missing function prototypes. Fix formatting.
+
+2001-08-23 Jakub Jelinek <jakub@redhat.com>
+
+ * elf-bfd.h (enum elf_reloc_type_class): New.
+ (struct elf_backend_data): Add elf_backend_reloc_type_class.
+ (_bfd_elf_reloc_type_class): New.
+ * elfxx-target.h (elf_backend_reloc_type_class): Define.
+ (elfNN_bed): Add elf_backend_reloc_type_class.
+ * elf.c (_bfd_elf_reloc_type_class): New.
+ * elf32-i386.c (elf_i386_check_relocs): Set DF_TEXTREL if the reloc
+ is against read-only section.
+ (elf_i386_size_dynamic_sections): Use DF_TEXTREL flag instead of
+ looking up section names for DT_TEXTREL.
+ (elf_i386_reloc_type_class): New.
+ (elf_backend_reloc_type_class): Define.
+ * elf32-sparc.c (elf32_sparc_check_relocs): Set DF_TEXTREL if the
+ reloc is against read-only section.
+ (elf32_sparc_size_dynamic_sections): Use DF_TEXTREL flag instead of
+ looking up section names for DT_TEXTREL.
+ (elf32_sparc_reloc_type_class): New.
+ (elf_backend_reloc_type_class): Define.
+ * elf64-sparc.c (sparc64_elf_check_relocs): Set DF_TEXTREL if the
+ reloc is against read-only section.
+ (sparc64_elf_size_dynamic_sections): Use DF_TEXTREL flag instead of
+ looking up section names for DT_TEXTREL.
+ (sparc64_elf_reloc_type_class): New.
+ (elf_backend_reloc_type_class): Define.
+ * elfxx-ia64.c (struct elfNN_ia64_link_hash_table): Add reltext field.
+ (elfNN_ia64_hash_table_create): Clear ia64_info.
+ (get_reloc_section): Set DF_TEXTREL if the reloc is against read-only
+ section.
+ (elfNN_ia64_size_dynamic_sections): Use ia64_info->reltext flag
+ instead of looking up section names for DT_TEXTREL.
+ (elfNN_ia64_reloc_type_class): New.
+ (elf_backend_reloc_type_class): Define.
+ * elflink.h (size_dynamic_sections): Add spare DT_NULL tags.
+ (struct elf_link_sort_rela): New.
+ (elf_link_sort_cmp1, elf_link_sort_cmp2, elf_link_sort_relocs): New.
+ (elf_bfd_final_link): Call elf_link_sort_relocs.
+ Convert one spare DT_NULL into DT_RELCOUNT resp. DT_RELACOUNT if
+ necessary.
+
+2001-08-23 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * configure.in (x86-bsdi): No corefile support.
+ * configure: Regenerate.
+
+2001-08-22 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * coff-stgo32.c (COFF_SECTION_ALIGNMENT_ENTRIES): Add missing
+ comma.
+
+2001-08-21 Mark Elbrecht <snowball3@bigfoot.com>
+
+ * coff-go32.c: Make DWARF2 sections use an alignment of 0. Set
+ the alignment of dwarf2 linkonce sections to 0.
+ * coff-sto32.c: Likewise.
+
+2001-08-20 Andreas Jaeger <aj@suse.de>
+
+ * coff-sparc.c: Add missing prototypes.
+ * elf32-s390.c: Likewise.
+ * elf32-i960.c: Likewise.
+ * aout-target.h: Likewise.
+
+2001-08-20 H.J. Lu <hjl@gnu.org>
+
+ * elf-bfd.h (elf_obj_tdata): Add num_section_syms.
+ (elf_num_section_syms): New for num_section_syms.
+
+ * elf.c (elf_map_symbols): Set num_section_syms.
+ (_bfd_elf_symbol_from_bfd_symbol): Check num_section_syms for
+ the section symbol index.
+
+2001-08-20 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elfxx-target.h (bfd_elfNN_bfd_link_hash_table_create): Never
+ select the generic has table creator. All elf backends need elf
+ specific fields in the hash table.
+
+2001-08-20 Alan Modra <amodra@bigpond.net.au>
+
+ * archive.c (offsetof): Remove define.
+ * elf.c: Likewise.
+ * oasys.c: Likewise
+ * sysdep.h (offsetof): Define.
+
+2001-08-17 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd.c (bfd_get_gp_size): Return an unsigned int.
+ (bfd_set_gp_size): Make param unsigned.
+ * bfd-in2.h: Regenerate.
+ * elf32-ppc.c (ppc_elf_add_symbol_hook): Use elf_gp_size rather
+ than calling bfd_get_gp_size.
+ * elf64-alpha.c (elf64_alpha_add_symbol_hook): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_add_symbol_hook): Likewise.
+
+2001-08-17 Alan Modra <amodra@bigpond.net.au>
+
+ * linker.c (default_fill_link_order): Handle four byte fill value.
+
+2001-08-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf64-sparc.c (sparc64_elf_output_arch_syms): Add missing
+ prototype.
+ * nlm32-alpha.c (nlm_alpha_write_external): Fix warning.
+
+ * elf64-mips.c (UNUSED_RELOC): Define.
+ (mips_elf64_howto_table_rel): Use it.
+ (mips_elf64_howto_table_rela): Here too.
+ (mips_elf64_write_relocs): Fix signed/unsigned warning.
+
+ * coffcode.h (coff_write_object_contents): Add ATTRIBUTE_UNUSED to
+ silence warning.
+ * coffgen.c (coff_print_symbol): Fix warnings.
+ (coff_find_nearest_line): Likewise.
+ * cofflink.c (_bfd_coff_link_input_bfd): Likewise.
+ * coff-alpha.c (alpha_convert_external_reloc): Likewise.
+ * format.c (bfd_check_format_matches): Likewise.
+ (bfd_set_format): Likewise.
+ * coff-ia64.c: Add missing prototypes.
+ * elf64-alpha.c (struct alpha_elf_link_hash_entry): Make addend
+ signed to silence warnings.
+ (elf64_alpha_relocate_section): Likewise.
+ (elf64_alpha_find_reloc_at_ofs): Fix warnings.
+ (elf64_alpha_add_symbol_hook): Likewise.
+ (elf64_alpha_final_link): Likewise.
+ (elf64_alpha_relax_section): Remove redundant assign to info.gotent.
+ (elf64_alpha_merge_gots): Add ATTRIBUTE_UNUSED to unused args.
+ (elf64_alpha_size_got_sections): Likewise.
+ * elfxx-ia64.c: Add missing prototypes.
+ (elfNN_ia64_relocate_section): Fix warning.
+ (elfNN_ia64_unwind_entry_compare): Make params const.
+
+2001-08-17 Alan Modra <amodra@bigpond.net.au>
+
+ * config.bfd (targ64_selvecs): New.
+ <powerpc-*-aix* entry>: Use it here instead of ineffectual #ifdef.
+
+ * bfd-in.h (BFD_VERSION): Remove wrong comment.
+ (BFD_DEFAULT_TARGET_SIZE): New.
+ (BFD_ARCH_SIZE): Comment.
+ * configure.in (target_size): New. Set instead of target64 in
+ selvecs case statement. Set target64 from it.
+ (bfd_default_target_size): New. Set from taget_size. AC_SUBST.
+ * bfd-in2.h: Regenerate.
+ * configure: Regenerate.
+
+2001-08-17 Alan Modra <amodra@bigpond.net.au>
+
+ * bfd.c (enum bfd_error): Add bfd_error_wrong_object_format.
+ (bfd_errmsgs): Add corresponding message.
+ * archive.c (bfd_generic_archive_p): Don't release bfd_ardata when
+ finding an archive that contains different format object files.
+ Return bfd_error_wrong_object_format for this case.
+ * format.c: Formatting fixes. s/CONST/const/.
+ (bfd_check_format_matches): Accept archives that give
+ bfd_error_wrong_object_format if no full match is found. Tidy
+ code handling matching_vector. Don't return a pointer to freed
+ memory in `matching'. Handle ambiguous matches as for partial
+ archive matches.
+ * bfd-in2.h: Regenerate.
+
+2001-08-15 Alan Modra <amodra@bigpond.net.au>
+
+ * libieee.h (common_header_type): Add last_byte field.
+
+ * ieee.c: Add missing prototypes. Some format fixes.
+ (struct output_buffer_struct): Move for availability to prototypes.
+ (ieee_part_after): New function.
+ (ieee_slurp_debug): Use it here.
+ (ieee_seek): Pass in ieee_data_struct rather than bfd. Use
+ ieee_part_after to set last_byte to one past end of current part.
+ Update callers.
+ (ieee_pos): Pass in ieee_data_struct rather than bfd.
+ Update callers.
+ (parse_expression): Don't go beyond the end of the current part.
+ (ieee_slurp_external_symbols): Correct type passed to read_2bytes.
+ (ieee_get_symtab_upper_bound, ieee_get_symtab,
+ ieee_get_symbol_info, ieee_print_symbol, ieee_new_section_hook,
+ ieee_get_reloc_upper_bound, ieee_canonicalize_reloc, block,
+ ieee_set_section_contents, ieee_write_object_contents,
+ ieee_make_empty_symbol): Make static.
+ (ieee_archive_p): Correct comments regarding bfd_read.
+ (ieee_object_p): Similarly.
+ (ieee_mkobject): Move it. Clear output_ptr_start, output_ptr,
+ output_ptr_end, input_ptr_start, input_ptr, input_ptr_end,
+ input_bfd, output_bfd, output_buffer.
+ (do_as_repeat): Write out ieee_set_current_pc_enum value as for
+ do_with_relocs, ie. as a symbol for relocatable files.
+ (ieee_vec): Add comments showing functions referenced by macros.
+
+2001-08-14 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * aout-tic30.c: Add missing prototypes. Fix formatting.
+ * aout-ns32k.c: Add missing prototypes. Fix formatting.
+ * peXXigen.c: Add missining prototypes. Fix formatting.
+ * aout-adobe.c: Add missining prototypes. Fix formatting.
+
+2001-08-13 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elf32-v850.c: Add missing function prototypes.
+ Fix some formatting.
+
+ * cpu-v850.c: Add missing function prototype.
+ Fix some formatting.
+
+2001-08-11 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elf-bfd.h (struct elf_backend_data): Add new fields
+ 'elf_backend_sprintf_vma' and 'elf_backend_fprintf_vma'.
+ (bfd_elf_sprintf_vma): Rename function prototype to
+ '_bfd_elf_sprintf_vma'.
+ (bfd_elf_fprintf_vma): Rename function prototype to
+ '_bfd_elf_fprintf_vma'.
+ * bfd.c (bfd_sprintf_vma): Do not invoke bfd_elf_sprintf_vma
+ directly, instead indirect via the elf_backend_data structure.
+ (bfd_fprintf_vma): Do not invoke bfd_elf_fprintf_vma directly,
+ instead indirect via the elf_backend_data structure.
+ * elf.c (bfd_elf_sprintf_vma): Rename to _bfd_elf_sprintf_vma.
+ (bfd_elf_fprintf_vma): Rename to _bfd_elf_fprintf_vma.
+ * elfxx-target.h (elf_backend_sprintf_vma): Initialise if not
+ already defined.
+ (elf_backend_fprintf_vma): Initialise if not already defined.
+ (struct elf_backend_data): Initialise the
+ elf_backend_sprintf_vma and elf_backend_fprintf_vma fields.
+
+2001-08-10 Andreas Jaeger <aj@suse.de>
+
+ * elf64-sparc.c: Add missing prototypes.
+ * elf32-cris.c: Likewise.
+ * elf32-i370.c: Likewise.
+ * elf64-hppa.c: Likewise.
+ * elf64-s390.c: Likewise.
+
+2001-08-10 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c (elf64_x86_64_elf_object_p): Make static.
+ Add prototypes where needed.
+
+2001-08-10 H.J. Lu <hjl@gnu.org>
+
+ * bfd.c (bfd_sprintf_vma): Fix a typo in the last change.
+ (bfd_fprintf_vma): Likewise.
+
+2001-08-10 H.J. Lu <hjl@gnu.org>
+
+ * bfd.c (bfd_sprintf_vma): Don't return void.
+ (bfd_fprintf_vma): Likewise.
+
+2001-08-10 Andreas Jaeger <aj@suse.de>
+
+ * configure.in: Add -Wstrict-prototypes and -Wmissing-prototypes
+ to build warnings.
+ * configure: Regenerate.
+
+2001-08-10 Alan Modra <amodra@bigpond.net.au>
+
+ * elf.c (bfd_elf_sprintf_vma): Add ATTRIBUTE_UNUSED to quiet
+ warning if not BFD64. Add braces so emacs auto format works.
+ (bfd_elf_fprintf_vma): Likewise.
+
+ * libxcoff.h (struct xcoff_backend_data_rec): Constify src param
+ of _xcoff_swap_ld*.
+ * coff-rs6000.c (xcoff_swap_ldhdr_in): Modify type of external
+ param to agree with libxcoff.h.
+ (xcoff_swap_ldhdr_out): Likewise.
+ (xcoff_swap_ldsym_in): Likewise.
+ (xcoff_swap_ldsym_out): Likewise.
+ (xcoff_swap_ldrel_in): Likewise.
+ (xcoff_swap_ldrel_out): Likewise.
+ (xcoff_create_csect_from_smclas): Likewise.
+ * coff64-rs6000.c: Add missing prototypes.
+ (xcoff64_swap_ldhdr_in): Modify type of external param to agree
+ with libxcoff.h.
+ (xcoff64_swap_ldhdr_out): Likewise.
+ (xcoff64_swap_ldsym_in): Likewise.
+ (xcoff64_swap_ldsym_out): Likewise.
+ (xcoff64_swap_ldrel_in): Likewise.
+ (xcoff64_swap_ldrel_out): Likewise.
+ (xcoff64_ppc_relocate_section): Make static.
+ (xcoff64_slurp_armap): Likewise.
+ (xcoff64_archive_p): Likewise.
+ (xcoff64_openr_next_archived_file): Likewise.
+ (xcoff64_sizeof_headers): Likewise.
+ (xcoff64_is_lineno_count_overflow): Likewise.
+ (xcoff64_is_reloc_count_overflow): Likewise.
+ (xcoff64_loader_symbol_offset): Likewise.
+ (xcoff64_loader_reloc_offset): Likewise.
+ * elf64-gen.c: Add missing prototypes.
+
+2001-08-09 H.J. Lu <hjl@gnu.org>
+
+ * elf.c (bfd_elf_sprintf_vma): Check ELFCLASS64 only in BFD64.
+ (bfd_elf_fprintf_vma): Likewise.
+
+2001-08-09 H.J. Lu <hjl@gnu.org>
+
+ * bfd-in.h (bfd_elf_sprintf_vma, bfd_elf_fprintf_vma): Moved
+ to ...
+ * elf-bfd.h: Here.
+ * bfd-in2.h: Regenerated.
+
+2001-08-09 H.J. Lu <hjl@gnu.org>
+
+ * bfd-in.h (bfd_sprintf_vma): New prototype.
+ (bfd_fprintf_vma): Likewise.
+ (bfd_elf_sprintf_vma): Likewise.
+ (bfd_elf_fprintf_vma): Likewise.
+ (bfd_printf_vma): New. Defined with bfd_fprintf_vma.
+ * bfd-in2.h: Regenerated.
+
+ * bfd.c (bfd_sprintf_vma): New. Defined.
+ (bfd_fprintf_vma): Likewise.
+
+ * elf.c (bfd_elf_sprintf_vma): New. Defined.
+ (bfd_elf_fprintf_vma): Likewise.
+
+2001-08-09 Alan Modra <amodra@bigpond.net.au>
+
+ * coff-rs6000.c: Add missing prototypes.
+ (xcoff_ppc_relocate_section, xcoff_is_lineno_count_overflow,
+ xcoff_is_reloc_count_overflow, xcoff_loader_symbol_offset,
+ xcoff_loader_reloc_offset): Make static.
+ * dwarf1.c: Add missing prototypes.
+ * dwarf2.c: Add missing prototypes.
+ (struct abbrev_info): Move definition.
+ (struct attr_abbrev, ABBREV_HASH_SIZE, ATTR_ALLOC_CHUNK): Likewise.
+ * elf.c: Add missing prototypes.
+ * elf32-gen.c: Likewise.
+ * elf32-i386.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ (ppc_elf_sort_rela): Use PTR instead of "void *".
+ * elflink.h: Add missing prototypes. Formatting fixes.
+ * merge.c: Add missing prototypes.
+ (last4_eq): Use PTR instead of "void *".
+ (last_eq): Likewise.
+ * syms.c: Add missing prototypes.
+
+2001-08-09 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * bfd.c: Fix formatting.
+ * bfd-in2.h: Regenerate.
+
+2001-08-09 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elf32-arc.c (R_ARC_B22_PCREL): Change 'partial_inplace' to
+ true (this target uses REL relocations) and 'pcrel_offset' to
+ false (the PC is implied, not stored in the offset).
+
+2001-08-08 Alan Modra <amodra@bigpond.net.au>
+
+ 1999-10-19 Linus Nordberg <linus@swox.se>
+ * elf-bfd.h (struct elf_backend_data): Add want_got_sym.
+ * elfxx-target.h (elf_backend_want_got_sym): Define.
+ (elfNN_bed): Add elf_backend_want_got_sym.
+ * elflink.c (_bfd_elf_create_got_section): Define
+ _GLOBAL_OFFSET_TABLE_ only if bed->want_got_sym.
+
+2001-08-08 Alexandre Oliva <aoliva@redhat.com>
+
+ * dwarf2.c (struct dwarf2_debug): Add sec, sec_info_ptr and syms.
+ (find_rela_addend): New function.
+ (parse_comp_unit): Call it to find the abbrev offset addend.
+ (_bfd_dwarf2_find_nearest_line): Initialize and maintain the new
+ members of dwarf2_debug as debugging information is read.
+
+2001-08-07 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * coff-sh.c (sh_coff_reloc_type_lookup): Provide for sh-coff
+ targets as well as sh-pe.
+
+2001-08-03 Ben Harris <bjh21@netbsd.org>
+
+ * elf32-arm.h (elf32_arm_final_link_relocate): Include offset of
+ reloc from start of section when computing value for R_ARM_REL32
+ reloc.
+
+2001-08-03 Alan Modra <amodra@bigpond.net.au>
+
+ From H.J. Lu <hjl@gnu.org>
+ * elf32-i386.c (allocate_plt_and_got_and_discard_relocs): Don't
+ keep relocs for undefined syms if there are no dynamic sections in
+ executable.
+ * elf32-hppa.c (allocate_plt_and_got_and_discard_relocs): Likewise.
+
+2001-08-02 Paul Sokolovsky <paul.sokolovsky@technologist.com>
+
+ * cofflink.c (coff_link_check_ar_symbols): also search for
+ __imp__symbol as well as _symbol.
+ * linker.c (_bfd_generic_link_add_archive_symbols): also
+ search for __imp__symbol as well as _symbol.
+
+2001-08-01 Adam Nemet <anemet@lnxw.com>
+
+ * elf.c (elf_sort_sections): Return zero only as the last step.
+
+2001-08-01 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * config.bfd (arm-vxworks): Change name of define from VXWORKS to
+ ARM_COFF_BUGFIX.
+ (arm-epoc-pe): Define ARM_COFF_BUGFIX.
+ coff-arm.c (coff_arm_relocate_section): Replace VXWORKS with
+ ARM_COFF_BUGFIX.
+
+2001-07-30 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+ * libecoff.h (_bfd_ecoff_styp_to_sec_flags): Changed return type
+ to match corresponding bfd_coff_backend data member.
+
+2001-07-24 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am: Update dependencies with "make dep-am".
+ * Makefile.in: Regenerate
+
+2001-07-15 H.J. Lu <hjl@gnu.org>
+
+ * Makefile.am (po/SRC-POTFILES.in): Use tmp.src instead of tmp.
+ (po/BLD-POTFILES.in): Use tmp.bld instead of tmp.
+ * Makefile.in: Regenerate.
+
+2001-07-11 H.J. Lu <hjl@gnu.org>
+
+ * elf64-alpha.c (elf64_alpha_check_relocs): Set the ALLOC|LOAD
+ flags when creating the reloc section if the ALLOC flag in the
+ source section is set.
+
+2001-07-11 Steve Ellcey <sje@cup.hp.com>
+
+ * reloc.c (bfd_reloc_code_type): Add IA64 relocs
+ BFD_RELOC_IA64_LTOFF_FPTR32MSB and BFD_RELOC_IA64_LTOFF_FPTR32LSB
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * elfxx-ia64.c (ia64_howto_table): Define how to handle
+ new relocations.
+ (elfNN_ia64_reloc_type_lookup): Handle new relocations.
+ (elfNN_ia64_check_relocs): Likewise.
+ (elfNN_ia64_install_value): Likewise.
+ (elfNN_ia64_relocate_section): Likewise.
+
+2001-07-11 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-sparc.c (_bfd_sparc_elf_howto_table): Remove support for
+ R_SPARC_UA64.
+ (elf32_sparc_check_relocs): Likewise.
+ Only create .rela section for alloced sections in shared libraries.
+ (elf32_sparc_relocate_section): Likewise.
+ Remove redundant check.
+ Optimize unaligned reloc usage.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Remove redundant
+ check.
+
+2001-07-11 H.J. Lu <hjl@gnu.org>
+
+ * elf64-alpha.c (elf64_alpha_check_relocs): Only use the same
+ ALLOC|LOAD flags as the source section for debugging sections
+ when creating the reloc section.
+
+2001-07-05 Jim Wilson <wilson@redhat.com>
+
+ * linker.c (_bfd_generic_link_add_one_symbol, case BIG): Use
+ the section of the bigger symbol.
+
+ * syms.c (bfd_is_local_label): Return false if BSF_SECTION_SYM.
+
+2001-07-05 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * peicode.h (coff_swap_scnhdr_in): For sections containing
+ uninitialised data, only set their size to s_paddr if this does
+ not reset their size to zero. MS's latest compilers will set
+ s_paddr to zero.
+
+2001-07-04 H.J. Lu <hjl@gnu.org>
+
+ * bfd/elf32-mips.c (_bfd_mips_elf_final_write_processing):
+ Handle bfd_mach_mips4400, bfd_mach_mips4600 and
+ bfd_mach_mips5000.
+
+2001-07-03 Mark Elbrecht <snowball3@softhome.net>
+
+ * bfd.c (bfd_get_sign_extend_vma): Support DJGPP COFF targets.
+
+ * cofflink.c (_bfd_coff_link_input_bfd): Skip section symbols from
+ sections being discarded.
+
+2001-06-30 Alan Modra <amodra@bigpond.net.au>
+
+ * elfcore.h (elf_core_file_p): Call bfd_section_from_phdr directly
+ instead of _bfd_elfcore_section_from_phdr.
+ * elf-bfd.h (_bfd_elfcore_section_from_phdr): Remove.
+ * elf.c (_bfd_elfcore_section_from_phdr): Remove.
+ (_bfd_elfcore_make_pseudosection): Expedite tail-call.
+ (elfcore_grok_prstatus): Likewise.
+ (elfcore_grok_lwpstatus): Likewise.
+ (bfd_get_elf_phdr_upper_bound): Likewise.
+ (elfcore_make_note_pseudosection): Formatting.
+ (_bfd_elfcore_strndup): Formatting.
+ * elf32-mips.c (mips_elf_sym_is_global): Formatting.
+ (_bfd_elf32_mips_grok_prstatus): Expedite tail-call.
+
+2001-06-29 Daniel Jacobowitz <drow@mvista.com>
+
+ * elf-bfd.h: Add prototypes for _bfd_elfcore_make_pseudosection
+ and _bfd_elfcore_strndup.
+ (struct elf_backend_data): Add elf_backend_grok_prstatus
+ and elf_backend_grok_psinfo.
+ * elf.c (_bfd_elfcore_make_pseudosection): New function.
+ (elfcore_grok_prstatus): Use it.
+ (elfcore_make_note_pseudosection): Likewise.
+ (elfcore_strndup): Rename to...
+ (_bfd_elfcore_strndup): Here, and make global.
+ (elfcore_grok_psinfo): Use _bfd_elfcore_strndup.
+ (elfcore_grok_note): Call elf_backend_grok_prstatus
+ and elf_backend_grok_psinfo if available.
+ * elf32-mips.c (_bfd_elf32_mips_grok_prstatus): New function.
+ (_bfd_elf32_mips_grok_psinfo): New function.
+ (elf_backend_grok_prstatus): Define.
+ (elf_backend_grok_psinfo): Define.
+ * elfxx-target.h (elf_backend_grok_prstatus): Default to NULL.
+ (elf_backend_grok_psinfo): Likewise.
+ (elfNN_bed): Include elf_backend_grok_prstatus and
+ elf_backend_grok_psinfo.
+
+2001-06-29 H.J. Lu <hjl@gnu.org>
+
+ * elf32-hppa.c (elf32_hppa_finish_dynamic_sections): Check if
+ hplink->sgot is NULL before filling GOT. Check if hplink->splt
+ is NULL before filling PLT.
+
+2001-06-29 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h (elf_link_output_extsym): Revert 1999-04-10.
+
+2001-06-27 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-hppa.c (elf32_hppa_check_relocs): Don't make syms dynamic
+ here..
+ (elf32_hppa_adjust_dynamic_symbol): ..nor here..
+ (allocate_plt_and_got_and_discard_relocs): .. instead do so here
+ after gc has run.
+
+ * elf32-hppa.c (RELATIVE_DYNAMIC_RELOCS): Delete.
+ (IS_ABSOLUTE_RELOC): Define.
+ (elf32_hppa_link_hash_entry): Always include reloc_entries field.
+ (hppa_link_hash_newfunc): Always init it.
+ (elf32_hppa_check_relocs): Mark symbols as ELF_LINK_NON_GOT_REF to
+ create COPY relocs only when the reloc is in a read-only section.
+ Instead, allocate space for a dynamic reloc to reference the
+ library symbol directly. Keep track of space we allocate using
+ relocs_entries.
+ (hppa_discard_copies): Delete, and move code to..
+ (allocate_plt_and_got): ..here. Rename to
+ allocate_plt_and_got_and_discard_relocs. Remove unneeded dynamic
+ relocs for non-shared link.
+ (elf32_hppa_size_dynamic_sections): Update calls to above.
+ (elf32_hppa_relocate_section): Write out the dynamic relocs used
+ in lieu of COPY relocs.
+
+ * elf32-i386.c (elf_i386_check_relocs): Don't make syms dynamic
+ here..
+ (elf_i386_adjust_dynamic_symbol): ..nor here..
+ (allocate_plt_and_got_and_discard_relocs): .. instead do so here
+ after gc has run.
+ (elf_i386_size_dynamic_sections): Fix a comment.
+ (elf_i386_relocate_section <R_386_32, R_386_PC32>): Rearrange code
+ involved in writing reloc out.
+
+2001-06-25 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-i386.c (elf_i386_check_relocs <R_386_32, R_386_PC32>):
+ Ensure syms are dynamic if we might be emitting a reloc.
+ (allocate_plt_and_got_and_discard_relocs): Don't discard relocs
+ for undefweak or undefined syms..
+ (elf_i386_relocate_section <R_386_32, R_386_PC32>): .. and emit.
+
+ * elf32-i386.c (allocate_plt_and_got_and_discard_relocs): Discard
+ relocs without ELF_LINK_HASH_DEF_DYNAMIC set.
+ (elf_i386_relocate_section <R_386_32, R_386_PC32>): Remove
+ redundant bfd_link_hash_defined, bfd_link_hash_defweak test.
+
+2001-06-24 H.J. Lu <hjl@gnu.org>
+
+ * cpu-i960.c (scan_960_mach): Don't modify const char *. Use
+ strncasecmp/strcasecmp instead of strncmp/strcmp.
+
+2001-06-23 H.J. Lu <hjl@gnu.org>
+
+ * elf32-i386.c (elf_i386_relocate_section <R_386_32, R_386_PC32>):
+ Check ELF_LINK_HASH_DEF_DYNAMIC to see if a symbol is not defined
+ in the regular object file and treat the weak definition as
+ the normal one.
+
+2001-06-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-i386.c (elf_i386_relocate_section <R_386_GOT32>): Tighten
+ unresolved_reloc test to exclude cases where we use "relocation"
+ before setting it to point into the .got. Reinstate fudge for
+ unresolved relocs in debugging sections.
+
+ * elf32-i386.c (elf_i386_relocate_section): Replace ugly
+ complicated tests for unresolvable relocs with a simple direct
+ scheme using "unresolved_reloc" var.
+
+ * elf32-i386.c (struct elf_i386_pcrel_relocs_copied): Rename to
+ elf_i386_dyn_relocs. Update comment.
+ (struct elf_i386_link_hash_entry): Rename pcrel_relocs_copied to
+ dyn_relocs.
+ (elf_i386_adjust_dynamic_symbol): Remove a BFD_ASSERT, change
+ others to aborts.
+ (allocate_plt_and_got_and_discard_relocs): Replace BFD_ASSERT with
+ abort.
+ (elf_i386_size_dynamic_sections): Likewise.
+ (elf_i386_finish_dynamic_symbol): Likewise.
+ (elf_i386_finish_dynamic_sections): Likewise.
+ (elf_i386_relocate_section): Likewise. Tidy R_386_GOT32 and error
+ handling code.
+
+ Avoid creating COPY relocs if possible.
+ * elf32-i386.c (elf_i386_check_relocs): Tweak condition under
+ which .got created. Mark symbols used by R_386_32 and R_386_PC32
+ relocs as ELF_LINK_NON_GOT_REF to create COPY relocs only when the
+ reloc is in a read-only section. Instead, allocate space for a
+ dynamic reloc to reference the library symbol directly. Keep
+ track of space we allocate using pcrel_relocs_copied.
+ (discard_copies): Delete, and move code to ..
+ (allocate_plt_and_got): ..here. Rename to
+ allocate_plt_and_got_and_discard_relocs. Remove unneeded dynamic
+ relocs for non-shared link.
+ (elf_i386_size_dynamic_sections): Update calls to above functions.
+ (elf_i386_relocate_section): Write out the dynamic relocs. Add
+ more ugly logic to avoid "unresolvable relocation" error. Use
+ htab shortcut in place of elf_hash_table macro.
+ (elf_i386_finish_dynamic_sections): Allow that dynamic .got may
+ not always be created now.
+
+2001-06-20 Bo Thorsen <bo@suse.co.uk>
+
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Fix linking of
+ shared libraries.
+
+2001-06-18 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * configure.host (mips64-*-linux): Reformat.
+
+2001-06-21 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Always
+ allocate local .got space. Use shortcuts from hash table for .got
+ and .plt rather than comparing section names.
+ (elf32_hppa_check_relocs): Use local_plt_refcounts var rather than
+ adjusting index into local_got_refcounts to document what we are
+ really doing.
+ (elf32_hppa_relocate_section): Similarly for local_plt_offsets.
+ Tidy .got and .plt error checking.
+
+2001-06-20 Catherine Moore <clm@redhat.com>
+
+ * elf-bfd.h (struct elf_backend_data):
+ elf_backend_emit_relocs: New field: Function for emitting
+ relocs.
+ elf_backend_count_relocs: New field: Function for determining
+ the number of relocs to be emitted.
+ * elfxx-target.h: Provide default (NULL) values for
+ elf_backend_emit_relocs and elf_backend_count_relocs.
+ * elflink.h (elf_link_size_reloc_section): Make the hash table
+ big enough to hold the relocs counted by either reloc_count or
+ o->reloc_count.
+ (elf_bfd_final_link) emit_relocs: New boolean, set if relocs
+ should be emitted, either because of a command line option
+ stored in the info structure or because the target provides a
+ special reloc emitting function.
+ If the target provides a reloc counting function use it,
+ unless performing a relocatable link or emitting all relocs.
+ Also set the SEC_RELOC flag on any output section which will
+ contain relocs.
+ (elf_link_input_bfd): emit_relocs: New boolean, set if relocs
+ should be emitted, either because of a command line option
+ stored in the info structure or because the target provides a
+ special reloc emitting function.
+ If the target provides a reloc emitting function, use it,
+ unless performing a relocatable link or emitting all relocs.
+
+2001-06-20 H.J. Lu <hjl@gnu.org>
+
+ * elf32-i386.c (elf_i386_size_dynamic_sections): Always
+ allocate local .got space.
+
+2001-06-19 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Fix creation of
+ dynamic symbols.
+
+2001-06-18 Hans-Peter Nilsson <hp@axis.com>
+
+ * elflink.h (struct elf_assign_sym_version_info): Remove member
+ export_dynamic. All users changed to use info member.
+ NAME(bfd_elf,size_dynamic_sections)): Remove parameter
+ export_dynamic, instead use member in parameter info.
+ * bfd-in.h (bfd_elf32_size_dynamic_sections,
+ bfd_elf64_size_dynamic_sections): Update prototype.
+ * bfd-in2.h: Regenerate.
+
+2001-06-18 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_info_failed): Add a new field, verdefs.
+ (NAME(bfd_elf,size_dynamic_sections): Pass verdefs to
+ elf_export_symbol.
+ (elf_export_symbol): Check eif->verdefs to decide if a symbol
+ should be exported.
+
+2001-06-17 H.J. Lu <hjl@gnu.org>
+
+ * elf32-mips.c (mips_elf_link_hash_entry): Add a new field,
+ readonly_reloc, to record if a relocation in the .rel.dyn
+ section is against a read-only section.
+ (mips_elf_link_hash_newfunc): Initialize the readonly_reloc
+ field to false.
+ (_bfd_mips_elf_check_relocs): Record if there is a relocation
+ in the .rel.dyn section against a read-only section by setting
+ DF_TEXTREL or readonly_reloc.
+ (_bfd_mips_elf_copy_indirect_symbol): Copy readonly_reloc if
+ it is true.
+ (_bfd_mips_elf_adjust_dynamic_symbol): Record DF_TEXTREL if
+ there is a relocation in the .rel.dyn section against a
+ read-only section.
+ (_bfd_mips_elf_size_dynamic_sections): Set DT_TEXTREL if
+ DF_TEXTREL is set.
+
+2001-06-12 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * coffcode.h (styp_flags_to_sec_flags): Change to a boolean
+ function. Move flagword result into parameter list. Remove
+ comment about setting bfd_error_handler to intercept failure
+ results.
+ * coffgen.c (make_a_section_from_file): Examine result of
+ calling bfd_coff_styp_to_sec_flags and pass a failure back to
+ caller.
+ * ecoff.h (styp_flags_to_sec_flags): Change to a boolean
+ function. Move flagword result into parameter list.
+ * libcoff.h: Regenerate.
+ * libecoff.h: Regenerate.
+
+2001-06-13 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * aoutx.h (adjust_z_magic): Only pad the tesxt section if the data
+ section is going to follow it.
+
+2001-06-12 Catherine Moore <clm@redhat.com>
+
+ * elflink.h (elf_gc_propagate_vtable_entries): Replace FILE_ALIGN
+ with the file_align entry from elf_backend_data.
+ (elf_gc_smash_unused_vtentry_relocs): Likewise.
+ (elf_gc_record_vtentry): Likewise.
+
+2001-06-10 Alan Modra <amodra@bigpond.net.au>
+
+ * elflink.h: Whitespace changes.
+ (elf_link_read_relocs_from_section): Use "unsigned int" iterator
+ rather than "unsigned char".
+ (elf_link_output_relocs): Likewise.
+ (elf_link_input_bfd): Likewise.
+ (elf_reloc_link_order): LIkewise.
+ * elf.c: s/CONST/const/. Whitespace changes.
+ * elf32-mips.c: Formatting fix.
+
+ * Makefile.am (SOURCE_HFILES): Include xcoff-target.h, remove xcoff.h.
+ * Makefile.in: Regenerate.
+ * po/Make-in: Remove trailing tab.
+
+2001-06-09 Philip Blundell <philb@gnu.org>
+
+ * elf32-arm.h (elf32_arm_plt0_entry): Correct error in last
+ change.
+ (elf32_arm_plt_entry): Likewise.
+
+2001-06-08 H.J. Lu <hjl@gnu.org>
+
+ * elf.c (swap_out_syms): Keep names for global section symbols.
+
+2001-06-07 H.J. Lu <hjl@gnu.org>
+
+ * config.bfd: Put back ecoff for Linux/mips. Firmwares on some
+ MIPS-based machines need it.
+
+2001-06-07 H.J. Lu <hjl@gnu.org>
+
+ * elf32-mips.c (_bfd_mips_elf_object_p): Set the bad symtab
+ for SGI only.
+
+ * config.bfd: Remove ecoff from Linux/mips.
+
+2001-06-07 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c (elf64_x86_64_finish_dynamic_symbol): Add an
+ assertion.
+ (elf64_x86_64_check_relocs): Fix VTENTRY relocation; set an
+ alignment of 8 for .rela sections; handle further relocations.
+
+2001-06-06 Christian Groessler <cpg@aladdin.de>
+
+ * coff-z8k.c: Fix formatting.
+ Fix howtos: howto->size was always 1.
+
+2001-06-05 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * configure.host (mips64*-*-linux*): Define.
+
+2001-06-05 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-i386.c (elf_i386_discard_copies): Rename to
+ discard_copies, and use elf_link_hash_entry arg rather than
+ elf_i386_link_hash_entry.
+ (elf_i386_link_hash_traverse): Delete.
+ (elf_i386_size_dynamic_sections): Adjust call to discard_copies.
+ Tidy sizing of dynamic sections.
+ (elf_i386_check_relocs <R_386_32, R_386_PC32>): Reference count
+ possible .plt entries.
+ (elf_i386_gc_sweep_hook): Likewise.
+ (elf_i386_adjust_dynamic_symbol): Discard .plt entries for
+ everything with plt.refcount <= 0.
+
+ * elf32-i386.c (elf_i386_check_relocs): Don't allocate .got and
+ .relgot space here.
+ (elf_i386_gc_sweep_hook): ..and no need to deallocate here..
+ (elf_i386_adjust_dynamic_symbol): ..and don't allocate .plt and
+ .rel.plt here..
+ (allocate_plt_and_got): ..instead do it all here. New function.
+ (elf_i386_size_dynamic_sections): Allocate local .got space and
+ call allocate_plt_and_got. No need to zap .relgot if not dynamic.
+ (bfd_elf32_bfd_final_link): Delete. (ie. use regular final link
+ rather than gc variety).
+ (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
+ (elf_i386_relocate_section): Use it here and correct handling of
+ R_386_GOT32. Provide section and offset for "unresolvable
+ relocation" error message.
+ (elf_i386_finish_dynamic_symbol): Correct handling of R_386_GOT32.
+
+ * elf32-i386.c (struct elf_i386_link_hash_table): Add sgot,
+ sgotplt, srelgot, splt, srelplt, sdynbss, srelbss fields.
+ (elf_i386_link_hash_table_create): Init them.
+ (create_got_section): New function.
+ (elf_i386_create_dynamic_sections): New function.
+ (elf_backend_create_dynamic_sections): Set to above.
+ (elf_i386_check_relocs): Use shortcuts from hash table rather than
+ calling bfd_get_section_by_name.
+ (elf_i386_gc_sweep_hook): Likewise.
+ (elf_i386_adjust_dynamic_symbol): Likewise.
+ (elf_i386_size_dynamic_sections): Likewise.
+ (elf_i386_relocate_section): Likewise.
+ (elf_i386_finish_dynamic_sections): Likewise.
+
+ * elf32-hppa.c (allocate_plt_and_got): Skip indirect and warning syms.
+
+2001-06-02 H.J. Lu <hjl@gnu.org>
+
+ * elf32-hppa.c (elf32_hppa_object_p): Check ELFOSABI_LINUX
+ and ELFOSABI_HPUX.
+ * elf64-hppa.c (elf64_hppa_object_p): Likewise.
+
+2001-06-02 H.J. Lu <hjl@gnu.org>
+
+ * aout-cris.c (MACHTYPE_OK): New. Defined.
+
+2001-06-02 Hans-Peter Nilsson <hp@axis.com>
+
+ * section.c (_bfd_strip_section_from_output): Handle NULL
+ output_section.
+
+2001-06-02 H.J. Lu <hjl@gnu.org>
+
+ * config.bfd (powerpc-*-aix*, powerpc-*-beos*, rs6000-*-*): Add
+ rs6000coff64_vec only if BFD64 is defined.
+ (powerpc64-*-aix*): Enable only if BFD64 is defined.
+
+2001-06-02 H.J. Lu <hjl@gnu.org>
+
+ * coff-ia64.c (ia64coff_object_p): Rewrite with
+ external_PEI_DOS_hdr and external_PEI_IMAGE_hdr.
+
+2001-06-01 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Add PC8
+ relocation, small reformatting.
+
+2001-05-29 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c (elf64_x86_64_check_relocs): Handle R_X86_64_64.
+ (elf64_x86_64_relocate_section): Likewise.
+
+2001-05-30 Alan Modra <amodra@one.net.au>
+
+ * elf32-hppa.c (elf32_hppa_check_relocs): Don't NEED_PLT for
+ millicode. Don't allocate .got and .rela.got space here..
+ (elf32_hppa_gc_sweep_hook): ..and no need to deallocate here..
+ (elf32_hppa_adjust_dynamic_symbol): ..and don't allocate .plt and
+ .rela.plt here..
+ (hppa_handle_PIC_calls): ..nor here..
+ (allocate_plt_and_got): ..instead do it all here. New function.
+ (elf32_hppa_size_dynamic_sections): Allocate local .got space and
+ call allocate_plt_and_got. No need to zap .got if not dynamic.
+ (elf32_hppa_final_link): Call regular bfd_final_link instead of
+ gc_common_final_link.
+ (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
+ (elf32_hppa_relocate_section): Use it here.
+ (elf32_hppa_finish_dynamic_symbol): Remove superfluous test of
+ dynamic_sections_created.
+ (hppa_type_of_stub): Don't LONG_BRANCH_VIA_PLT if millicode sym.
+
+2001-05-28 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c (elf64_86_64_size_info): Remove, we can use the
+ generic version since we want a hashsize of 4.
+ (elf_backend_size_info): Likewise.
+
+2001-05-28 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elflink.h (elf_link_size_reloc_section): Use bfd_zmalloc instead of
+ a zeroing loop.
+ (elf_link_output_relocs): Handle MIPS ELF64 relocations correctly.
+ (elf_link_input_bfd): Likewise.
+ (elf_reloc_link_order): Likewise.
+ (elf_finish_pointer_linker_section): Typo. Handle MIPS ELF64
+ relocations correctly.
+
+2001-05-28 Nicolas Pitre <nico@cam.org>
+
+ * elf32-arm.h: fix PLT generation for big endian ARM
+
+2001-05-28 Alan Modra <amodra@one.net.au>
+
+ * elf32-hppa.c (elf32_hppa_relocate_section): Set up .plt entries
+ for symbols forced local that need plabels.
+ (elf32_hppa_adjust_dynamic_symbol): Don't allocate space in
+ .plt.rela for local syms if non-shared.
+ (hppa_build_one_stub): Mask lsb of plt.offset.
+ (elf32_hppa_finish_dynamic_symbol): Abort if lsb of plt.offset set.
+ (clobber_millicode_symbols): Correct comment.
+ (elf32_hppa_relocate_section): Likewise.
+ (elf32_hppa_finish_dynamic_symbol): Likewise.
+
+2001-05-28 Jeff Sturm <jsturm@one-point.com>
+
+ * reloc.c: Add BFD_RELOC_SPARC_UA16 and BFD_RELOC_SPARC_UA64.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+ * elf32-sparc.c: Enable BFD_RELOC_SPARC_UA16, BFD_RELOC_SPARC_UA32
+ and BFD_RELOC_SPARC_UA64 mapping
+ * elf64-sparc.c: Likewise.
+
+2001-05-25 H.J. Lu <hjl@gnu.org>
+
+ * Makefile.am (BFD32_BACKENDS): Remove coff-pmac.lo.
+ (BFD32_BACKENDS_CFILES): Remove coff-pmac.c.
+ (coff-rs6000.lo): Remove the old dependency.
+ * Makefile.in: Rebuild.
+
+ * configure.in (pmac_xcoff_vec): Replace coff-pmac.lo with
+ coff-rs6000.lo.
+
+2001-05-25 H.J. Lu <hjl@gnu.org>
+
+ * coff-rs6000.c (rs6000coff_vec): Use rs6000coff_core_p,
+ rs6000coff_core_file_matches_executable_p,
+ rs6000coff_core_file_failing_command and
+ rs6000coff_core_file_failing_signal only if AIX_CORE is
+ defined.
+ (pmac_xcoff_vec): Likewise.
+ * coff64-rs6000.c (rs6000coff64_vec): Likewise.
+
+2001-05-25 Timothy Wall <twall@redhat.com>
+
+ * elfxx-ia64.c (allocate_dynrel_entries): Don't allocate an entry
+ for __GLOB_DATA_PTR on AIX5. Clean up some relocation bugs.
+
+2001-05-25 H.J. Lu <hjl@gnu.org>
+
+ * bfd-in2.h: Regenerated.
+ * libcoff.h: Likewise.
+
+2001-05-25 Alan Modra <amodra@one.net.au>
+
+ * elf32-hppa.c (elf32_hppa_relocate_section): Don't allow
+ undefined millicode syms in shared libs.
+ (hppa_build_one_stub): Turn BFD_ASSERTs into aborts.
+ (elf32_hppa_check_relocs): Likewise.
+ (elf32_hppa_adjust_dynamic_symbol): Likewise.
+ (elf32_hppa_size_dynamic_sections): Likewise.
+ (elf32_hppa_relocate_section): Likewise.
+ (elf32_hppa_finish_dynamic_symbol): Likewise.
+ (elf32_hppa_finish_dynamic_sections): Likewise.
+
+2001-05-24 Tom Rix <trix@redhat.com>
+
+ * Makefile.am coff-pmac bfd now defined in coff-rs6000.c
+ xcoff-target.h not used to define rs6000 or ppc bfd.
+ * Makefile.in same
+
+ * bfd-in.h : (struct lineno_cache_entry) promote element "offset"
+ to 64 bit.
+
+ * coff-rs6000.c : Many changes for 64 bit support. Move common
+ 32/64 code to xcofflink.c. Explictly define the rs6000coff_vec
+ and pmac_xcoff_vec
+
+ * coff64-rs6000.c : Many changes for 64 bit support. 64 bit
+ linker now supported. Explictly define the rs6000coff64_vec.
+
+ * coffcode.h : (coff_set_arch_mach_hook) xcoff 64 bit support
+ (coff_print_aux) same
+ (coff_write_object_contents) same
+ (coff_slurp_line_table) same
+
+ * coffgen.c : (coff_fix_symbol_name) formatting
+ (coff_mangle_symbols) xcoff 64 bit support
+ (coff_write_symbol) same
+ (coff_write_alien_symbol) same
+ (coff_write_native_symbol) same
+ (coff_write_symbols) same
+ (coff_get_symbol_info) same
+ (bfd_coff_get_syment) same
+ (coff_print_symbol) same
+
+ * config.bfd : add powerpc64-*-aix* target
+
+ * libcoff-in.h : formatting
+
+ * libcoff.h : move xcoff extern declarations to libxcoff.h
+
+ * libxcoff.h : New file
+
+ * xcofflink.c : Many changes for xcoff64 support. Move common
+ structures to include/coff/xcoff.h. Move specific structure to
+ backends coff-rs6000.c and coff64-rs6000.c. Use new backend
+ functions, defined in libxcoff.h, to isolate 32/64 dependencies.
+
+ (bfd_xcoff_size_dynamic_sections) : special __rtinit symbol for
+ aix4.2+ -binitfini.
+
+ (xcoff_build_ldsyms) : handle special __rtinit symbol.
+
+2001-05-23 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf64-sparc.c (sparc64_elf_slurp_reloc_table): Fix typo
+ s/ENTIRES/ENTRIES/.
+
+2001-05-23 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * reloc.c (bfd_reloc_code_real): Add MIPS ELF64 relocations.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+
+ * aoutx.h (aout_@var{size}_machine_type): Add MIPS r12k support.
+ * archures.c (bfd_mach_mips12000): Define.
+ * cpu-mips.c (arch_info_struct): Add MIPS r12k support.
+ * elf32-mips.c (_bfd_mips_elf_final_write_processing): Add MIPS r12k
+ support.
+ (_bfd_mips_elf_size_dynamic_sections): Use official bfd typedef.
+ * bfd-in2.h: Regenerate.
+ * elfxx-target.h: Do not redefine bfd_elfNN_bfd_make_debug_symbol.
+
+2001-05-23 kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf32-sh.c (elf_sh_plt0_entry_be, elf_sh_plt0_entry,
+ elf_sh_plt_entry_be, elf_sh_plt_entry, elf_sh_pic_plt_entry_be,
+ elf_sh_pic_plt_entry): New PLT code, that does not use r2, since
+ that is used by GCC.
+
+2001-05-23 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elf-bfd.h (NUM_SHDR_ENTRIES): New macro: compute the number
+ of entries in a structured section.
+ * elf.c: Use new macro.
+ * elf32-i386.c: Use new macro.
+ * elf32-mips.c: Use new macro.
+ * elf64-alpha.c: Use new macro.
+ * elf64-sparc.c: Use new macro.
+ * elfcode.h: Use new macro.
+ * elflink.h: Use new macro.
+
+2001-05-23 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * bfdint.texi: Replace -oformat with --oformat.
+
+2001-05-21 Andreas Jaeger <aj@suse.de>
+
+ * dwarf2.c (decode_line_info): Fix error message.
+ (read_abbrevs): Fix test for offset as suggested by Alan Modra and
+ adjust error message.
+
+2001-05-18 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_link_add_object_symbols): Revert the last
+ change.
+
+2001-05-17 Alan Modra <amodra@one.net.au>
+
+ * elf32-hppa.c (clobber_millicode_symbols): Temporarily set
+ ELF_LINK_FORCED_LOCAL to suit 2001-04-30 change.
+ (hppa_build_one_stub): Add an assert to check plt.offset.
+
+2001-05-17 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set the
+ version definition to basename of the output filename.
+
+2001-05-17 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_link_add_object_symbols): Set DT_NEEDED to
+ basename of the bfd filename.
+
+2001-05-16 Alan Modra <amodra@one.net.au>
+
+ * section.c (asection): Add linker_has_input field.
+ (STD_SECTION): Adjust initialization to suit.
+ * ecoff.c (bfd_debug_section): Likewise.
+ * bfd-in2.h: Regenerate.
+
+2001-05-15 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf-m10300.c (mn10300_elf_relax_section): Don't relax
+ negative 32-bit operands to 16 operands when the operand is
+ going to be zero-extended by the modified opcode.
+
+2001-05-12 Peter Targett <peter.targett@arccores.com>
+
+ * cpu-arc.c (arch_info_struct): Add entry 'base' representing old
+ name for 'arc5' core versions.
+ (bfd_arc_arch): Make bfd_mach_arc_6 default.
+
+ * elf32-arc.c (arc_elf_object_p): Make E_ARC_MACH_ARC6 default
+ architecture.
+ (arc_elf_final_write_processing): Make bfd_mach_arc_6 default.
+
+2001-05-11 Jakub Jelinek <jakub@redhat.com>
+
+ * elfxx-ia64.c (is_unwind_section_name): Consider linkonce unwind
+ sections as well.
+ (elfNN_ia64_final_write_processing): Map .gnu.linkonce.ia64unw.FOO
+ to .gnu.linkonce.t.FOO text section.
+
+2001-05-11 Jakub Jelinek <jakub@redhat.com>
+
+ * merge.c (struct sec_merge_hash_entry): Add u.entsize and u.suffix
+ fields, change sec into secinfo.
+ (struct sec_merge_info): Add chain, remove last fields.
+ (struct sec_merge_sec_info): Add next, sec, psecinfo fields.
+ (sec_merge_hash_lookup): If lookup could not use a string only
+ because it has bad alignment, mark the old string for deletion.
+ (sec_merge_add): Add secinfo argument. Don't compute entry's
+ position, instead record the section.
+ (sec_merge_emit): Update for the sec into secinfo change in
+ struct sec_merge_hash_entry.
+ (_bfd_merge_section): Only record the section for merging, defer
+ putting strings into the hash table.
+ (cmplengthentry, last4_eq, last_eq, record_section, merge_strings,
+ _bfd_merge_sections): New functions.
+ (_bfd_merged_section_offset): Update for the sec_merge_hash_entry
+ changes.
+ * libbfd-in.h (_bfd_merge_sections): Add prototype.
+ (_bfd_nolink_bfd_merge_sections): Define.
+ * libbfd.h: Likewise.
+ (bfd_generic_merge_sections): Add prototype.
+ * targets.c (BFD_JUMP_TABLE_LINK): Add _bfd_merge_sections.
+ (struct bfd_target): Likewise.
+ * bfd.c (bfd_merge_sections): Define.
+ * bfd-in2.h: Rebuilt.
+ * elf.c (_bfd_elf_merge_sections): New function.
+ * elf-bfd.h (_bfd_elf_merge_sections): Add prototype.
+ * elfxx-target.h (bfd_elfNN_bfd_merge_sections): Define.
+ * reloc.c (bfd_generic_merge_sections): New function.
+ * vms.c (vms_bfd_merge_sections): New function.
+ * aout-adobe.c (aout_32_bfd_merge_sections): Define.
+ * aout-target.h (MY_bfd_merge_sections): Define.
+ * aout-tic30.c (MY_bfd_merge_sections): Define.
+ * binary.c (binary_bfd_merge_sections): Define.
+ * bout.c (b_out_bfd_merge_sections): Define.
+ * coff-alpha.c (_bfd_ecoff_bfd_merge_sections): Define.
+ * coffcode.c (coff_bfd_merge_sections): Define.
+ * coff-mips.c (_bfd_ecoff_bfd_merge_sections): Define.
+ * i386msdos.c (msdos_bfd_merge_sections): Define.
+ * i386os9k.c (os9k_bfd_merge_sections): Define.
+ * ieee.c (ieee_bfd_merge_sections): Define.
+ * ihex.c (ihex_bfd_merge_sections): Define.
+ * nlm-target.h (nlm_bfd_merge_sections): Define.
+ * oasys.c (oasys_bfd_merge_sections): Define.
+ * ppcboot.c (ppcboot_bfd_merge_sections): Define.
+ * som.c (som_bfd_merge_sections): Define.
+ * srec.c (srec_bfd_merge_sections): Define.
+ * tekhex.c (tekhex_bfd_merge_sections): Define.
+ * versados.c (versados_bfd_merge_sections): Define.
+ * xcoff-target.h (_bfd_xcoff_bfd_merge_sections): Define.
+
+2001-05-11 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * dwarf1.c (_bfd_dwarf1_find_nearest_line): Change type of 'addr'
+ to be unsigned long, in order to match its use.
+
+2001-05-10 H.J. Lu <hjl@gnu.org>
+
+ * linker.c (_bfd_generic_link_add_one_symbol): Check loop on
+ indirect symbols.
+
+2001-05-09 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_link_add_object_symbols): Fix a typo. Allocate
+ versymhdr->sh_size bytes for extversym instead of hdr->sh_size.
+ Remove the unused veriable `dynver'.
+
+2001-05-08 Ian Lance Taylor <ian@zembu.com>
+
+ * coff-i386.c (coff_i386_reloc): Don't dump core if output_bfd is
+ NULL or is not COFF.
+ (coff_i386_rtype_to_howto): Don't dump core if output section
+ owner is not COFF.
+
+2001-05-07 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * ecoff.c (bfd_debug_section): Fix initialization.
+ * elf.c (_bfd_elf_slurp_version_tables): Change maxidx to unsigned, it
+ is always a positive integer. Cast away sign mismatch.
+ * elf32-mips.c: Fix misleading comment and typo.
+ (_bfd_mips_elf_section_from_bfd_section): Remove unused attribute, use
+ correct data type.
+ * elflink.c: Fix typo.
+ (_bfd_elf_create_dynamic_sections): Remove superfluous initialization.
+ * ecoffswap.h (ecoff_swap_fdr_in): Cast away sign mismatch.
+
+2001-05-04 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (SREL16, SREL32, SREL64): Set pcrel_offset true.
+
+2001-05-04 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * elf32-arm.h (elf32_arm_final_link_relocate): Set
+ EF_ARM_HASENTRY if the start address is set.
+
+2001-05-03 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * targets.c (_bfd_target_vector_entries): Compute value based on
+ the size of the _bfd_target_vector and not bfd_target_vector.
+
+2001-05-03 H.J. Lu <hjl@gnu.org>
+
+ * elfcode.h: Include "libiberty.h".
+
+ * elflink.h (elf_link_add_object_symbols): Set
+ elf_dt_name (abfd) to basename of the bfd filename.
+ (NAME(bfd_elf,size_dynamic_sections)): Set vn_file to basename
+ of the bfd filename.
+
+2001-05-03 Andreas Jaeger <aj@suse.de>
+
+ * elf64-gen.c (elf_generic_info_to_howto): Add unused attribute.
+ (elf_generic_info_to_howto_rel): Likewise.
+ * coff-alpha.c (reloc_nil): Likewise.
+ (alpha_ecoff_bad_format_hook): Likewise.
+ (alpha_adjust_reloc_out): Likewise.
+ (alpha_bfd_reloc_type_lookup): Likewise.
+ (alpha_convert_external_reloc): Likewise.
+ * elf64-alpha.c (elf64_alpha_reloc_nil): Likewise.
+ (elf64_alpha_reloc_bad): Likewise.
+ (elf64_alpha_reloc_gpdisp): Likewise.
+ (elf64_alpha_bfd_reloc_type_lookup): Likewise.
+ (elf64_alpha_info_to_howto): Likewise.
+ (elf64_alpha_add_symbol_hook): Likewise.
+ (elf64_alpha_create_got_section): Likewise.
+ (elf64_alpha_is_local_label_name): Likewise.
+ (elf64_alpha_merge_ind_symbols): Likewise.
+ * elf64-mips.c (mips_elf64_reloc_type_lookup): Likewise.
+ (mips_elf64_get_reloc_upper_bound): Likewise.
+ * nlm32-alpha.c (nlm_alpha_mangle_relocs): Likewise.
+ (nlm_alpha_get_public_offset): Likewise.
+
+2001-05-02 Johan Rydberg <jrydberg@opencores.org>
+
+ * elf32-openrisc.c (openrisc_elf_howto_table): Do not complain
+ about overflow in R_OPENRISC_LO_16_IN_INSN and
+ R_OPENRISC_HI_16_IN_INSN.Index: bfd/elf32-openrisc.c
+
+2001-04-30 H.J. Lu <hjl@gnu.org>
+
+ * elf.c (_bfd_elf_link_hash_hide_symbol): Set dynindx to -1
+ only for ELF_LINK_FORCED_LOCAL.
+ * elf32-hppa.c (elf32_hppa_hide_symbol): Likewise.
+ * elf32-mips.c (_bfd_mips_elf_hide_symbol): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_hash_hide_symbol): Likewise.
+
+ * elflink.h (elf_fix_symbol_flags): Set ELF_LINK_FORCED_LOCAL
+ if the symbol has hidden or internal visibility.
+
+2001-04-30 Alan Modra <amodra@one.net.au>
+
+ * elf32-hppa.c (final_link_relocate): Branch to .+8 for
+ calls to undefined weak symbols.
+
+2001-04-30 Andreas Jaeger <aj@suse.de>, Andreas Schwab <schwab@suse.de>
+
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Correct test for
+ R_X86_64_GOTPCREL, don't use assignments instead of comparisons.
+
+2001-04-27 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c (elf64_x86_64_finish_dynamic_sections): Only swap
+ out handled entries.
+ (elf64_x86_64_finish_dynamic_symbol): Set up GOT entries.
+ (elf64_x86_64_relocate_section): Fix GOTPCREL calculation.
+ (elf64_x86_64_relocate_section): Merge entries for GOTPCREL and
+ GOT32.
+
+2001-04-27 Sean McNeil <sean@mcneil.com>
+
+ * config.bfd: Add arm-vxworks target.
+ * coff-arm (coff_arm_relocate_section): Add in symbol value to
+ addend (fro VXworks targets).
+
+2001-04-26 H.J. Lu <hjl@gnu.org>
+
+ * elf32-i386.c (elf_i386_check_relocs): Verify if r_symndx is
+ valid.
+
+2001-04-25 Frank Ch. Eigler <fche@redhat.com>
+
+ * bfd-in.h (bfd_cache_close): Declare newly exported function.
+ * bfd-in2.h: Regenerated.
+
+2001-04-24 Jakub Jelinek <jakub@redhat.com>
+
+ * merge.c (struct sec_merge_hash_entry): Add alignment field.
+ (struct sec_merge_hash): Remove alignment_power.
+ (sec_merge_hash_newfunc): Clear alignment.
+ (sec_merge_hash_lookup): Pass alignment as argument.
+ Use hashp->root.next, not hashp->next to walk the hash chain.
+ If a string already in the hashtable does not have required
+ alignment, create a new hashtable entry.
+ (sec_merge_init): Remove alignment_power argument.
+ (sec_merge_add): Add alignment argument.
+ (sec_merge_emit): Alignment is now a per-entity thing, not per
+ section.
+ (_bfd_merge_section): Sanity check even non-SEC_STRINGS sections
+ for proper alignment.
+ Pass alignment information to sec_merge_add.
+
+2001-04-24 Christian Groessler <cpg@aladdin.de>
+
+ * coff-z8k.c (extra_case): added handler for R_DISP7, R_CALLR
+ and R_REL16 reloc types; accept odd values for R_REL16 type
+
+2001-04-24 Johan Rydberg <jrydberg@opencores.org>
+
+ * cpu-openrisc.c: New file.
+ * elf32-openrisc.c: Likewise.
+
+ * Makefile.am (ALL_MACHINES): Add cpu-openrisc.lo.
+ (ALL_MACHINES_CFILES): Add cpu-openrisc.c.
+ (BFD32_BACKENDS): Add elf32-openrisc.lo.
+ (BFD32_BACKENDS_CFILES): Add elf32-openrisc.c.
+ (cpu-openrisc.lo, elf32-openrisc.lo): New rules.
+ * Makefile.in: Regenerated.
+ * config.bfd: (openrisc-*-elf): New target.
+ * configure.in (bfd_elf32_openrisc_vec): New vector.
+ * configure: Regenerated.
+ * libbfd.h: Regenerated.
+ * bfd-in2.h: Regenerated.
+ * reloc.c: Add OpenRISC relocations.
+ * targets.c (bfd_elf32_openrisc_vec): Declare.
+ (bfd_target_vect): Add bfd_elf32_openrisc_vec.
+ * archures.c (enum bfd_architecture): Add bfd_arch_openrisc.
+ (bfd_openrisc_arch): Declare.
+ (bfd_archures_list): Add bfd_openrisc_arch.
+ * elf.c (prep_headers): Add bfd_arch_openrisc.
+
+2001-04-23 Bo Thorsen <bo@suse.de>
+
+ * elf64-x86-64.c: Add c++ vtable hack.
+ Small whitespace and comment changes.
+
+2001-04-19 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c (elf64_x86_64_plt0_entry): Fix instructions.
+ (elf64_x86_64_plt_entry): Likewise.
+ (elf64_x86_64_finish_dynamic_sections): Fix PLT0 generation.
+ (elf64_x86_64_finish_dynamic_symbol): Fix PLT generation.
+
+2001-04-17 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf32-cris.c: Tweak comments related to dynamic linking.
+ (cris_elf_relocate_section): When not creating shared object, fill
+ in the .got table for any symbol not in the dynamic symbol table.
+ (elf_cris_finish_dynamic_symbol): When not creating shared object,
+ only emit a .got.rela reloc if the symbol is in the dynamic symbol
+ table.
+ (cris_elf_check_relocs): Use variable r_type in all places rather
+ than the original expression. Add default case in switch for
+ reloc types.
+ (elf_cris_size_dynamic_sections): Iterate over
+ elf_cris_discard_excess_program_dynamics when not creating shared
+ library.
+ (elf_cris_discard_excess_dso_dynamics): Renamed from
+ elf_cris_discard_copies. Correct typo, s/Rel/Rela/.
+ (elf_cris_discard_excess_program_dynamics): New.
+
+2001-04-14 Mark Elbrecht <snowball3@bigfoot.com>
+
+ * coffcode.h (coff_write_object_contents): Use
+ bfd_coff_swap_filehdr_out instead of coff_swap_filehdr_out.
+
+2001-04-14 H.J. Lu <hjl@gnu.org>
+
+ * bfd-in2.h: Regenerate.
+
+2001-04-14 Jakub Jelinek <jakub@redhat.com>
+
+ * section.c (STD_SECTION): Add entsize.
+
+2001-04-13 H.J. Lu <hjl@gnu.org>
+
+ * section.c (SEC_MERGE): Define new flag for merging.
+ (SEC_STRINGS): Likewise.
+ (entsize): New field.
+
+2001-04-13 Roger Sayle <roger@metaphorics.com>
+
+ * coff-i386.c (TARGET_SYM): SEC_READONLY is an applicable section
+ flag on pe-i386 targets.
+
+2001-04-13 Jakub Jelinek <jakub@redhat.com>
+
+ * libbfd-in.h (_bfd_merge_section): New.
+ (_bfd_write_merged_section): New.
+ (_bfd_merged_section_offset): New.
+ * libbfd.h: Rebuilt.
+ * linker.c (_bfd_generic_link_output_symbols): Handle
+ discard_sec_merge.
+ * aoutx.h (aout_link_write_symbols): Likewise.
+ * pdp11.c (aout_link_write_symbols): Likewise.
+ * elflink.h (elf_link_add_object_symbols): Call _bfd_merge_section.
+ (elf_bfd_final_link): Adjust global symbols pointing into SEC_MERGE
+ sections.
+ (elf_link_sec_merge_syms): New.
+ (elf_link_input_bfd): Call _bfd_merged_section_offset
+ and _bfd_write_merged_section.
+ Handle discard_sec_merge.
+ * elf-bfd.h (struct elf_link_hash_table): Add merge_info
+ field.
+ (struct bfd_elf_section_data): Likewise.
+ * elf.c (_bfd_elf_make_section_from_shdr): Set SEC_MERGE and
+ SEC_STRINGS section flags and entsize from their ELF counterparts.
+ (_bfd_elf_link_hash_table_init): Initialize merge_info.
+ (elf_fake_sections): Set SHF_MERGE, SHF_STRINGS and sh_entsize
+ from their BFD counterparts.
+ * merge.c: New file.
+ * Makefile.am: Add strtab.lo.
+ * Makefile.in: Rebuilt.
+
+2001-04-09 Hans-Peter Nilsson <hp@axis.com>
+
+ * elflink.h (elf_fix_symbol_flags): For non-default visibilities,
+ only hide symbols marked STV_INTERNAL or STV_HIDDEN.
+
+2001-04-05 Steven J. Hill <sjhill@cotw.com>
+
+ * config.bfd (mips*el*-*-linux-gnu*): Use traditional little
+ endian MIPS ELF target.
+ * config.bfd (mips*-*-linux-gnu*): Use traditional big endian
+ MIPS ELF target.
+
+ * configure.in (bfd_elf64_tradbigmips_vec): New. Traditional
+ 64bit big endian MIPS ELF target.
+ (bfd_elf64_tradlittlemips_vec): New. Traditional 64bit little
+ endian MIPS ELF target.
+ * configure: Regenerated.
+
+ * elf32-mips.c (IRIX_COMPAT): Handle traditional 64bit and
+ little endian targets.
+ (mips_elf_sym_is_global): Handle traditional targets.
+
+ * elf64-mips.c (bfd_elf64_tradbigmips_vec): New. Traditional
+ 64bit big endian MIPS ELF target.
+ (bfd_elf64_tradlittlemips_vec): New. Traditional 64bit little
+ endian MIPS ELF target.
+
+ * targets.c: (_bfd_target_vector): Add bfd_elf64_tradbigmips_vec
+ and bfd_elf64_tradlittlemips_vec.
+
+2001-04-05 David Mosberger <davidm@hpl.hp.com>
+
+ * elf32-i386.c (elf_i386_fake_sections): Treat ".reloc" as an
+ ordinary "progbits" section.
+
+2001-04-04 Alan Modra <alan@linuxcare.com.au>
+
+ * elflink.h (elf_fix_symbol_flags): Call elf_backend_hide_symbol
+ when -Bsymbolic causes a symbol to no longer need a .plt entry.
+
+2001-04-03 David Mosberger <davidm@hpl.hp.com>
+
+ * efi-app-ia32.c (ALIGN_SECTIONS_IN_FILE): Deleted.
+
+2001-03-30 H.J. Lu <hjl@gnu.org>
+
+ * efi-app-ia32.c (PEI_TARGET_SUBSYSTEM): Rename from ...
+ (PEI_DEFAULT_TARGET_SUBSYSTEM): This.
+
+2001-03-26 H.J. Lu <hjl@gnu.org>
+
+ * elf32-gen.c (elf32_generic_link_add_symbols): New. Check
+ if there are any relocations for generic ELF.
+ (bfd_elf32_bfd_link_add_symbols): Defined to
+ elf32_generic_link_add_symbols.
+ * elf64-gen.c (elf64_generic_link_add_symbols): New. Check
+ if there are any relocations for generic ELF.
+ (bfd_elf64_bfd_link_add_symbols): Defined to
+ elf64_generic_link_add_symbols.
+
+2001-03-23 Nick Clifton <nickc@redhat.com>
+
+ * Makefile.am (BUILD_CFILES): New variable: List of C source
+ files created in build directory.
+ (BUILD_HFILES): New variable: List of header files created in
+ build directory.
+ (POTFILES): Delete.
+ (po/POTFILES.in): Replace rule with empty entry.
+ (po/SRC-POTFILES.in): New rule: Create a list of source files
+ in the source directory.
+ (po/BLD-POTFILES.in): New rule: Create a list of source files
+ in the build directory.
+ (MOSTLYCLEAN): Do not delete source files created in build
+ directory.
+ * Makefile.in: Regenerate.
+ * configure.in: Insert SRC-POTFILES.in and BLD-POTFILES.in
+ into po/Makefile.
+ * configure: Regenerate.
+
+ * po/Make-in: Replace occurrences of POTFILES with SRC-POTFILES
+ and BLD_POTFILES.
+ Add .. to the search path when building bfd.pot.
+ Delete POTFILES when performing distclean.
+ Add comment describing why distclean is broken in maintainer mode.
+ * po/POTFILES.in: Delete.
+ * po/SRC-POTFILES.in: New file.
+ * po/BLD-POTFILES.in: New file.
+ * po/bfd.pot: Regenerate.
+
+2001-03-22 Hans-Peter Nilsson <hp@axis.com>
+
+ * elf32-cris.c: Shlib and PIC support. PCREL tweaks.
+ (elf_cris_discard_copies, elf_cris_adjust_gotplt_to_got,
+ elf_cris_try_fold_plt_to_got, elf_cris_link_hash_newfunc,
+ elf_cris_link_hash_table_create, elf_cris_adjust_dynamic_symbol,
+ elf_cris_size_dynamic_sections, elf_cris_finish_dynamic_symbol,
+ elf_cris_finish_dynamic_sections,elf_cris_hide_symbol): New
+ functions.
+ (cris_elf_howto_table) <R_CRIS_8_PCREL, R_CRIS_16_PCREL,
+ R_CRIS_32_PCREL>: Correct comments. Set pcrel_offset to false.
+ <R_CRIS_COPY, R_CRIS_GLOB_DAT, R_CRIS_JUMP_SLOT, R_CRIS_RELATIVE,
+ R_CRIS_16_GOT, R_CRIS_32_GOT, R_CRIS_16_GOTPLT, R_CRIS_32_GOTPLT,
+ R_CRIS_32_GOTREL, R_CRIS_32_PLT_GOTREL, R_CRIS_32_PLT_PCREL>:
+ New HOWTO members for new relocs.
+ (cris_reloc_map): Map new relocs.
+ (ELF_DYNAMIC_INTERPRETER): Define.
+ (PLT_ENTRY_SIZE): Define.
+ (elf_cris_plt0_entry, elf_cris_plt_entry, elf_cris_pic_plt0_entry,
+ elf_cris_pic_plt_entry): New, PLT templates.
+ (struct elf_cris_pcrel_relocs_copied, struct
+ elf_cris_link_hash_entry, struct elf_cris_link_hash_table): New.
+ (elf_cris_link_hash_traverse, elf_cris_hash_table): Define.
+ (cris_final_link_relocate): Check that 16-bit GOT relocs have
+ positive values. Adjust PCREL relocs to be relative to location
+ after relocation.
+ (cris_elf_relocate_section): Handle relocations to dynamic
+ objects. Handle new relocations. Call error handler when seeing
+ non-PIC relocation for read-only sections while generating shared
+ object.
+ (cris_elf_check_relocs): Set reference counts for GOT and PLT
+ entries.
+ (bfd_elf32_bfd_link_hash_table_create,
+ elf_backend_adjust_dynamic_symbol,
+ elf_backend_size_dynamic_sections,
+ elf_backend_finish_dynamic_symbol,
+ elf_backend_finish_dynamic_sections,
+ elf_backend_create_dynamic_sections, bfd_elf32_bfd_final_link,
+ elf_backend_hide_symbol, elf_backend_want_got_plt,
+ elf_backend_plt_readonly, elf_backend_want_plt_sym,
+ elf_backend_got_header_size, elf_backend_plt_header_size):
+ Define.
+
+ * reloc.c: (BFD_RELOC_CRIS_COPY, BFD_RELOC_CRIS_GLOB_DAT,
+ BFD_RELOC_CRIS_JUMP_SLOT, BFD_RELOC_CRIS_RELATIVE,
+ BFD_RELOC_CRIS_32_GOT, BFD_RELOC_CRIS_16_GOT,
+ BFD_RELOC_CRIS_32_GOTPLT, BFD_RELOC_CRIS_16_GOTPLT,
+ BFD_RELOC_CRIS_32_GOTREL, BFD_RELOC_CRIS_32_PLT_GOTREL,
+ BFD_RELOC_CRIS_32_PLT_PCREL): New relocs.
+ * bfd-in2.h, libbfd.h: Regenerate.
+
+2001-03-21 Diego Novillo <dnovillo@redhat.com>
+
+ (_bfd_mips_elf_relocate_section): Give a better error message when
+ a relocation is not recognized.
+
+2001-03-21 Alan Modra <alan@linuxcare.com.au>
+
+ * elf32-hppa.c (elf32_hppa_set_gp): Check sec->output_section
+ non-NULL before attempting to dereference.
+
+2001-03-20 H.J. Lu <hjl@gnu.org>
+
+ * configure.in: Remove the redundent AC_ARG_PROGRAM.
+ * configure: Rebuild.
+
+2001-03-20 Andreas Schwab <schwab@suse.de>
+
+ * elf32-m68k.c (elf_m68k_relocate_section): Don't need the
+ relocation value when resolving a reference from a debugging
+ section.
+
+2001-03-16 Scott Thomason <SThomaso@hii.com>
+
+ * coff64-rs6000.c (xcoff64_swap_sym_out): Fix syntax errors.
+ (xcoff64_swap_sym_out): Fix syntax errors.
+
+2001-03-16 Richard Sandiford <rsandifo@redhat.com>
+
+ * elf32-arm.h (elf32_arm_merge_private_bfd_data): Fix warning.
+
+2001-03-15 Alan Modra <alan@linuxcare.com.au>
+
+ * elf32-hppa.c (elf32_hppa_link_hash_entry): Add maybe_pic_call.
+ (hppa_link_hash_newfunc): Init it.
+ (hppa_type_of_stub): Only use non-PIC to PIC call stub if caller
+ section appears to be non-PIC.
+ (final_link_relocate): Likewise.
+ (elf32_hppa_adjust_dynamic_symbol): Set maybe_pic_call for any
+ possible candidate function, and set pic_call for those that will
+ only have a .plt entry for the PIC call stub.
+ (hppa_handle_PIC_calls): Set maybe_pic_call.
+
+2001-03-12 DJ Delorie <dj@redhat.com>
+
+ * elf32-sh.c (sh_elf_relocate_section): Only relocation
+ R_SH_DIR8WP* relocs if they're against external symbols, else
+ they're just for relaxing. Validate the reloc values.
+
+2001-03-12 Stefan Geuken <mail@stefan-geuken.de>
+
+ * binary.c (bfd_external_binary_architecture): Declare.
+ (binary_object_p): If bfd_external_binary_architecture is defined,
+ set the architecture to this string.
+
+2001-03-11 Philip Blundell <philb@gnu.org>
+
+ * elf32-arm.h (elf32_arm_finish_dynamic_symbol): Don't make PLT
+ entries that could serve as a definition for a weak symbol.
+
+2001-03-08 Nick Clifton <nickc@redhat.com>
+
+ * Most files: Update copyright notices using Perl script created
+ by Kevin Buettner <kevinb@redhat.com>.
+
+2001-03-07 Nick Clifton <nickc@redhat.com>
+
+ * elf32-arm.h (elf32_arm_final_link_relocate): Conditionalise
+ prior patch on ! defined OLD_ARM_ABI.
+
+2001-03-07 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Fix handling of
+ some relocation values.
+
+2001-03-06 Nick Clifton <nickc@redhat.com>
+
+ * elf32-arm.h (elf32_arm_final_link_relocate): Clear bit zero
+ of offset in BLX(1) instruction.
+ * coff-arm.c (coff_arm_relocate_section): Clear bit zero of
+ offset in BLX(1) instruction.
+ Fix formatting.
+
+2001-03-06 Nick Clifton <nickc@redhat.com>
+
+ * coff-arm.c (coff_arm_reloc_type_lookup): Add
+ BFD_RELOC_THUMB_PCREL_BLX.
+
+2001-03-06 Igor Shevlyakov <igor@windriver.com>
+
+ * archures.c (bfd_default_scan): Add Coldfire CPUs.
+ * bfd-in2.h: Regenerate.
+ * cpu-m68k.c: Add Coldfire CPUs for arch table.
+ * ieee.c (ieee_write_processor): Set proper id for
+ Coldfire CPUs.
+
+2001-03-01 D.J. Barrow <djbarrow@de.ibm.com,barrow_dj@yahoo.com>
+
+ * configure.in: Add s390 target.
+ * configure: Regenerate.
+
+2001-02-28 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Add relocation
+ to addend.
+
+2001-02-28 Philip Blundell <pb@futuretv.com>
+
+ * elf32-arm.h: Update mentions of renamed EF_xx constants.
+ (elf32_arm_print_private_bfd_data): Handle ARM EABI version 2.
+
+2001-02-27 H.J. Lu <hjl@gnu.org>
+
+ * aoutx.h (NAME(aout,bfd_free_cached_info)): Return true if
+ abfd->tdata.aout_data == NULL.
+
+2001-02-27 Alan Modra <alan@linuxcare.com.au>
+
+ * elf32-hppa.c: Correct field selector in stub comments.
+ (clobber_millicode_symbols): Formatting fix.
+
+ * configure.in: Bump version to 2.11.90.
+ * configure: Regenerate.
+ * Makefile.am (CFILES): Rename to SOURCE_CFILES.
+ (CFILES): $SOURCE_CFILES + generated C files.
+ (POTFILES): Include $HFILES not $SOURCE_HFILES.
+ Run "make dep-am"
+ * Makefile.in: Regenerate.
+ * doc/Makefile.in: This too.
+
+2001-02-26 Timothy Wall <twall@cygnus.com>
+
+ * elfxx-ia64.c (elfNN_ia64_aix_add_symbol_hook): Remove obsolete
+ comments.
+
+2001-02-26 Nick Clifton <nickc@redhat.com>
+
+ * coffcode.h (styp_to_sec_flags) [COFF_WITH_PE version]: Tidy
+ up, replacing multiple if statements with a switch.
+ (handle_COMDAT): New function.
+
+2001-02-26 H.J. Lu <hjl@gnu.org>
+
+ * coffcode.h (styp_to_sec_flags) [COFF_WITH_PE version]: Issue
+ a warning for section flags we do not handle instead of
+ aborting.
+
+2001-02-26 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c (x86_64_elf_howto_table): Fix order of entries.
+
+2001-02-22 Timothy Wall <twall@cygnus.com>
+
+ * config.bfd (targ_cpu): Add vectors for ia64-*-aix* (aka Monterey).
+ * configure.in: Add objects for elf64_ia64_aix vectors.
+ * configure: Regenerated.
+ * configure.host: Recognize ia64-*-aix*.
+ * elfxx-ia64.c: Add hooks for ELF64 on AIX5. Define new vectors
+ for AIX. AIX5 requires most relocations to be dynamic (*all*
+ binaries are somewhat similar to shared libraries).
+ * targets.c: Add elf64_ia64_aix vectors.
+
+2001-02-21 David Mosberger <davidm@hpl.hp.com>
+
+ * cpu-ia64-opc.c (elf64_ia64_operands}: Fix typo: error string for
+ C8 said "1" instead of "8". Clarify error string for IMM22:
+ "signed integer" instead of just "integer".
+
+2001-02-20 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c (elf64_x86_64_finish_dynamic_symbol): Don't make
+ PLT entries that could serve as a definition for a weak symbol.
+
+2001-02-19 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-sparc.c (elf32_sparc_finish_dynamic_symbol): Don't make PLT
+ entries that could serve as a definition for a weak symbol.
+ * elf64-sparc.c (sparc64_elf_finish_dynamic_symbol): Likewise.
+
+2001-02-18 David O'Brien <obrien@FreeBSD>
+
+ * configure.in: Recognize FreeBSD/arm, FreeBSD/PowerPC, and treat
+ FreeBSD/i386-CURRENT differently until I can figure out the needed
+ corefile changes.
+ * configure: Regenerate.
+ * config.bfd: Recognize FreeBSD/x86-64, FreeBSD/ia64, FreeBSD/arm,
+ FreeBSD/PowerPC, and FreeBSD/sparc64.
+
+2001-02-18 lars brinkhoff <lars@nocrew.org>
+
+ * Makefile.am: Add PDP-11 a.out target.
+ * config.bfd: Likewise.
+ * configure.in: Likewise.
+ * targets.c: Likewise.
+ * archures.c: Likewise.
+ * bfd-in2.h: Likewise. Add PDP-11 relocations.
+ * libbfd.h: Add PDP-11 relocations.
+ * reloc.c: Likewise.
+ * cpu-pdp11.c: New file.
+ * pdp11.c: New file.
+
+ * libaout.h (GET_WORD) [ARCH_SIZE==16]: Define.
+ (GET_SWORD) [ARCH_SIZE==16]: Likewise.
+ (GET_SWORD) [ARCH_SIZE==16]: Likewise.
+ (PUT_WORD) [ARCH_SIZE==16]: Likewise.
+ (GET_MAGIC): New macro.
+ (PUT_MAGIC): Likewise.
+ * aout-target.h (MY(object_p)): Use GET_MAGIC to read magic word.
+
+2001-02-18 Jim Kingdon <jkingdon@engr.sgi.com>
+
+ * irix-core.c (irix_core_core_file_p): Set the architecture (GDB
+ multiarch needs it).
+
+2001-02-18 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_link_input_bfd): Ignore invalid section symbol
+ index.
+
+2001-02-18 Kazu Hirata <kazu@hxi.com>
+
+ * vms-misc.c: Fix formatting.
+
+2001-02-16 Kazu Hirata <kazu@hxi.com>
+
+ * vms.c: Fix formatting.
+
+2001-02-14 H.J. Lu <hjl@gnu.org>
+
+ * elf.c (elf_find_function): New function.
+ (_bfd_elf_find_nearest_line): Call elf_find_function () to find
+ the file name and function name.
+
+2001-02-14 Nick Clifton <nickc@redhat.com>
+
+ * ecoff.c (bfd_debug_section): Update to initialise new fields in
+ asection structure.
+
+ * Makefile.am (BFD32_BACKENDS_CFILES): Remove peigen.c
+ (BFD64_BACKENDS): Add pepigen.c
+ Add rules to create peigen.c and pepigen.c from peXXigen.c.
+
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+ * po/POTFILES.in: Regenerate.
+ * po/bfd.pot: Regenerate.
+
+2001-02-14 H.J. Lu <hjl@gnu.org>
+
+ * libcoff-in.h (pe_tdata): Add members target_subsystem and
+ force_minimum_alignment.
+
+2001-02-14 Bo Thorsen <bo@suse.de>
+
+ * elf64-x86-64.c: Small formatting fixes and rearrangements of code.
+ (elf64_86_64_size_info): Struct added to fix a problem
+ with the hashtable string entries.
+ (elf64_x86_64_adjust_dynamic_symbol): Add generation of .got.plt.
+ (elf64_x86_64_size_dynamic_sections): A FIXME removed.
+ (elf64_x86_64_size_dynamic_sections): Fix a dynamic entry and
+ remove the FIXME for this.
+ (elf64_x86_64_adjust_dynamic_symbol): Fix check for unneeded .plt
+ section. Also removed the FIXME for it.
+ (x86_64_elf_howto_table): Use bfd_elf_generic_reloc.
+ (ELF_DYNAMIC_INTERPRETER): Fix the name of the dynamic linker.
+ (elf64_x86_64_finish_dynamic_sections): Enable .got.plt writing.
+
+2001-02-13 Richard Henderson <rth@redhat.com>
+
+ * elfxx-ia64.c (elfNN_ia64_final_link): Set __gp if required
+ and not user provided.
+
+2001-02-13 Kazu Hirata <kazu@hxi.com>
+
+ * vms.c (vms_print_symbol): Remove unreachable code.
+
+ * rs6000-core.c: Fix formatting.
+
+2001-02-13 David Mosberger <davidm@hpl.hp.com>
+
+ * peicode.h (coff_swap_filehdr_out) [COFF_IMAGE_WITH_PE]: Define
+ as _bfd_XXi_only_swap_filehdr_out.
+ (pe_mkobject) [PEI_FORCE_MINIMUM_ALIGNMENT]: Set
+ pe->force_minimum_alignment to TRUE.
+ (pe_mkobject) [PEI_TARGET_SUBSYSTEM]: Set pe->target_subsystem to
+ PEI_TARGET_SUBSYSTEM.
+ (pe_print_private_bfd_data): Call
+ _bfd_XX_print_private_bfd_data_common() instead of
+ _bfd_pe_print_private_bfd_data_common().
+ (pe_bfd_copy_private_bfd_data): Call
+ _bfd_XX_bfd_copy_private_bfd_data_common() instead of
+ _bfd_pe_bfd_copy_private_bfd_data_common().
+ (coff_bfd_copy_private_section_data): Define as
+ _bfd_XX_bfd_copy_private_section_data instead of
+ _bfd_pe_bfd_copy_private_section_data.
+ (coff_get_symbol_info): Define as _bfd_XX_get_symbol_info instead
+ of a _bfd_pe_get_symbol_info.
+
+ * peigen.c: Delete.
+
+ * peXXigen.c: Renamed from peigen.c.
+ (COFF_WITH_XX): Define this macro (will get expanded into
+ COFF_WITH_pep or COFF_WITH_pe, depending on whether this is being
+ compiled as peigen.c or pepigen.c.
+ [COFF_WITH_pep]: Include "coff/ia64.h" instead of "coff/i386.h" to
+ define the canonical PEP structures and definitions.
+ (_bfd_XXi_swap_aouthdr_out): If pe->force_minimum_alignment is in
+ effect, enforce minimum file and section alignments. If
+ extra->Subsystem is IMAGE_SUBSYSTEM_UNKNOWN, set it to
+ pe->target_subsystem (this defaults to IMAGE_SUBSYSTEM_UNKNOWN,
+ so, by default, this is a no-op).
+
+ * libpei.h: Rename COFF_WITH_PEP to COFF_WITH_pep.
+ (_bfd_XX_bfd_copy_private_bfd_data_common): Add macros to map
+ _bfd_XXfoo to _bfd_pepfoo if COFF_WIT_PEP is defined and to
+ _bfd_pefoo if it's not defined. Use these macros to define
+ coff swap macros.
+
+ * libcoff.h (pe_tdata): Add members target_subsystem and
+ force_minimum_alignment.
+
+ * efi-app-ia64.c (COFF_WITH_pep): Rename COFF_WITH_PEP to
+ COFF_WITH_pep.
+ (PEI_TARGET_SUBSYSTEM): Rename from PEI_DEFAULT_TARGET_SUBSYSTEM.
+
+ * configure.in (bfd_efi_app_ia64_vec): Use pepigen.lo instead of
+ peigen.lo.
+
+ * coff-ia64.c: Rename COFF_WITH_PEP to COFF_WITH_pep.
+ (AOUTSZ): Rename PEP64AOUTSZ and PEP64AOUTHDR to PEPAOUTSZ and
+ PEPAOUTHDR.
+
+ * Makefile.in (BFD64_BACKENDS): Mention pepigen.lo.
+ (BFD64_BACKENDS_CFILES): Mention pepigen.c
+ (peigen.c): Add rule to generate from peXXigen.c.
+ (pepigen.c): Ditto.
+ (pepigen.lo): List dependencies for pepigen.lo.
+
+2001-02-13 Alan Modra <alan@linuxcare.com.au>
+
+ * elf32-hppa.c (elf32_hppa_set_gp): Handle weak $global$. If
+ $global$ referenced but not defined, set its value here.
+
+2001-02-09 Bo Thorsen <bo@suse.de>
+
+ * elf64-x86-64.c (elf64_x86_64_check_relocs): Set .rela.got section
+ alignment to 3.
+ (elf64_x86_64_check_relocs): Write R_X86_64_GOTPCREL GOT entry
+ and relocation.
+ (elf64_x86_64_relocate_section): Fix formatting.
+ (elf64_x86_64_relocate_section): Fix addend for relocation of
+ R_X86_64_(8|16|32|PC8|PC16|PC32).
+
+2001-02-12 Jan Hubicka <jh@suse.cz>
+
+ * elf64-x86-64.c (x86_64_elf_howto): Fix name of R_X86_64_GOTPCREL.
+
+2001-02-11 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_bfd_final_link): Use file_align for SYMTAB
+ alignment.
+
+2001-02-11 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
+
+ * elf32-mips.c (mips_elf_create_dynamic_relocation): Undo patch
+ from 2000-10-13. Do not add the symbol's value for R_MIPS_REL32
+ relocations against dynsym symbols.
+
+ * elf32-mips.c (elf_mips_howto_table): Fix the comment on
+ the R_MIPS_26 relocation.
+ (mips_elf_calculate_relocation): Use (p + 4) instead of p for
+ the R_MIPS_26 relocation.
+ (mips_elf_perform_relocation): Fix the comment on the R_MIPS16_26
+ relocation.
+ * elf64-mips.c (mips_elf64_howto_table_rel): Fix the comment on
+ the R_MIPS_26 relocation.
+ (mips_elf64_howto_table_rela): Likewise.
+
+ * elf32-mips.c (struct mips_elf_link_hash_entry): Added no_fn_stub
+ member to mark symbols that have non-CALL relocations against
+ them.
+ (mips_elf_link_hash_newfunc): Initialize no_fn_stub.
+ (mips_elf_calculate_relocation): Handle R_MIPS_CALL16 like
+ R_MIPS_GOT16.
+ (_bfd_mips_elf_check_relocs): Set no_fn_stub for a symbol if a
+ non-CALL relocation against it is encountered.
+ (_bfd_mips_elf_copy_indirect_symbol): Merge no_fn_stub as well.
+ (_bfd_mips_elf_adjust_dynamic_symbol): Only create a stub if
+ no_fn_stub is not set.
+
+ * elf32-mips.c (mips_elf_output_extsym): Get the output section
+ information from the real symbol for indirect ones.
+ Check no_fn_stub to find out if a symbol has a function stub
+ indeed.
+
+2001-02-11 Michael Sokolov <msokolov@ivan.Harhan.ORG>
+
+ * Makefile.am (stamp-lib): ranlib the libbfd.a in the build directory.
+ * Makefile.in: Regenerate.
+
+2001-02-09 David Mosberger <davidm@hpl.hp.com>
+
+ * elfxx-ia64.c (is_unwind_section_name): New function. Returns
+ true if section name is an unwind table section name.
+ (elfNN_ia64_additional_program_headers): Count each unwind section
+ separately.
+ (elfNN_ia64_modify_segment_map): Install one unwind program header
+ for each unwind separate section. Note: normally the linker
+ script merges the unwind sections that go into a single segment,
+ so this still generates at most one unwind program header per
+ segment.
+
+ * elfxx-ia64.c (elfNN_ia64_section_from_shdr): Accept any section
+ name for SHT_IA_64_UNWIND, not just .IA_64.unwind.
+ (elfNN_ia64_fake_sections): Mark sections with names that start
+ with .IA_64.unwind but not with .IA_64.unwind_info as an IA-64
+ unwind section.
+
+ * elfxx-ia64.c (elfNN_ia64_final_write_processing): New function.
+ Use it to make sh_info in unwind section point to the text section
+ it applies to.
+
+2001-02-09 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * Makefile.am: Add linux target for S/390.
+ * archures.c: Likewise.
+ * bfd-in2.h: Likewise.
+ * config.bfd: Likewise.
+ * configure.in: Likewise.
+ * elf.c: Likewise.
+ * libbfd.h: Likewise.
+ * targets.c: Likewise.
+ * cpu-s390.c: New file.
+ * elf32-s390.c: New file.
+ * elf64-s390.c: New file.
+
+2001-02-09 Nick Clifton <nickc@redhat.com>
+
+ * peigen.c (_bfd_pe_get_symbol_info): Suppress addition of
+ ImageBase. This has already been done by coff_swap_hdr_in.
+
+2001-02-09 Jakub Jelinek <jakub@redhat.com>
+
+ * elf64-sparc.c (sparc64_elf_copy_private_bfd_data): New function.
+
+2001-02-09 Jakub Jelinek <jakub@redhat.com>
+
+ * elf64-sparc.c (sparc64_elf_check_relocs): Don't trust reloc_count.
+ (sparc64_elf_relocate_section): Likewise.
+
+2001-02-09 Mark Kettenis <kettenis@gnu.org>
+
+ * elf32-sparc.c (_bfd_sparc_elf_howto_table): Treat R_SPARC_UA32
+ similar to R_SPARC_32.
+ * elf64-sparc.c (sparc64_elf_howto_table): Likewise.
+
+2001-02-08 H.J. Lu <hjl@gnu.org>
+
+ * elf32-i386.c (elf_i386_check_relocs): Reserve R_386_PC32
+ relocation entries for weak definitions when building DSO with
+ -Bsymbolic.
+
+2001-02-08 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Respect weakness
+ before visibility. Locally defined protected symbols are not
+ dynamic.
+
+2001-02-08 Geoffrey Keating <geoffk@redhat.com>
+
+ * config.bfd: Enable coff64 for rs6000-*. Patch from
+ <hzoli@austin.ibm.com>.
+
+2001-02-07 Mark Elbrecht <snowball3@bigfoot.com>
+
+ * coffgen.c (coff_find_nearest_line): If stabs info is successfully
+ found, do not attempt to find dwarf2 info before returning.
+
+2001-02-07 Jakub Jelinek <jakub@redhat.com>
+
+ * elflink.h (is_global_symbol_definition): Rename to
+ is_global_data_symbol_definition and have it reject function
+ symbols.
+ (elf_link_is_defined_archive_symbol): Use renamed function.
+
+2001-02-07 Todd Vierling <tv@wasabisystems.com>
+
+ * libbfd-in.h (bfd_target_vector): Change extern array to pointer.
+ * libbfd.h (bfd_target_vector): Likewise.
+ * targets.c (bfd_target_vector): Rename to _bfd_target_vector and
+ make static; create pointer reference named bfd_target_vector.
+ (_bfd_target_vector_entries): Calculate this based on the array
+ typed _bfd_target_vector.
+
+2001-02-06 H.J. Lu <hjl@gnu.org>
+
+ * elfxx-ia64.c (elfNN_ia64_dynamic_symbol_p): Only hidden and
+ internal symbols are not dynamic.
+ * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Likewise.
+
+2001-02-06 Nick Clifton <nickc@redhat.com>
+
+ * Makefile.am (BFD64_BACKENDS_CFILES): Remove elf64-ia64.c, so
+ that it will not be pulled into the list of files that make up
+ po/POTFILES.in.
+ * Makefile.in: Regenerate.
+ * po/bfd.pot: Regenerate.
+
+2001-02-06 H.J. Lu <hjl@gnu.org>
+
+ * peicode.h (coff_swap_filehdr_in): Remove the e_magic
+ checking.
+ (pe_bfd_object_p): Rewrite with external_PEI_DOS_hdr and
+ external_PEI_IMAGE_hdr.
+
+2001-02-06 Kazu Hirata <kazu@hxi.com>
+
+ * elf-m10200.c: Fix formatting.
+
+2001-02-04 Nick Clifton <nickc@redhat.com>
+
+ * elf32-v850.c (v850_elf_reloc): Do not convert reloc addend to PC
+ rel, it will be handled later on.
+
+2001-02-02 Fred Fish <fnf@ninemoons.com>
+
+ * Makefile.in: Fix typo.
+
+2001-02-01 Kazu Hirata <kazu@hxi.com>
+
+ * elf-m10300.c: Fix formatting.
+
+2001-01-30 Alan Modra <alan@linuxcare.com.au>
+
+ * elf64-hppa.c (elf64_hppa_elf_get_symbol_type): New function.
+ (elf_backend_get_symbol_type): Define.
+ (elf64_hppa_object_p): Set architecture and machine from elf
+ header flags.
+
+2001-01-30 Curtis L. Janssen <cljanss@ca.sandia.gov>
+
+ * elf64-alpha.c (elf64_alpha_find_nearest_line): Query dwarf2
+ before mdebug.
+
+2001-01-26 Richard Henderson <rth@redhat.com>
+
+ * elfxx-ia64.c (elfNN_ia64_dynamic_symbol_p): Return false
+ for non-default visibility.
+ * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Likewise, but
+ delete ugly macro and replace with pretty function.
+
+2001-01-25 Mark Elbrecht <snowball3@bigfoot.com>
+
+ * coff-go32.c: Update copyright.
+ * coff-stgo32.c: Likewise.
+ * coff-go32.c (COFF_LONG_FILENAMES): Define.
+ * coff-stgo32.c (COFF_LONG_FILENAMES): Likewise.
+ * coff-go32.c (COFF_SECTION_ALIGNMENT_ENTRIES): Remove .bss entry.
+ * coff-stgo32.c (COFF_SECTION_ALIGNMENT_ENTRIES): Likewise.
+
+2001-01-25 Kazu Hirata <kazu@hxi.com>
+
+ * bfd-in2.h: Rebuild.
+ * libbfd.h: Likewise.
+
+2001-01-23 H.J. Lu <hjl@gnu.org>
+
+ * bfd-in2.h: Rebuild.
+
+2001-01-23 H.J. Lu <hjl@gnu.org>
+
+ * vms-misc.c (_bfd_vms_next_record): Return -1 if PRIV(vms_buf)
+ is NULL or PRIV(vms_rec) is outside of the buffer.
+
+2001-01-23 Kazu Hirata <kazu@hxi.com>
+
+ * coff64-rs6000.c: Fix formatting.
+ * coff-arm.c: Likewise.
+ * coffgen.c: Likewise.
+ * cofflink.c: Likewise.
+ * coff-mcore.c: Likewise.
+ * coff-mips.c: Likewise.
+ * coff-pmac.c: Likewise.
+ * coff-ppc.c: Likewise.
+ * coff-rs6000.c: Likewise.
+ * elf32.c: Likewise.
+ * elf32-fr30.c: Likewise.
+ * elf32-i370.c: Likewise.
+ * elf32-i860.c: Likewise.
+ * elf32-m32r.c: Likewise.
+ * elf32-m68k.c: Likewise.
+ * elf32-mcore.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-v850.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-sparc.c: Likewise.
+ * elflink.c: Likewise.
+ * elflink.h: Likewise.
+ * elf-m10200.c: Likewise.
+ * elf-m10300.c: Likewise.
+ * elfxx-ia64.c: Likewise.
+
+ * aoutx.h: Fix formatting.
+ * bfd.c: Likewise.
+ * bfd-in2.h: Likewise.
+ * bfd-in.h: Likewise.
+ * cpu-i386.c: Likewise.
+ * cpu-m68hc11.c: Likewise.
+ * dwarf2.c: Likewise.
+ * elf64-x86-64.c: Likewise.
+ * format.c: Likewise.
+ * freebsd.h: Likewise.
+ * hash.c: Likewise.
+ * hp300hpux.c: Likewise.
+ * hppabsd-core.c: Likewise.
+ * hpux-core.c: Likewise.
+
+2001-01-22 Bo Thorsen <bo@suse.de>
+
+ * elf64-x86-64.c: Added PIC support for X86-64.
+ (elf64_x86_64_link_hash_newfunc): Function added.
+ (elf64_x86_64_link_hash_table_create): Likewise.
+ (elf64_x86_64_check_relocs): Likewise.
+ (elf64_x86_64_gc_mark_hook): Likewise.
+ (elf64_x86_64_gc_sweep_hook): Likewise.
+ (elf64_x86_64_adjust_dynamic_symbol): Likewise.
+ (elf64_x86_64_size_dynamic_sections): Likewise.
+ (elf64_x86_64_discard_copies): Likewise.
+ (elf64_x86_64_finish_dynamic_symbol): Likewise.
+ (elf64_x86_64_finish_dynamic_sections): Likewise.
+ (elf64_x86_64_relocate_section): Add relocation of PIC sections.
+
+2001-01-21 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
+
+ * Makefile.am (install-data-local): Make use of $(DESTDIR).
+ * Makefile.in: Regenerate.
+
+2001-01-21 Kazu Hirata <kazu@hxi.com>
+
+ * coff-a29k.c: Fix formatting.
+
+2001-01-19 H.J. Lu <hjl@gnu.org>
+
+ * elf32-i386.c (elf_i386_check_relocs): Report files with bad
+ relocation section names.
+ (elf_i386_relocate_section): Report files with bad relocation
+ section names and return false.
+
+2001-01-17 Bo Thorsen <bo@suse.de>
+
+ * targets.c: Alphabetize list of xvecs.
+
+2001-01-14 Alan Modra <alan@linuxcare.com.au>
+
+ * config.bfd: Add linux target variant for elfxx-hppa.
+ * configure.in: Recognize bfd_elf32_hppa_linux_vec and
+ bfd_elf64_hppa_linux_vec.
+ * configure: Regenerate.
+ * elf64-hppa.c: Include elf64-target.h again to support linux
+ target variant.
+ (elf64_hppa_post_process_headers): Set ELFOSABI_LINUX for linux.
+ * elf32-hppa.c: Include elf32-target.h again to support linux
+ target variant.
+ (elf32_hppa_post_process_headers): New function.
+ (elf_backend_post_process_headers): Define.
+ * targets.c (bfd_target_vector): Add bfd_elf64_hppa_linux_vec and
+ bfd_elf32_hppa_linux_vec.
+
+ * elf32-hppa.c (elf32_hppa_link_hash_table): Add text_segment_base,
+ and data_segment_base fields.
+ (elf32_hppa_link_hash_table_create ): Init them.
+ (elf32_hppa_check_relocs): Update comments.
+ (hppa_record_segment_addr): New function.
+ (elf32_hppa_relocate_section): Call it.
+ (final_link_relocate): Handle R_PARISC_SEGREL32.
+ (elf32_hppa_final_link): New function.
+ (bfd_elf32_bfd_final_link): Define to call it.
+ (hppa_unwind_entry_compare): New function.
+ * cache.c (bfd_open_file): Create files in write+read mode.
+
+ * elf-hppa.h (elf_hppa_howto_table): Set bitsize value for
+ SEGREL32 and numerous other relocs. Change duplicate
+ R_PARISC_NONE relocs to R_PARISC_UNIMPLEMENTED.
+
+ * opncls.c (bfd_fdopenr): Add parens like the comment says around
+ O_ACCMODE.
+
+ * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Don't create
+ .plt entries for DT_INIT and DT_FINI.
+ (elf32_hppa_finish_dynamic_sections): Remove special handling of
+ DT_INIT and DT_FINI.
+
+ * elf64-hppa.c (elf64_hppa_finish_dynamic_symbol): Use 16-bit
+ offsets for stub .plt access if wide mode. Check offset in range.
+
+2001-01-13 Nick Clifton <nickc@redhat.com>
+
+ * elf32-fr30.c (fr30_elf_howto_table): Remove spurious blank
+ line.
+
+ * coffcode.h (coff_canonicalize_reloc): Remove spurious blank
+ line.
+
+2001-01-12 Alan Modra <alan@linuxcare.com.au>
+
+ * configure.in ([bfd_elf64_x86_64_vec]): Set target64.
+ * configure: Regenerate.
+
+2001-01-11 Peter Targett <peter.targett@arccores.com>
+
+ * bfd-in2.h (bfd_architecture): Add bfd_mach_arc_5,
+ bfd_mach_arc_6, bfd_mach_arc_7, bfd_mach_arc_8 for ARC variants.
+ * cpu-arc.c (arch_info_struct): Add entries for variants.
+ (bfd_arc_arch) Set default to bfd_mach_arc_5.
+ (arc_get_mach) Don't assume machine names prefixed arc- before
+ testing.
+ * elf32-arc.c (arc_elf_object_p): Set machine number based on new
+ selections.
+ (arc_elf_final_write_processing) Likewise.
+ (ELF_MACHINE_CODE) Use EM_ARC.
+
+2001-01-10 Nick Clifton <nickc@redhat.com>
+
+ * coff-arm.c (LOCAL_LABEL_PREFIX): Change definition to "".
+
+2001-01-07 Philip Blundell <philb@gnu.org>
+
+ * README: Replace `bug-gnu-utils@gnu.org' with
+ `bug-binutils@gnu.org'.
+
+2001-01-04 Kazu Hirata <kazu@hxi.com>
+
+ * som.c: Fix formatting.
+
+2001-01-03 Kazu Hirata <kazu@hxi.com>
+
+ * ecoffswap.h: Fix formatting.
+ * elf-bfd.h: Likewise.
+ * elfarm-nabi.c: Likewise.
+ * elfarm-oabi.c: Likewise.
+ * elfcode.h: Likewise.
+ * elfcore.h: Likewise.
+ * elflink.c: Likewise.
+ * elflink.h: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * elfxx-target.h: Likewise.
+ * libbfd.c: Likewise
+ * linker.c: Likewise.
+ * lynx-core.c: Likewise.
+
+2001-01-02 Kazu Hirata <kazu@hxi.com>
+
+ * pc532-mach.c: Fix formatting.
+ * pe-arm.c: Likewise.
+ * pe-i386.c: Likewise.
+ * pe-mips.c: Likewise.
+ * pe-ppc.c: Likewise.
+ * pe-sh.c: Likewise.
+ * pei-mips.c: Likewise.
+ * pei-sh.c: Likewise.
+ * peicode.h: Likewise.
+ * ppcboot.c: Likewise.
+ * ptrace-core.c: Likewise.
+
+2001-01-01 Kazu Hirata <kazu@hxi.com>
+
+ * reloc.c: Fix formatting.
+ * riscix.c: Likewise.
+ * rs6000-core.c: Likewise.
+ * xcoff-target.h: Likewise.
+
+2000-12-29 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * elfcode.h (elf_object_p): Also restore the bfd mach field on
+ error, by calling bfd_default_set_arch_mach with incoming
+ values.
+
+2000-12-26 Kazu Hirata <kazu@hxi.com>
+
+ * vaxnetbsd.c: Fix formatting.
+ * versados.c: Likewise.
+ * vms-gsd.c: Likewise.
+ * vms-hdr.c: Likewise.
+ * vms-misc.c: Likewise.
+
+2000-12-25 Alexandre Oliva <aoliva@redhat.com>
+
+ * archive.c (coff_write_armap): Don't write more than symbol_count
+ `archive_member_file_ptr's.
+
+2000-12-25 Kazu Hirata <kazu@hxi.com>
+
+ * vms-tir.c: Fix formatting.
+
+2000-12-23 Kazu Hirata <kazu@hxi.com>
+
+ * vms.c: Fix formatting.
+ * vms.h: Likewise.
+
+2000-12-21 Santeri Paavolainen <santtu@ssh.com>
+
+ * vms-hdr.c: Include alloca.h if HAVE_ALLOCA_H is defined.
+
+ * peicode.h (pe_ILF_object_p): Add const to import of TARGET_LITTLE_SYM.
+
+ * elf32-m32r.c (m32r_elf_generic_reloc): Add cast to avoid (void *)
+ arithmetic.
+
+ * elf32-fr30.c: Add casts to avoid (void *) arithmetic.
+
+ * coffcode.h (styp_to_sec_flags): Add empty statement after label.
+
+2000-12-21 Richard Sandiford <rsandifo@redhat.com>
+
+ * libbfd.c (bfd_get_bits): Added
+ (bfd_put_bits): Likewise
+ * bfd-in.h: Declared the above.
+ * bfd-in2.h: Regenerated.
+
+2000-12-20 Kazu Hirata <kazu@hxi.com>
+
+ * targets.c: Fix formatting.
+ * tekhex.c: Likewise.
+ * trad-core.c: Likewise.
+
+2000-12-19 Kazu Hirata <kazu@hxi.com>
+
+ * sco5-core.c: Fix formatting.
+ * section.c: Likewise.
+ * sparclinux.c: Likewise.
+ * sparclynx.c: Likewise.
+ * sparcnetbsd.c: Likewise.
+ * srec.c: Likewise.
+ * stabs.c: Likewise.
+ * stab-syms.c: Likewise.
+ * sunos.c: Likewise.
+ * syms.c: Likewise.
+ * sysdep.h: Likewise.
+
+2000-12-18 Nick Clifton <nickc@redhat.com>
+
+ * coff-arm.c (EXTRA_S_FLAGS): Only define if not already
+ defined.
+ * epoc-pe-arm.c (EXTRA_S_FLAGS): Define.
+ * epoc-pei-arm.c (EXTRA_S_FLAGS): Define.
+
+2000-12-18 Nick Clifton <nickc@redhat.com>
+
+ * vms-misc.c (_bfd_vms_get_record): Add default case to
+ file_format switch.
+
+2000-12-15 Miloslav Trmac <mitr@volny.cz>
+
+ * elfcore.h (elf_core_file_p): Move to the start of the program
+ headers before attempting to read them.
+
+2000-12-14 Kazu Hirata <kazu@hxi.com>
+
+ * peigen.c: Fix formatting.
+ * som.c: Likewise.
+ * som.h: Likewise.
+
+2000-12-13 Kazu Hirata <kazu@hxi.com>
+
+ * peigen.c: Fix formatting.
+
+2000-12-12 Jim Wilson <wilson@redhat.com>
+
+ * elfxx-ia64.c (get_dyn_sym_info): Cast %p argument to void *.
+
+2000-12-08 Mark Salter <msalter@redhat.com>
+
+ * binary.c (binary_set_section_contents): Ignore sections
+ with zero size.
+
+2000-12-12 Kazu Hirata <kazu@hxi.com>
+
+ * m68klinux.c: Fix formatting.
+ * m68knetbsd.c: Likewise.
+ * mipsbsd.c: Likewise.
+ * netbsd-core.c: Likewise.
+ * netbsd.h: Likewise.
+ * newsos3.c: Likewise.
+ * nlm32-alpha.c: Likewise.
+ * nlm32-i386.c: Likewise.
+ * nlm32-ppc.c: Likewise.
+ * nlm32-sparc.c: Likewise.
+ * nlmcode.h: Likewise.
+ * nlmswap.h: Likewise.
+ * nlm-target.h: Likewise.
+ * ns32knetbsd.c: Likewise.
+
+2000-12-10 Fred Fish <fnf@be.com>
+
+ * elflink.h (elf_link_output_extsym): Don't complain about undefined
+ symbols in shared objects if allow_shlib_undefined is true.
+
+2000-12-12 Nick Clifton <nickc@redhat.com>
+
+ * cpu-sh.c: Fix formattng.
+ * elf.c: Fix formattng.
+ * elf32-mips.c: Fix formattng.
+ * elf32-sh.c: Fix formattng.
+ * elf64-alpha.c: Fix formattng.
+
+2000-12-09 Nick Clifton <nickc@redhat.com>
+
+ * elf32-mips.c (_bfd_mips_elf_find_nearest_line): Pass
+ dwarf2_find_line_info as last parameter to invocation of
+ _bfd_dwarf2_find_nearest_line.
+ * elf32-arm.h (elf32_arm_find_nearest_line): Pass
+ dwarf2_find_line_info as last parameter to invocation of
+ _bfd_dwarf2_find_nearest_line.
+
+2000-12-08 Mark Elbrecht <snowball3@bigfoot.com>
+
+ * Makefile.am (BFD32_BACKENDS): Move dwarf2.lo from here...
+ (BFD_LIBS): ...to here.
+ (BFD32_BACKENDS_CFILES): Move dwarf2.c from here...
+ (BFD_LIBS_CFILES): ...to here.
+ * Makefile.in: Regenerate.
+ * configure.in: Remove dwarf.lo from the elf shell variable.
+ * configure: Regenerate.
+ * libcoff-in.h (coff_tdata): Add pointer dwarf2_find_line_info.
+ * libcoff.h: Regenerate.
+ * coffgen.c (coff_find_nearest_line): Call
+ _bfd_dwarf2_find_nearest_line.
+ * dwarf2.c (_bfd_dwarf2_find_nearest_line): Add parameter. Update
+ accordingly.
+ (read_abbrevs): Likewise
+ (decode_line_info): Likewise.
+ (parse_comp_unit): Likewise.
+ (comp_unit_find_nearest_line): Likewise.
+ * libbfd-in.h (_bfd_dwarf2_find_nearest_line): Update prototype.
+ * libbfd.h: Regenerate.
+ * elf.c (_bfd_elf_find_nearest_line): Update call.
+ * elf-bfd.h (elf_obj_tdata): Change dwarf2_find_line_info to type PTR.
+ * dwarf2.c (concat_filename): Use IS_ABSOLUTE_PATH.
+ * coffcode.h (STYP_XCOFF_DEBUG, STYP_DEBUG_INFO): New macros.
+ (sec_to_styp_flags): Use them. Handle DWARF2 sections.
+ (styp_to_sec_flags): Handle DWARF2 sections.
+ * elf32-arm.h (elf32_arm_find_nearest_line): Add parameter to call
+ to _bfd_find_nearest_line.
+ * elf32-mips.c (_bfd_mips_elf_find_nearest_line): Add parameter to
+ call to _bfd_find_nearest_line.
+
+2000-12-08 Kazu Hirata <kazu@hxi.com>
+
+ * coffgen.c: Fix formatting.
+ * elf-m10300.c: Likewise.
+ * elf32-i386.c: Likewise.
+ * elf32-i960.c: Likewise.
+ * elf32-m68k.c: Likewise.
+ * elf32-mcore.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-sparc.c: Likewise.
+ * elf32-v850.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-hppa.c: Likewise.
+ * elf64-mips.c: Likewise.
+ * elf64-sparc.c: Likewise.
+
+2000-12-07 Kazu Hirata <kazu@hxi.com>
+
+ * elf32-ppc.c: Fix formatting.
+ * elf64-x86-64.c: Likewise.
+
+2000-12-06 Ulf Carlsson <ulfc@engr.sgi.com>
+
+ From Ralf Baechle <ralf@gnu.org>
+
+ * elf32-mips.c (elf32_mips_merge_private_bfd_data): Always permit
+ BFDs containing no sections or empty .text, .data or .bss sections
+ to be merged, regardless of their flags.
+
+2000-12-06 Kazu Hirata <kazu@hxi.com>
+
+ * elf32-m32r.c: Fix formatting.
+ * elf32-m68hc11.c: Likewise.
+ * elf32-m68hc12.c: Likewise.
+ * elf32-m68k.c: Likewise.
+ * elf32-mcore.c: Likewise.
+ * elf32-pj.c: Likewise.
+ * elf32-ppc.c: Likewise.
+
+2000-12-05 Kazu Hirata <kazu@hxi.com>
+
+ * elf32-fr30.c: Fix formatting.
+ * elf32-hppa.c: Likewise.
+ * elf32-i370.c: Likewise.
+ * elf32-i386.c: Likewise.
+ * elf32-i860.c: Likewise.
+ * elf32-i960.c: Likewise.
+
+2000-12-03 Kazu Hirata <kazu@hxi.com>
+
+ * elf32-arm.h: Fix formatting.
+ * elf32-avr.c: Likewise.
+ * elf32-cris.c: Likewise.
+ * elf32-d10v.c: Likewise.
+ * elf32-d30v.c: Likewise.
+ * elf-hppa.h: Likewise.
+ * elf-m10200.c: Likewise.
+ * elf-m10300.c: Likewise.
+
+2000-12-01 Chris Demetriou <cgd@sibyte.com>
+
+ * aoutx.h (NAME(aout,machine_type)): Add bfd_mach_mips32 and
+ bfd_mach_mips32_4k. Update FIXME comment.
+ * archures.c (bfd_mach_mips32): New constant.
+ (bfd_mach_mips4K, bfd_mach_mips32_4k) Rename the former to
+ the latter, renumber it.
+ * bfd-in2.h (bfd_mach_mips32): New constant.
+ (bfd_mach_mips4K, bfd_mach_mips32_4k) Rename the former to
+ the latter, renumber it.
+ * cpu-mips.c (I_mips32): New constant.
+ (I_mips4K, I_mips32_4k): Rename the former to the latter.
+ (arch_info_struct): Add bfd_mach_mips32 entry, replace
+ bfd_mach_mips4K entry with bfd_mach_mips32_4k entry.
+ * elf32-mips.c (elf_mips_isa): Add E_MIPS_ARCH_32 case.
+ (elf_mips_mach): Likewise. Also, replace E_MIPS_MACH_MIPS32
+ with E_MIPS_MACH_MIPS32_4K.
+ (_bfd_mips_elf_final_write_processing): Replace
+ bfd_mach_mips4K with bfd_mach_mips32_4k case, add
+ bfd_mach_mips32 case.
+ (_bfd_mips_elf_merge_private_bfd_data): Generalize ISA mixing
+ comparison with support for MIPS32.
+ (_bfd_mips_elf_print_private_bfd_data): Print ISA name for
+ MIPS32.
+
+ * aoutx.h (NAME(aout,machine_type)): Add cases for
+ bfd_mach_mips5 and bfd_mach_mips64.
+ * archures.c (bfd_mach_mips5, bfd_mach_mips64): New constants.
+ * bfd-in2.h (bfd_mach_mips5, bfd_mach_mips64): Likewise.
+ * cpu_mips.c (I_mips5, I_mips64): New definitions.
+ (arch_info_struct): Add entries for bfd_mach_mips5 and
+ bfd_mach_mips64.
+ * elf32-mips.c (elf_mips_isa, elf_mips_mach,
+ _bfd_mips_elf_print_private_bfd_data): Add cases for
+ E_MIPS_ARCH_5 and E_MIPS_ARCH_64.
+ (_bfd_mips_elf_final_write_processing): Add cases for
+ bfd_mach_mips5 and bfd_mach_mips64.
+
+ * aoutx.h (NAME(aout,machine_type)): Add a
+ bfd_mach_mips_sb1 case.
+ * archures.c (bfd_mach_mips_sb1): New constant.
+ * bfd-in2.h (bfd_mach_mips_sb1): New constant.
+ * cpu-mips.c (I_sb1): New constant.
+ (arch_info_struct): Add entry for bfd_mach_mips_sb1.
+ * elf32-mips.c (elf_mips_mach): Add case for
+ E_MIPS_MACH_SB1.
+ (_bfd_mips_elf_final_write_processing): Add case for
+ bfd_mach_mips_sb1.
+
+2000-12-01 Joel Sherrill <joel@OARcorp.com>
+
+ * config.bfd (arm-*-rtems*, a29k-*rtems*): New targets.
+ (sparc*-*-rtemself*, sparc*-*-rtemsaout*): New targets.
+ (sparc*-*-rtems*): Switched from a.out to ELF.
+
+2000-11-30 Jan Hubicka <jh@suse.cz>
+
+ * Makefile.am (BFD64_BACKENDS): Add elf64-x86-64.lo
+ BFD64_BACKENDS_CFILES): Add elf64-x86-64.c
+ (elf64-x86-64.lo): Add dependencies.
+ * archures.c (DESCRIPTION): Add bfd_mach_x86_64,
+ bfd_mach_x86_64_intel_syntax.
+ * elf.c (prep_headers): Use EM_x86_64 for 64bit output.
+ * config.bfd (x86_64): Add.
+ * configure.in: Add support for bfd_elf64_x86_64_vec.
+ * cpu-i386.c (bfd_x86_64_arch_intel_syntax, bfd_x86_64_arch): Add.
+ (bfd_i386_arch, i8086_ar): Link in.
+ * elf64-x86-64.c: New file.
+ * reloc.c (ENUMDOC): Add BFD_RELOC_X86_64*.
+ * targets.c (bfd_elf64_x86_64_vec): Add.
+ (bfd_target_vect): Add bfd_elf64_x86_64_vec.
+
+2000-11-30 Kazu Hirata <kazu@hxi.com>
+
+ * xcofflink.c: Fix formatting.
+
+2000-11-28 Kazu Hirata <kazu@hxi.com>
+
+ * aoutx.h: Fix formatting.
+ * bfd-in.h: Likewise.
+ * bfd-in2.h: Likewise.
+ * cache.c: Likewise.
+ * cisco-core.c: Likewise.
+ * coff64-rs6000.c: Likewise.
+ * coffcode.h: Likewise.
+ * coffswap.h: Likewise.
+ * corefile.c: Likewise.
+ * elf32-mips.c: Likewise.
+
+2000-11-27 Kazu Hirata <kazu@hxi.com>
+
+ * aout-adobe.c: Fix formatting.
+ * coff64-rs6000.c: Likewise.
+ * coffgen.c: Likewise.
+ * cofflink.c: Likewise.
+
+2000-11-27 Philip Blundell <pb@futuretv.com>
+
+ * libcoff-in.h (coff_tdata): Add `strings_written' flag.
+ (obj_coff_strings_written): New accessor macro for above.
+ * libcoff.h: Regenerate.
+ * cofflink.c (_bfd_coff_final_link): Say that we wrote the
+ strings.
+ * coffcode.h (coff_write_object_contents): No need to write out
+ the string table if it's already been done.
+
+2000-11-22 Philip Blundell <pb@futuretv.com>
+
+ * cofflink.c (_bfd_coff_generic_relocate_section): Don't object to
+ weak undefined symbols.
+
+2000-11-24 Nick Clifton <nickc@redhat.com>
+
+ * archures.c (bfd_mach_arm_5TE): Define.
+ (bfd_mach_arm+XScale): Define.
+ * bfd-in2.h: Regenerate.
+
+ * coff-arm.c (coff_arm_reloc_type_lookup): Accept
+ BFD_RELOC_ARM_PCREL_BLX.
+
+ * coffcode.h (coff_set_flags): Set flags for 5t, 5te and
+ XScale machine numbers.
+
+ * config.bfd (xscale-elf): Add target.
+ (xscale-coff): Add target.
+
+ * cpu-arm.c: Add xscale machine name.
+ Add v5t, v5te and XScale machine numbers.
+
+2000-11-23 Kazu Hirata <kazu@hxi.com>
+
+ * aix386-core.c: Fix formatting.
+
+2000-11-22 Jim Wilson <wilson@redhat.com>
+
+ * coff-ia64.c (howto_table): Use EMPTY_HOWTO.
+ (in_reloc_p): Add ATTRIBUTE_UNUSED to unused parameters.
+ * cpu-ia64-opc.c (ins_rsvd, ext_rsvd, ins_const, ext_const): Likewise.
+ (ins_imms_scaled): Initialize sign_bit at function entry.
+ (elf64_ia64_operands): Add missing initializers.
+ * elfxx-ia64.c (elfNN_ia64_reloc, elfNN_ia64_reloc_type_lookup,
+ elfNN_ia64_info_to_howto, elfNN_ia64_fake_sections,
+ elfNN_ia64_add_symbol_hook, elfNN_ia64_is_local_label_name,
+ elfNN_ia64_local_hash_table_init, get_fptr, get_pltoff,
+ elfNN_ia64_adjust_dynamic_symbol): Add ATTRIBUTE_UNUSED for unused
+ parameters.
+ (elfNN_ia64_info_to_howto): Initialize free_relocs, free_contents,
+ and free_extsyms at function entry.
+ (elfNN_add_symbol_hook): Add unsigned cast to bfd_get_gp_size result.
+ (elfNN_ia64_create_dynamic_sections): Delete unused local h.
+ (get_got): Delete unused local srel.
+ (elfNN_ia64_check_relocs): Initialize dynrel_type when declared.
+ (elfNN_ia64_relocate_section): Delete unused local dynindx.
+
+2000-11-21 Kazu Hirata <kazu@hxi.com>
+
+ * coff-a29k.c: Fix formatting.
+ * coff-h8500.c: Likewise.
+ * coff-i960.c: Likewise.
+ * coff-ppc.c: Likewise.
+ * coff-rs6000.c: Likewise.
+ * coff-stgo32.c: Likewise.
+ * coff-tic54x.c: Likewise.
+ * coff-w65.c: Likewise.
+ * cpu-h8500.c: Likewise.
+ * cpu-hppa.c: Likewise.
+ * cpu-ns32k.c: Likewise.
+ * ecoff.c: Likewise.
+ * ecofflink.c: Likewise.
+
+2000-11-21 Nick Clifton <nickc@redhat.com>
+
+ * elf32-sh.c (sh_elf_reloc_loop): Fix compile time warning, and
+ remove possibility of infinite loop.
+
+2000-11-20 Kazu Hirata <kazu@hxi.com>
+
+ * aix386-core.c: Fix formatting.
+ * aout-adobe.c: Likewise.
+ * aout-arm.c: Likewise.
+ * aout-encap.c: Likewise.
+ * aout-ns32k.c: Likewise.
+ * aout-target.h: Likewise.
+ * aout-tic30.c: Likewise.
+ * aoutf1.h: Likewise.
+ * aoutx.h: Likewise.
+ * archive.c: Likewise.
+ * bfd-in.h: Likewise.
+ * bfd-in2.h: Likewise.
+ * bfd.c: Likewise.
+ * bout.c: Likewise.
+
+2000-11-17 H.J. Lu <hjl@gnu.org>
+
+ * elfxx-ia64.c (elfNN_ia64_size_dynamic_sections): Don't create
+ pltoff entries for DT_INIT and DT_FINI.
+ (elfNN_ia64_final_link): Don't set DT_INIT/FINI entries.
+ (elfNN_ia64_finish_dynamic_sections): Don't fill in DT_INIT/FINI
+ entries.
+
+2000-11-16 Richard Henderson <rth@redhat.com>
+
+ * elfxx-ia64.c (elfNN_ia64_check_relocs): Handle IPLT relocs.
+ (allocate_dynrel_entries): Likewise.
+ (elfNN_ia64_relocate_section): Likewise. Set REL addends correctly.
+ (set_pltoff_entry): Likewise.
+ (ia64_howto_table): Remove R_IA64_SEGBASE, and R_IA64_EPLT[ML]SB
+ (elfNN_ia64_reloc_type_lookup): Likewise.
+ (elfNN_ia64_install_value): Likewise.
+ (elfNN_ia64_relocate_section): Likewise.
+ * reloc.c (BFD_RELOC_IA64_SEGBASE): Remove.
+ (BFD_RELOC_IA64_EPLTMSB, BFD_RELOC_IA64_EPLTLSB): Remove.
+
+2000-11-16 Kazu Hirata <kazu@hxi.com>
+
+ * cpu-a29k.c: Fix formatting.
+ * cpu-alpha.c: Likewise.
+ * cpu-arm.c: Likewise.
+ * cpu-avr.c: Likewise.
+ * cpu-d10v.c: Likewise.
+ * cpu-h8500.c: Likewise.
+ * cpu-hppa.c: Likewise.
+ * cpu-i370.c: Likewise.
+ * cpu-i386.c: Likewise.
+ * cpu-i960.c: Likewise.
+ * cpu-ia64-opc.c: Likewise.
+ * cpu-ia64.c: Likewise.
+ * cpu-m32r.c: Likewise.
+ * cpu-m68hc11.c: Likewise.
+ * cpu-m68hc12.c: Likewise.
+ * cpu-m68k.c: Likewise.
+ * cpu-m88k.c: Likewise.
+ * cpu-mips.c: Likewise.
+ * cpu-ns32k.c: Likewise.
+ * cpu-pj.c: Likewise.
+ * cpu-powerpc.c: Likewise.
+ * cpu-sh.c: Likewise.
+ * cpu-sparc.c: Likewise.
+ * cpu-tic54x.c: Likewise.
+ * cpu-v850.c: Likewise.
+ * cpu-vax.c: Likewise.
+ * cpu-w65.c: Likewise.
+ * cpu-we32k.c: Likewise.
+ * cpu-z8k.c: Likewise.
+ * dwarf1.c: Likewise.
+ * dwarf2.c: Likewise.
+
+2000-11-15 Kazu Hirata <kazu@hxi.com>
+
+ * coff-arm.c: Fix formatting.
+ * coff-ppc.c: Likewise.
+ * coff-rs6000.c: Likewise.
+ * coff-sh.c: Likewise.
+ * coff-sparc.c: Likewise.
+ * coff-tic30.c: Likewise.
+ * coff-tic54x.c: Likewise.
+ * coff-tic80.c: Likewise.
+ * coff-w65.c: Likewise.
+ * coff-we32k.c: Likewise.
+ * coff-z8k.c: Likewise.
+
+2000-11-15 Richard Henderson <rth@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_check_relocs): Create the reloc
+ section with the same ALLOC|LOAD flags as the source section.
+
+2000-11-14 Jakub Jelinek <jakub@redhat.com>
+
+ * elf64-alpha.c (elf64_alpha_relax_opt_call): Only check bits used
+ by STO_ALPHA constants.
+
+2000-11-14 Kazu Hirata <kazu@hxi.com>
+
+ * coff-pmac.c: Fix formatting.
+ * coff-ppc.c: Likewise.
+
+2000-11-13 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_link_add_object_symbols): Also add indirect
+ symbols for common symbols with the default version.
+
+2000-11-09 Philip Blundell <pb@futuretv.com>
+
+ * section.c (STD_SECTION): Set gc_mark flag.
+
+2000-11-11 Kazu Hirata <kazu@hxi.com>
+
+ * coff-i960.c: Likewise.
+ * coff-m68k.c: Likewise.
+ * coff-m88k.c: Likewise.
+ * coff-mcore.c: Likewise.
+ * coff-mips.c: Likewise.
+
+2000-11-11 Bernd Schmidt <bernds@cygnus.co.uk>
+
+ * elf32-sh.c (sh_elf_relocate_section): Ignore R_SH_NONE relocs.
+
+2000-11-10 Kazu Hirata <kazu@hxi.com>
+
+ * coff-h8300.c: Fix formatting.
+ * coff-h8500.c: Likewise.
+ * coff-i386.c: Likewise.
+ * coff-i860.c: Likewise.
+ * coff-i960.c: Likewise.
+ * coff-ia64.c: Likewise.
+
+2000-11-09 Kazu Hirata <kazu@hxi.com>
+
+ * archive.c: Fix formatting.
+ * archures.c: Likewise.
+
+2000-11-07 Richard Henderson <rth@redhat.com>
+
+ * elfxx-ia64.c (elf64_ia64_final_link): New local unwind_output_sec.
+ Set it before bfd_elf64_bfd_final_link call. Use it after the call.
+ * section.c (bfd_set_section_contents): Call memcpy if
+ section->contents set and location not equal to contents plus offset.
+
+2000-11-08 Kazu Hirata <kazu@hxi.com>
+
+ * bfd-in.h: Fix formatting.
+ * bfd-in2.h: Likewise.
+ * bfd.c: Likewise.
+ * binary.c: Likewise.
+ * bout.c: Likewise.
+ * coff-a29k.c: Likewise.
+ * coff-alpha.c: Likewise.
+ * coff-apollo.c: Likewise.
+ * coff-aux.c: Likewise.
+
+2000-11-07 Kazu Hirata <kazu@hxi.com>
+
+ * aix386-core.c: Fix formatting.
+ * aoutf1.h: Likewise.
+ * aoutx.h: Likewise.
+ * archures.c: Likewise.
+ * armnetbsd.c: Likewise.
+
+2000-11-07 Alan Modra <alan@linuxcare.com.au>
+
+ * coff-h8300.c (special): Adjust reloc address.
+
+2000-11-06 Steve Ellcey <sje@cup.hp.com>
+
+ * archures.c (bfd_mach_ia64_elf64, bfd_mach_ia64_elf32): Add defines
+ to differentiate elf32 and elf64 on ia64.
+ * bfd-in2.h: Regenerate.
+ * config.bfd: Add target for "ia64*-*-hpux*".
+ * configure.in: Add bfd_elf32_ia64_big_vec to selvecs switch.
+ * configure: Regenerate.
+ * cpu-ia64.c (bfd_ia64_elf32_arch): Add elf32 arch info structure.
+ * targets.c: Add bfd_target bfd_elf32_ia64_big_vec.
+
+ * Makefile.am: Make elf32-ia64.c and elf64-ia64.c derived objects
+ from elfxx-ia64.c. Add depenency rules for making elf32-ia64.lo.
+ * Makefile.in: Regnerate.
+ * elf64-ia64.c: Deleted.
+ * elfxx-ia64.c: New file, paramaterized version of elf64-ia64.c.
+
+2000-11-06 Kazu Hirata <kazu@hxi.com>
+
+ * aout-adobe.c: Fix formatting.
+ * aout-arm.c: Likewise.
+ * aout-cris.c: Likewise.
+ * aout-encap.c: Likewise.
+ * aout-ns32k.c: Likewise.
+ * aout-target.h: Likewise.
+ * aout-tic30.c: Likewise.
+
+2000-11-05 Philip Blundell <philb@gnu.org>
+
+ * elf32-arm.h (elf32_arm_merge_private_bfd_data): Always permit
+ BFDs containing no sections to be merged, regardless of their flags.
+
+2000-11-04 Philip Blundell <philb@gnu.org>
+
+ * elf32-arm.h (elf32_arm_relocate_section): Suppress error message
+ if a relocation for an undefined symbol also results in an
+ overflow.
+
+2000-11-06 Christopher Faylor <cgf@cygnus.com>
+
+ * config.bfd: Add support for Sun Chorus.
+
+2000-11-05 David O'Brien <obrien@FreeBSD.org>
+
+ * configure.in: Recognize alpha-*-freebsd*.
+ * configure: Regenerate.
+
+2000-11-02 Luciano Gemme <ishitawa@yahoo.com>
+
+ * srec.c (CHUNK): Rename to DEFAULT_CHUNK.
+ (Chunk): New global variable set by a parameter in objcopy.c.
+ (S3Forced): New global variable set by a parameter in
+ objcopy.c.
+ (srec_set_section_contents): If S3Forced is true, always generate
+ S3 records.
+ (srec_write_section): Use 'Chunk' to limit maximum length of S
+ records.
+
+2000-11-02 Per Lundberg <plundis@chaosdev.org>
+
+ * config.bfd: Add support for i[3456]86-chaosdev-storm-chaos.
+ * Makefile.in: Regenerate.
+ * bfd-in2.h: Regenerate.
+ * po/bfd.pot: Regenerate.
+
+2000-10-31 Philip Blundell <philb@gnu.org>
+
+ * elf32-arm.h (elf32_arm_merge_private_bfd_data): Only handle
+ EF_SOFT_FLOAT if it is defined.
+
+2000-10-27 Philip Blundell <philb@gnu.org>
+
+ * elf32-arm.h (elf32_arm_copy_private_bfd_data): Don't refuse
+ attempts to mix PIC code with non-PIC, just mark the output as
+ being position dependent.
+ (elf32_arm_merge_private_bfd_data): Likewise. Print an error
+ message for EF_SOFT_FLOAT mismatches. Display diagnostics for
+ all mismatches, not just the first one.
+
+2000-10-25 Chris Demetriou <cgd@sibyte.com>
+
+ * ieee.c (ieee_archive_p): Plug one of many possible
+ memory leaks in error handling.
+
+2000-10-20 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-sparc.c (elf32_sparc_merge_private_bfd_data,
+ elf32_sparc_object_p, elf32_sparc_final_write_processing):
+ Support v8plusb.
+ * elf64-sparc.c (sparc64_elf_merge_private_bfd_data,
+ sparc64_elf_object_p): Support v9b.
+ * archures.c: Declare v8plusb and v9b machines.
+ * bfd-in2.h: Ditto.
+ * cpu-sparc.c: Ditto.
+
+2000-10-16 Geoffrey Keating <geoffk@shoggoth.cygnus.com>
+
+ * elf64-sparc.c (sparc64_elf_relocate_section): Clear the location
+ of a GOT reloc.
+
+ * elf32-ppc.c (SYMBOL_REFERENCES_LOCAL): New macro.
+ (SYMBOL_CALLS_LOCAL): New macro.
+ (ppc_elf_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL.
+ (ppc_elf_check_relocs): Use SYMBOL_REFERENCES_LOCAL.
+ (ppc_elf_finish_dynamic_symbol): Use SYMBOL_REFERENCES_LOCAL.
+ (ppc_elf_relocate_section): Use flag variable to determine
+ whether the relocation refers to a local symbol.
+ Test whether a PLTREL24 reloc will produce a reloc by looking
+ to see whether a PLT entry was made.
+
+2000-10-14 Geoffrey Keating <geoffk@shoggoth.cygnus.com>
+
+ * elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Don't make PLT
+ entries that could serve as a definition for a weak symbol.
+
+2000-10-13 Ulf Carlsson <ulfc@engr.sgi.com>
+
+ From Ralf Baechle <ralf@gnu.org>
+
+ * elf32-mips.c (mips_elf_create_dynamic_relocation): New argument
+ local_p. Add symbol value only for non-R_MIPS_REL32 relocations
+ against local symbols.
+ (_bfd_mips_elf_finish_dynamic_sections): Undo patch from 2000-10-01.
+
+2000-10-12 Alan Modra <alan@linuxcare.com.au>
+
+ * section.c (struct sec): Add kept_section.
+ (struct bfd_comdat_info): Remove sec, we can use above.
+ (STD_SECTION): Add initializer.
+ (bfd_make_section_anyway): Init here too.
+
+ * bfd-in2.h: Regenerate.
+
+ * elflink.h (elf_link_add_object_symbols): Remove unnecessary
+ zeroing of `flags'.
+ (elf_link_input_bfd): Set all asection->symbol->value's here, and
+ fudge values for discarded link-once section symbols.
+
+ * elf64-hppa.c: Include alloca-conf.h
+
+2000-10-11 Alan Modra <alan@linuxcare.com.au>
+
+ * elf.c (swap_out_syms): Revert 2000-10-07 changes.
+
+ * ieee.c (ieee_make_empty_symbol): Oops, bfd_zalloc needs another arg.
+
+2000-10-10 Alan Modra <alan@linuxcare.com.au>
+
+ * ieee.c (ieee_make_empty_symbol): Use bfd_zalloc, not bfd_zmalloc.
+
+2000-10-10 Tom Rix <trix@redhat.com>
+
+ * section.c (bfd_make_section_anyway): Release newsect ptr when
+ newsect->symbol fails to alloc. Use bfd_release instead of free.
+
+2000-10-09 Richard Henderson <rth@cygnus.com
+
+ * elf64-ia64.c (elf64_ia64_unwind_entry_compare_bfd): New.
+ (elf64_ia64_unwind_entry_compare): New.
+ (elf64_ia64_final_link): Sort the .IA_64.unwind section.
+
+2000-10-07 Alan Modra <alan@linuxcare.com.au>
+
+ * elflink.h (size_dynamic_sections): Don't create various tags if
+ .dynstr is excluded from the link. Don't set first dynsym entry
+ if dynsymcount is zero.
+ (elf_bfd_final_link): Don't try to swap out dynamic syms if
+ .dynsym excluded from the link. Don't try to write any dynamic
+ sections excluded from the link.
+
+ * elf.c (swap_out_syms): Handle global section symbols.
+
+2000-10-05 DJ Delorie <dj@redhat.com>
+
+ * peigen.c (_bfd_pei_swap_scnhdr_out): note extended relocs
+ * coffcode.h (coff_set_alignment_hook): read extended reloc count
+ (coff_write_relocs): write extended reloc count
+ (coff_write_object_contents): account for extended relocs
+
+2000-10-05 Jim Wilson <wilson@cygnus.com>
+
+ * elf-bfd.h (struct elf_backend_data): Add elf_backend_section_flags
+ field.
+ * elf.c (_bfd_elf_make_section_from_shdr): Call the
+ elf_backend_section_flags function.
+ * elf64-ia64.c (elf64_ia64_section_from_shdr): Delete flag conversion
+ code.
+ (elf64_ia64_section_flags): New function containing flag conversion
+ code.
+ (elf_backend_section_flags): Define to elf64_ia64_section_flags.
+ * elfxx-target.h (elf_backend_section_flags): Define.
+ (elfNN_bed): Initialize elf_backend_section_flags field.
+
+2000-10-02 Alan Modra <alan@linuxcare.com.au>
+
+ * elf32-hppa.c (elf32_hppa_check_relocs): Correct call to
+ _bfd_elf32_gc_record_vtable. Correct a comment.
+
+2000-10-01 Ulf Carlsson <ulfc@engr.sgi.com>
+
+ From Ralf Baechle <ralf@gnu.org>
+
+ * elf32-mips.c (_bfd_mips_elf_finish_dynamic_sections): Mark gld
+ produces binaries with got[1] = 0x80000001 to differenciate them
+ for the dynamic linker from the broken binaries produced by old
+ versions.
+
+2000-09-30 Petr Sorfa <petrs@sco.com>
+
+ * elf.c (elfcore_grok_pstatus): Check for size of pxstatus_t.
+ (elfcore_grok_lwpstatus): Check for size of lwpxstatus_t.
+ * configure.in: Add check for pxstatus_t and lwpxstatus_t.
+ * configure: Regenerate.
+
+2000-09-27 Hans-Peter Nilsson <hp@axis.com>
+
+ Define two bfd_targets for absence and presence of leading
+ underscore on symbols. Make sure to only link same kind.
+ * elf32-cris.c (cris_elf_object_p,
+ cris_elf_final_write_processing, cris_elf_print_private_bfd_data,
+ cris_elf_merge_private_bfd_data): New.
+ (elf_backend_object_p, elf_backend_final_write_processing,
+ bfd_elf32_bfd_print_private_bfd_data,
+ bfd_elf32_bfd_merge_private_bfd_data): Define.
+ <Target vector definition>: Include elf32-target.h twice with
+ different macro settings:
+ (TARGET_LITTLE_SYM): First as bfd_elf32_cris_vec, then as
+ bfd_elf32_us_cris_vec.
+ (TARGET_LITTLE_NAME): First as "elf32-cris", then "elf32-us-cris".
+ (elf_symbol_leading_char): First as 0, then '_'.
+ (INCLUDED_TARGET_FILE): Define for second include of elf32-target.h.
+ * config.bfd (cris-*-*): Add bfd_elf32_us_cris_vec to targ_selvecs.
+ * configure.in (bfd_elf32_cris_vec, cris_aout_vec): New vector.
+ * configure: Regenerate.
+ * targets.c: Declare bfd_elf32_us_cris_vec.
+ * po/bfd.pot: Regenerate.
+
+2000-09-29 Momchil Velikov <velco@fadata.bg>
+
+ * elf32-arm.h (arm_add_to_rel): Correctly adjust the addend for
+ R_ARM_THM_PC22 relocations.
+
+2000-09-29 NIIBE Yutaka <gniibe@chroot.org>
+
+ * elflink.h (elf_link_add_object_symbols): Don't bfd_release runpath.
+
+2000-09-29 Momchil Velikov <velco@fadata.bg>
+
+ * elf.c (elf_fake_sections): Do not mark the section SHT_NOBITS if
+ is has the SEC_HAS_CONTENTS flag set.
+
+2000-09-28 Örjan Friberg <orjanf@axis.com>
+ Hans-Peter Nilsson <hp@axis.com>
+
+ * aout-cris.c (N_TXTADDR): Define.
+
+2000-09-28 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * som.c: Include alloca-conf.h.
+ * Makefile.am: "make dep-am"
+ * Makefile.in: Regenerate.
+
+2000-09-27 Alan Modra <alan@linuxcare.com.au>
+
+ * elf32-hppa.c (plt_stub): New.
+ (PLT_STUB_ENTRY): Define.
+ (elf32_hppa_link_hash_table): Change multi_subspace to packed
+ boolean. Add need_plt_stub, has_12bit_branch and has_17bit_branch.
+ (elf32_hppa_link_hash_table_create): Init to suit.
+ (elf32_hppa_check_relocs): Set has_12bit_branch and
+ has_17bit_branch as appropriate.
+ (elf32_hppa_adjust_dynamic_symbol): Set need_plt_stub for
+ non-local functions.
+ (elf32_hppa_size_dynamic_sections): Correct setting of reltext.
+ Add space for plt_stub as needed.
+ (elf32_hppa_finish_dynamic_symbol): Point .plt entries for global
+ functions at plt_stub.
+ (elf32_hppa_finish_dynamic_sections): Write plt_stub.
+ (elf32_hppa_create_dynamic_sections): Leave .plt executable.
+
+ * elf32-hppa.h (elf32_hppa_size_stubs): Add group_size param.
+ * elf32-hppa.c (elf32_hppa_size_stubs): Likewise. Use it instead
+ of fixed size, and if negative, disable handling of input sections
+ before stub section. Set up default stub group size depending
+ on detected branch relocs.
+ (hppa_build_one_stub): Use lrsel and rrsel for import stubs to
+ ensure different offsets from sym_value aren't rounded to
+ different 2k blocks. Use lrsel and rrsel for other stubs too for
+ consistency rather than necessity.
+ (elf32_hppa_check_relocs): Handle R_PARISC_DIR14F.
+ (final_link_relocate): Likewise.
+ (elf32_hppa_relocate_section): Likewise.
+
+ * elf-hppa.h (elf_hppa_howto_table): Add R_PARISC_DIR14F reloc.
+ (_bfd_elf_hppa_gen_reloc_type): Generate them.
+ (elf_hppa_final_link_relocate): Handle them.
+ (elf_hppa_relocate_insn): Likewise.
+ (_bfd_elf_hppa_gen_reloc_type): Add missing e_ldsel and e_rdsel cases.
+
+2000-09-26 Hans-Peter Nilsson <hp@axis.com>
+
+ * elfcode.h (elf_object_p): Preserve and clear abfd section
+ information. Restore at error.
+
+2000-09-26 Paul Sokolovsky <Paul.Sokolovsky@technologist.com>
+
+ * peigen.c (_bfd_pei_swap_aouthdr_in): If some DataDirectory
+ is empty, make sure that its rva also 0. NT loader dislikes
+ having otherwise.
+
+2000-09-26 Steve Ellcey <sje@cup.hp.com>
+
+ * som.c (som_bfd_derive_misc_symbol_info): Make weak symbols
+ global by default.
+
+2000-09-21 Alan Modra <alan@linuxcare.com.au>
+
+ * elf32-hppa.c (elf32_hppa_check_relocs): Fix weak sym handling in
+ currently unused RELATIVE_DYNAMIC_RELOCS code.
+ (hppa_discard_copies): Likewise.
+ (elf32_hppa_size_stubs): Size `input_list' array correctly. Correct
+ comments. Don't check non-code output sections for stub grouping.
+
+2000-09-20 Alan Modra <alan@linuxcare.com.au>
+
+ * section.c (bfd_get_unique_section_name): Return NULL if
+ bfd_malloc fails.
+
+2000-09-19 Michael Sokolov <msokolov@ivan.Harhan.ORG>
+
+ * elf32-m68k.c (elf_cpu32_plt0_entry): Change the PLT entry 0
+ instruction sequence to actually work.
+ (elf_m68k_finish_dynamic_sections): Change the patch-in offset
+ accordingly.
+
+2000-09-18 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-sh.c (sh_elf_relocate_section): Use
+ _bfd_final_link_relocate to apply the relocation against a section
+ symbol, when doing relocatable links.
+
+2000-09-18 Alan Modra <alan@linuxcare.com.au>
+
+ * elf32-hppa.c (elf32_hppa_stub_hash_entry): Rename input_section
+ to id_sec.
+ (stub_hash_newfunc): Here too.
+ (hppa_add_stub): And here.
+ (elf32_hppa_link_hash_table): Remove stub_section_created,
+ reloc_section_created, first_init_sec and first_fini_sec. Add
+ stub_group.
+ (elf32_hppa_link_hash_table_create): Init to suit.
+ (hppa_get_stub_entry): Add support for grouping stub sections.
+ (hppa_add_stub): Likewise. Remove sec_count param and init/fini
+ section code. Index stub vars by section->id.
+ (elf32_hppa_size_stubs): Likewise. Remove duplicated function
+ exit paths. Zap allocation of above removed vars. Refine
+ link-once test.
+
+ * elf32-hppa.h (elf32_hppa_size_stubs): Add output_bfd param.
+ * elf32-hppa.c (elf32_hppa_size_stubs): Likewise.
+ (hppa_get_stub_entry): Pass in pointer to elf32_hppa_link_hash_table
+ rather than pointer to bfd_link_info.
+ (hppa_add_stub): Likewise.
+ (final_link_relocate): Likewise.
+
+2000-09-17 David Huggins-Daines <dhd@linuxcare.com>
+
+ (elf32_hppa_size_stubs): Don't try to build stubs for discarded
+ link-once sections.
+
+2000-09-16 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-sh.c (ELF_MAXPAGESIZE): Define to 128, to match
+ ld/emulparams/shelf.sh.
+
+2000-09-10 Michael Sokolov <msokolov@ivan.Harhan.ORG>
+
+ * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): New function.
+ * bfd-in.h (bfd_m68k_elf32_create_embedded_relocs): Add declaration.
+ * bfd-in2.h: Regenerate.
+
+2000-09-15 Kenneth Block <Kenneth.Block@compaq.com>
+
+ * elf64-alpha.c (elf64_alpha_relax_with_lituse): ld performs
+ LITUSE relocations incorrectly if -relax is specified on the ld
+ command line and the displacement field of the load or store
+ instruction is non-zero. (Patch by paul.winalski@compaq.com)
+
+2000-09-15 Alan Modra <alan@linuxcare.com.au>
+
+ * elf32-hppa.c (hppa_add_stub): Dont set first_init_sec and
+ first_fini_sec here.
+ (elf32_hppa_size_stubs): Instead correctly find the first .init
+ and .fini section here.
+
+2000-09-15 David Huggins-Daines <dhd@linuxcare.com>
+
+ * elf32-hppa.c (clobber_millicode_symbols): New function.
+ (elf32_hppa_size_dynamic_sections): Call it.
+
+2000-09-14 Alan Modra <alan@linuxcare.com.au>
+
+ * elf32-hppa.c (elf32_hppa_link_hash_entry): Make pic_call
+ packed. Add plabel, plt_abs packed booleans.
+ (hppa_link_hash_newfunc): Init new fields.
+ (PLABEL_PLT_ENTRY_SIZE): Define.
+ (hppa_stub_name): Use size_t len vars.
+ (hppa_add_stub): Likewise.
+ (elf32_hppa_build_stubs): Likewise.
+ (hppa_build_one_stub): Kill some compiler warnings.
+ (elf32_hppa_check_relocs): Always generate a plt entry for PLABELs
+ if dynamic linking. Munge the local plt offsets into
+ local_got_refcounts. Set h->plabel for all global PLABELs. Use
+ size_t len vars. Add assert for plabel addend.
+ (elf32_hppa_gc_sweep_hook): Sweep local plt entries too.
+ (elf32_hppa_hide_symbol): New function.
+ (elf_backend_hide_symbol): Define.
+ (elf32_hppa_adjust_dynamic_symbol): Don't throw away plt entries
+ with h->plabel set. Don't make plt entries to have dynamic syms
+ when they have been forced local. If plt entry is used by a
+ plabel, make it PLABEL_PLT_ENTRY_SIZE.
+ (elf32_hppa_size_dynamic_sections): Set plt_abs for init fns.
+ Set up .plt offsets for local syms.
+ (elf32_hppa_relocate_section): Initialise plt entries for local
+ syms. Leave weak undefined plabels zero. Make global plabel
+ relocs against function symbol, and leave the addend zero.
+ Use *ABS* DIR32 relocs instead of SEGREL32 for dynamic got relocs.
+ (elf32_hppa_finish_dynamic_symbol): Set up IPLT relocs for
+ non-dynamic syms. Init extra plt for plabels. Use *ABS* DIR32
+ relocs instead of SEGREL32 for dynamic got relocs.
+ (elf32_hppa_finish_dynamic_sections): Reserve one more .got entry.
+ (elf_backend_got_header_size): Adjust.
+ (elf32_hppa_set_gp): Calculate an "ideal" LTP.
+
+ * elf32-hppa.c (LONG_BRANCH_VIA_PLT): Define.
+ (hppa_type_of_stub): Use it instead of #if 0
+ (hppa_discard_copies): Use it here too.
+ (elf32_hppa_size_dynamic_sections): And here.
+
+ * elf32-hppa.c (elf32_hppa_link_hash_table): Remove `offset' field.
+ (elf32_hppa_link_hash_table_create): And here.
+ (hppa_build_one_stub): And here. Instead keep track of stub
+ offset using _raw_size.
+ (elf32_hppa_size_stubs): Likewise.
+ (elf32_hppa_build_stubs): Likewise.
+ (hppa_size_one_stub): Likewise. Resize reloc section too.
+
+ * elf32-hppa.c (hppa_add_stub): Correct first_init_sec and
+ first_fini_sec handling. Don't search for reloc section or set
+ hplink->reloc_section_created here.
+ (elf32_hppa_size_stubs): Instead search for reloc sections, and
+ set reloc_section_created here.
+ (hppa_handle_PIC_calls): Set ELF_LINK_HASH_NEEDS_PLT.
+ (elf32_hppa_size_dynamic_sections): Make a .plt entry for DT_INIT
+ and DT_FINI.
+ (elf32_hppa_finish_dynamic_sections): Set DT_INIT and DT_FINI.
+
+ * elf32-hppa.c (hppa_build_one_stub): Replace `elf_hash_table (info)'
+ with `hplink->root.'.
+ (elf32_hppa_check_relocs): Likewise.
+ (elf32_hppa_gc_sweep_hook): Likewise.
+ (elf32_hppa_adjust_dynamic_symbol): Likewise.
+ (hppa_handle_PIC_calls): Likewise.
+ (elf32_hppa_size_dynamic_sections): Likewise.
+ (elf32_hppa_set_gp): Likewise.
+ (elf32_hppa_relocate_section): Likewise.
+ (elf32_hppa_finish_dynamic_symbol): Likewise.
+ (elf32_hppa_finish_dynamic_sections): Likewise.
+
+ From David Huggins-Daines <dhd@linuxcare.com>
+ * elf32-hppa.c (hppa_type_of_stub): Generate import stubs for
+ defined weak symbols in shared links.
+ (final_link_relocate): Calls to defined weak symbols in shared
+ objects must go via import stubs, as the target might not be known
+ at link time.
+
+2000-09-14 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-sh.c (sh_elf_howto_table): Moved R_SH_GOT32, R_SH_PLT32,
+ R_SH_COPY, R_SH_GLOB_DAT, R_SH_JMP_SLOT, R_SH_RELATIVE,
+ R_SH_GOTOFF, R_SH_GOTPC) to the range from 160 to 167. Replaced
+ the original entries with EMPTY_HOWTOs, and added new ones to fill
+ in the gap.
+ (sh_elf_info_to_howto): Make sure the new gap isn't used.
+ (sh_elf_relocate_section): Likewise.
+
+2000-09-13 Anders Norlander <anorland@acc.umu.se>
+
+ * cpu-mips.c (arch_info_struct): Add mips:4K
+ * bfd-in2.h (bfd_mach_mips4K): New define.
+ * archures.c: Add bfd_mach_mips4K to comment.
+ * elf32-mips.c (_bfd_mips_elf_final_write_processing): Return
+ E_MIPS_ARCH_2 for bfd_mach_mips4K.
+
+2000-09-13 Marco Franzen <marcof@thyron.com>
+
+ * som.c (som_write_symbol_strings): Do not used fixed buffers,
+ use size_t as a counter.
+ (som_write_space_strings): Similarly.
+
+2000-09-12 Jason Eckhardt <jle@cygnus.com>
+
+ * elf32-i860.c (elf32_i860_relocate_pc26): New function
+ and prototype.
+ (elf32_i860_relocate_section): Invoke new function from here.
+
+2000-09-11 Michael Sokolov <msokolov@ivan.Harhan.ORG>
+
+ * elf.c (_bfd_elf_make_section_from_shdr): Make debug_sec_names
+ static.
+
+2000-09-10 Michael Sokolov <msokolov@ivan.Harhan.ORG>
+
+ * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): Emit 8 NULs for
+ target section name instead of dumping core when the target symbol is
+ undefined.
+
+2000-09-09 Kazu Hirata <kazu@hxi.com>
+
+ * riscix.c: Remove DEFUN.
+
+2000-09-08 Nick Clifton <nickc@redhat.com>
+
+ * elf32-arm.h (elf32_arm_merge_private_bfd_data): Do not
+ initialise flags in output bfd if the input bfd is the default
+ architecture with the default flags.
+
+2000-09-08 Kazu Hirata <kazu@hxi.com>
+
+ * archive.c: Fix formatting.
+ * coff-arm.c: Likewise.
+ * doc/chew.c: Likewise.
+
+2000-09-08 Alan Modra <alan@linuxcare.com.au>
+
+ * section.c (bfd_get_unique_section_name): Put a dot before the
+ numeric suffix.
+
+2000-09-07 Kazu Hirata <kazu@hxi.com>
+
+ * doc/chew.c: Remove all uses of DEFUN and DEFUN_VOID.
+ * elf.c: Fix formatting.
+
+2000-09-07 Alexandre Oliva <aoliva@redhat.com>
+
+ * config.bfd (sh-*-linux*): Added.
+ * configure.in (bfd_elf32_shlin_vec, bfd_elf32_shblin_vec): New.
+ * targets.c: Declare them.
+ * elf32-sh-lin.c: New file.
+ * Makefile.am: Compile it.
+ * elf32-sh.c: Don't override defines from elf32-sh-lin.c.
+ * configure, Makefile.in: Rebuilt.
+
+2000-09-06 Geoffrey Keating <geoffk@cygnus.com>
+
+ * xcofflink.c (xcoff_link_input_bfd): Include the .tocbss
+ pseduo-section when determining where the TOC ends.
+
+ * coff-rs6000.c (_bfd_xcoff_swap_aux_out): Use bfd_h_put_16 to
+ output x_tvndx as it is only two bytes wide.
+
+ * coff-rs6000.c (xcoff_howto_table): A modifiable branch-absolute
+ reloc is 26 or 32 bits wide.
+
+ * coff-rs6000.c (_bfd_xcoff_rtype2howto): The bitsize is irrelevant
+ for relocs that don't change anything. Also look at the full
+ 6 bits of bitsize.
+
+2000-09-06 Philip Blundell <philb@gnu.org>
+
+ * config.bfd (arm*-*-uclinux*): New target.
+
+2000-09-06 Alexandre Oliva <aoliva@redhat.com>
+
+ * configure: Rebuilt with new libtool.m4.
+
+2000-09-06 Alan Modra <alan@linuxcare.com.au>
+
+ * section.c (bfd_get_unique_section_name): Avoid c++ reserved
+ word for variable name.
+ * bfd-in2.h: Regenerate.
+
+2000-09-05 Nick Clifton <nickc@redhat.com>
+
+ * config.in: Regenerate.
+ * libbfd.h: Regenerate.
+ * po/bfd.pot: Regenerate.
+ * doc/bfdint.texi: Remove CVS date string - it foils compares with
+ local versions.
+
+2000-09-05 Steven Johnson <sbjohnson@ozemail.com.au>
+
+ * cpu-powerpc.c (arch_info_struct): Added MPC860 Family entry.
+
+2000-09-05 Alan Modra <alan@linuxcare.com.au>
+
+ Shared library and PIC support.
+ * elf32-hppa.c (PLT_ENTRY_SIZE): New.
+ (GOT_ENTRY_SIZE): New.
+ (ELF_DYNAMIC_INTERPRETER): New.
+ (STUB_SUFFIX): Define.
+ (LONG_BRANCH_PIC_IN_SHLIB): Define.
+ (RELATIVE_DYNAMIC_RELOCS): Define.
+ (enum elf32_hppa_stub_type): New.
+ (struct elf32_hppa_stub_hash_entry): Rename offset to
+ stub_offset. Add a number of new fields.
+ (struct elf32_hppa_link_hash_entry): New.
+ (struct elf32_hppa_link_hash_table): Add numerous fields. Remove
+ global_value.
+ (elf32_hppa_hash_table): Rename to hppa_link_hash_table.
+ (elf32_hppa_stub_hash_lookup): Rename to hppa_stub_hash_lookup.
+ (elf32_hppa_stub_hash_newfunc): Rename to stub_hash_newfunc. Init
+ new fields.
+ (hppa_link_hash_newfunc): New function.
+ (elf32_hppa_link_hash_table_create): Use above function. Init new
+ fields.
+ (elf32_hppa_stub_name): Rename to hppa_stub_name. Pass in reloc
+ instead of addend, and remove sym_name from args. Don't use
+ symbol name for local syms, instead use sym index.
+ (elf32_hppa_size_of_stub): Rename to hppa_type_of_stub, and return
+ stub type rather than size. Pass in hash and handle import stub
+ case. Also pass in reloc instead of offset so we can calculate
+ PCREL22F and PCREL12F branches properly.
+ (elf32_hppa_build_one_stub): Rename to hppa_build_one_stub. Build
+ import and export stubs too.
+ (elf32_hppa_size_one_stub): Rename to hppa_size_one_stub. Handle
+ import and export stub sizing.
+ (elf32_hppa_check_relocs): New function.
+ (elf32_hppa_adjust_dynamic_symbol): New function.
+ (hppa_discard_copies): New function.
+ (elf32_hppa_size_dynamic_sections): New function.
+ (elf_backend_size_dynamic_sections): Define.
+ (elf32_hppa_finish_dynamic_symbol): New function.
+ (elf_backend_finish_dynamic_symbol): Define.
+ (elf32_hppa_size_stubs): Stash params in link hash table, and move
+ some local vars into the link hash table too. For shared links,
+ trundle over function syms, generating export stubs. Handle
+ PCREL22F branches. Break out stub creation code from here..
+ (hppa_add_stub): .. to here. New function.
+ (elf32_hppa_final_link): Rename to elf32_hppa_set_gp, and don't
+ call the bfd linker. Use elf_gp to record global pointer.
+ Calculate a value from sections if $global$ is missing.
+ (bfd_elf32_bfd_final_link): Define as _bfd_elf32_gc_common_final_link.
+ (elf32_hppa_gc_mark_hook): New function.
+ (elf_backend_gc_mark_hook): Define.
+ (elf32_hppa_gc_sweep_hook): New function.
+ (elf_backend_gc_sweep_hook): Define.
+ (elf32_hppa_bfd_final_link_relocate): Rename to final_link_relocate.
+ Add rel to args, and remove howto, input_bfd, offset, addend,
+ sym_name as we can recalculate these locally. Handle calls to
+ dynamic objects, extra PIC relocs, PCREL22F branches. Change
+ handling of undefined weak syms. Check that stubs are in range.
+ Only look for import stubs on PCREL17F and PCREL22F relocs. Add
+ message on hitting a DPREL21L reloc that needs fixing. Subtract
+ off PC for PCREL14F. Break out code that does a stub lookup from
+ here..
+ (hppa_get_stub_entry): ..to here. New function.
+ (elf32_hppa_relocate_insn): Merge into final_link_relocate.
+ (elf32_hppa_relocate_section): Handle got and plt relocs, dynamic
+ relocs, etc. etc.
+ (elf32_hppa_finish_dynamic_sections): New function.
+ (elf_backend_finish_dynamic_sections): Define.
+ (elf_backend_final_write_processing) Define.
+ (hppa_handle_PIC_calls): New function.
+ (elf32_hppa_build_stubs): Call it. Pass link_info to
+ hppa_build_one_stub.
+ (elf32_hppa_create_dynamic_sections): New function
+ to create .plt and .got then set .plt flags correctly.
+ (elf_backend_create_dynamic_sections): Define.
+ (elf32_hppa_object_p): New function.
+ (elf_backend_object_p): Define.
+ (elf32_hppa_elf_get_symbol_type): New function.
+ (elf_backend_get_symbol_type): Define.
+ (elf_backend_can_gc_sections): Define.
+ (elf_backend_want_got_plt): Define.
+ (elf_backend_plt_alignment): Set to 2.
+ (elf_backend_plt_readonly): Define.
+ (elf_backend_want_plt_sym): Define.
+ (elf_backend_got_header_size): Reserve one entry.
+
+ * elf32-hppa.h (elf32_hppa_build_stubs): Don't pass stub bfd.
+ (elf32_hppa_size_stubs): Pass in multi_subspace.
+ (elf32_hppa_set_gp): Declare.
+
+ * section.c (SEC_HAS_GOT_REF): Define new flag for asection.
+ (bfd_get_unique_section_name): New function.
+ * bfd-in2.h: Regenerate.
+
+ * elf64-hppa.c (elf64_hppa_check_relocs): Handle R_PARISC_PCREL12F.
+ (elf64_hppa_size_dynamic_sections): Remove the FIXME at bfd_zalloc
+ comment.
+
+ From David Huggins-Daines <dhd@linuxcare.com>
+ * elf64-hppa.c (elf64_hppa_check_relocs): Fix a warning.
+ (elf64_hppa_mark_exported_functions): Set dyn_h->st_shndx.
+ (elf64_hppa_link_output_symbol_hook): Test dyn_h->st_shndx has
+ been updated in finish_dynamic_symbol before modifying function
+ symbol.
+
+ * elf-hppa.h (elf_hppa_howto_table): Restructure into groups of
+ eight entries. Replace NULL with bfd_elf_generic_reloc. Add
+ R_PARISC_GNU_VTENTRY, R_PARISC_GNU_VTINHERIT and R_PARISC_PCREL12F.
+ (_bfd_elf_hppa_gen_reloc_type): Handle R_PARISC_GNU_VT*. Add some
+ comments. Handle format == 12 for R_HPPA_PCREL_CALL.
+ (elf_hppa_final_link_relocate): Handle R_PARISC_PCREL12F.
+ (elf_hppa_relocate_insn): Likewise. Reformat some comments.
+ (elf_hppa_final_write_processing): Expose it for ARCH_SIZE == 32.
+
+ From David Huggins-Daines <dhd@linuxcare.com>
+ * elf-hppa.h (elf_hppa_is_local_label_name): Accept the SysV/ELF
+ style of local labels as well.
+
+2000-09-03 Philip Blundell <philb@gnu.org>
+
+ * elf32-arm.h (elf32_arm_relocate_section): Don't try to relocate
+ references to undefined symbols in debugging sections.
+
+2000-09-02 H.J. Lu <hjl@gnu.org>
+
+ * reloc.c (BFD_RELOC_SH_COPY, BFD_RELOC_SH_GLOB_DAT,
+ BFD_RELOC_SH_JMP_SLOT, BFD_RELOC_SH_RELATIVE,
+ BFD_RELOC_SH_GOTPC): Move them from the MIPS section to the SH
+ section.
+
+2000-09-02 Jason Eckhardt <jle@cygnus.com>
+
+ * elf32-i860.c (bfd_elf32_bfd_is_local_label_name): Define macro.
+ (elf32_i860_is_local_label_name): New function and prototype.
+
+2000-09-02 Nick Clifton <nickc@redhat.com>
+
+ * configure.in: Increase version number to 2.10.91.
+ * configure: Regenerate.
+ * aclocal.m4: Regenerate.
+ * config.in: Regenerate.
+ * po/bfd.pot: Regenerate.
+
+2000-09-02 Daniel Berlin <dberlin@redhat.com>
+
+ * elf.c (_bfd_elf_make_section_from_shdr): Add
+ .gnu.linkobce.wi. to the list of debug section names.
+
+2000-09-02 Nick Clifton <nickc@redhat.com>
+
+ * dwarf2.c (find_debug_info): New function: Locate a section
+ containing dwarf2 debug information.
+ (bfd_dwarf2_find_nearest_line): Find all sections containing
+ debug information and include them in the stash.
+
+2000-09-01 Niibe Yutaka <gniibe@m17n.org>, Kaz Kojima <kkojima@rr.iij4u.or.jp>, Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-sh.c (R_SH_GOT32, R_SH_PLT32, R_SH_COPY, R_SH_GLOB_DAT,
+ R_SH_JMP_SLOT, R_SH_RELATIVE, R_SH_GOTOFF, R_SH_GOTPC): New.
+ (sh_reloc_map): Add new relocs.
+ (sh_elf_check_relocs, sh_elf_link_hash_newfunc,
+ sh_elf_link_hash_table_create, sh_elf_adjust_dynamic_symbol,
+ sh_elf_size_dynamic_sections, sh_elf_finish_dynamic_symbol,
+ sh_elf_finishe_dynamic_sections, sh_elf_discard_copies): New
+ functions.
+ (ELF_DYNAMIC_INTERPRETER, PLT_ENTRY_SIZE): Define.
+ (elf_sh_plt0_entry_be, elf_sh_plt0_entry_le,
+ elf_sh_plt_entry_be, elf_sh_plt_entry_le,
+ elf_sh_pic_plt_entry_be, elf_sh_pic_plt_entry_le):
+ New array constants.
+ (elf_sh_plt0_entry, elf_sh_plt_entry, elf_sh_pic_plt_entry):
+ New variables.
+ (elf_sh_sizeof_plt, elf_sh_plt_plt0_offset,
+ elf_sh_plt0_linker_offset, elf_sh_plt0_gotid_offset,
+ elf_sh_plt_temp_offset, elf_sh_plt_symbol_offset,
+ elf_sh_plt_reloc_offset): Define.
+ (elf_sh_pcrel_relocs_copied, elf_sh_link_hash_entry,
+ elf_sh_link_hash_table): New structs.
+ (sh_elf_link_hash_traverse, sh_elf_hash_table): New macros.
+ (sh_elf_relocate_section, sh_elf_check_relocs): Handle new
+ relocation types.
+ (elf_backend_create_dynamic_sections,
+ bfd_elf32_bfd_link_hash_table_create,
+ elf_backend_adjust_dynamic_symbol,
+ elf_backend_size_dynamic_sections,
+ elf_backend_finish_dynamic_symbol,
+ elf_backend_finish_dynamic_sections, elf_backend_want_got_plt,
+ elf_backend_plt_readonly, elf_backend_want_plt_sym,
+ elf_backend_got_header_size, elf_backend_plt_header_size):
+ Define.
+ * reloc.c (BFD_RELOC_SH_COPY, BFD_RELOC_SH_GLOB_DAT,
+ BFD_RELOC_SH_JMP_SLOT, BFD_RELOC_SH_RELATIVE, BFD_RELOC_SH_GOTPC):
+ New relocs.
+ * bfd-in2.h, libbfd.h: Rebuilt.
+
+2000-09-01 Alan Modra <alan@linuxcare.com.au>
+
+ * elf32-i386.c (elf_i386_finish_dynamic_symbol): Revert 2000-08-27
+ change.
+
+2000-08-31 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ * elf32-sh.c (sh_elf_merge_private_data): If ibfd's elf header flags
+ not initialized, set them to indicate the SH1 instruction set.
+
+2000-08-31 Alexandre Oliva <aoliva@redhat.com>
+
+ * acinclude.m4: Include libtool and gettext macros from the
+ top level.
+ * aclocal.m4, configure: Rebuilt.
+
+2000-08-29 Michael Snyder <msnyder@seadog.cygnus.com>
+
+ * elf.c: Eliminate references to __sparcv9 macro; replace with
+ autoconf variables HAVE_PSINFO32_T etc.
+ * configure.in: Auto-configure HAVE_PSINFO_32_T, HAVE_PRPSINFO32_T,
+ HAVE_PSTATUS32_T, HAVE_PRSTATUS32_T, HAVE_PRSTATUS32_T_PR_WHO.
+ * config.in: Ditto.
+ * acinclude.m4 (BFD_HAVE_SYS_PROCFS_TYPE) define _SYSCALL32 so it can
+ detect the above typedefs. (BFD_HAVE_SYS_PROCFS_TYPE_MEMBER): Ditto.
+ * aclocal.m4: Ditto.
+ * configure: Regenerate.
+
+2000-08-27 Alan Modra <alan@linuxcare.com.au>
+
+ * elf32-i386.c (elf_i386_check_relocs): Keep info on relocs copied
+ for any shared link, not just shared -Bsymbolic.
+ (elf_i386_size_dynamic_sections): Call elf_i386_discard_copies on
+ any shared link, and pass link info to it.
+ (elf_i386_size_dynamic_sections): Update comment.
+ (elf_i386_discard_copies): Modify to discard relocs for symbols
+ that have been forced local.
+ (elf_i386_finish_dynamic_symbol): Don't copy relocs for symbols
+ that have been forced local.
+
+2000-08-24 Denis Chertykov <denisc@overta.ru> & Nick Clifton <nickc@redhat.com>
+
+ * elflink.h (elf_link_add_object_symbols): Allow common
+ symbols to have an alignment of 1 if explicitly requested, and
+ not overridden by other definitions.
+
+2000-08-22 Doug Kwan <dkwan@transmeta.com>
+
+ * coff-w65.c (CREATE_LITTLE_COFF_TARGET): Fix typo.
+ * coffcode.h (coff_set_flags): Add detection of w65 architecture.
+
+2000-08-22 H.J. Lu <hjl@gnu.org>
+
+ * elf-bfd.h (elf_link_hash_table): Add runpath.
+
+ * bfd-in.h (bfd_elf_get_runpath_list): New prototype.
+ * bfd-in2.h: Rebuilt.
+
+ * elf.c (_bfd_elf_link_hash_table_init): Initialize the
+ "runpath" field to NULL.
+ (bfd_elf_get_runpath_list): New function.
+
+ * elflink.h (elf_link_add_object_symbols): Record DT_RPATH and
+ DT_RUNPATH entries.
+
+2000-08-22 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-sh.c (sh_elf_relocate_section) [R_SH_IND12W,
+ R_SH_DIR8WPN, R_SH_DIR8WPZ, R_SH_DIR8WPL]: Handle them
+ explicitly. Improve validation of r_type.
+
+2000-08-21 H.J. Lu <hjl@gnu.org>
+
+ * elf32-i386.c (elf_i386_size_dynamic_sections): Zero out the
+ dynamic allocated content space. Add a comment to remind us that
+ one day this ought to be fixed.
+ * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
+ * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise.
+ * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
+
+2000-08-21 Jason Eckhardt <jle@cygnus.com>
+
+ * elf32-i860.c (elf32_i860_relocate_pc16): Just write the immediate
+ field with the newly relocated value instead of adding it to the
+ existing immediate field.
+ (elf32_i860_relocate_splitn): Likewise.
+ (elf32_i860_relocate_highadj): Likewise.
+
+2000-08-16 Jason Eckhardt <jle@cygnus.com>
+
+ * elf32-i860.c (elf32_i860_relocate_pc16): Implemented function (it
+ was previously just a stub).
+
+2000-08-16 Alexandre Oliva <aoliva@redhat.com>
+
+ * elflink.c (_bfd_elf_create_got_section): Don't abort().
+ Formatting fixes.
+ (_bfd_elf_create_dynamic_sections): Likewise.
+
+2000-08-16 Andrew Macleod <amacleod@cygnus.com>
+
+ * elf64-sparc.c (sparc64_elf_relocate_section): Set relocation address
+ for undefined symbols to be the beginning of the section.
+
+ * elf64-sparc.c (sparc64_elf_adjust_dynamic_symbol): Don't allocate
+ four extra entries at the beginning of the .rela.plt section.
+ (sparc64_elf_finish_dynamic_symbol): Adjust the offset in the .rela.plt
+ section to account for the four reserved entries in the .plt section.
+
+2000-08-15 Geoffrey Keating <geoffk@cygnus.com>
+
+ * xcofflink.c (_bfd_ppc_xcoff_relocate_section): Add ori r0,r0,0
+ to the list of NOPs we recognize after a branch-and-link.
+ Use the ori NOP when one is needed.
+
+ * coff-rs6000.c (_bfd_xcoff_slurp_armap): Finish implementation
+ for large archives.
+
+2000-08-14 Jim Wilson <wilson@cygnus.com>
+
+ * elf64-ia64.c (elf64_ia64_merge_private_bfd_data): Handle
+ EF_IA_64_REDUCEDFP, EF_IA_64_CONS_GP, and EF_IA_64_NOFUNCDESC_CONS_GP.
+ (elf64_ia64_print_private_bfd_data): Likewise. Also handle
+ EF_IA_64_ABSOLUTE.
+
+2000-08-11 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-sh.c (sh_elf_set_mach_from_flags): Make it static.
+
+2000-08-10 Jason Eckhardt <jle@cygnus.com>
+
+ * elf32-i860.c (elf32_i860_relocate_section): New function.
+ (i860_final_link_relocate): New function.
+ (elf32_i860_relocate_splitn): New function.
+ (elf32_i860_relocate_pc16): New function.
+ (elf32_i860_relocate_highadj): New function.
+ (elf32_i860_howto): Minor adjustments to some relocations.
+ (elf_info_to_howto_rel): Define.
+ (elf_backend_relocate_section): Define.
+
+2000-08-10 Nick Clifton <nickc@cygnus.com>
+
+ * elf32-arm.h: Fix formatting.
+
+2000-08-10 Bernd Schmidt <bernds@cygnus.co.uk>
+
+ * elf32-sh.c (sh_elf_reloc_loop): Make LAST_SYMBOL_SECTION static.
+
+2000-08-08 Jason Eckhardt <jle@cygnus.com>
+
+ * elf32-i860.c (elf32_i860_howto_table): Updated some fields.
+
+2000-08-07 Kazu Hirata <kazu@hxi.com>
+
+ * ieee.c (ieee_write_debug_part): Rewrite a comment.
+ * elf64-ia64.c: Fix a typo.
+
+2000-08-05 Jason Eckhardt <jle@cygnus.com>
+
+ * elf32-i860.c (elf32_i860_howto_table): New structure.
+ (lookup_howto): New function.
+ (elf32_i860_reloc_type_lookup): New function.
+ (elf32_i860_info_to_howto_rela): New function.
+ (elf_code_to_howto_index): New structure.
+ (elf_info_to_howto): Re-define as elf32_i860_info_to_howto_rela.
+ (bfd_elf32_bfd_reloc_type_lookup): Re-define as
+ elf32_i860_reloc_type_lookup.
+
+2000-08-04 Rodney Brown <RodneyBrown@pmsc.com>
+
+ * som.c (struct fixup_format): Constify `format'.
+ (som_hppa_howto_table): Use SOM_HOWTO macro.
+ (try_prev_fixup, hppa_som_reloc): Decorate unused parameter.
+ (som_bfd_reloc_type_lookup): Likewise.
+ (compare_subspaces): Remove unused `count1', `count2'.
+ (som_begin_writing): Remove unused `total_reloc_size'.
+ (som_bfd_derive_misc_symbol_info): Decorate unused parameter.
+ (som_print_symbol, som_bfd_is_local_label_name): Likewise.
+ (som_set_reloc_info): Constify `cp'. Remove unused `addend'.
+ (som_find_nearest_line): Decorate unused parameter(s).
+ (som_sizeof_headers, som_get_symbol_info, som_write_armap): Likewise.
+ (som_bfd_link_split_section): Likewise.
+
+2000-08-03 Nick Clifton <nickc@cygnus.com>
+
+ * section.c: Restore backed out code.
+ * elf.c: Restore backed out code.
+ (copy_private_bfd_data): Fix bug preventing stipped dynamic
+ binaries from working.
+ * bfd-in2.h: Regenerate.
+
+2000-08-03 H.J. Lu <hjl@gnu.org>
+
+ * section.c: Back out the change made by Nick Clifton
+ <nickc@cygnus.com> on 2000-07-31. It breaks stripping dynamic
+ binaries.
+ * bfd-in2.h: Likewise.
+ * elf.c: Likewise.
+
+2000-08-03 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-sh.c (sh_elf_reloc_loop): Warning removal.
+
+2000-07-31 Jason Eckhardt <jle@cygnus.com>
+
+ * reloc.c (BFD_RELOC_860_*): New bfd relocs for i860.
+ * bfd-in2.h, libbfd.h: Regenerate.
+
+2000-07-31 Nick Clifton <nickc@cygnus.com>
+
+ * section.c (struct sec): Add new boolean field 'segment_mark'.
+ (STD_SECTION): Initialise new field to zero.
+
+ * bfd-in2.h: Regenerate.
+
+ * elf.c (copy_private_bfd_data): Reorganise section to segment
+ mapping to cope with moved sections requiring new segments,
+ and overlapping segments.
+ (SEGMENT_END): New macro: Return the end address of a segment.
+ (IS_CONTAINED_BY_VMA): New macro: Determine if a segment
+ contains a section by comparing their VMA addresses.
+ (IS_CONTAINED_BY_LMA): New macro: Determine if a segment
+ contains a section by comparing their LMA addresses.
+ (INCLUDE_SECTION_IN_SEGMENT): New macro: Determine if a
+ section should be included in a segment.
+ (SEGMENT_AFTER_SEGMENT): New macro: Determine if one segment
+ follows another in memory.
+ (SEGMENT_OVERLAPS_SEGMENT): New macro: Determine if two
+ segments overlap.
+
+2000-07-22 Jason Eckhardt <jle@cygnus.com>
+
+ * cpu-i860.c: Added comments.
+
+ * elf32-i860.c (TARGET_LITTLE_SYM): Defined to
+ bfd_elf32_i860_little_vec.
+ (TARGET_LITTLE_NAME): Defined to "elf32-i860-little".
+ (ELF_MAXPAGESIZE): Changed to 4096.
+
+ * targets.c (bfd_elf32_i860_little_vec): Declaration of
+ new target.
+ (bfd_target_vector): Added bfd_elf32_i860_little_vec.
+
+ * config.bfd (i860-stardent-sysv4*, i860-stardent-elf*): Added
+ config for little endian elf32 i860.
+ (targ_defvec): Define for the new config above
+ as "bfd_elf32_i860_little_vec".
+ (targ_selvecs): Define for the new config above
+ as "bfd_elf32_i860_vec bfd_elf32_i860_little_vec"
+
+ * configure.in (bfd_elf32_i860_little_vec): Added recognition
+ of new target vec.
+
+ * configure: Regenerated.
+
+2000-07-27 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_merge_symbol): Take one more argument,
+ dt_needed, to indicate if the symbol comes from a DT_NEEDED
+ entry. Don't overide the existing weak definition if dt_needed
+ is true.
+ (elf_link_add_object_symbols): Pass dt_needed to
+ elf_merge_symbol ().
+
+2000-07-27 Nick Clifton <nickc@cygnus.com>
+
+ * elflink.h (elf_link_size_reloc_section): Zeroes the section's
+ allocated contents.
+
+2000-07-25 Geoffrey Keating <geoffk@cygnus.com>
+
+ * configure.host (*-*-aix*): AIX has 'long long' always.
+
+ * coff-rs6000.c (xcoff_write_one_armap_big): New procedure.
+ (xcoff_write_armap_big): Write both 32-bit and 64-bit armaps.
+ (xcoff_write_archive_contents_big): Don't update the offset
+ of the symbol table, xcoff_write_armap will do it.
+
+2000-07-23 Ulf Carlsson <ulfc@engr.sgi.com>
+
+ * elf32-mips.c (_bfd_mips_elf_check_relocs): Use abfd instead
+ of dynobj for SGI_COMPAT checks.
+
+2000-07-21 Michael Sokolov <msokolov@ivan.Harhan.ORG>
+
+ * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): New function.
+ * bfd-in.h (bfd_m68k_coff_create_embedded_relocs): Add declaration.
+ * bfd-in2.h: Regenerate.
+
+2000-07-21 Nick Clifton <nickc@cygnus.com>
+
+ * elf32-mips.c (_bfd_mips_elf_check_relocs): Detect out of
+ range symbol indices in relocs and issue an error message.
+
+2000-07-20 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Don't check
+ info->new_dtags when setting DT_FLAGS_1. It will only be set
+ by the new linker options. It shouldn't break anything.
+
+2000-07-20 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set DT_FLAGS_1
+ only if info->new_dtags is true.
+
+2000-07-20 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set
+ DT_RUNPATH and DT_FLAGS only if info->new_dtags is true.
+
+2000-07-20 Hans-Peter Nilsson <hp@axis.com>
+
+ * Makefile.am (ALL_MACHINES): Add cpu-cris.lo.
+ (ALL_MACHINES_CFILES): Add cpu-cris.c.
+ (BFD32_BACKENDS): Add aout-cris.lo and elf32-cris.lo.
+ (BFD32_BACKENDS_CFILES): Add aout-cris.c and elf32-cris.c.
+ (cpu-cris.lo, aout-cris.lo, elf32-cris.lo): New rules.
+ * Makefile.in: Rebuild.
+ * aclocal.m4: Rebuild.
+ * aoutx.h (NAME(aout,machine_type)): Add case for bfd_arch_cris.
+ * archures.c (enum bfd_architecture): Add bfd_arch_cris.
+ (bfd_cris_arch): Declare.
+ (bfd_archures_list): Add bfd_cris_arch.
+ * bfd-in2.h: Rebuild.
+ * config.bfd: (cris-*-*): New target.
+ * configure.in (bfd_elf32_cris_vec, cris_aout_vec): New vectors.
+ * configure: Rebuild.
+ * elf.c (prep_headers): Add bfd_arch_cris.
+ * libbfd.h: Rebuild.
+ * libaout.h (enum machine_type): Add M_CRIS.
+ * reloc.c: Add CRIS relocations.
+ * targets.c (bfd_elf32_cris_vec, cris_aout_vec): Declare.
+ (bfd_target_vect): Add bfd_elf32_cris_vec and cris_aout_vec.
+ * cpu-cris.c, aout-cris.c, elf32-cris.c: New files.
+ * po/POTFILES.in, po/bfd.pot: Regenerate.
+
+2000-07-19 H.J. Lu <hjl@gnu.org>
+
+ * elf32-arm.h (elf32_arm_size_dynamic_sections): Also set
+ DF_TEXTREL if DT_TEXTREL is set.
+ * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise.
+ * elf32-i386.c (elf_i386_size_dynamic_sections): Likewise.
+ * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
+ * elf32-mips.c (_bfd_mips_elf_size_dynamic_sections): Likewise.
+ * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
+ * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise.
+ * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
+ * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
+ * elf64-ia64.c (elf64_ia64_size_dynamic_sections): Likewise.
+ * elf64-sparc.c (sparc64_elf_size_dynamic_sections): Likewise.
+
+ * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Also
+ set DF_SYMBOLIC for symbolic link. Also set DT_RUNPATH if
+ DT_RPATH is set.
+ Set the DT_FLAGS and DT_FLAGS_1 entries if necessary.
+
+2000-07-19 H.J. Lu <hjl@gnu.org>
+
+ * bfd-in.h (bfd_elf_set_dt_needed_soname): New.
+ * bfd-in2.h: Rebuild.
+
+ * elf-bfd.h (elf_obj_tdata): Add dt_soname.
+ (elf_dt_soname): New.
+
+ * elf.c (bfd_elf_set_dt_needed_soname): New.
+
+ * elflink.h (elf_link_add_object_symbols): Add the DT_NEEDED
+ entry if the shared object loaded by DT_NEEDED is used to
+ resolve the reference in a regular object.
+
+2000-07-19 H.J. Lu <hjl@gnu.org>
+
+ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_CONFIG,
+ DT_DEPAUDIT and DT_AUDIT as strings.
+
+2000-07-19 Nick Clifton <nickc@cygnus.com>
+
+ * format.c: Fix formatting.
+
+2000-07-19 H.J. Lu <hjl@gnu.org>
+
+ * elf.c (_bfd_elf_print_private_bfd_data): Fix DT_CHECKSUM.
+
+2000-07-19 H.J. Lu <hjl@gnu.org>
+
+ * elf.c (_bfd_elf_print_private_bfd_data): Handle DT_BIND_NOW,
+ DT_INIT_ARRAY, DT_FINI_ARRAY, DT_INIT_ARRAYSZ, DT_FINI_ARRAYSZ,
+ DT_RUNPATH, DT_FLAGS, DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ,
+ DT_PLTPADSZ, DT_MOVEENT, DT_MOVESZ, DT_FEATURE, DT_POSFLAG_1,
+ DT_SYMINSZ, DT_SYMINENT, DT_CONFIG, DT_DEPAUDIT, DT_AUDIT,
+ DT_PLTPAD, DT_MOVETAB, DT_SYMINFO, DT_RELACOUNT, DT_RELCOUNT,
+ DT_FLAGS_1, DT_USED and DT_CHECKSUM.
+
+2000-07-18 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * elf.c (bfd_elf_get_sign_extend_vma, bfd_elf_get_arch_size): Move
+ renamed functions from here...
+ (assign_section_numbers): Use renamed functions.
+ (prep_headers): Use renamed functions.
+
+ * bfd.c (bfd_get_sign_extend_vma, bfd_get_arch_size): ...To here.
+ * bfd-in.h (bfd_get_sign_extend_vma, bfd_get_arch_size): Update.
+ * bfd-in2.h: Regenerate.
+
+2000-07-18 Ulf Carlsson <ulfc@engr.sgi.com>
+
+ * elf32-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Add
+ parenthesis in if statement.
+
+2000-07-17 Koundinya K <kk@ddeorg.soft.net>
+
+ Enable the support for Traditional MIPS.
+ * elf32-mips.c (IRIX_COMPAT): Recognize bfd_elf32_tradbigmips_vecand
+ return ict_none appropriately for traditional mips targets.
+ (STUB_LW): Change 0x8f998000 to 0x8f998010 for traditional mips.
+ (STUB_MOVE): Conditionalize for traditonal mips.
+ (STUB_LI16): Likewise.
+ (_bfd_mips_elf_modify_segment_map): Conditionalize to avoid making
+ room for RTPROC header.
+ (_bfd_mips_elf_modify_segment_map): For a normal mips executable set
+ the permission for the PT_DYNAMIC as read, write and execute.
+ (mips_elf_calculate_relocation): Check for the symbol _DYNAMIC_LINKING
+ for traditonal mips.
+ (_bfd_mips_elf_create_dynamic_sections): Add the symbol
+ _DYNAMIC_LINKING for traditonal mips.
+ (_bfd_mips_elf_create_dynamic_sections): Add the symbol __RLD_MAP
+ in case of traditonal mips.
+ (_bfd_mips_elf_adjust_dynamic_symbol): Create a stub only if a PLT
+ entry is required. For a function if PLT is not required then set the
+ corresponding hash table entry to 0.
+ (_bfd_mips_elf_size_dynamic_sections): Add DT_DEBUG entry for
+ traditonal mips.
+ (_bfd_mips_elf_finish_dynamic_symbol): for a undefined symbol in a
+ shared object set the value to 0.
+ (_bfd_mips_elf_finish_dynamic_symbol): Check for the symbol
+ _DYNAMIC_LINKING for traditonal mips.
+ (_bfd_mips_elf_finish_dynamic_symbol): Check for the symbol __RLD_MAP
+ for traditonal mips.
+
+2000-07-15 H.J. Lu <hjl@gnu.org>
+
+ * aoutx.h (translate_to_native_sym_flags): Handle BSF_LOCAL.
+
+2000-07-12 Charles Wilson <cwilson@ece.gatech.edu>
+
+ * libbfd.c (bfd_seek): fix 'seek beyond EOF' error when writing
+ out a structure that is BFD_IN_MEMORY.
+
+2000-07-11 Alan Modra <alan@linuxcare.com.au>
+
+ * elf64-hppa.c (get_dyn_name): Pass in section pointer instead of
+ bfd pointer. Print section id instead of bfd pointer for local
+ syms. Prefix addend with `+' for global syms as well as local.
+ Correct calculation of name component lengths.
+ (elf64_hppa_check_relocs): Update call to get_dyn_name.
+
+ From David Huggins-Daines <dhd@linuxcare.com>
+ * elf-hppa.h (elf_hppa_relocate_section): Update calls here too.
+ * elf64-hppa.c (elf64_hppa_check_relocs): Fix some warnings.
+ (elf64_hppa_modify_segment_map): Likewise.
+
+2000-07-11 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * elf.c (bfd_elf_get_sign_extend_vma): Return tendency of VMA
+ addresses to be "naturally" sign extended. Return -1 if unknown.
+ * bfd-in.h (bfd_elf_get_sign_extend_vma): Add declaration.
+ * bfd-in2.h: Regenerate.
+
+2000-07-11 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * ecoffswap.h (ecoff_get_off, ecoff_put_off): Add ECOFF_SIGNED_32
+ and ECOF_SIGNED_64 to list ways to extract an offset.
+ (ecoff_swap_fdr_in, ecoff_swap_fdr_out, ecoff_swap_pdr_in,
+ ecoff_swap_pdr_out, ecoff_swap_ext_in, ecoff_swap_ext_out):
+ Update.
+ * elf64-mips.c (ECOFF_SIGNED_64): Define instead of ECOFF_64.
+ * elf32-mips.c (ECOFF_SIGNED_32): Define instead of ECOFF_32.
+
+2000-07-11 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * elfcode.h (elf_object_p): Use bfd_set_start_address and not
+ bfd_get_start_address.
+ (elf_swap_ehdr_in): Sign extend e_entry when applicable.
+ (elf_swap_ehdr_out): Ditto.
+
+2000-07-10 Alexander Aganichev <AAganichev@hypercom.com>
+
+ * archures.c (bfd_default_scan): Add set of bfd_mach_ cases for
+ compatibility with older binutils.
+
+2000-07-10 Alan Modra <alan@linuxcare.com.au>
+
+ * section.c (bfd_make_section_anyway): Start section_id at 0x10.
+ (STD_SECTION): Avoid negative ids, instead use 0 to 3.
+
+ From Ryan Bradetich <rbradetich@uswest.net>
+ * dwarf1.c (parse_die): Cure signed/unsigned char warnings.
+ (parse_line_table): Ditto.
+ (_bfd_dwarf1_find_nearest_line): Ditto.
+ * syms.c (cmpindexentry): Remove extra `*' from params.
+
+2000-07-09 Koundinya K <kk@ddeorg.soft.net>
+
+ * elf32-mips.c (sort_dynamic_relocs): New Function.
+ (_bfd_mips_elf_finish_dynamic_sections): Call sort_dynamic_relocs
+ via qsort to sort the dynamic relocations in increasing r_symndx
+ value.
+
+2000-07-09 Alan Modra <alan@linuxcare.com.au>
+
+ * elf64-hppa.c (elf64_hppa_dyn_hash_table_init): Add
+ ATTRIBUTE_UNUSED to unused args.
+ (get_opd): Likewise.
+ (get_plt): Likewise.
+ (get_dlt): Likewise.
+ (get_stub): Likewise.
+ (elf64_hppa_adjust_dynamic_symbol): Likewise.
+ (elf64_hppa_link_output_symbol_hook): Likewise.
+ (elf64_hppa_check_relocs): Delete unused var.
+ (elf64_hppa_size_dynamic_sections): Likewise.
+ (elf64_hppa_finalize_opd): Likewise.
+ (elf64_hppa_finalize_dynreloc): Likewise.
+ (elf64_hppa_modify_segment_map): Likewise.
+ (elf64_hppa_finish_dynamic_sections): Likewise.
+
+ * elf-hppa.h (elf_hppa_final_write_processing): Add
+ ATTRIBUTE_UNUSED to unused args.
+ (elf_hppa_final_link_relocate): Likewise.
+ (elf_hppa_record_segment_addrs): Add paretheses.
+ (elf_hppa_relocate_section): Constify dyn_name.
+
+ From David Huggins-Daines <dhd@linuxcare.com>
+ * config.bfd: Add hppa*64*-*-linux-gnu 64-bit target, and
+ rearrange case statement so that it gets preferred to 32-bit ones.
+
+ * elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Use
+ asection->id instead of address of asection structure.
+ (elf32_hppa_size_stubs): Likewise.
+
+ * elf32-hppa.c (elf32_hppa_size_stubs): Use just one stub section
+ for .init* and .fini*.
+
+ * elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Mask pointers
+ and addends used in stub names to 32 bits.
+ (elf32_hppa_size_stubs): Likewise.
+
+ * elf-hppa.h (elf_hppa_final_link_relocate): Don't sum addend
+ twice for R_PARISC_GPREL64. Use bfd_put_32 for R_PARISC_PCREL32,
+ not bfd_put_64. Fix minor comment typo and formatting.
+
+ Changes to create multiple linker stubs, positioned immediately
+ before the section where they are required.
+ * elf32-hppa.c: Don't include hppa_stubs.h.
+ (elf32_hppa_stub_hash_entry): Add a pointer to the stub section.
+ (elf32_hppa_stub_hash_table): Delete.
+ (elf32_hppa_link_hash_entry): Delete.
+ (elf32_hppa_link_hash_table): Use plain bfd_hash_table for
+ stub_hash_table, and store the struct here rather than a pointer.
+ Delete output_symbol_count. Add offset array. Change
+ global_value to a bfd_vma.
+ (elf32_hppa_stub_hash_lookup): Use table instead of table->root.
+ (elf32_hppa_stub_hash_traverse): Delete.
+ (elf32_hppa_name_of_stub): Delete.
+ (elf32_hppa_link_hash_lookup): Delete.
+ (elf32_hppa_link_hash_traverse): Delete.
+ (elf32_hppa_stub_hash_table_init): Delete.
+ (elf32_hppa_size_of_stub): Pass input section and offset rather
+ than location and calculate location here. Don't pass name as all
+ stubs are now the same size.
+ (elf32_hppa_stub_hash_newfunc): Init new fields.
+ (elf32_hppa_link_hash_table_create): Likewise, and stub_hash_table
+ too.
+ (elf32_hppa_bfd_final_link_relocate): Cast enums to int before
+ comparing against ints. Rewrite stub handling code.
+ (elf32_hppa_relocate_section): Make r_type and r_symndx unsigned.
+ Case enums to int before comparing against ints. Remove
+ bfd_reloc_dangerous case.
+ (elf32_hppa_build_one_stub): Rewrite.
+ (elf32_hppa_size_one_stub): New function.
+ (elf32_hppa_build_stubs): Rewrite.
+ (elf32_hppa_size_stubs): Pass in linker call-back functions.
+ Rewrite stub-handling specific code.
+
+ * elf32-hppa.h (elf32_hppa_size_stubs): Update prototype.
+
+ * elf64-hppa.c (elf64_hppa_dyn_hash_entry): Fix a comment typo.
+
+ * hppa_stubs.h: Delete.
+ * Makefile.am (SOURCE_HFILES): Remove hppa_stubs.h
+ (elf32-hppa.lo): Remove hppa_stubs.h from dependencies.
+ * Makefile.in: Regenerate.
+
+ * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Handle e_nlsel and
+ e_nlrsel.
+
+ * libhppa.h (hppa_field_adjust): Correct e_nsel case.
+
+ * elf32-hppa.c (elf32_hppa_relocate_section): Mention the offset
+ and section name for bfd_reloc_notsupported error message.
+ (elf32_hppa_bfd_final_link_relocate): Print reasons for returning
+ bfd_reloc_notsupported.
+ (elf32_hppa_relocate_section): Add ATTRIBUTE_UNUSED to output_bfd.
+
+ * elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Handle
+ undefined weak symbols for all relocs.
+ (elf32_hppa_size_of_stub): Adjust calculation by 8 since branch
+ offsets are relative to one past the delay slot.
+ (elf32_hppa_size_stubs): Account for reloc addend when calculating
+ branch destination. Put addend into stub name too.
+ (elf32_hppa_bfd_final_link_relocate): Account for reloc addend and
+ adjust by 8 when deciding whether a linker stub is needed. Put
+ addend into stub name as for above.
+
+ * elf32-hppa.c (hppa_elf_relocate_insn): Change signed/unsigned on
+ various args and vars.
+ (elf32_hppa_bfd_final_link_relocate): Here too.
+ (elf32_hppa_size_stubs): Rename index -> indx. Use e_indx for
+ inner block var to avoid shadowing.
+
+ * elf32-hppa.h (_bfd_elf32_hppa_gen_reloc_type): Make `field' arg
+ unsigned.
+ * elf64-hppa.h (_bfd_elf64_hppa_gen_reloc_type): Ditto.
+ * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type): Ditto.
+ (elf_hppa_fake_sections): Rename local var to avoid shadowing.
+
+ * libhppa.h: Change practically all unsigned ints to plain ints.
+ Remove tests on gcc version. Instead use ATTRIBUTE_UNUSED for
+ prototypes.
+
+ From Ryan Bradetich <rbradetich@uswest.net>
+ * libhppa.h (hppa_opcode_type): New enum to replace #define's.
+ * elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Modify to
+ suit above.
+ From David Huggins-Daines <dhd@linuxcare.com>
+ * elf-hppa.h (elf_hppa_relocate_insn): Update the opcode constants
+ to the new OP_* ones.
+
+ * elf32-hppa.c (elf32_hppa_size_stubs): Consolidate freeing on
+ error exit. Bail out earlier on plabel relocs that we aren't
+ interested in. Don't tell elf32_hppa_stub_hash_lookup to copy
+ string, and then don't free our copy.
+ (elf32_hppa_build_one_stub): Make insn unsigned int.
+
+ * libhppa.h (bfd_hppa_insn2fmt): 22 bit branches are only
+ available with BL, not BE and BLE.
+
+ * elf32-hppa.c (hppa_elf_relocate_insn): Add some more example
+ code for elf arg relocs.
+ (elf32_hppa_bfd_final_link_relocate): Replace boolean is_local
+ argument with elf_link_hash_entry h. Handle undefined weak
+ symbols. Move $global$ lookup from here...
+ (elf32_hppa_relocate_section): ...to here. Return correct error
+ message for non-handled relocs.
+ (elf32_hppa_size_of_stub): Correctly test branch range. Previous
+ wrong test was -0x3ffff to +0x40000.
+
+ * elf-hppa.h (elf_hppa_final_link_relocate): R_PARISC_DIR17R,
+ R_PARISC_DIR17F, and R_PARISC_DIR21L are for absolute branches;
+ Handle them as such.
+ (elf_hppa_relocate_insn): Fix a typo.
+
+ * libhppa.h (GET_FIELD, GET_BIT, MASK, CATENATE, ELEVEN): Delete.
+ (assemble_3, assemble_6, assemble_12, assemble_16, assemble_16a,
+ assemble_17, assemble_21): Delete.
+ Supply defines for all 64 possible opcodes.
+ (bfd_hppa_insn2fmt): Add bfd argument, and use to select wide mode
+ formats. Handle COMICLR.
+ (hppa_rebuild_insn): Delete bfd argument. Handle formats 10, -11,
+ -10, -16, 16, 22.
+
+ * elf32-hppa.c (hppa_elf_relocate_insn): Complete rewrite.
+ (elf32_hppa_bfd_final_link_relocate): Major rewrite.
+ (elf32_hppa_build_one_stub): Modify hppa_elf_relocate_insn calls
+ to suit.
+ (elf32_hppa_size_stubs): Don't free stub_name twice. Read in all
+ the local syms - did this code get deleted accidentally? Ignore
+ undefined and undefweak syms.
+
+ * elf-hppa.h (elf_hppa_final_link): Move hppa_info to outermost
+ block. Use it instead of elf64_hppa_hash_table (info).
+ (elf_hppa_final_link_relocate): Use hppa_info instead of
+ elf64_hppa_hash_table (info).
+
+ * libhppa.h (re_assemble_3, re_assemble_12, re_assemble_16,
+ re_assemble_17, re_assemble_21, re_assemble_22): Don't mask insn.
+ (hppa_rebuild_insn): Mask immediate bits here instead.
+ * elf-hppa.h (elf_hppa_relocate_insn): Mask here too.
+
+2000-07-08 Alan Modra <alan@linuxcare.com.au>
+
+ * section.c (struct sec): Add id field. Tidy comment formatting.
+ (bfd_make_section_anyway): Set id.
+ (STD_SECTION): Init id too.
+ Change CONST to const throughout.
+ * archures.c (bfd_arch_info): Tidy comment.
+ (bfd_arch_list): Change a CONST to const.
+ * libbfd-in.h: Tidy comments and replace CONST with const.
+ * elf-bfd.h: Likewise.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+ * libcoff.h: Regenerate.
+
+2000-07-07 DJ Delorie <dj@redhat.com>
+
+ * archive.c (_bfd_write_archive_contents): Add an informative
+ comment.
+
+2000-07-06 Kazu Hirata <kazu@hxi.com>
+
+ * srec.c: Fix formatting.
+
+2000-06-05 DJ Delorie <dj@redhat.com>
+
+ * MAINTAINERS: new
+
+2000-07-04 Alexandre Oliva <aoliva@redhat.com>
+
+ * coff-arm.c (coff_arm_relocate_section): Do not ignore the symbol
+ value of PC-relative offsets.
+
+2000-07-03 Jim Wilson <wilson@cygnus.com>
+
+ * elf64-alpha.c (alpha_elf_size_info): New.
+ (elf_backend_size_info): Define to alpha_elf_size_info.
+ * elfcode.h (elf_size_info): Change hash bucket size to 4.
+
+2000-07-03 Ulf Carlsson <ulfc@engr.sgi.com>
+
+ * elf32-mips.c: Include elf32-target.h again for the traditional
+ MIPS targets.
+
+2000-07-03 Marek Michalkiewicz <marekm@linux.org.pl>
+
+ * elf32-avr.c (bfd_elf32_bfd_reloc_type_lookup):
+ Add ATTRIBUTE_UNUSED to unused arguments to avoid warnings.
+ (avr_info_to_howto_rela): Likewise.
+ (elf32_avr_gc_mark_hook): Likewise.
+ (elf32_avr_gc_sweep_hook): Likewise.
+ (elf32_avr_relocate_section): Likewise.
+
+2000-07-03 Mark Elbrecht <snowball3@bigfoot.com>
+
+ * cofflink.c (_bfd_coff_write_global_sym): Turn a weak symbol into
+ an external symbol for a non-shared, non-relocatable link.
+
+2000-07-03 Nick Clifton <nickc@redhat.com>
+
+ * cofflink.c (IS_EXTERNAL): New macro: Return true if the symbol
+ is an external symbol.
+ (IS_WEAK_EXTERNAL): New macro: Return true if the symbol is a weak
+ external symbol.
+
+2000-07-03 Kazu Hirata <kazu@hxi.com>
+
+ * reloc16.c: Fix formatting.
+
+2000-07-01 Koundinya K <kk@ddeorg.soft.net>
+
+ * config.bfd: Change targ_defvec and targ_selvecs for mips*-*-sysv4*
+ to add a new target for traditional mips i.e
+ bfd_elf32_tradbigmips_vec and bfd_elf32_tradlittlemips_vec.
+ * configure.in: Likewise.
+ * configure: Rebuild.
+ * targets.c (bfd_elf32_tradbigmips_vec): Declare and put in
+ bfd_target_vector.
+ (bfd_elf32_tradlittlemips_vec): Likewise.
+ * elfxx-target.h: Add macro INCLUDED_TARGET_FILE which is more a test
+ to see that elfNN_bed does not get redefined even if the target file
+ is included twice for a chip. See elf32-mips.c.
+
+2000-07-01 Alan Modra <alan@linuxcare.com.au>
+
+ * Makefile.am (DEP): Fix 2000-06-22. grep after running dep.sed
+ (CLEANFILES): Add DEPA.
+ * Makefile.in: Regenerate.
+
+2000-06-30 DJ Delorie <dj@cygnus.com>
+
+ * peicode.h (coff_swap_filehdr_in): can't use e_magic because we
+ can't assume the PE header is at 0x80.
+
+2000-06-29 Mark Elbrecht <snowball3@bigfoot.com>
+
+ * syms.c (_bfd_stab_section_find_nearest_line): Use IS_ABSOLUTE_PATH.
+
+2000-06-28 Mark Elbrecht <snowball3@bigfoot.com>
+
+ * go32stub.h: Update stub.
+
+2000-06-26 Marek Michalkiewicz <marekm@linux.org.pl>
+
+ * archures.c (bfd_mach_avr5): Define.
+ * bfd-in2.h (bfd_mach_avr5): Define.
+ * cpu-avr.c (arch_info_struct): Rename bfd_mach_avr4 to
+ bfd_mach_avr5, add bfd_mach_avr4. Update comments.
+ (compatible): Update comment. Add missing test.
+ * elf32-avr.c (avr_final_link_relocate): Support 8K wrap
+ for avr2 and avr4. Simplify 8K wrap code.
+ (bfd_elf_avr_final_write_processing): Recognize bfd_mach_avr5.
+ (elf32_avr_object_p): Recognize E_AVR_MACH_AVR5.
+
+2000-06-26 Kazu Hirata <kazu@hxi.com>
+
+ * coff-h8300.c: Fix formatting.
+ * cpu-h8300.c: Likewise.
+
+2000-06-24 Alexandre Oliva <aoliva@redhat.com>
+
+ * elf32-arm.h (elf32_arm_final_link_relocate): Print `(local)'
+ for local symbols whose names are unknown.
+
+2000-06-22 Alan Modra <alan@linuxcare.com.au>
+
+ * Makefile.am (DEP): grep for leading `/' in DEP1, and fail if we
+ find one.
+ * Makefile.in: Regenerate.
+ * doc/Makefile.in: Regenerate.
+
+2000-06-20 H.J. Lu <hjl@gnu.org>
+
+ * Makefile.am: Rebuild dependency.
+ * Makefile.in: Rebuild.
+
+2000-06-20 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
+
+ * elf32-mips.c (_bfd_mips_elf_copy_indirect_symbol): New function.
+ (elf_backend_copy_indirect_symbol): Map to the new function.
+
+2000-06-20 Alan Modra <alan@linuxcare.com.au>
+
+ * archive.c (normalize): Correct pointer comparison when checking
+ for backslashes.
+ (bfd_bsd_truncate_arname): Likewise.
+ (bfd_gnu_truncate_arname): Likewise.
+
+2000-06-20 Ulf Carlsson <ulfc@engr.sgi.com>
+
+ * elf-bfd.h (struct elf_obj_tdata): Define per BFD Irix 5 virtual
+ sections elf_{text,data}_{section,symbol}.
+ * elf32-mips.c: mips_elf_{text,data}_{section,symbol}{,_ptr}: Remove.
+ (_bfd_mips_elf_hide_symbol): New function.
+ (elf_backend_hide_symbol): Map to the new function.
+ (_bfd_mips_elf_add_symbol_hook): Change to use new per BFD
+ definitions of mips_elf_{text,data}_{section,symbol}.
+ (mips_elf_local_relocation_p): Try to find the direct symbol
+ based on new check_forced argument.
+ (mips_elf_calculate_relocation): Use new version of
+ mips_elf_local_relocation_p.
+ (mips_elf_relocate_section): Likewise.
+ (_bfd_mips_elf_relocate_section): Likewise.
+ (mips_elf_sort_hash_table): Only assert that have enough GOT
+ space.
+ (mips_elf_got16_entry): Match all 32 bits to the existing GOT
+ entry if the relocation based on the new external argument.
+ (mips_elf_create_dynamic_relocation): Assert that we have a
+ section contents allocated where we can swap out the dynamic
+ relocations.
+ (mips_elf_calculate_relocation): Find the real hash-table entry
+ correctly by using h->root.root.type. Only create a dynamic
+ relocation entry if the symbol is defined in a shared library.
+ Create an external GOT entry for the GOT16 relocation if the
+ symbol was forced local.
+ (_bfd_mips_elf_finish_dynamic_symbol): Don't assert there is a
+ dynamic index if the symbol was forced local.
+
+2000-06-20 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
+
+ * elf32-mips.c: Fix typos in comments.
+
+2000-06-19 Mark Kettenis <kettenis@gnu.org>
+
+ * rs6000-core.c: Wrap definition of `union VmInfo' within #ifdef
+ CORE_VERSION_1.
+
+2000-06-18 Stephane Carrez <stcarrez@worldnet.fr>
+
+ * Makefile.in, bfd-in2.h, libbfd.h, configure: Rebuild.
+ * Makefile.am (ALL_MACHINES, ALL_MACHINES_CFILES, BFD32_BACKENDS,
+ BFD32_BACKENDS_CFILES): Add 68hc12, 68hc11 files.
+ * configure.in (bfd_elf32_m68hc12_vec): Recognize.
+ (bfd_elf32_m68hc11_vec): Likewise.
+ * config.bfd (targ_cpu): Recognize 68hc12 and 68hc11.
+ Supports 68hc11 & 68hc12 at the same time.
+ * targets.c (bfd_elf32_m68hc12_vec): Declare and put in
+ bfd_target_vector.
+ (bfd_elf32_m68hc11_vec): Likewise.
+ * elf.c (prep_headers): Recognize bfd_arch_m68hc12 and 68hc11.
+ * archures.c (bfd_m68hc12_arch): Define and register in global list
+ (bfd_m68hc11_arch): Likewise.
+ * reloc.c (BFD_RELOC_M68HC11_HI8, BFD_RELOC_M68HC11_LO8,
+ BFD_RELOC_M68HC11_3B): Define.
+ * cpu-m68hc12.c, elf32-m68hc12.c: New files for 68hc12 support.
+ * cpu-m68hc11.c, elf32-m68hc11.c: New files for 68hc11 support.
+
+2000-06-18 Ulf Carlsson <ulfc@engr.sgi.com>
+
+ * elf_bfd.h (struct elf_backend_data): Add info argument to
+ elf_backend_hide_symbol.
+ (_bfd_elf_link_hash_hide_symbol): Likewise.
+ * elf.c (_bfd_elf_link_hash_hide_symbol): Likewise.
+ * elf64-ia64.c (elf64_ia64_hash_hide_symbol): Likewise.
+ * elflink.h (elf_link_add_object_symbols): Likewise.
+ (elf_link_assign_sym_version): Likewise.
+
+2000-06-18 H.J. Lu <hjl@gnu.org>
+
+ * coff-i386.c (coff_i386_reloc): Don't return in case of
+ output_bfd == (bfd *) NULL if COFF_WITH_PE is defined.
+ Compensate PE relocations when linking with non-PE object
+ files to generate a non-PE executable.
+
+2000-06-17 Ulf Carlsson <ulfc@engr.sgi.com>
+
+ * elf32-mips.c (mips_elf_calculate_relocation): Explicitly write
+ GOT entries if we're doing a static link or -Bsymbolic link.
+
+2000-06-15 Ulf Carlsson <ulfc@engr.sgi.com>
+
+ * elflink.h (elf_link_adjust_relocs): Check for and call backend
+ specifific swap_reloc_{in,out} and swap_reloca_{in,out} if
+ available.
+ (elf_link_output_relocs): Likewise.
+ (elf_reloc_link_order): Likewise.
+
+2000-06-16 Nicholas Duffek <nsd@redhat.com>
+
+ * archures.c (enum bfd_architecture): #define constants for
+ PowerPc and RS6000 machine numbers.
+ * bfd-in2.h: Regenerate.
+ * coffcode.h (coff_set_arch_mach_hook): #ifdef XCOFF64, set arch
+ to bfd_arch_powerpc instead of bfd_arch_rs6000. Refer to PowerPc
+ and RS6000 machine numbers using #defined constants from
+ archures.c.
+ * cpu-powerpc.c (arch_info_struct): Refer to PowerPc and RS6000
+ machine numbers using #defined constants from archures.c. Add
+ entries for EC603e, 630, A35, RS64II, RS64III, 7400. Specify
+ 64-bit words in 620 entry.
+ * cpu-rs6000.c (arch_info_struct): Create with entries for RS1,
+ RSC, and RS2.
+ (bfd_rs6000_arch): Change default machine to 0 (bfd_mach_rs6k).
+
+2000-06-16 Nicholas Duffek <nsd@cygnus.com>
+
+ * coffcode.h (coff_mkobject_hook): Set xcoff_tdata.xcoff64.
+ * libcoff-in.h (struct xcoff_tdata): Define xcoff64 field.
+ * libcoff.h (struct xcoff_tdata): Define xcoff64 field.
+
+2000-06-16 Nicholas Duffek <nsd@redhat.com>
+
+ * bfd-in.h (bfd_family_coff): Define.
+ * bfd-in2.h: Regenerate.
+ * coffgen.c (coff_count_linenumbers, coff_symbol_from,
+ coff_find_nearest_line): Check COFFness using bfd_family_coff()
+ instead of bfd_target_coff_flavour.
+ * cofflink.c (_bfd_coff_final_link): Likewise.
+ * cpu-ns32k.c (do_ns32k_reloc): Don't strcmp() target name to
+ exclude XCOFF files.
+ * reloc.c (bfd_perform_relocation, bfd_install_relocation):
+ Likewise.
+ * targets.c (enum bfd_flavour): Add bfd_target_xcoff_flavour.
+ * xcoff-target.h (TARGET_SYM): Use bfd_target_xcoff_flavour.
+ * xcofflink.c (XCOFF_XVECP): Delete.
+ (bfd_xcoff_link_record_set, bfd_xcoff_import_symbol,
+ bfd_xcoff_export_symbol, bfd_xcoff_link_count_reloc,
+ bfd_xcoff_record_link_assignment,
+ bfd_xcoff_size_dynamic_sections): Replace XCOFF_XVECP() with
+ check for bfd_target_xcoff_flavour.
+
+2000-06-16 Nicholas Duffek <nsd@redhat.com>
+
+ * rs6000-core.c: Support 64-bit core files, support pre-4.3 core
+ files on AIX 4.3.
+ (read_hdr): New function.
+ (rs6000coff_core_p): Store mstsave or __context64 struct instead
+ of trying to extract individual registers. Set abfd->arch_info
+ to match the architecture that created the core file.
+ (rs6000coff_get_section_contents): Delete.
+ * xcoff-target.h (rs6000coff_get_section_contents): Delete.
+
+2000-06-14 H.J. Lu <hjl@gnu.org>
+
+ * vms-misc.c (_bfd_vms_next_record): Return -1 if PRIV(vms_rec)
+ is NULL.
+
+2000-06-13 H.J. Lu <hjl@gnu.org>
+
+ * configure: Regenerate.
+
+2000-06-13 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ * peicode.h (pe_ILF_object_p): Use TARGET_LITTLE_SYM instead of
+ armpei_little_vec.
+
+2000-06-08 David O'Brien <obrien@FreeBSD.org>
+
+ * configure.in (VERSION): Update to show this is the CVS mainline.
+
+2000-06-07 Alan Modra <alan@linuxcare.com.au>
+
+ * elf32-d10v.c: Include elf/d10v.h
+ (enum reloc_type): Delete.
+ * elf32-d30v.c: Include elf/d30v.h
+ (enum reloc_type): Delete.
+
+ * Makefile.am: Run "make dep-am" to regenerate dependencies.
+ * Makefile.in: Regenerate.
+
+ * elf32-i386.c (elf_howto_table): Remove EMPTY_HOWTOs.
+ (elf32_i386_vtinherit_howto, elf32_i386_vtentry_howto): Delete and
+ move HOWTOs into elf_howto_table.
+ (R_386_standard, R_386_ext_offset): Define.
+ (R_386_ext, R_386_vt_offset, R_386_vt): Define.
+ (elf_i386_reloc_type_lookup): Modify calculation of index into
+ elf_howto_table since we've removed the padding.
+ (elf_i386_info_to_howto_rel): Likewise.
+ (elf_i386_relocate_section): Likewise.
+
+2000-06-06 Michael Snyder <msnyder@seadog.cygnus.com>
+
+ * elf.c (elf_grok_pr_status): Eliminate reference to prgregset_t.
+
+2000-06-05 H.J. Lu <hjl@gnu.org>
+
+ * elflink.c (_bfd_elf_link_record_dynamic_symbol): Don't flag
+ an error when seeing an undefined symbol with hidden/internal
+ attribute. It is handled in *_relocate_section ().
+
+2000-06-05 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_fix_symbol_flags): Follow the link for the
+ indirect symbol for the ELF_LINK_NON_ELF bit.
+ (elf_link_output_extsym): Don't output the indirect symbol even
+ if the ELF_LINK_NON_ELF bit is set.
+
+2000-06-01 J.T. Conklin <jtc@redback.com>
+
+ * config.bfd (i[3456]86-*-netbsdelf*): New target.
+ (i[3456]86-*-netbsdaout*): New target.
+ (i[3456]86-*-netbsd*): Add bfd_elf32_i386_vec to targ_selvecs.
+ (i[3456]86-*-openbsd*): Likewise.
+
+2000-05-30 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * trad-core.c: From hpux-core.c, include <dirent.h> or
+ <sys/ndir.h> when possible.
+
+2000-05-31 Ulrich Drepper <drepper@redhat.com>
+
+ * elf.c (_bfd_elf_slurp_version_tables): Correct reading of version
+ definitions. We must not assume they are sorted in the file
+ according to their index numbers.
+
+2000-05-31 Alan Modra <alan@linuxcare.com.au>
+
+ * elf-hppa.h: (elf_hppa_final_link_relocate): Use e_rsel field
+ selector for R_PARISC_PCREL17R. R_PARISC_DIR17R and
+ R_PARISC_DIR17F are for absolute branches; Handle them as such.
+
+2000-05-30 Nick Clifton <nickc@cygnus.com>
+
+ * cpu-i960.c (scan_960_mach): Accept 80960KA, 80960KB,
+ 80960CA, 80960MC as valid machine names.
+
+2000-05-30 H.J. Lu <hjl@gnu.org>
+
+ * elflink.c (_bfd_elf_link_record_dynamic_symbol): Clear the
+ visibility bits if the symbol is undefined. Correctly handle
+ weak undefined symbols with hidden and internal attributes.
+
+ * elflink.h (elf_link_add_object_symbols): Always turn the
+ symbol into local if it has the hidden or internal attribute.
+
+2000-05-29 Philip Blundell <philb@gnu.org>
+
+ * ppcboot.c: Add packed attribute if compiling with GCC.
+
+2000-05-29 Anatoly Vorobey <mellon@pobox.com>
+
+ * elf.c (_bfd_elf_link_hash_table_init): Initialize dynlocal.
+
+2000-05-26 Michael Snyder <msnyder@seadog.cygnus.com>
+
+ * elf.c (elfcore_grok_prstatus, elfcore_grok_pstatus,
+ elfcore_grok_psinfo): Add code to allow debugging a 32-bit
+ corefile on a 64-bit (Sparc Solaris) host. Also clean up
+ a few old comments.
+
+2000-05-26 Alan Modra <alan@linuxcare.com.au>
+
+ * Makefile.am: Update dependencies with "make dep-am"
+ * Makefile.in: Regenerate.
+
+ * sysdep.h (gettext, dgettext, dcgettext, textdomain,
+ bindtextdomain): Replace defines with those from intl/libgettext.h
+ to quieten gcc warnings.
+
+2000-05-26 Eli Zaretskii <eliz@is.elta.co.il>
+
+ * aoutx.h (find_nearest_line): Use IS_ABSOLUTE_PATH.
+
+ * archive.c (normalize, bfd_bsd_truncate_arname,
+ bfd_gnu_truncate_arname) [HAVE_DOS_BASED_FILE_SYSTEM]: Support
+ file names with backslashes.
+
+ * cache.c (bfd_open_file) [__MSDOS__]: Don't unlink the file
+ before opening it.
+
+ * sysdep.h: Include filenames.h.
+
+2000-05-26 Alan Modra <alan@linuxcare.com.au>
+
+ * opncls.c (bfd_close_all_done): Mask file perms with 0777 not 0x777.
+
+2000-05-26 Jakub Jelinek <jakub@redhat.com>
+
+ * elf64-sparc.c (sparc64_elf_relax_section): New.
+ (sparc64_elf_relocate_section): Optimize tail call into branch always
+ if possible.
+ * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+ (elf32_sparc_relax_section): New.
+
+2000-05-26 Jakub Jelinek <jakub@redhat.com>
+
+ * elf64-sparc.c: Add ATTRIBUTE_UNUSED to unused function parameters.
+ Remove unusued variables.
+ (sparc64_elf_relocate_section): Change r_symndx type to unsigned long.
+ (sparc64_elf_merge_private_bfd_data): Fix shared library case from
+ previous fix, so that shared libs really don't influence targets
+ extension mask and memory model.
+
+2000-05-23 H.J. Lu <hjl@gnu.org>
+
+ * elf64-alpha.c (elf64_alpha_relocate_section): Check
+ h->root.other not h->other.
+ * elf32-mips.c (mips_elf_calculate_relocation): Likewise.
+
+ * elf32-ppc.c (ppc_elf_relocate_section): Fix a typo.
+
+2000-05-23 H.J. Lu <hjl@gnu.org>
+
+ * elf32-i386.c (elf_i386_relocate_section): Don't allow the
+ undefined symbol with the non-default visibility attributes.
+ * elf-hppa.h (elf_hppa_relocate_section): Likewise.
+ * elf32-arm.h (elf32_arm_relocate_section): Likewise.
+ * elf32-i370.c (i370_elf_relocate_section): Likewise.
+ * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+ * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
+ * elf32-mips.c (mips_elf_calculate_relocation): Likewise.
+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+ * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
+ * elf64-ia64.c (elf64_ia64_relocate_section): Likewise.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+
+2000-05-22 Richard Henderson <rth@cygnus.com>
+
+ * elf64-ia64.c (ia64_howto_table): Add PCREL60B, PCREL21BI,
+ PCREL22, PCREL64I. Zero size of special relocs.
+ (elf64_ia64_reloc_type_lookup): Likewise.
+ (USE_BRL, oor_brl, oor_ip): New.
+ (elf64_ia64_relax_section): New.
+ (elf64_ia64_check_relocs): Handle PCREL60B, PCREL22, PCREL64I.
+ (elf64_ia64_install_value): Likewise, plus PCREL21BI.
+ (elf64_ia64_relocate_section): Likewise.
+ (bfd_elf64_bfd_relax_section): New.
+ * reloc.c (BFD_RELOC_IA64_PCREL21BI): New.
+ (BFD_RELOC_IA64_{PCREL22,PCREL60B,PCREL64I}): New.
+ * bfd-in2.h, libbfd.h: Regenerate.
+
+2000-05-22 Nick Clifton <nickc@cygnus.com>
+
+ * configure.in : Add peigen.lo to MIPS PE targets.
+ * configure: Regenerate.
+
+2000-05-22 Momchil Velikov <velco@fadata.bg>
+
+ * libbfd.c (_bfd_generic_verify_endian_match): Compare endianess
+ only if it is known for both input and output bfds. Separate
+ error message strings as in some languages, it may be necessary
+ to change more than one place in the string to change between
+ 'big' and 'little'.
+
+ * elf32-ppc.c (ppc_elf_merge_private_bfd_data): Remove inline
+ endianess checks, call _bfd_generic_verify_endian_match() instead.
+
+ * elf32-mips.c (_bfd_mips_elf_merge_private_bfd_data): Likewise.
+
+ * elf32-mcore.c (mcore_elf_merge_private_bfd_data): Likewise.
+
+ * elf32-arm.h (elf32_arm_merge_private_bfd_data): Likewise. Verify
+ endianess before checking bfd flavours.
+
+2000-05-22 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_link_output_extsym): Clear the visibility
+ field for symbols not defined locally.
+
+2000-05-18 Alan Modra <alan@linuxcare.com.au>
+
+ * libhppa.h (re_assemble_3, re_assemble_12, re_assemble_16,
+ re_assemble_17, re_assemble_21, re_assemble_22): Don't mask insn.
+ (hppa_rebuild_insn): Mask immediate bits here instead.
+ * elf-hppa.h (elf_hppa_relocate_insn): Mask here too.
+
+2000-05-18 Momchil Velikov <velco@fadata.bg>
+
+ * elflink.h (elf_bfd_final_link, elf_link_input_bfd): When emiting
+ relocs for an executable, ensure that they are virtual addresses.
+
+2000-05-18 Jeffrey A Law (law@cygnus.com)
+
+ * config.bfd (hppa*64*-*-hpux11*): New target triplet.
+
+2000-05-17 S. Bharadwaj Yadavalli <sby@scrugs.lkg.dec.com>
+ Rick Gorton <gorton@scrugs.lkg.dec.com>
+
+ * elflink.h: Add emitrelocations support: when enabled, relocation
+ information and relocation sections are put into final output
+ executables. If the emitrelocations flag is set, do the following:
+ (elf_bfd_final_link): Emit relocation sections.
+ (elf_link_input_bfd): Compute relocation section contents.
+ (elf_gc_sections): Don't clean relocation sections.
+
+2000-05-16 Catherine Moore <clm@cygnus.com>
+
+ * som.c (som_decode_symclass): Recognize weak symbols.
+
+2000-05-16 Szabolcs Szakacsits <szaka@F-Secure.com>
+
+ * peigen.c (pe_print_idata): Undo part of 2000-05-12 change that
+ read idata section only from dataoff.
+ (pe_print_edata): Correctly check for valid eat_member.
+
+2000-05-16 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ * elf32-sh.c (sh_elf_relax_delete_bytes): Handle R_SH_SWITCH8.
+
+2000-05-14 Philip Blundell <philb@gnu.org>
+
+ * config.bfd (armeb-*-elf, arm*b-*-linux-gnu*): New targets.
+
+2000-05-12 Alan Modra <alan@linuxcare.com.au>
+
+ * targets.c (bfd_target_vector): #ifdef BFD64 rs6000coff64_vec
+
+ * peigen.c (pe_print_idata): Look for .idata section and print
+ info even if data directory has zero entries. Read idata section
+ starting from dataoff, and adjust all data offsets to suit. Cast
+ all bfd_vma vars to unsigned long before passing to fprintf.
+ * peigen.c (pe_print_edata): Similarly, look for .edata section
+ and print info even if data directory has zero entries. Cast
+ all bfd_vma vars to unsigned long before passing to fprintf.
+
+ From Szabolcs Szakacsits <szaka@F-Secure.com>
+ * peigen.c (pe_print_idata): Use bfd_section_size rather than data
+ directory size which may be bogus.
+ * peigen.c (pe_print_edata): Similarly.
+
+2000-05-09 Alan Modra <alan@linuxcare.com.au>
+
+ * elf.c (bfd_section_from_shdr): Don't set use_rela_p if rela
+ section is empty.
+ (copy_private_bfd_data): Allow for space possibly taken up by elf
+ headers when calculating segment physical address from lma.
+
+2000-05-08 Alan Modra <alan@linuxcare.com.au>
+
+ * versados.c (versados_scan): Init stringlen and pass_2_done.
+
+ * trad-core.c (trad_unix_core_file_p): Return
+ bfd_error_wrong_format rather than bfd_error_file_truncated.
+
+ * peigen.c (_bfd_pei_swap_aouthdr_out): Pass ImageBase to
+ add_data_entry. DataDirectory virtual address is relative.
+ (pe_print_idata): Account for relative DataDirectory virtual
+ addresses. Don't trash datasize inside POWERPC_LE_PE code.
+ (pe_print_edata): Similarly.
+
+ From Szabolcs Szakacsits <szaka@F-Secure.com>
+ * peigen.c (dir_names): Add Delay Import Directory.
+ (pe_print_idata): Always search for bfd section containing
+ idata address rather than looking up section name. Print this
+ section name rather than .idata.
+ (pe_print_edata): Similarly. Also print some fields as %08lx.
+ (_bfd_pe_print_private_bfd_data_common): Print Reserved1 field as
+ Win32Version.
+
+2000-05-05 Clinton Popetz <cpopetz@cygnus.com>
+
+ * xcoff.h: Rename to xcoff-target.h
+ * Makefile.am: Change all instances of xcoff.h to xcoff-target.h
+ * coff-rs6000.c: Ditto.
+ * coff64-rs6000.c: Ditto.
+ * coff-pmac.c: Ditto.
+ * Makefile.in: Regenerate.
+
+2000-05-05 Clinton Popetz <cpopetz@cygnus.com>
+
+ * coffcode.h (coff_set_arch_mach_hook, coff_set_flags):
+ Change U802TOC64MAGIC to U803XTOCMAGIC.
+
+2000-05-04 Michael Snyder <msnyder@seadog.cygnus.com>
+
+ * elf.c (bfd_elf_get_arch_size): New function, return 32 | 64 | -1.
+ * bfd-in.h: Prototype bfd_elf_get_arch_size.
+ * bfd-in2.h: Prototype bfd_elf_get_arch_size.
+
+2000-05-04 Alan Modra <alan@linuxcare.com.au>
+
+ * libhppa.h (HPPA_R_CONSTANT): Cast argument to bfd_signed_vma.
+
+2000-05-03 Martin v. Löwis <loewis@informatik.hu-berlin.de>
+
+ * elflink.h (elf_link_add_object_symbols): Reset dynindx for
+ hidden and internal symbols.
+ (elf_fix_symbol_flags): Clear NEEDS_PLT for symbols with
+ visibility.
+ * elflink.c (_bfd_elf_link_record_dynamic_symbol): Do not
+ assign a PLT or GOT entry to symbols with hidden and
+ internal visibility.
+
+2000-05-03 Mark Elbrecht <snowball3@bigfoot.com>
+
+ * coff-go32.c (COFF_SECTION_ALIGNMENT_ENTRIES): Add entry for
+ the .bss section.
+ * coff-stgo32.c (COFF_SECTION_ALIGNMENT_ENTRIES): Likewise.
+
+2000-05-02 H.J. Lu <hjl@gnu.org>
+
+ * elf.c (prep_headers): Use ELFOSABI_NONE instead of
+ ELFOSABI_SYSV.
+
+2000-05-02 Alan Modra <alan@linuxcare.com.au>
+
+ * targets.c (bfd_target_vector): Restore bfd_elf32_hppa_vec.
+ * Makefile.am (BFD32_BACKENDS): Restore elf32-hppa.lo. Regenerate
+ dependencies.
+ * Makefile.in: Regenerate.
+
+2000-05-01 Jim Wilson <wilson@cygnus.com>
+
+ * Makefile.am (BFD32_BACKENDS): Add efi-app-ia32.lo.
+ (BFD32_BACKENDS_CFILES): Add efi-app-ia32.c.
+ (BFD64_BACKENDS): Delete coff-ia64.lo. Add efi-app-ia64.lo.
+ (BFD64_BACKENDS_CFILES): Delete coff-ia64.c. Add efi-app-ia64.c.
+ * Makefile.in: Rebuild.
+
+2000-05-02 Alan Modra <alan@linuxcare.com.au>
+
+ * config.bfd: Re-enable elf32-hppa. It now compiles, even if it
+ doesn't work very well.
+
+ * elf-hppa.h (elf_hppa_internal_shdr): Define.
+ (elf_hppa_fake_sections): hdr is elf_hppa_internal_shdr.
+ Set hdr->s_type to 1 if ARCH_SIZE == 32.
+ (_bfd_elf_hppa_gen_reloc_type): Add prototype.
+ (elf_hppa_info_to_howto): Likewise.
+ (elf_hppa_info_to_howto_rel): Likewise.
+ (elf_hppa_reloc_type_lookup): Likewise.
+ (elf_hppa_is_local_label_name): Likewise.
+ (elf_hppa_fake_sections): Likewise.
+ (elf_hppa_final_write_processing): Likewise.
+ (elf_hppa_howto_table): Fully initialise all entries.
+ (_bfd_elf_hppa_gen_reloc_type): Add ATTRIBUTE_UNUSED to args.
+ (elf_hppa_info_to_howto): Likewise.
+ (elf_hppa_info_to_howto_rel): Likewise.
+ (elf_hppa_reloc_type_lookup): Likewise.
+ (elf_hppa_final_write_processing, elf_hppa_add_symbol_hook,
+ elf_hppa_unmark_useless_dynamic_symbols,
+ elf_hppa_remark_useless_dynamic_symbols,
+ elf_hppa_record_segment_addrs, elf_hppa_final_link,
+ elf_hppa_relocate_section, elf_hppa_final_link_relocate,
+ elf_hppa_relocate_insn): Compile only if ARCH_SIZE == 64 until
+ elf32-hppa.c mess is cleaned up.
+ (elf_hppa_final_link_relocate): Make insn and r_type unsigned
+ int. Delete r_field. In case R_PARISC_PCREL21L, don't set
+ r_field then call hppa_field_adjust inline func with variable
+ r_field arg, instead call hppa_field_adjust with fixed arg.
+ In case R_PARISC_PCREL22F, don't set r_field.
+ (elf_hppa_relocate_insn): Change args and return type to unsigned
+ int. Call re_assemble_* funcs to do the work.
+
+ * elf32-hppa.c (hppa_elf_relocate_insn): Don't assume 32 bit when
+ sign extending.
+
+ * libhppa.h (HPPA_R_CONSTANT): Don't assume 32 bit when sign
+ extending.
+ (sign_extend): Mask first before sign extending.
+ (low_sign_extend): Rewrite without condition expression.
+ (ones, dis_assemble_3, dis_assemble_12, dis_assemble_16,
+ dis_assemble_17, dis_assemble_21, dis_assemble_22): Delete.
+ (assemble_3, assemble_6, assemble_12, assemble_16, assemble_16a,
+ assemble_17, assemble_21, sign_unext, low_sign_unext): Return
+ result as function return value rather than through pointer arg.
+ Accept unsigned int args, and return unsigned int.
+ (re_assemble_3): New. Combines function of dis_assemble_3 with
+ re-assembly of opcode and immediate.
+ (re_assemble_12): Likewise.
+ (re_assemble_16): Likewise.
+ (re_assemble_17): Likewise.
+ (re_assemble_21): Likewise.
+ (re_assemble_22): Likewise.
+ (hppa_field_adjust): Rewrite and document, paying attention to
+ size of types and signed/unsigned issues.
+ (get_opcode): Shift before masking.
+ (FDLW): Rename to FLDW.
+ (bfd_hppa_insn2fmt): Change arg to unsigned int. Delete fmt.
+ (hppa_rebuild_insn): Change args and return value to unsigned
+ int. Make use of re_assemble_*. Correct case 11.
+
+ * dep-in.sed: Handle ../opcodes/.
+ * Makefile.am (SOURCE_HFILES): Add elf-hppa.h, elf32-hppa.h,
+ elf64-hppa.h, hppa_stubs.h, xcoff.h.
+ (BFD32_BACKENDS_CFILES): Restore elf32-hppa.c.
+ Remove elf64-hppa.lo, cpu-ia64.lo, elf64-ia64.lo, elfarm-oabi.lo,
+ elfarm-nabi.lo dependencies outside of auto-dependency area.
+ Regenerate dependencies.
+ * Makefile.in: Regenerate.
+
+ * configure.in (TRAD_HEADER): Test non-null before
+ AC_DEFINE_UNQUOTED.
+ * configure: Regenerate.
+
+ * reloc.c: Fix mis-spelling in comment.
+
+2000-05-01 Alan Modra <alan@linuxcare.com.au>
+
+ * coff-sh.c (bfd_coff_small_swap_table): Fix Fri Apr 28 change.
+ * vms.c (vms_openr_next_archived_file): Return NULL.
+
+2000-04-28 Clinton Popetz <cpopetz@cygnus.com>
+
+ * coffcode.h Copy changes mistakenly done to libcoff.h in
+ 4/24/2000 patch.
+
+2000-04-29 Andreas Jaeger <aj@suse.de>
+
+ * libbfd-in.h: Correctly check GCC version.
+ * bfd-in.h: Likewise.
+ * libhppa.h: Likewise.
+ * libbfd.h: Regenerate.
+ * bfd-in2.h: Regenerate.
+
+2000-04-28 Clinton Popetz <cpopetz@cygnus.com>
+
+ * Makefile.am (BFD64_BACKENDS, BFD64_BACKENDS_CFILES): Add
+ coffdu-rs6000.{lo,c}.
+ (coff-pmac.lo, coff-rs6000.lo, coff64-rs6000.lo): Add dependency
+ on xcoff.h
+ * Makefile.in: Regenerate.
+ * xcoff.h: New file.
+ * coff-pmac.c: Use xcoff.h instead of coff-rs6000.c.
+ * coff-rs6000.c: Move all declarations and defines that are
+ common to the xcoff backends into xcoff.h
+ * coff64-rs6000.c: Ditto,
+
+2000-04-28 Clinton Popetz <cpopetz@cygnus.com>
+
+ * coff-mips.c (mips_ecoff_backend_data): Add initialization of
+ _bfd_coff_force_symnames in strings and
+ _bfd_coff_debug_string_prefix_length to their default values.
+ * coff-sh.c: (bfd_coff_small_swap_table): Ditto.
+
+2000-04-28 Clinton Popetz <cpopetz@cygnus.com>
+
+ * coff-alpha.c (alpha_ecoff_backend_data): Add initialization of
+ _bfd_coff_force_symnames in strings and
+ _bfd_coff_debug_string_prefix_length to their default values.
+
+2000-04-27 Alan Modra <alan@linuxcare.com.au>
+
+ * elf32-m68k.c (elf_m68k_gc_sweep_hook): Return if dynobj NULL.
+ Check local_got_refcounts before dereferencing.
+
+ * elf32-ppc.c (ppc_elf_relocate_section): Check splt != NULL
+ before deciding we don't need R_PPC_PLT32 relocation.
+ (ppc_elf_gc_sweep_hook): Check local_got_refcounts before
+ dereferencing.
+
+ * elflink.h (elf_gc_common_finalize_got_offsets): Fix comment.
+
+ * elf32-i386.c (elf_i386_check_relocs): Reference count .got and
+ .plt entries.
+ (elf_i386_gc_sweep_hook): Garbage collect .got and .plt entries.
+ (elf_i386_adjust_dynamic_symbol): Recognize unused .plt entries.
+ (elf_i386_relocate_section): Allow for .plt to go missing.
+ (elf_i386_finish_dynamic_symbol): Use same test to decide if we
+ can use a relative reloc for got as elf_i386_relocate_section.
+ (bfd_elf32_bfd_final_link): Define to use gc form of final link.
+
+2000-04-26 Clinton Popetz <cpopetz@cygnus.com>
+
+ * config.bfd: Remove extraneous bfd_powerpc_64_arch.
+
+2000-04-24 Clinton Popetz <cpopetz@cygnus.com>
+
+ * Makefile.am (coff64-rs6000.lo): New rule.
+ * Makefile.in: Regenerate.
+ * coff-rs6000.c (xcoff_mkobject, xcoff_copy_private_bfd_data,
+ xcoff_is_local_label_name, xcoff_rtype2howto,
+ xcoff_reloc_type_lookup, xcoff_slurp_armap, xcoff_archive_p,
+ xcoff_read_ar_hdr, xcoff_openr_next_archived_file, xcoff_write_armap,
+ xcoff_write_archive_contents): No longer static, and prefix with _bfd_.
+ (NO_COFF_SYMBOLS): Define.
+ (xcoff64_swap_sym_in, xcoff64_swap_sym_out, xcoff64_swap_aux_in,
+ xcoff64_swap_aux_out): New functions; handle xcoff symbol tables
+ internally.
+ (MINUS_ONE): New macro.
+ (xcoff_howto_tabl, xcoff_reloc_type_lookup): Add 64 bit POS
+ relocation.
+ (coff_SWAP_sym_in, coff_SWAP_sym_out, coff_SWAP_aux_in,
+ coff_SWAP_aux_out): Map to the new functions.
+ * coff64-rs6000.c: New file.
+ * libcoff.h (bfd_coff_backend_data): Add new fields
+ _bfd_coff_force_symnames_in_strings and
+ _bfd_coff_debug_string_prefix_length.
+ (bfd_coff_force_symnames_in_strings,
+ bfd_coff_debug_string_prefix_length): New macros for above fields.
+ * coffcode.h (coff_set_arch_mach_hook): Handle XCOFF64 magic.
+ Set machine to 620 for XCOFF64. Use bfd_coff_swap_sym_in instead
+ of using coff_swap_sym_in directly.
+ (FORCE_SYMNAMES_IN_STRINGS): New macro, defined for XCOFF64.
+ (coff_set_flags) Set magic for XCOFF64.
+ (coff_compute_section_file_positions): Add symbol name length to
+ string section length if bfd_coff_debug_string_prefix_length is
+ true.
+ (coff_write_object_contents): Don't do reloc overflow for XCOFF64.
+ (coff_slurp_line_table): Use bfd_coff_swap_lineno_in instead of
+ using coff_swap_lineno_in directly.
+ (bfd_coff_backend_data): Add _bfd_coff_force_symnames_in_strings
+ and _bfd_coff_debug_string_prefix_length fields.
+ * coffgen.c (coff_fix_symbol_name, coff_write_symbols): Force
+ symbol names into strings table when
+ bfd_coff_force_symnames_in_strings is true.
+ * coffswap.h (MAX_SCNHDR_NRELOC, MAX_SCNHDR_NLNNO, GET_RELOC_VADDR,
+ SET_RELOC_VADDR): New macros.
+ (coff_swap_reloc_in, coff_swap_reloc_out): Use above macros.
+ (coff_swap_aux_in, coff_swap_aux_out): Remove RS6000COFF_C
+ code.
+ (coff_swap_aouthdr_in, coff_swap_aouthdr_out): Handle XCOFF64
+ changes within RS6000COFF_C specific code.
+ (coff_swap_scnhdr_out): Use PUT_SCNHDR_NLNNO, PUT_SCNHDR_NRELOC,
+ MAX_SCNHDR_NRELOC, and MAX_SCNHDR_NLNNO.
+ * reloc.c (bfd_perform_relocation, bfd_install_relocation):
+ Extend existing hack on target name.
+ * xcofflink.c (XCOFF_XVECP): Extend existing hack on
+ target name.
+ * coff-tic54x.c (ticof): Keep up to date with new fields
+ in bfd_coff_backend_data.
+ * config.bfd: Add bfd_powerpc_64_arch to targ_arch and define
+ targ_selvecs to include rs6000coff64_vec for rs6000.
+ * configure.in: Add rs6000coff64_vec case.
+ * cpu-powerpc.c: New bfd_arch_info_type.
+
+2000-04-24 Jeffrey A Law (law@cygnus.com)
+
+ * config.bfd: Only disable elf32-hppa vectors, not all of the
+ BSD and OSF configuration support. Provide (disabled) clauses
+ for PA64 support.
+ * configure.in: Add clause for PA64 support.
+ * configure: Rebuilt.
+
+ * targets.c (bfd_target_vector): Add bfd_elf64_hppa_vec.
+ (bfd_elf64_hppa_vec): Declare.
+
+ * Makefile.am (BFD64_BACKENDS): Add elf64-hppa.lo
+ (BFD64_BACKENDS_CFILES): Add elf64-hppa.c
+ (elf64-hppa.lo): Add dependencies.
+ * Makefile.in: Rebuilt.
+
+ * elf64-hppa.c, elf64-hppa.h: New files with PA64 support.
+
+2000-04-24 Jason Eckhardt <jle@cygnus.com>
+
+ * libhppa.h (dis_assemble_16): New function.
+ (pa_arch): Added pa20w element.
+
+2000-04-24 Ulrich Drepper <drepper@cygnus.com>
+
+ * elf-bfd.h: Add prototypes for bfd_elf32_write_relocs,
+ bfd_elf32_slurp_reloc_table, bfd_elf64_write_relocs, and
+ bfd_elf64_slurp_reloc_table.
+
+ * elfcode.h (elf_write_relocs, elf_slurp_reloc_table): New
+ definitions to get external names.
+ (elf_write_relocs): Renamed from write_relocs and make global.
+ (elf_slurp_reloc_table): Make global.
+ (_bfd_elf,size_info): Use elf_write_relocs instead of write_relocs.
+
+ * archive.c (hpux_uid_gid_encode): New function.
+ (bfd_ar_hdr_from_filesystem): Use it if HPUX_LARGE_AR_IDS is
+ defined and the ID is greater than 99999.
+ (bfd_generic_stat_arch_elt): If HPUX_LARGE_AR_IDS is defined decode
+ special uid/gid fields into 32 bit values.
+
+2000-04-21 Matthew Green <mrg@cygnus.com>
+
+ * config.bfd: Add NetBSD/sparc64 support.
+
+2000-04-21 Richard Henderson <rth@cygnus.com>
+ David Mosberger <davidm@hpl.hp.com>
+ Timothy Wall <twall@cygnus.com>
+ Jim Wilson <wilson@cygnus.com>
+
+ * Makefile.am (ALL_MACHINES): Add cpu-ia64.lo.
+ (ALL_MACHINES_CFILES): Add cpu-ia64.c.
+ (BFD64_BACKENDS): Add elf64-ia64.lo.
+ (BFD64_BACKENDS_CFILES): Add elf64-ia64.c.
+ (cpu-ia64.lo, elf64-ia64.lo): New rules.
+ * Makefile.in: Rebuild.
+ * archures.c (enum bfd_architecture): Add bfd_arch_ia64.
+ (bfd_ia64_arch): Declare.
+ (bfd_archures_list): Add bfd_ia64_arch.
+ * bfd-in2.h: Rebuild.
+ * config.bfd: (ia64*-*-linux-gnu*, ia64*-*-elf*): New targets.
+ * configure: Rebuild.
+ * configure.host: (ia64-*-linux*): New host.
+ * configure.in (bfd_elf64_ia64_little_vec, bfd_elf64_ia64_big_vec,
+ bfd_efi_app_ia64_vec, bfd_efi_app_ia64_vec): New vectors.
+ * elf.c (prep_headers): Add bfd_arch_ia64.
+ * libbfd.h: Rebuild.
+ * reloc.c: Add IA-64 relocations.
+ * targets.c (bfd_elf64_ia64_little_vec, bfd_elf64_ia64_big_vec):
+ Declare.
+ (bfd_target_vect): Add bfd_elf64_ia64_little_vec.
+ * cpu-ia64-opc.c, cpu-ia64.c, elf64-ia64.c: New files.
+
+2000-04-21 Richard Henderson <rth@cygnus.com>
+
+ * elf32-d30v.c (bfd_elf_d30v_reloc): Don't modify section
+ contents when performing a partial link.
+ (bfd_elf_d30v_reloc_21): Likewise.
+
+2000-04-20 H.J. Lu <hjl@gnu.org>
+
+ * elf32-i386.c (elf_i386_relocate_section): Restrict 1998-12-10
+ patch to symbols defined by a shared object.
+ * elf32-ppc.c (ppc_elf_relocate_section): Similarly.
+
+2000-04-19 Michael Sokolov <msokolov@ivan.Harhan.ORG>
+
+ K&R compiler fixes.
+ * dwarf2.c (concat_filename): Avoid string literal concatenation.
+ * ieee.c (ieee_get_symtab): Don't initialise union in struct.
+
+2000-04-11 David Mosberger <davidm@hpl.hp.com>
+
+ * Makefile.am (BFD64_BACKENDS): Mention coff-ia64.lo.
+ (BFD64_BACKENDS_CFILES): Mention coff-ia64.c
+ (coff-ia64.lo): Add dependency.
+ * Makefile.in: Regenerate.
+ * coff-ia64.c: New file.
+ * efi-app-ia32.c: Ditto.
+ * efi-app-ia64.c: Ditto.
+ * coffcode.h (coff_set_arch_mach_hook): Handle IA64MAGIC.
+ (coff_set_flags): Ditto.
+ (coff_write_object_contents) [IA64]: Set magic number to ZMAGIC.
+ * config.bfd (i[3456]86-*-linux-gnu*): Mention bfd_efi_app_ia32_vec.
+ * configure.in (elf): Handle bfd_efi_app_ia32 and bfd_efi_app_ia64_vec.
+ * configure: Regenerate.
+ * libpei.h (GET_OPTHDR_IMAGE_BASE): New macro.
+ (PUT_OPTHDR_IMAGE_BASE): Ditto.
+ (GET_OPTHDR_SIZE_OF_STACK_RESERVE): Ditto.
+ (PUT_OPTHDR_SIZE_OF_STACK_RESERVE): Ditto.
+ (GET_OPTHDR_SIZE_OF_STACK_COMMIT): Ditto.
+ (PUT_OPTHDR_SIZE_OF_STACK_COMMIT): Ditto.
+ (GET_OPTHDR_SIZE_OF_HEAP_RESERVE): Ditto.
+ (PUT_OPTHDR_SIZE_OF_HEAP_RESERVE): Ditto.
+ (GET_OPTHDR_SIZE_OF_HEAP_COMMIT): Ditto.
+ (PUT_OPTHDR_SIZE_OF_HEAP_COMMIT): Ditto.
+ (GET_PDATA_ENTRY): Ditto.
+ * peigen.c (_bfd_pei_swap_aouthdr_in) [COFF_WITH_PEP64]: Don't read
+ data_start. Use above macros to read fields that are 64 bit wide for
+ COFF_WITH_PEP64. Don't truncate entry and text_start to 32 bits.
+ (_bfd_pei_swap_aouthdr_out) [PEI_FORCE_MINIMUM_ALIGNMENT]: Force
+ FileAlignment and SectionAlignment to minimum alignment if they
+ are zero.
+ (_bfd_pei_swap_aouthdr_out) [PEI_DEFAULT_TARGET_SUBSYSTEM]: Set
+ Subsystem to default PEI_DEFAULT_TARGET_SUBSYSTEM.
+ (_bfd_pei_swap_aouthdr_out) [COFF_WITH_PEP64]: Don't set data_start.
+ Use above macros to write fields that are 64 bit wide for
+ COFF_WITH_PEP64.
+ (pe_print_pdata): Set PDATA_ROW_SIZE to 3*8 for COFF_WITH_PEP64,
+ 5*4 otherwise. This should be right for IA-32 and IA-64, but may
+ be wrong for platforms. Use PDATA_ROW_SIZE instead of hardcoded
+ value of 20 bytes. Modify printing for COFF_WITH_PEP64 to print
+ begin address, end address, and unwind info address only. Use
+ GET_PDATA_ENTRY() to read .pdata entries. Use fprintf_vma() to
+ print addresses.
+ (tbl): Add SECTION, REL32, RESERVED1, MIPS_JMPADDR16, DIR64, and
+ HIGH3ADJ relocation names.
+ (_bfd_pe_print_private_bfd_data): Print Subsystem name in legible form.
+ * targets.c: Declare bfd_efi_app_ia32_vec and
+ bfd_efi_app_ia64_vec.
+ (bfd_target_vector): Mention bfd_efi_app_ia32_vec and
+ bfd_efi_app_ia64_vec.
+
+2000-04-17 Timothy Wall <twall@cygnus.com>
+
+ * bfd-in2.h: Add prototypes for tic54x load page access.
+ * bfd-in.h: Regenerate.
+ * coff-tic54x.c: Add load page functions; allow bfd_arch_unknown
+ in customized _set_arch_mach function.
+ * coffcode.h (coff_set_alignment_hook): Set section load page if
+ the appropriate macro is defined.
+ (write_object_contents): Read section load page.
+
+2000-04-13 Alan Modra <alan@linuxcare.com.au>
+
+ * elf32-hppa.h: Update copyright date.
+
+ * elf32-fr30.c (fr30_elf_i20_reloc): Don't use U suffix.
+ * elf32-mips.c (_bfd_mips_elf_relocate_section): And here.
+
+ * elf32-d30v.c (MAX32): Don't use LL suffix.
+ (MIN32): Define in terms of MAX32.
+ (bfd_elf_d30v_reloc): Make relocation a bfd_signed_vma.
+
+ * coff-a29k.c (SIGN_EXTEND_HWORD): Replace with more concise
+ expression.
+
+ * peicode.h (pe_ILF_build_a_bfd): Remove UL from hex constants.
+
+2000-04-12 Alan Modra <alan@linuxcare.com.au>
+
+ * dep-in.sed: Match space before file name, not after.
+ * Makefile.am: Regenerate dependencies.
+ * Makefile.in: Regenerate.
+
+ * reloc.c (_bfd_relocate_contents): In complain_overflow_bitfield
+ case, allow address wrap-around stupidly removed 2000-03-17. Sign
+ extend without an if statement.
+
+2000-04-11 Alan Modra <alan@linuxcare.com.au>
+
+ * coff-mips.c (mips_gprel_reloc): Test for 16 bit range using
+ signed quantites.
+ * elf32-mips.c (gprel16_with_gp): Likewise.
+ * elf32-hppa.c (elf32_hppa_bfd_final_link_relocate): Test range
+ here using -0x40000, not (int)0xfffc0000.
+ (elf32_hppa_size_of_stub): Likewise.
+
+2000-04-11 Timothy Wall <twall@cygnus.com>
+
+ * coff-tic54x.c: Now builds with all targets.
+ * Makefile.am: Add coff/tic54x.h to coff-tic54x.o dependencies.
+ * Makefile.in: Regenerate.
+ * coffcode.h (coff_set_arch_mach_hook): Eliminate warning on
+ unitialized variable.
+
+2000-04-07 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * configure.in (WARN_CFLAGS): Set to -W -Wall by default. Add
+ --enable-build-warnings option.
+ * Makefile.am (AM_CFLAGS, WARN_CFLAGS): Add definitions.
+ * Makefile.in, configure: Re-generate.
+
+2000-04-07 Nick Clifton <nickc@cygnus.com>
+
+ * reloc.c: Add BFD_RELOC_ARM_PCREL_BLX and
+ BFD_RELOC_THUMB_PCREL_BLX.
+
+ * elf32-arm.h (elf32_arm_final_link_relocate): Handle
+ R_ARM_XPC25 and R_ARM_THM_PC22.
+
+ * elfarm-nabi.c (elf32_arm_howto_): Fix definitions of
+ R_ARM_XPC25 and R_ARM_THM_XPC22.
+ (elf32_arm_reloc_map): Make BFD_RELOC_{ARM|THUMB}_PCREL_BLX to
+ R_ARM_[XPC25|THM_XPC22].
+
+ * elfarm-oabi.c: Define OLD_ARM_ABI and change include from
+ elf/arm-oabi.h to elf/arm.h
+
+ * Makefile.am: Fix dependency for elfarm-oabi.c
+ * Makefile.in: Regenerate.
+
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+
+2000-04-06 Michael Snyder <msnyder@seadog.cygnus.com>
+
+ * elfcore.h (elf_core_file_p): preserve value of tdata at entry,
+ and restore it on failure. Release newly allocated tdata on
+ failure.
+
+2000-04-07 Jim Wilson <wilson@cygnus.com>
+
+ * dwarf2.c (struct dwarf2_debug): New field dwarf_line_size.
+ (decode_line_info): Set it. Report error if unit->line_offset is
+ equal to or larger than it.
+
+2000-04-07 Timothy Wall <twall@cygnus.com>
+
+ * targets.c: Added vecs for tic54x.
+ * reloc.c: Added relocs for tic54x.
+ * libbfd.h: Regenerated.
+ * configure: Add TI COFF vecs for tic54x.
+ * configure.in: Ditto.
+ * config.bfd (targ_cpu): Recognize new tic54x target.
+ * coffcode.h (coff_slurp_symbol_table): Additions for TI COFF handling.
+ * bfd-in2.h: Add tic54x target and relocations.
+ * Makefile.am, Makefile.in: Add tic54x target.
+ * archures.c (bfd_archures_list): Add tic54x target.
+ * coff-tic54x.c: New.
+ * cpu-tic54x.c: New.
+
+2000-04-06 Michael Snyder <msnyder@seadog.cygnus.com>
+
+ * elfcore.h (elf_core_file_p): call backend_object_p which
+ thereby gets an opportunity to update the arch/machine type.
+
+2000-04-06 Timothy Wall <twall@cygnus.com>
+
+ * coffcode.h (coff_slurp_symbol_table): Handle C_STATLAB storage
+ class. Handle SEC_CLINK and SEC_BLOCK flags.
+ * section.c: Add SEC_CLINK and SEC_BLOCK flags.
+ * bfd-in2.h: Add SEC_CLINK and SEC_BLOCK flags.
+
+2000-04-06 Nick Clifton <nickc@cygnus.com>
+
+ * elf32-arm.h (elf32_arm_set_private_flags): Only check for
+ EF_INTERWORK if this is an unknown EABI.
+ (elf32_arm_merge_private_bfd_data): Check EABI version
+ numbers. Only check EF_xxx flags if the EABI version number
+ is unknown.
+ (elf32_arm_check_private_bfd_data): Only check EF_xxx flags
+ if the EABI version number is unknown.
+ (elf32_arm_print_private_bfd_data): Only decode EF_xxx flags
+ if the EABI version number is unknown.
+
+2000-04-05 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ * reloc.c (_bfd_relocate_contents): Add BFD_RELOC_SH_LOOP_START and
+ BFD_RELOC_SH_LOOP_END.
+ * elf32-sh.c (sh_elf_howto_tab): Change special_func to
+ sh_elf_ignore_reloc for all entries that sh_elf_reloc used to ignore.
+ Add entries for R_SH_LOOP_START and R_SH_LOOP_END.
+ (sh_elf_reloc_loop): New function.
+ (sh_elf_reloc): No need to test for always-to-be-ignored relocs
+ any more.
+ (sh_rel): Add entries for BFD_RELOC_SH_LOOP_{START,END}.
+ (sh_elf_relocate_section): Handle BFD_RELOC_SH_LOOP_{START,END}.
+ * bfd-in2.h, libbfd.h: Regenerate.
+
+2000-04-04 Alan Modra <alan@linuxcare.com.au>
+
+ * po/bfd.pot: Regenerate.
+
+ * Makefile.am: Remove extraneous mkdep comment.
+ (MKDEP): Use gcc -MM rather than mkdep.
+ (DEP): Quote when passing vars to sub-make. Add warning
+ message to end.
+ (DEP1): Rewrite for "gcc -MM".
+ (CLEANFILES): Add DEP2.
+ Update dependencies.
+ * Makefile.in: Regenerate.
+
+2000-04-03 Kevin Buettner <kevinb@redhat.com>
+
+ * configure.in: Added corefile support for AIX 4.3. In particular,
+ AIX_CORE_DUMPX_CORE will be defined in addition to AIX_CORE when
+ compiling rs6000-core.c.
+ * configure: Regenerated.
+
+2000-04-03 H.J. Lu <hjl@gnu.org>
+
+ * cache.c (bfd_open_file): Unlink the output file only if
+ it has non-zero size.
+
+2000-04-01 Ken Block USG <block@zk3.dec.com>
+
+ * elf64-alpha.c (elf64_alpha_relocate_section): Don't emit
+ relative relocations for non-loaded sections in shared objects.
+ (elf64_alpha_check_relocs): Similarly.
+
+2000-04-03 Hans-Peter Nilsson <hp@axis.com>
+
+ * aoutx.h (NAME(aout,reloc_type_lookup)): Add BFD_RELOC_8 and
+ BFD_RELOC_16 to switch for extended relocs.
+ (MY_swap_ext_reloc_in): New.
+ (MY_swap_ext_reloc_out): New.
+ (NAME(aout,slurp_reloc_table)): Use MY_swap_ext_reloc_in rather
+ than NAME(aout,swap_ext_reloc_in) for extended relocs.
+ (NAME(aout,squirt_out_relocs)): Similarly use
+ MY_swap_ext_reloc_out.
+ (aout_link_reloc_link_order): Use MY_put_ext_reloc if defined.
+
+2000-04-03 Kazu Hirata <kazu@hxi.com>
+
+ * coff-h8300.c (h8300_reloc16_extra_cases): Add bsr:16 -> bsr:8 to
+ the R_PCRWORD_B case.
+
+2000-03-31 Thomas de Lellis <tdel@wrs.com>
+
+ * srec.c : Set CHUNK size to 16 bytes to prevent download failures
+ on some targets.
+ * ihex.c : Ditto.
+
+2000-03-30 Donald Lindsay <dlindsay@cygnus.com>
+
+ * elf32-m32r.c (m32r_elf_generic_reloc): new function. All
+ HOWTO references to bfd_elf_generic_reloc, that have
+ partial_inplace == true, now use the new function. The function
+ is based on the recent rewrite of m32r_elf_lo16_reloc(), and
+ extends its fixes to the R_M32R_{16,24,32} relocs.
+ The new logic in m32r_elf_lo16_reloc() has been removed, and
+ it instead calls the new routine to obtain that functionality.
+
+2000-03-27 Alan Modra <alan@linuxcare.com.au>
+
+ * elf32-avr.c (elf32_avr_gc_mark_hook, elf32_avr_gc_sweep_hook,
+ elf32_avr_check_relocs, avr_final_link_relocate,
+ elf32_avr_relocate_section, bfd_elf_avr_final_write_processing,
+ elf32_avr_object_p): Add prototypes.
+ (elf32_avr_gc_mark_hook): Add default for h->root.type.
+ (bfd_elf_avr_final_write_processing): Make static.
+
+2000-03-27 Denis Chertykov <denisc@overta.ru>
+
+ * cpu-avr.c: New file. BFD support routines for AVR architecture.
+ * archures.c (bfd_architecture): Add AVR architecture.
+ (bfd_archures_list): Add reference to AVR architecture info.
+ * elf.c (prep_headers): Handle bfd_arch_avr.
+ * reloc.c: Add various AVR relocation enums.
+ * targets.c (bfd_elf32_avr_vec): Declare and add to target vector
+ list.
+ * Makefile.am: Add support for AVR elf.
+ * configure.in: Likewise.
+ * config.bfd: Likewise.
+ * Makefile.in: Regenerate.
+ * configure: This too.
+ * bfd-in2.h: And this.
+ * libbfd.h: And this.
+
+2000-03-24 H.J. Lu <hjl@gnu.org>
+
+ * elf64-alpha.c (elf64_alpha_merge_ind_symbols): Add prototype.
+ (elf64_alpha_find_reloc_at_ofs): Likewise.
+
+2000-03-17 Alan Modra <alan@linuxcare.com.au>
+
+ * reloc.c (bfd_check_overflow): In case complain_overflow_bitfield,
+ flag an overflow if the bitfield is outside -2**n to 2**n-1. The
+ allowable range used to be -2**(n-1) to 2**n-1.
+ * reloc.c (_bfd_relocate_contents): Same here. Also replace
+ "boolean overflow" with "bfd_reloc_status_type flag".
+
+2000-03-14 Doug Evans <dje@casey.transmeta.com>
+
+ * elf32-m32r.c (m32r_elf_lo16_reloc): Rewrite.
+
+2000-03-14 Kazu Hirata <kazu@hxi.com>
+
+ * reloc16.c (bfd_coff_reloc16_relax_section): Count the total number
+ of shrinks properly, including the last reloc.
+
+2000-03-13 Kazu Hirata <kazu@hxi.com>
+
+ * coff-h8300.c (h8300_reloc16_extra_cases): Fix the sanity
+ check for R_MOVL2.
+
+2000-03-11 Alan Modra <alan@linuxcare.com.au>
+
+ * ieee.c (ieee_archive_p): Return bfd_error_wrong_format on
+ a format mismatch rather than an "error" from bfd_read such as
+ bfd_error_file_truncated.
+
+2000-03-10 Geoff Keating <geoffk@cygnus.com>
+
+ * elf32-mips.c (_bfd_mips_elf_relocate_section): Do proper
+ sign-extension and big-endian compensation for
+ R_MIPS_64 even in ld -r.
+
+2000-03-10 Geoffrey Keating <geoffk@cygnus.com>
+
+ * elf32-mips.c (mips_elf_next_relocation): Rename from
+ mips_elf_next_lo16_relocation, and generalize to look
+ for any relocation type.
+ (elf_mips_howto_table): Make R_MIPS_PC16 pcrel_offset.
+ (elf_mips_gnu_rel_hi16): Howto for R_MIPS_GNU_REL_HI16.
+ (elf_mips_gnu_rel_lo16): Howto for R_MIPS_GNU_REL_LO16.
+ (elf_mips_gnu_rel16_s2): Howto for R_MIPS_GNU_REL16_S2.
+ (elf_mips_gnu_pcrel64): Howto for R_MIPS_PC64.
+ (elf_mips_gnu_pcrel32): Howto for R_MIPS_PC32.
+ (bfd_elf32_bfd_reloc_type_lookup): Add new relocs.
+ (mips_rtype_to_howto): Likewise.
+ (mips_elf_calculate_relocation): Handle new relocs.
+ (_bfd_mips_elf_relocate_section): REL_HI16/REL_LO16 relocs
+ are paired. The addend for R_MIPS_GNU_REL16_S2
+ is shifted right two bits.
+
+2000-03-10 Alan Modra <alan@linuxcare.com.au>
+
+ * reloc.c (bfd_perform_relocation): Undo emacs formatting of
+ comment, and ensure it doesn't happen again.
+ (bfd_install_relocation): Same here.
+ (_bfd_relocate_contents): Don't bother assigning unused signmask
+ shift result. Fix typos in comments.
+ Remove trailing whitespace throughout file.
+
+2000-03-07 Doug Evans <dje@casey.transmeta.com>
+
+ * reloc.c (reloc_howto_struct): Fix partial_inplace comment.
+ * bfd-in2.h: Rebuild.
+
+2000-03-06 Nick Clifton <nickc@cygnus.com>
+
+ * peicode.h (struct pe_ILF_vars): Add sym_ptr_table and
+ sym_ptr_ptr fields.
+ (SIZEOF_ILF_SYM_PTR_TABLE): Define.
+ (SIZEOF_ILF_STRINGS): Redefine.
+ (pe_ILF_make_a_symbol-reloc): New function. Creates a symbol
+ relative reloc, as opposed to a section relative reloc.
+ (pe_ILF_make_a_symbol): Set the class of local symbols to C_STAT
+ not C_LABEL.
+ Add length of symbol's prefix to string pointer.
+ Store a pointer to the symbol in the symbol pointer table.
+ (pe_ILF_build_a_bfd): Do not build .idata$2 or .idata$7.
+ Initialise the symbol pointer table.
+ Store the hint in the Hint/Name table.
+ Make the jump reloc be symbol realtive, not section relative.
+ Create an import symbol for imported code.
+
+2000-03-06 Catherine Moore <clm@cygnus.com>
+
+ * elf.c (swap_out_syms): Check for null type_ptr.
+
+2000-03-01 Hans-Peter Nilsson <hp@axis.com>
+
+ * aout-target.h (MY(write_object_contents)): Remove unused
+ and unusable "#if CHOOSE_RELOC_SIZE".
+ * pc532-mach.c (MY(write_object_contents)): Ditto.
+ * netbsd.h (MY(write_object_contents)): Ditto.
+ * hp300hpux.c (MY(write_object_contents)): Ditto.
+ * freebsd.h (MY(write_object_contents)): Ditto.
+ * aout-tic30.c (tic30_aout_write_object_contents): Ditto.
+
+2000-02-29 H.J. Lu <hjl@gnu.org>
+
+ * peicode.h (jtab): Make it static.
+
+ * coff-sh.c (sh_align_load_span): Declared if COFF_WITH_PE is
+ defined and COFF_IMAGE_WITH_PE is not defined.
+ (_bfd_sh_align_load_span): Defined as sh_align_load_span if
+ COFF_WITH_PE is defined and COFF_IMAGE_WITH_PE is not defined.
+
+2000-03-01 Nick Clifton <nickc@cygnus.com>
+
+ * coff-arm.c (bfd_arm_process_before_allocation): Make
+ 'symndx' signed to prevent compile time warning.
+
+ * coff-mcore.c: Remove unused prototype for pe_object_p.
+
+ * coff-sh.c: Add "#ifndef COFF_IMAGE_WITH_PE" around static
+ functions that are not used when COFF_IMAGE_WITH_PE is
+ defined.
+ (struct sh_opcode): Change type of 'flags' field to unsigned
+ long so that it can hold the USESAS flag.
+
+ * coffcode.h (styp_to_sec_flags): Initialise 'target_name'.
+
+ * elf-m10300.c (mn10300_elf_relax_section): Initialise
+ 'sym_sec'.
+
+ * elf32-i370.c: Add ATTRIBUTE_UNUSED to unused function
+ parameters.
+ Remove unusued variables and code.
+ (elf_backend_add_symbol_hook): Fix prototype.
+
+ * elf32-m68k.c (elf_m68k_gc_sweep_hook): Initialise 'sgot' and
+ 'srelgot'.
+
+ * elf32-mcore.c (mcore_elf_relocate_section): Initialise
+ 'oldinst'.
+
+ * elf32-mips.c: Add ATTRIBUTE_UNUSED to unused function
+ parameters.
+ Remove unusued variables and code.
+ (elf_backend_add_symbol_hook): Fix prototype.
+
+ * elf32-sh.c (sh_elf_set_mach_from_flags): Use 'flags'.
+
+ * elflink.h (elf_bfd_link_add_symbols): Add ATTRIBUTE_UNUSED
+ to unused function parameter.
+
+ * pe-mips.c: Add ATTRIBUTE_UNUSED to unused function
+ parameters.
+ Use EMPTY_HOWTO to initialise empty howto slots.
+ Remove unused variables.
+
+ * peicode.h (pe_ILF_build_a_bfd): Initialise id6.
+
+2000-03-01 H.J. Lu <hjl@gnu.org>
+
+ * aoutx.h (aout_link_input_section_std): Pass "true" to
+ the undefined_symbol callback.
+ (aout_link_input_section_ext): Likewise.
+ * bout.c (get_value): Likewise.
+ * coff-a29k.c (coff_a29k_relocate_section): Likewise.
+ * coff-alpha.c (alpha_ecoff_get_relocated_section_conten):
+ Likewise.
+ (alpha_relocate_section): Likewise.
+ * coff-arm.c (coff_arm_relocate_section): Likewise.
+ * coff-i960.c (coff_i960_relocate_section): Likewise.
+ * coff-mcore.c (coff_mcore_relocate_section): Likewise.
+ * coff-mips.c (mips_relocate_section): Likewise.
+ * coff-ppc.c (coff_ppc_relocate_section): Likewise.
+ * coff-sh.c (sh_relocate_section): Likewise.
+ * coff-tic80.c (coff_tic80_relocate_section): Likewise.
+ * cofflink.c (_bfd_coff_generic_relocate_section): Likewise.
+ * elf-m10200.c (mn10200_elf_relocate_section): Likewise.
+ * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
+ * elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
+ * elf32-fr30.c (fr30_elf_relocate_section): Likewise.
+ * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
+ * elf32-i370.c (i370_elf_relocate_section): Likewise.
+ * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
+ * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
+ * elf32-sh.c (sh_elf_relocate_section): Likewise.
+ * elf32-v850.c (v850_elf_relocate_section): Likewise.
+ * elflink.c (_bfd_elf_link_record_dynamic_symbol): Likewise.
+ * elflink.h (elf_link_output_extsym): Likewise.
+ * pe-mips.c (coff_pe_mips_relocate_section): Likewise.
+ * reloc.c (bfd_generic_get_relocated_section_conten): Likewise.
+ * reloc16.c (_bfd_ppc_xcoff_relocate_section): Likewise.
+
+ * elf-hppa.h (elf_hppa_relocate_section): Pass "false" to the
+ undefined_symbol callback when building shared library with
+ -Bsymbolic and undefined symbols are allowed. Otherwise, pass
+ "true".
+ * elf32-arm.h (elf32_arm_relocate_section): Likewise.
+ * elf32-i386.c (elf_i386_relocate_section): Likewise.
+ * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+ * elf32-mips.c (mips_elf_calculate_relocation): Likewise.
+ (elf32_mips_get_relocated_section_content): Likewise.
+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+ * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+
+2000-02-28 Nick Clifton <nickc@cygnus.com>
+
+ * Makefile.am: Add rules to build pe[i]-{sh|mips}.lo objects.
+ * Makefile.in: Regenerate.
+
+ * configure.in: Add support for mips and sh pe vectors.
+ * configure: regenerate.
+
+ * config.bfd: Add support for arm-wince, mips-pe and sh-pe
+ targets.
+
+ * targets.c: Add mips and sh pe vectors.
+
+ * libpei.h (coff_final_link_postscript): Only define if not
+ already defined.
+
+ * coffcode.h: Add support for WinCE magic numbers.
+
+ * peigen.c (pe_print_reloc): Update comment and rearrange
+ appending of newline character.
+
+ * peicode.h: Add support for Image Library Format.
+ (pe_ILF_vars): Structure containing data used by ILF code.
+ (pe_ILF_make_a_section): New function. Create a section based
+ on ILF data.
+ (pe_ILF_make_a_reloc): New function. Create a reloc based on
+ ILF data.
+ (pe_ILF_make_a_symbol): New function. Create a symbol based
+ on ILF data.
+ (pe_ILF_save_relocs): New function. Store the relocs created
+ by pe_ILF_make_a_reloc in a section.
+ (pe_ILF_build_a_bfd): New function. Create a BFD describing
+ an ILF object.
+ (pe_ILF_object_p): New function. Return a bfd_target pointer
+ for an ILF object.
+ (pe_bfd_object_p): If an ILF object is detected call
+ pe_ILF_object_p on it.
+
+ * coff-arm.c: Add support for WinCE relocs which are different
+ from normal ARM COFF relocs.
+ * pe-arm.c: Unset TARGET_UNDERSCORE for a WinCE target.
+
+ * coff-sh.c: Add support for sh-pe target.
+ * pe-sh.c: New file. Support code for sh-pe target.
+ * pei-sh.c: New file. Support code for sh-pe target.
+
+ * pe-mips.c: New file. Support code for mips-pe target.
+ * pei-mips.c: New file. Support code for mips-pe target.
+
+2000-02-27 Jakub Jelinek <jakub@redhat.com>
+
+ * elf32-sparc.c (elf32_sparc_merge_private_bfd_data): Don't bump
+ architecture if the object causing the bump is dynamic.
+ * elf64-sparc.c (sparc64_elf_merge_private_bfd_data): Likewise,
+ and also don't it for memory ordering.
+ (sparc64_elf_write_relocs): Take src_rela out of the loop.
+
+2000-02-27 Ian Lance Taylor <ian@zembu.com>
+
+ * dwarf2.c (read_abbrevs): Use _raw_size directly rather than
+ calling bfd_get_section_size_before_reloc.
+ (decode_line_info): Likewise.
+ (_bfd_dwarf2_find_nearest_line): Likewise.
+
+2000-02-27 Eli Zaretskii <eliz@is.elta.co.il>
+
+ * Makefile.am (stamp-lib): Use $(LIBTOOL) --config to get the
+ name of the libtool directory.
+ * Makefile.in: Rebuild.
+
+2000-02-25 Rodney Brown (RodneyBrown@pmsc.com)
+
+ * som.c (SOM_HOWTO): Define.
+ (som_hppa_howto_table): Use it.
+
+2000-02-25 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
+
+ * config.bfd: Enable 64 bit support for GNU/Linux/sparc.
+
+ * config.bfd: Enable 64 bit support for Solaris7+/sparc.
+
+2000-02-24 Catherine Moore <clm@cygnus.com>
+
+ * som.c (som_misc_symbol_info): Add field
+ secondary_def.
+ (som_bfd_derive_misc_symbol_info): Initialize
+ secondary_def.
+ (som_build_and_write_symbol_table): Keep track
+ of secondary_def field.
+ (som_slurp_symbol_table): Set BSF_WEAK symbol flag
+ if secondary_def field is set.
+ (som_bfd_ar_write_symbol_stuff): Initialize
+ secondary_def.
+
+2000-02-23 Stephane Carrez <stcarrez@worldnet.fr>
+
+ * dwarf2.c (read_address): Read 16-bits addresses.
+ (parse_comp_unit): Accept addr_size == 2.
+
+2000-02-23 Alan Modra <alan@spri.levels.unisa.edu.au>
+
+ * bfd-in.h: Update copyright date.
+
+2000-02-23 Linas Vepstas <linas@linas.org>
+
+ * cpu-i370.c: New file.
+ * elf32-i370.c: New file.
+ * archures.c (enum bfd_architecture): Add bfd_arch_i370.
+ (bfd_i370_arch): New.
+ (bfd_archures_list): Add bfd_i370_arch.
+ * elf.c (prep_headers): Add bfd_arch_i370.
+ * Makefile.am: Add support for IBM 370 elf.
+ * config.bfd: Likewise.
+ * configure.in: Likewise.
+ * libbfd.h (bfd_reloc_code_real_names): Likewise.
+ * reloc.c (bfd_reloc_code_type): Likewise.
+ * targets.c: Likewise.
+
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+ * bfd-in2.h: Regenerate.
+
+2000-02-22 Ian Lance Taylor <ian@zembu.com>
+
+ * elf32-i386.c (elf_i386_info_to_howto_rel): Give a warning for
+ invalid relocation types, and change them to R_386_NONE.
+
+2000-02-22 H.J. Lu <hjl@gnu.org>
+
+ * elflink.h (elf_link_add_object_symbols): If a version symbol is
+ not defined, don't add a second ELF_VER_CHR.
+
+ * elflink.h (elf_bfd_final_link): Call output_extsym for global
+ symbols converted to local symbols even when stripping all
+ symbols.
+ (elf_link_output_extsym): Process global symbols converted to
+ local symbols even if they are being stripped.
+
+2000-02-21 Alan Modra <alan@spri.levels.unisa.edu.au>
+
+ * archures.c (bfd_octets_per_byte): Return unsigned int.
+ (bfd_arch_mach_octets_per_byte): Ditto.
+ * libbfd.c (bfd_read, bfd_seek): Quell signed vs. unsigned
+ comparison warning.
+ * section.c (bfd_get_section_size_before_reloc): Quell signed
+ vs. unsigned comparison warning.
+ (bfd_get_section_size_after_reloc): Same here. Fix parentheses too.
+ * trad-core.c (trad_unix_core_file_p): Correct 2000-01-27
+ change. What was I thinking?
+ * bfd-in2.h: Regenerate.
+
+ * elflink.h (elf_gc_sweep): Skip non-elf input bfds.
+ (elf_gc_sections): Same here.
+ (elf_gc_common_finalize_got_offsets): And here.
+
+2000-02-21 Ian Lance Taylor <ian@zembu.com>
+
+ ELF HPPA doesn't work at present; remove it until it does.
+ * config.bfd: Comment out setting targ_defvec to
+ bfd_elf32_hppa_vec.
+ * Makefile.am: Rebuild dependencies.
+ (BFD32_BACKENDS): Remove elf32-hppa.lo.
+ (BFD32_BACKENDS_CFILES): Remove elf32-hppa.c.
+ (SOURCE_HFILES): Remove elf32-hppa.h and hppa_stubs.h.
+ * Makefile.in: Rebuild.
+ * targets.c (bfd_target_vector): Comment out bfd_elf32_hppa_vec.
+
+2000-02-18 Geoff Keating <geoffk@cygnus.com>
+
+ * coffcode.h (coff_set_arch_mach_hook): Use free(), because there
+ is no bfd_free(). Revert bfd_free part of previous change.
+
+2000-02-18 Geoff Keating <geoffk@cygnus.com>
+
+ * coffcode.h (coff_set_arch_mach_hook): Don't use variable-size
+ arrays.
+ (coff_compute_section_file_positions): Use bfd_free to pair
+ bfd_malloc.
+ (coff_write_object_contents): Likewise.
+
+ * coff-rs6000.c (xcoff_howto_table_16): New variable.
+ (xcoff_rtype2howto): Handle 16-bit variants of 32-bit relocs.
+
+2000-02-18 Ulrich Drepper <drepper@cygnus.com>
+
+ * coff-rs6000.c (XCOFFARMAGBIG): New macro.
+ (xcoff_ar_file_hdr_big): New structure.
+ (SIZEOF_AR_FILE_HDR_BIG): New macro.
+ (xcoff_ar_hdr_big): New structure.
+ (SIZEOF_AR_HDR_BIG): New macro.
+ (xcoff_big_format_p): New macro.
+ (xcoff_ardata_big): New macro.
+ (arch_xhdr_big): New macro.
+ (xcoff_slurp_armap): Handle large archives.
+ (xcoff_archive_p): Detect large archives.
+ (xcoff_read_ar_hdr): Handle large archives.
+ (xcoff_openr_next_archived_file): Handle large archives.
+ (xcoff_generic_stat_arch_elt): Handle large archives.
+ (xcoff_write_armap_old): Rename from xcoff_write_armap.
+ (xcoff_write_armap_big): New function.
+ (xcoff_write_armap): New function, dispatch to _old or _big.
+ (xcoff_write_archive_contents_old): Rename from
+ xcoff_write_archive_contents.
+ (xcoff_write_archive_contents_big): New function.
+ (xcoff_write_archive_contents): New function, dispatch to _old or
+ _big.
+
+2000-02-18 Richard Henderson <rth@cygnus.com>
+
+ * elf-bfd.h (struct elf_link_hash_table): Remove copy_indirect
+ and hide_symbol members.
+ (elf_link_hash_copy_indirect): Remove.
+ (elf_link_hash_hide_symbol): Remove.
+ (struct elf_backend_data): Add elf_backend_copy_indirect_symbol
+ and elf_backend_hide_symbol.
+ (_bfd_elf_link_hash_copy_indirect): Declare.
+ (_bfd_elf_link_hash_hide_symbol): Declare.
+ * elf.c (_bfd_elf_link_hash_copy_indirect): Remove table argument.
+ (_bfd_elf_link_hash_hide_symbol): Likewise.
+ (_bfd_elf_link_hash_table_init): Don't init killed members.
+ * elflink.h (elf_link_add_object_symbols): Use the bed function
+ pointers not elf_link_hash_{copy_indirect,hide_symbol}.
+ (elf_link_assign_sym_version): Likewise.
+ * elfxx-target.h (elf_backend_copy_indirect_symbol): Default.
+ (elf_backend_hide_symbol): Likewise.
+ (elfNN_bed): Update for new members.
+
+2000-02-17 Kevin Buettner <kevinb@redhat.com>
+
+ * rs6000-core.c (CORE_DATA_SIZE_FIELD, CORE_COMM_FIELD, SAVE_FIELD,
+ STACK_END_ADDR): Define for new core file format.
+ (LOADER_OFFSET_FIELD, LOADER_REGION_SIZE, CORE_DUMP): New defines
+ for handling the vagaries of the various core file structures used
+ by AIX over the years.
+ (rs6000coff_core_p, rs6000coff_core_file_matches_executable,
+ Rs6kCorData): Use above defines to adapt code to use AIX 4.3's
+ core_dumpx structure.
+
+2000-02-17 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ * archures.c (bfd_mach_sh2, bfd_mach_sh_dsp): New macros.
+ (bfd_mach_sh3_dsp): Likewise.
+ (bfd_mach_sh4): Reinstate.
+ (bfd_default_scan): Recognize 7410, 7708, 7729 and 7750.
+ * bfd-in2.h: Regenerate.
+ * coff-sh.c (struct sh_opcode): flags is no longer short.
+ (USESAS, USESAS_REG, USESR8, SETSAS, SETSAS_REG): New macros.
+ (sh_opcode41, sh_opcode42): Integrate as sh_opcode41.
+ (sh_opcode01, sh_opcode02, sh_opcode40): Add sh-dsp opcodes.
+ (sh_opcode41, sh_opcode4, sh_opcode80): Likewise.
+ (sh_opcodes): No longer const.
+ (sh_dsp_opcodef0, sh_dsp_opcodef): New arrays.
+ (sh_insn_uses_reg): Check for USESAS and USESR8.
+ (sh_insn_sets_reg, sh_insns_conflict): Check for SETSAS.
+ (_bfd_sh_align_load_span): Return early for SH4.
+ Modify sh_opcodes lookup table for sh-dsp / sh3-dsp.
+ Take into account that field b of a parallel processing insn
+ could be mistaken for a separate insn.
+ * cpu-sh.c (arch_info_struct): New array elements for
+ sh2, sh-dsp and sh3-dsp.
+ Reinstate element for sh4.
+ (SH2_NEXT, SH_DSP_NEXT, SH3_DSP_NEXT): New macros.
+ (SH4_NEXT): Reinstate.
+ (SH3_NEXT, SH3E_NEXT): Adjust.
+ * elf-bfd.h (_sh_elf_set_mach_from_flags): Declare.
+ * elf32-sh.c (sh_elf_set_private_flags): New function.
+ (sh_elf_copy_private_data, sh_elf_set_mach_from_flags): Likewise.
+ (sh_elf_merge_private_data): New function.
+ (elf_backend_object_p, bfd_elf32_bfd_set_private_bfd_flags): Define.
+ (bfd_elf32_bfd_copy_private_bfd_data): Define.
+ (bfd_elf32_bfd_merge_private_bfd_data): Change to
+ sh_elf_merge_private_data.
+
+2000-02-13 Richard Henderson <rth@cygnus.com>
+
+ * elf-bfd.h (struct elf_link_hash_table): Add copy_indirect and
+ hide_symbol members.
+ (elf_link_hash_copy_indirect): New.
+ (elf_link_hash_hide_symbol): New.
+ * elflink.h (elf_link_add_object_symbols): Break out copy from
+ indirect new new symbol to elf.c.
+ (elf_link_assign_sym_version): Break out privatization of
+ non-exported symbol to elf.c.
+ * elf.c (_bfd_elf_link_hash_copy_indirect): New.
+ (_bfd_elf_link_hash_hide_symbol): New.
+ (_bfd_elf_link_hash_table_init): Init copy_indirect and hide_symbol.
+
+2000-02-13 Ian Lance Taylor <ian@zembu.com>
+
+ * section.c (_bfd_strip_section_from_output): Add info parameter.
+ If it passed as non-NULL, use it to check whether any input BFD
+ has an input section which uses this output section. Change all
+ callers.
+ * bfd-in2.h: Rebuild.
+
+ * bfd-in.h: Move declarations of bfd_get_elf_phdr_upper_bound and
+ bfd_get_elf_phdrs in from bfd-in2.h, correcting patch of
+ 1999-11-29.
+ * bfd-in2.h: Rebuild.
+
+2000-02-10 Timothy Wall <twall@cygnus.com>
+
+ * coffswap.h (coff_swap_sym_in): Add hook SWAP_SYM_IN_POST to
+ allow final modifications of swapped-in symbol.
+ (coff_swap_sym_out): Ditto with SWAP_SYM_OUT_POST.
+ * coffcode.h (coff_write_relocs): Use macro
+ SECTION_RELATIVE_ABSOLUTE_SYMBOL_P if defined to determine whether
+ symbol index should be set to -1.
+
+2000-02-10 Toshiyasu Morita (toshi.morita@sega.com)
+
+ * coff-sh.c (USES1_REG, USES2_REG, SETS1_REG, SETS2_REG,
+ USESF1_REG, USESF2_REG, SETSF1_REG, SETSF2_REG): New macros.
+ * (sh_insn_sets_reg, sh_insn_sets_freg): New prototypes.
+ * (sh_insn_sets_reg, sh_insn_uses_or_sets_reg, sh_insns_sets_freg,
+ sh_insns_uses_or_sets_freg): New functions.
+ * (sh_insn_uses_reg, sh_insn_uses_freg): Use new macros.
+ * (sh_insns_conflict): Use new functions and new macros to
+ detect conflicts when two instructions both set same integer registers,
+ both set same fp register, and both set special register.
+
+2000-02-09 Timothy Wall <twall@cygnus.com>
+
+ * coffgen.c (coff_real_object_p): Set arch/mach info prior to
+ swapping in sections, so that the swapping routines have access to
+ the arch/mach info.
+
+2000-02-08 Mark Elbrecht <snowball3@bigfoot.com>
+
+ * coff-go32.c: Update comment. Update copyright.
+
+2000-01-27 Thomas de Lellis <tdel@windriver.com>
+
+ * syms.c (bfd_decode_symclass)
+ Two new class characters were added - 'V' and 'v'. The
+ meaning of 'W' is now restricted to just weak non-object
+ symbols. This allows differentiation between, for example,
+ weak functions vs weak objects. nm for example now dumps:
+ 'W' = weak global
+ 'w' = weak unresolved
+ 'V' = weak global object
+ 'v' = weak unresolved object
+
+ (bfd_is_undefined_symclass): New function. Return true if the
+ given symbol class represents and undefined/unresolved symbol.
+
+ (bfd_symbol_info): Use bfd_is_undefined_symclass to check for
+ unresolved symbols.
+
+ * bfd-in2.h: Add prototype for bfd_is_undefined_symbol().
+
+ * elf32-arm.h (elf32_arm_get_symbol_type): If a symbol has the
+ STT_ARM_16BIT flag set, but it is not attached to a data object
+ return STT_ARM_16BIT so that it will be treated as code by the
+ disassembler.
+
+2000-01-27 Alan Modra <alan@spri.levels.unisa.edu.au>
+
+ * coff-i386.c (i3coff_object_p): Remove prototype.
+ Update copyright.
+
+ * elflink.c (_bfd_elf_link_record_dynamic_symbol): Add const
+ to name. Update copyright.
+
+ * trad-core.c (trad_unix_core_file_p): Cast core_regsec
+ assignment to avoid warning. Update copyright.
+
+2000-01-24 Robert Lipe (robertl@sco.com)
+
+ * coffcode.h (coff_write_object_contents): Get buff via bfd_malloc
+ instead of using GNU C extension.
+
+2000-01-21 Nick Clifton <nickc@cygnus.com>
+
+ * libbfd.c (bfd_read): Do not attempt to get a negativly sized
+ amount from a bfd_in_memory structure.
+ (bfd_seek): Do not allow seeks past the end of a bfd_in_memory
+ structure.
+
+2000-01-14 Nick Clifton <nickc@cygnus.com>
+
+ * linker.c (default_indirect_link_order): oops - fix incorrectly
+ applied patch from Tim Wall.
+
+2000-01-13 Timothy Wall (twall@tiac.net>
+
+ * coffcode.h: Use bfd_coff_xxx instead of the macro XXX (where xxx
+ = scnhsz, filhsz, relsz, aoutsz, etc)
+
+ * coffswap.h: Ditto.
+
+2000-01-13 Nick Clifton <nickc@cygnus.com>
+
+ * elf32-arm.h (elf32_thumb_to_arm_stub): Fix offset in branch to
+ interwork thumb to arm stub.
+
+2000-01-13 Timothy Wall (twall@tiac.net>
+
+ * archures.c (bfd_octets_per_byte): New function: Return
+ target byte size.
+ (bfd_arch_mach_octets_per_byte): New function: Return target
+ byte size.
+
+ * section.c: Distinguish between octets and bytes for usage of
+ _cooked_size, _raw_size, and output_offset. Clarify
+ description of bfd_set_section_contents.
+
+ * bfd-in2.h: Regenerate.
+
+ * coffgen.c: Indicate that the offset parameter is in bytes, not
+ octets.
+
+ * cofflink.c (bfd_coff_link_input_bfd): Use bfd_octets_per_byte
+ where appropriate to get the octet offset when calling
+ bfd_set_section_contents.
+ (bfd_coff_reloc_link_order): Ditto.
+
+ * linker.c (bfd_generic_reloc_link_order): Ditto.
+ (_bfd_default_link_order): Ditto.
+
+ * reloc.c (bfd_perform_relocation): Distinguish between octets
+ and bytes. Use octets when indexing into octet data; use bytes
+ when calculating target addresses.
+ (bfd_install_relocation): Ditto.
+
+ * srec.c (srec_write_section): Ditto.
+
+2000-01-13 Nick Clifton <nickc@cygnus.com>
+
+ * coff-mcore.c (COFF_DEFAULT_SECTION_ALIGNMENT_POWER): Change from
+ 3 to 2. This allows 4 byte sized sections, which is necessary for
+ dlltool to build functioning DLLs.
+
+2000-01-10 Philip Blundell <pb@futuretv.com>
+
+ * config.bfd (arm*-*-linux-gnu*): Match instead of arm*-*-linux-gnu.
+ (arm*-*-conix*): New target.
+
+2000-01-10 Egor Duda <deo@logos-m.ru>
+
+ * config.bfd: Include elf32_i386 vector to target list for cygwin
+ and mingw.
+
+ * config.in: Undefine HAVE_WIN32_PSTATUS_T.
+ * configure.in: Test for structure win32_pstatus_t in
+ <sys/procfs.h>
+ * configure: Regenerate.
+
+ * elf.c (elfcore_grok_win32pstatus): New function: process
+ win32_pstatus_t notes in elf core file.
+ (elfcore_grok_note): Detect win32_pstatus notes.
+
+2000-01-03 Martin v. Loewis <loewis@informatik.hu-berlin.de>
+
+ * elflink.c (_bfd_elf_link_record_dynamic_symbol): Process symbol
+ visibility.
+ * elflink.h (elf_link_add_object_symbols): Combine visibilities.
+ * elf.c (bfd_elf_print_symbol): Interpret st_other as visibility.
+
+For older changes see ChangeLog-9899
+
+Local Variables:
+mode: change-log
+left-margin: 8
+fill-column: 74
+version-control: never
+End:
diff --git a/contrib/binutils/bfd/ChangeLog-9193 b/contrib/binutils/bfd/ChangeLog-9193
index 15af931..01863de 100644
--- a/contrib/binutils/bfd/ChangeLog-9193
+++ b/contrib/binutils/bfd/ChangeLog-9193
@@ -408,7 +408,7 @@ Tue Nov 30 16:45:23 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* config/irix5.mh (HDEFINES): Define to be -DIRIX_CORE.
(HDEPFILES): Define to be irix-core.o.
* Makefile.in (OPTIONAL_BACKENDS): Added irix-core.o. Removed
- sco-core.o, which no longer exists.
+ sco5-core.o, which no longer exists.
(CFILES): Added all *-core.c files.
Rebuilt dependencies.
@@ -458,11 +458,11 @@ Mon Nov 22 14:17:36 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
Mon Nov 22 10:54:27 1993 Fred Fish (fnf@cygnus.com)
Merged changes from kev@spuds.geg.mot.com (Kevin A. Buettner):
- * bfd/config/delta88.mh (HDEFINES): Define this to be -DPTRACE_CORE.
- * bfd/config/delta88.mh (HDEPFILES): Defined to be ptrace-core.o.
- * bfd/ptrace-core.c: New file for dealing with core files with
+ * config/delta88.mh (HDEFINES): Define this to be -DPTRACE_CORE.
+ * config/delta88.mh (HDEPFILES): Defined to be ptrace-core.o.
+ * ptrace-core.c: New file for dealing with core files with
start with the ptrace_user structure found on BCS compliant systems.
- * bfd/targets.c (ptrace_core_vec): New vector.
+ * targets.c (ptrace_core_vec): New vector.
Mon Nov 22 02:33:12 1993 Jeffrey A. Law (law@snake.cs.utah.edu)
@@ -1855,7 +1855,7 @@ Thu Sep 2 00:59:55 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* libhppa.h (hppa_field_adjust): Remove unused `init_value' variable.
* hosts/delta88v4.h: New for SVR4.
- * configure.hosts: Use it.
+ * configure.host: Use it.
Wed Sep 1 14:23:32 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
@@ -2379,8 +2379,9 @@ Sat Aug 7 09:14:21 1993 David J. Mackenzie (djm@thepub.cygnus.com)
* config/i386-sco.mt (TDEFAULTS): Don't put &sco_core_vec in
SELECT_VECS manually; -DSCO_CORE does it automatically now.
- * config/h8300-coff.mt,h8500-coff.mt,sh-coff.mt,st2000.mt,z8k-coff.mt
- (TDEFAULTS): Don't define BFD; not used.
+ * config/h8300-coff.mt, config/h8500-coff.mt, config/sh-coff.mt,
+ config/st2000.mt, config/z8k-coff.mt (TDEFAULTS): Don't define
+ BFD; not used.
* config/hppaosf.mh (HDEFINES): Don't define SELECT_ARCHITECTURES;
this is a host, not a target.
@@ -2559,7 +2560,7 @@ Tue Aug 3 16:33:11 1993 David J. Mackenzie (djm@thepub.cygnus.com)
Tue Aug 3 15:19:09 1993 Fred Fish (fnf@deneb.cygnus.com)
- * nlm_slurp_symbol_table: Don't use '&' on arrays.
+ * nlmcode.h (nlm_slurp_symbol_table): Don't use '&' on arrays.
Tue Aug 3 11:06:28 1993 Ian Lance Taylor (ian@cygnus.com)
@@ -2671,7 +2672,7 @@ Mon Jul 26 17:39:01 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
Yet another trad-core variant:
* config/esix.mh, hosts/esix.h: New files.
- * configure.hosts: Use them.
+ * configure.host: Use them.
Mon Jul 26 13:22:15 1993 Ian Lance Taylor (ian@cygnus.com)
@@ -3740,8 +3741,8 @@ Fri Apr 30 17:25:23 1993 Stu Grossman (grossman@cygnus.com)
* The following patches are from Jeffrey Law <law@cs.utah.edu>.
* hppa.c (hppa_core_file_p): Provide a temporary dummy routine
for HOST_HPPABSD.
- * bfd/hosts/hppabsd.h: Fix declarations of malloc and free.
- * bfd/libhppa.h: Include sysdep here. Conditionalize
+ * hosts/hppabsd.h: Fix declarations of malloc and free.
+ * libhppa.h: Include sysdep here. Conditionalize
includes based on HOST_HPPAHPUX or HOST_HPPABSD.
Provide definitions for MAXCOMLEN and _PA_RISC_ID suitable
for BSD.
@@ -4424,7 +4425,7 @@ Tue Jan 26 11:43:14 1993 Ian Lance Taylor (ian@cygnus.com)
(bfd_com_section): Set SEC_IS_COMMON flag.
* bfd-in.h (bfd_is_com_section): New macro to test SEC_IS_COMMON.
* aoutx.h, archive.c, bout.c, coff-a29k.c, coff-m88k.c,
- coff-mips.c, coffgen.c, ieee.c, oasys.c, reloc.c, syms.: Use
+ coff-mips.c, coffgen.c, ieee.c, oasys.c, reloc.c, syms.c: Use
bfd_is_com_section macro rather than checking for equality to
bfd_com_section.
@@ -4850,7 +4851,7 @@ Thu Nov 5 15:34:19 1992 Ian Lance Taylor (ian@cygnus.com)
Thu Nov 5 04:43:09 1992 John Gilmore (gnu@cygnus.com)
- * target.c (struct bfd_target): Eliminate the SDEF and SDEF_FMT
+ * targets.c (struct bfd_target): Eliminate the SDEF and SDEF_FMT
macros; use PARAMS to declare the function pointers involved.
* bfd-in.h, bfd.c, libbfd.h, reloc.c, seclet.h, section.c,
@@ -5261,12 +5262,6 @@ Fri Aug 28 16:29:15 1992 Ian Lance Taylor (ian@cygnus.com)
large, assume we're using a swapped byte order and fail with
wrong_format rather than dumping core.
-Fri Aug 28 15:38:03 1992 Ken Raeburn (raeburn@cygnus.com)
-
- * Renamed opc-sparc.c to sparc-opc.c for systems with short
- filename constraints.
- * Makefile.in: Updated to reflect change.
-
Thu Aug 27 13:05:28 1992 Brendan Kehoe (brendan@cygnus.com)
Add preliminary support for the we32k:
@@ -5297,7 +5292,7 @@ Tue Aug 25 08:39:10 1992 Steve Chamberlain (sac@thepub.cygnus.com)
Fri Aug 14 15:39:29 PDT 1992 Howard Chu (hyc@hanauma.jpl.nasa.gov)
Documentation fixes:
- * ctors.c, format.c, section.c, reloc.c: append " -" to item tags.
+ * ctor.c, format.c, section.c, reloc.c: append " -" to item tags.
* reloc.c, section.c, syms.c, targets.c: add DOCDD before @node
comments.
* reloc.c: break out addend item from surrounding text.
@@ -5381,7 +5376,7 @@ Sat Aug 8 23:15:35 1992 Fred Fish (fnf@cygnus.com)
pointers to bfd_byte* before performing arithmetic on them. Such
use with bare void* pointers is a gcc extension.
* cache.c (bfd_cache_delete): Forward decl with prototype form.
- * archive (normalize): Add to CONST to match actual usages with
+ * archive.c (normalize): Add to CONST to match actual usages with
CONST.
Mon Aug 3 00:35:29 1992 Fred Fish (fnf@cygnus.com)
@@ -5471,7 +5466,7 @@ Tue Jul 7 00:23:23 1992 Fred Fish (fnf@cygnus.com)
Sat Jul 4 03:29:41 1992 John Gilmore (gnu at cygnus.com)
- * syms.h: Define BSF_FILE, update BSF_SECTION_SYM desc.
+ * syms.c: Define BSF_FILE, update BSF_SECTION_SYM desc.
* elf.c: Remove unconditional debug printf's.
(elf_write_object_contents, elf_slurp_symbol_table): Handle
BSF_SECTION_SYM <=> STT_SECTION, BSF_FILE <=> STT_FILE.
@@ -5497,7 +5492,7 @@ Tue Jun 23 21:54:44 1992 Fred Fish (fnf@cygnus.com)
* libbfd.h, libbfd-in.h (bfd_seek): Make prototype match definition.
* reloc.c (bfd_default_reloc_type_lookup): Make cast on return
type match actual return type.
- * elf_print_symbol (section_name): Make CONST.
+ * section.c (elf_print_symbol): Make CONST.
Mon Jun 22 17:35:24 1992 Per Bothner (bothner@cygnus.com)
@@ -5766,7 +5761,7 @@ Tue May 12 14:08:59 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* opncls.c: don't use fdopen on DOS systems
short patches from Glenn Kasten (glenn@ready.com)
- * target.c: enabled oasys support
+ * targets.c: enabled oasys support
* oasys.c: Insert . when UNDERSCORE_HACK is enabled,
fix problem where a relocation which crossed a modification byte
boundary did not work. Fix problem where a relocation near the end
@@ -5923,7 +5918,7 @@ Tue Mar 17 14:12:25 1992 Per Bothner (bothner@rtl.cygnus.com)
Tue Mar 17 10:45:12 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* aout-target.h: change ar_max_namelen to 15 (the right value)
- * coff-a29k, coffcode.h: more hangovers from the bfd_abs_section
+ * coff-a29k.c, coffcode.h: more hangovers from the bfd_abs_section
change
Mon Mar 16 14:57:22 1992 Steve Chamberlain (sac@rtl.cygnus.com)
@@ -6384,7 +6379,7 @@ Sat Nov 30 21:19:15 1991 Steve Chamberlain (sac at rtl.cygnus.com)
* aout-encap.c, aoutf1.h, aoutx.h, archive.c, bout.c, coff-a29k.c,
coff-h8300.c, coff-i386.c, coff-i960.c, coff-m68k.c, coff-m88k.c,
coff-mips.c, coff-rs6000.c, cpu-h300.c, elf.c, i386aout.c,
- newos3.c, stab-syms.c, syms.c: All these files have had their
+ newsos3.c, stab-syms.c, syms.c: All these files have had their
#includes altered to point to the new places.
Fri Nov 29 20:04:49 1991 Fred Fish (fnf at cygnus.com)
@@ -6792,7 +6787,7 @@ Fri Oct 11 13:03:02 1991 Per Bothner (bothner at cygnus.com)
* host-aout.c (NAME(host_aout, callback) and
NAME(host_aout,mkobject): Ditto.
* i386aout.c (aout386_callback) and new aout386_mkobject): Ditto.
- * newos3.c (newsos3_callback) and new newsos_mkobject): Ditto.
+ * newsos3.c (newsos3_callback) and new newsos_mkobject): Ditto.
* aoutf1.c (sunos4_callback) and new sunos_mkobject): Ditto.
* aoutx.h (NAME(aout,some_aout_object_p)): Don't subtract
EXEC_BYTES_SIZE from the a_test size; this is only appropriate
@@ -7182,7 +7177,7 @@ Wed Aug 21 14:33:06 1991 Roland H. Pesch (pesch at cygint.cygnus.com)
* bfd.c, reloc.c, syms.c: minor spelling/wording fixes in doc
portions
- * Makefile.in, awkscan-ip, awkscan-p, intobfd,
+ * Makefile.in, awkscan-ip, awkscan-p, doc/intobfd,
libbfd.h, libcoff.h, tolibcoff; new bfd-in.h, libbfd-in.h,
libcoff-in.h: (a) use separate files for invariant parts of bfd.h,
libbfd.h, and libcoff.h; (b) in generated parts of same, use less
@@ -7251,12 +7246,14 @@ Mon Jul 15 16:27:42 1991 Steve Chamberlain (steve at cygint.cygnus.com)
Thu Jul 4 09:53:16 1991 Steve Chamberlain (steve at cygint.cygnus.com)
- * Everything: created some new files, core.c format.c, reloc.c,
- section.c and syms.c to split the functionality a bit better.
+ * core.c: New file.
+ * format.c: New file.
+ * reloc.c: New file.
+ * section.c: New file.
+ * syms.c: New filew.
Cleaned up the rest of the files a bit, and added some
documentation.
-
Mon Jul 1 13:29:47 1991 David Wood (wood at david.ultra.nya.edu)
* opncls.c, ../include/sys/h-sun3.h ../include/sys/h-sun4.h: fcntl
@@ -7299,7 +7296,7 @@ Fri Jun 7 12:35:46 1991 Sean Fagan (sef at cygint.cygnus.com)
Thu Jun 6 18:27:38 1991 Steve Chamberlain (steve at cygint.cygnus.com)
- * ../include/oasys.h oasys.c (oasys_archive_p): fixed so it works
+ * oasys.c (oasys_archive_p): fixed so it works
* srec.c: now allows any number of sections to be created in a
file. Outputs addresses of the right length.
@@ -7445,7 +7442,7 @@ Fri May 10 16:58:53 1991 John Gilmore (gnu at cygint.cygnus.com)
get_section_contents in favor of generics. New transfer vector
regime.
- * newsos.c: New support for Sony NEWS, another a.out format.
+ * newsos3.c: New support for Sony NEWS, another a.out format.
* ecoff.c: Remove close_and_cleanup. New tvec regime.
* icoff.c, m88k-bcs.c: Add write_contents to tvec.
@@ -7465,7 +7462,7 @@ Fri May 10 16:58:53 1991 John Gilmore (gnu at cygint.cygnus.com)
* liba.out.h: Handle the new aout.c split. Add prototypes for
all routines defined in aout.c. Rename "sunos" things to "aout"
things. Add a few fields where needed for various formats.
- * Makefile.in: Add aout.c and newsos.c.
+ * Makefile.in: Add aout.c and newsos3.c.
* archive.c, ieee.c, oasys.c: Lint.
@@ -7698,7 +7695,7 @@ Mon Jan 28 19:15:29 PST 1991 steve@cygnus.com
Mon Jan 21 11:53:51 PST 1991 steve@cygnus.com
- * bfd.h changed name of alignment entry in sec_struct to
+ * bfd.h: changed name of alignment entry in sec_struct to
alignment_power, because of conflicting uses within bfd.
Now it should be obvious that it's a 2**n alignment
specifier. Removed start_pad, end_alignment, block, minsize,
@@ -7706,21 +7703,21 @@ Mon Jan 21 11:53:51 PST 1991 steve@cygnus.com
Added align_power() macro. Fixed bfd_section_alignment
acessor macros. Added bfd_symbol_same_target macro.
- * b.out.c (b_out_write_object_contents) fixed to use
+ * b.out.c (b_out_write_object_contents): fixed to use
new alignment member. Fixed (callj_callback) to use section
relative symbols properly.
- * sunos.c (sunos4_object_p) fixed to use new alignment_power.
+ * sunos.c (sunos4_object_p): fixed to use new alignment_power.
Fixed (translate_from_native_sym_flags) to correctly make
symbols section relative.
- * bfd.c (bfd_errmsg) fixed various enum cast problems.
- (bfd_make_section) took out initialization of obsolete members.
- (bfd_print_symbol_vandf) added
+ * bfd.c (bfd_errmsg): fixed various enum cast problems.
+ (bfd_make_section): took out initialization of obsolete members.
+ (bfd_print_symbol_vandf): added
- * opncls.c (bfd_create) created.
+ * opncls.c (bfd_create): created.
- * coff-code.h (coff_new_section_hook) took away refs
+ * coff-code.h (coff_new_section_hook): took away refs
to obsolete members. (make_a_section_from_file) added
conversion between alignment types. (coff_symbol_from)
added. (coff_count_linenumbers) only counts linenumbers
@@ -7732,36 +7729,36 @@ Mon Jan 21 11:53:51 PST 1991 steve@cygnus.com
Sat Jan 19 16:10:42 PST 1991 steve@cygnus.com
- * archive.c lots of lint
+ * archive.c> lots of lint.
- * b.out.c added callj relocation support, upgrated reloc howto.
+ * b.out.c: added callj relocation support, upgrated reloc howto.
Fixed so that asymbol and reloc records are output
correctly.
- * bfd.c lots of lint, support for new bfd entry point
+ * bfd.c: lots of lint, support for new bfd entry point
bfd_print_symbol.
- * bfd.h changed definition of asymbol to contain pointer to
+ * bfd.h: changed definition of asymbol to contain pointer to
owning bfd, removed target dependencies.
- * cache.c took out print statements, put in BFD_ASSERT calls.
+ * cache.c: took out print statements, put in BFD_ASSERT calls.
- * coff-code.h various lints, corrected linenumber output
+ * coff-code.h: various lints, corrected linenumber output
functionality. Added support for new style asymbols and
bfd_print_symbol. Fixed so that asymbol and
reloc records are handled correctly. Added timestamp.
- * icoff.c Added support for new howto shape.
+ * icoff.c: Added support for new howto shape.
- * liba.out.h Added support for new asymbol shape
+ * liba.out.h: Added support for new asymbol shape
- * libbfd.c various lints
+ * libbfd.c: various lints
- * libbfd.h various lints
+ * libbfd.h: various lints
- * libcoff.h added support for new asymbol shape.
+ * libcoff.h: added support for new asymbol shape.
- * sunos.c various lints. Added support for new asymbol shape
+ * sunos.c: various lints. Added support for new asymbol shape
and bfd_print_symbol.
Wed Jan 16 21:38:09 PST 1991 steve@cygnus.com
@@ -7785,7 +7782,7 @@ Wed Jan 16 21:38:09 PST 1991 steve@cygnus.com
Wed Jan 16 01:55:53 1991 John Gilmore (gnu at rtl)
* ChangeLog: Started ChangeLog for BFD.
- * ToDo: Create file for suggestions.
+ * TODO: Create file for suggestions.
* Makefile: Support easy loading into Saber C.
Add dependencies for icoff.o and bcs88kcoff.o.
diff --git a/contrib/binutils/bfd/ChangeLog-9495 b/contrib/binutils/bfd/ChangeLog-9495
index 9868583..4657d66 100644
--- a/contrib/binutils/bfd/ChangeLog-9495
+++ b/contrib/binutils/bfd/ChangeLog-9495
@@ -178,7 +178,7 @@ Fri Dec 1 14:46:51 1995 Ian Lance Taylor <ian@cygnus.com>
* bfd.c (bfd_record_phdr): New function.
* bfd-in.h (bfd_record_phdr): Declare.
- * bfd_in2.h: Rebuild.
+ * bfd-in2.h: Rebuild.
* elf32-sparc.c (elf32_sparc_relocate_section): Remove bogus
BFD_ASSERT.
@@ -407,7 +407,7 @@ Wed Nov 15 18:05:52 1995 Ian Lance Taylor <ian@cygnus.com>
_bfd_print_private_bfd_data from void * to PTR.
* libbfd-in.h (_bfd_generic_bfd_print_private_bfd_data): Cast
using PTR rather than void *.
- * bfd-in2, libbfd.h: Rebuild.
+ * bfd-in2.h, libbfd.h: Rebuild.
* peicode.h (pe_print_private_bfd_data): Change vfile from void *
to PTR.
* elfxx-target.h (bfd_elfNN_bfd_print_private_bfd_data): Define as
@@ -2357,7 +2357,7 @@ Wed Aug 6 09:12:50 1995 Doug Evans <dje@canuck.cygnus.com>
Sat Aug 5 00:04:08 1995 Jeff Law (law@snake.cs.utah.edu)
- * som (som_get_reloc_upper_bound): Return -1 on error. Compute
+ * som.c (som_get_reloc_upper_bound): Return -1 on error. Compute
return value with sizeof (arelent *), not sizeof (arelent).
Wed Aug 2 12:32:21 1995 Ian Lance Taylor <ian@cygnus.com>
@@ -4334,7 +4334,7 @@ Thu Nov 17 17:37:39 1994 Ken Raeburn <raeburn@cujo.cygnus.com>
Thu Nov 17 13:12:08 1994 Jeff Law (law@snake.cs.utah.edu)
- * bfd/elf32-hppa.c (elf32_hppa_bfd_final_link_relocated): Use the
+ * elf32-hppa.c (elf32_hppa_bfd_final_link_relocated): Use the
vma from the output_section containing $global$ when computing
global_vlaue.
@@ -7454,7 +7454,7 @@ Fri Apr 15 12:22:07 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
gas does this anyhow, but some other assemblers seem to leave
garbage in the R_IHCONST address field.
- * bfd/archive.c: Consistently use ARFMAG; from
+ * archive.c: Consistently use ARFMAG; from
schwab@issan.informatik.uni-dortmund.de (Andreas Schwab).
(_bfd_write_archive_contents): Use ARFMAG rather than '`' and
'\012'.
@@ -8307,7 +8307,7 @@ Mon Mar 21 12:28:19 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
Sun Mar 20 09:24:36 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
- * bfd/som.c (som_begin_writing): Fix thinko (off by one error).
+ * som.c (som_begin_writing): Fix thinko (off by one error).
* som.c (bfd_section_from_som_symbol): Only to do the value
comparison for function symbols within executables.
@@ -8539,7 +8539,7 @@ Mon Mar 14 11:41:23 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
undefined symbols. Correctly distinguish between debugger symbols
and section symbols.
- * som (setup_sections): Set SEC_DEBUGGING and the section attributes
+ * som.c (setup_sections): Set SEC_DEBUGGING and the section attributes
for spaces and subspaces.
* som.c (som_bfd_count_ar_symbols): Fix typo.
@@ -9587,7 +9587,7 @@ Mon Jan 24 12:38:54 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* elf32-hppa.c (hppa_elf_gen_reloc_type): Typo (== for =).
- * bfd/aoutx.h (aout_link_input_section_std,
+ * aoutx.h (aout_link_input_section_std,
aout_link_input_section_ext): Pass additional arguments to
reloc_overflow callback.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents,
diff --git a/contrib/binutils/bfd/ChangeLog-9697 b/contrib/binutils/bfd/ChangeLog-9697
index dc22c8c..e9a5c1d 100644
--- a/contrib/binutils/bfd/ChangeLog-9697
+++ b/contrib/binutils/bfd/ChangeLog-9697
@@ -235,7 +235,7 @@ Tue Nov 25 11:26:27 1997 Ian Lance Taylor <ian@cygnus.com>
* Makefile.am (BFD32_BACKENDS): Remove tekhex.lo.
(BFD32_BACKENDS_CFILES): Remove tekhex.c.
* Makefile.in: Rebuild.
- * aclocal.m4, configure, src/Makefile.in: Rebuild with current
+ * aclocal.m4, configure, Makefile.in: Rebuild with current
automake and autoconf.
* coff-arm.c (arm_allocate_interworking_sections): Fix typo
@@ -672,7 +672,7 @@ Tue Sep 9 10:21:56 1997 Nick Clifton <nickc@cygnus.com>
Sun Sep 7 12:25:22 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
- * bfd/elf64-alpha.c (reloc_howto_type): Fix the howto table.
+ * elf64-alpha.c (reloc_howto_type): Fix the howto table.
Thu Sep 4 09:44:10 1997 Ian Lance Taylor <ian@cygnus.com>
@@ -762,7 +762,10 @@ Tue Aug 26 17:26:51 1997 Ian Lance Taylor <ian@cygnus.com>
* acinclude.m4 (BFD_CC_FOR_BUILD): Set EXEEXT_FOR_BUILD.
* doc/Makefile.am (MKDOC): Use EXEEXT_FOR_BUILD, not EXEEXT.
- * aclocal.m4, configure, Makefile.in, doc/Makefile.in: Rebuild.
+ * aclocal.m4: Rebuild.
+ * configure: Rebuild.
+ * Makefile.in: Rebuild.
+ * doc/Makefile.in: Rebuild.
Mon Aug 25 16:14:34 1997 Christopher Provenzano <proven@cygnus.com>
@@ -920,8 +923,10 @@ Sun Aug 10 14:45:56 1997 Ian Lance Taylor <ian@cygnus.com>
* coff-stgo32.c: Rename from coff-stubgo32.c to avoid old System V
file system 14 character limit.
- * Makefile.am, configure.in: Corresponding changes.
- * Makefile.in, configure: Rebuild.
+ * Makefile.am: Corresponding changes.
+ * configure.in: Corresponding changes.
+ * Makefile.in: Rebuild.
+ * configure: Rebuild.
Fri Aug 8 18:34:36 1997 Ian Lance Taylor <ian@cygnus.com>
@@ -958,7 +963,9 @@ Fri Aug 1 12:58:32 1997 Ian Lance Taylor <ian@cygnus.com>
* acinclude.m4: Move acmacros.m4 in here. Remove AM_PROG_LIBTOOL
copy; use a patches libtool instead.
* acmacros.m4: Remove.
- * Makefile.in, aclocal.m4, configure: Rebuild.
+ * Makefile.in: Rebuild.
+ * aclocal.m4: Rebuild.
+ * configure: Rebuild.
Thu Jul 31 19:55:36 1997 Ian Lance Taylor <ian@cygnus.com>
@@ -2022,7 +2029,7 @@ Thu Mar 20 12:39:02 1997 Ian Lance Taylor <ian@cygnus.com>
* cf-m68klynx.c: Simplify greatly: just define macros to control
coff-m68k.c.
* coff-aux.c: Likewise. Just leave add_one_symbol routine.
- * targets. (m68ksysvcoff_vec): Declare.
+ * targets.c (m68ksysvcoff_vec): Declare.
(bfd_target_vector): Add m68ksysvcoff_vec.
* config.bfd (m68*-motorola-sysv*): New target.
* configure.in (m68ksysvcoff_vec): New vector.
@@ -2478,7 +2485,7 @@ Fri Feb 21 13:55:14 1997 Doug Evans <dje@seba.cygnus.com>
Store lower 16 bits of addend in R_M32R_HI16_[SU]LO insns.
Add small data area support (R_M32R_SDA16).
* reloc.c: Document BFD_RELOC_M32R_SDA16.
- * bfd-in2.h,libbfd.h: Regenerated.
+ * bfd-in2.h, libbfd.h: Regenerated.
Thu Feb 20 23:50:31 1997 Jeffrey A Law (law@cygnus.com)
@@ -2495,12 +2502,18 @@ Thu Feb 20 23:50:31 1997 Jeffrey A Law (law@cygnus.com)
Tue Feb 18 17:22:59 1997 Martin M. Hunt <hunt@pizza.cygnus.com>
- * Makefile.in, archures.c, config.bfd, configure.in, elf.c,
- reloc.c, targets.c: New target, elf-*-D30V.
-
- * bfd-in2.h, configure, libbfd.h: Rebuilt.
-
- * cpu-d30v.c, elf32-d30v.c: New files.
+ * Makefile.in: New target, elf-*-D30V.
+ * archures.c: New target, elf-*-D30V.
+ * config.bfd: New target, elf-*-D30V.
+ * configure.in: New target, elf-*-D30V.
+ * elf.c: New target, elf-*-D30V.
+ * reloc.c: New target, elf-*-D30V.
+ * targets.c: New target, elf-*-D30V.
+ * bfd-in2.h: Rebuilt.
+ * configure: Rebuilt.
+ * libbfd.h: Rebuilt.
+ * cpu-d30v.c: New files.
+ * elf32-d30v.c: New files.
Tue Feb 18 15:31:48 1997 Fred Fish <fnf@cygnus.com>
@@ -3398,8 +3411,8 @@ Wed Oct 2 15:46:45 1996 Klaus Kaempf <kkaempf@progis.de>
* evax-emh.c (get_vms_time_string): Local function now.
(_bfd_evax_write_emh): Extract source filename and case_hack flags
from symbol table.
- * evax_write_etir (_bfd_evax_write_etir): Pass all symbol names
- through _bfd_evax_case_hack_symbol.
+ (_bfd_evax_write_etir): Pass all symbol names through
+ _bfd_evax_case_hack_symbol.
* evax-misc.c (hash_string, _bfd_evax_case_hack_symbol): New
functions.
(_bfd_evax_basename): Removed.
@@ -3521,7 +3534,7 @@ Thu Sep 12 11:45:57 1996 Doug Evans <dje@seba.cygnus.com>
* reloc.c: Add m32r relocs.
* bfd-in2.h, libbfd.h: Rebuilt.
- * cpu-m32r.c,elf32-m32r.c: New files.
+ * cpu-m32r.c, elf32-m32r.c: New files.
Thu Sep 12 11:10:05 1996 Ian Lance Taylor <ian@cygnus.com>
@@ -3626,8 +3639,13 @@ Mon Sep 9 22:36:01 1996 Jeffrey A Law (law@cygnus.com)
Mon Sep 9 12:31:22 1996 Doug Evans <dje@canuck.cygnus.com>
- * config.bfd,configure.in,configure: Add m32r support.
- * Makefile.in,archures.c,elf.c,targets.c: Likewise.
+ * config.bfd: Add m32r support.
+ * configure.in: Likewise.
+ * configure: Likewise.
+ * Makefile.in: Likewise.
+ * archures.c: Likewise.
+ * elf.c: Likewise.
+ * targets.c: Likewise.
* config.bfd: Keep target list alphabetically sorted.
Mon Sep 9 11:48:41 1996 Jeffrey A Law (law@cygnus.com)
@@ -4320,7 +4338,7 @@ Tue Jun 25 11:41:24 1996 Richard Henderson <rth@tamu.edu>
Mon Jun 24 17:15:10 1996 Jason Molenda (crash@godzilla.cygnus.co.jp)
- * Makefile.in, (bindir, libdir, datadir, mandir, infodir, includedir):
+ * Makefile.in (bindir, libdir, datadir, mandir, infodir, includedir):
Use autoconf-set values.
* doc/Makefile.in (bindir, libdir, datadir, mandir, infodir,
includedir, INSTALL, INSTALL_PROGRAM, INSTALL_DATA): Use autoconf-set
@@ -4699,7 +4717,7 @@ Wed May 29 16:15:29 1996 Ian Lance Taylor <ian@cygnus.com>
* config.bfd (mips*el-*-elf*) Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to targ_selvecs.
(mips*-*-elf*): Likewise.
- * confingure.in: Add bfd_elf64_bigmips_vec and
+ * configure.in: Add bfd_elf64_bigmips_vec and
bfd_elf64_littlemips_vec to vector switch.
* configure: Rebuild.
* elf32-mips.c (_bfd_mips_elf_section_from_shdr): New function,
@@ -5110,7 +5128,7 @@ Wed Apr 17 12:08:24 1996 Michael Meissner <meissner@tiktok.cygnus.com>
* pe{,i}-ppc.c (PPC_PE): Define instead of PPC, so that compiling
on Solaris PowerPC systems doesn't get confused.
- * ccffcode.h (coff_write_object_contents): Use #ifdef PPC_PE, not
+ * coffcode.h (coff_write_object_contents): Use #ifdef PPC_PE, not
#ifdef PPC.
* elfcore.h (bfd_prstatus, bfd_fpregset): Add thread argument.
diff --git a/contrib/binutils/bfd/ChangeLog-9899 b/contrib/binutils/bfd/ChangeLog-9899
index c6348c4..6d7f5cd 100644
--- a/contrib/binutils/bfd/ChangeLog-9899
+++ b/contrib/binutils/bfd/ChangeLog-9899
@@ -2072,10 +2072,10 @@ Wed Jun 16 03:09:57 1999 Jeffrey A Law (law@cygnus.com)
1999-06-10 Jakub Jelinek <jj@ultra.linux.cz>
- * elf64_sparc.c (sparc64_elf_relocate_section): Use R_SPARC_max_std
+ * elf64-sparc.c (sparc64_elf_relocate_section): Use R_SPARC_max_std
instead of R_SPARC_max.
(sparc64_elf_info_to_howto): Likewise.
- * elf32_sparc.c (elf32_sparc_relocate_section): Likewise.
+ * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
(elf32_sparc_info_to_howto): Likewise; handle vtable relocations.
1999-06-07 Richard Henderson <rth@cygnus.com>
@@ -2380,7 +2380,7 @@ Wed Jun 2 11:51:12 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
1999-05-25 Philip Blundell <pb@nexus.co.uk>
- * bfd/elf32-arm.h (elf32_arm_link_hash_newfunc): New function.
+ * elf32-arm.h (elf32_arm_link_hash_newfunc): New function.
(elf32_arm_link_hash_table_create): Use above function as the
constructor for hash table entries.
(elf32_arm_relocate_section): Avoid crash when there is no output
@@ -2431,7 +2431,7 @@ Mon May 17 13:35:35 1999 Stan Cox <scox@cygnus.com>
IMAGE_REL_MCORE_RVA.
(coff_mcore_relocate_section): Add support for
IMAGE_REL_MCORE_RVA.
- * elf32-mcore (mcore_elf_howto_): Add R_MCORE_RELATIVE.
+ * elf32-mcore.c (mcore_elf_howto_): Add R_MCORE_RELATIVE.
(mcore_elf_reloc_type_lookup): Map BFD_RELOC_RVA to
R_MCORE_RELATIVE.
(mcore_elf_relocate_section): Delete redundant case labels.
@@ -2724,9 +2724,9 @@ Sat Apr 10 15:12:09 1999 Richard Henderson <rth@cygnus.com>
* targets.c: Add support for arm-epoc-pe target.
* coff-arm.c: Allow header files to override definition of
TARGET_UNDERSCORE and USER_LABEL_PREFIX.
- * pe-arm.h: Allow previous header files to override definition of
+ * pe-arm.c: Allow previous header files to override definition of
TARGET_LITTLE_SYM and TARGET_BIG_SYM.
- * pei-arm.h: Allow previous header files to override definition of
+ * pei-arm.c: Allow previous header files to override definition of
TARGET_LITTLE_SYM and TARGET_BIG_SYM.
* epoc-pe-arm.c: New file. Support arm-epoc-pe target.
* epoc-pei-arm.c: New file. Support arm-epoc-pei target.
@@ -3079,7 +3079,8 @@ Tue Dec 22 15:21:41 1998 Catherine Moore <clm@cygnus.com>
1998-12-16 Gavin Romig-Koch <gavin@cygnus.com>
- * archures.c,bfd-in2.h (bfd_mach_mips4111): New.
+ * archures.c (bfd_mach_mips4111): New.
+ * bfd-in2.h: Regenerate.
* cpu-mips.c: Add support for and independent 4111.
* elf32-mips.c (elf_mips_mach): E_MIPS_MACH_4111 -> bfd_mach_mips4111.
(_bfd_mips_elf_final_write_processing):
@@ -3597,7 +3598,7 @@ Mon Oct 5 12:02:31 1998 Gavin Romig-Koch <gavin@cygnus.com>
* dwarf1.c : New file. Adds _bfd_dwarf1_find_nearest_line.
* configure.in (elf): Add dwarf1.lo.
- * elf_bfd.h (elf_ob_tdata): Add dwarf1_find_line_info.
+ * elf-bfd.h (elf_ob_tdata): Add dwarf1_find_line_info.
* elf.c (_bfd_elf_find_nearest_line): Add call to
_bfd_dwarf1_find_nearest_line.
* elf32-mips.c (_bfd_mips_elf_find_nearest_line):
@@ -4334,7 +4335,10 @@ Thu Jun 25 18:31:41 1998 Richard Henderson <rth@cygnus.com>
* aout-adobe.c: Hook to default implementation.
* aout-target.h, aout-tic30.c, binary.c, bout.c: Likewise.
* coff-alpha.c, coff-mips.c, coff-rs6000.c, coffcode.h: Likewise.
- * evax-alpha.c, i386msdos.c, i386os9k.c, ieee.c: Likewise.
+ * evax-alpha.c: Likewise.
+ * i386msdos.c: Likewise.
+ * i386os9k.c: Likewise.
+ * ieee.c: Likewise.
* ihex.c, nlm-target.h, oasys.c, ppcboot.c, srec.c: Likewise.
* tekhex.c, versados.c: Likewise.
* libbfd-in.h (_bfd_nolink_bfd_gc_sections): New.
@@ -4600,7 +4604,7 @@ Thu May 7 17:40:56 1998 Ian Lance Taylor <ian@cygnus.com>
* aoutx.h: Don't include <string.h>. Use "sysdep.h" rather than
<sysdep.h>.
* archive.c: Don't include <string.h> or <errno.h>.
- * evax-alpha.c; Don't include <stdio.h>.
+ * evax-alpha.c: Don't include <stdio.h>.
* evax-egsd.c: Likewise.
* evax-etir.c: Likewise.
* evax-misc.c: Likewise.
diff --git a/contrib/binutils/bfd/Makefile.am b/contrib/binutils/bfd/Makefile.am
index 630cbe1..c96f171 100644
--- a/contrib/binutils/bfd/Makefile.am
+++ b/contrib/binutils/bfd/Makefile.am
@@ -25,19 +25,23 @@ BFD_H = bfd.h
# for the debugger, so if you are downloading things as S-records you
# need two copies of the executable, one to download and one for the
# debugger).
-BFD_LIBS = \
+BFD32_LIBS = \
archive.lo archures.lo bfd.lo cache.lo coffgen.lo corefile.lo \
format.lo init.lo libbfd.lo opncls.lo reloc.lo \
section.lo syms.lo targets.lo hash.lo linker.lo \
srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo \
- dwarf2.lo
+ merge.lo dwarf2.lo
-BFD_LIBS_CFILES = \
+BFD64_LIBS = archive64.lo
+
+BFD32_LIBS_CFILES = \
archive.c archures.c bfd.c cache.c coffgen.c corefile.c \
format.c init.c libbfd.c opncls.c reloc.c \
section.c syms.c targets.c hash.c linker.c \
srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \
- dwarf2.c
+ merge.c dwarf2.c
+
+BFD64_LIBS_CFILES = archive64.c
# This list is alphabetized to make it easier to keep in sync
# with the decls and initializer in archures.c.
@@ -68,10 +72,14 @@ ALL_MACHINES = \
cpu-m10300.lo \
cpu-mcore.lo \
cpu-mips.lo \
+ cpu-mmix.lo \
cpu-ns32k.lo \
+ cpu-openrisc.lo \
+ cpu-pdp11.lo \
cpu-pj.lo \
cpu-powerpc.lo \
cpu-rs6000.lo \
+ cpu-s390.lo \
cpu-sh.lo \
cpu-sparc.lo \
cpu-tic30.lo \
@@ -81,6 +89,7 @@ ALL_MACHINES = \
cpu-vax.lo \
cpu-we32k.lo \
cpu-w65.lo \
+ cpu-xstormy16.lo \
cpu-z8k.lo
ALL_MACHINES_CFILES = \
@@ -110,10 +119,14 @@ ALL_MACHINES_CFILES = \
cpu-m10300.c \
cpu-mcore.c \
cpu-mips.c \
+ cpu-mmix.c \
cpu-ns32k.c \
+ cpu-openrisc.c \
+ cpu-pdp11.c \
cpu-pj.c \
cpu-powerpc.c \
cpu-rs6000.c \
+ cpu-s390.c \
cpu-sh.c \
cpu-sparc.c \
cpu-tic30.c \
@@ -123,6 +136,7 @@ ALL_MACHINES_CFILES = \
cpu-vax.c \
cpu-we32k.c \
cpu-w65.c \
+ cpu-xstormy16.c \
cpu-z8k.c
# The .o files needed by all of the 32 bit vectors that are configured into
@@ -154,7 +168,6 @@ BFD32_BACKENDS = \
coff-m68k.lo \
coff-m88k.lo \
coff-mips.lo \
- coff-pmac.lo \
coff-rs6000.lo \
coff-sh.lo \
coff-sparc.lo \
@@ -182,6 +195,7 @@ BFD32_BACKENDS = \
elf32-d30v.lo \
elf32-fr30.lo \
elf32-gen.lo \
+ elf32-h8300.lo \
elf32-hppa.lo \
elf32-i370.lo \
elf32-i386.lo \
@@ -197,14 +211,20 @@ BFD32_BACKENDS = \
elf-m10300.lo \
elf32-mcore.lo \
elf32-mips.lo \
+ elf32-openrisc.lo \
elf32-pj.lo \
elf32-ppc.lo \
+ elf32-s390.lo \
elf32-sh.lo \
elf32-sh-lin.lo \
+ elf32-sh-nbsd.lo \
elf32-sparc.lo \
elf32-v850.lo \
+ elf32-xstormy16.lo \
elf32.lo \
elflink.lo \
+ elf-strtab.lo \
+ elf-eh-frame.lo \
epoc-pe-arm.lo \
epoc-pei-arm.lo \
hp300bsd.lo \
@@ -236,6 +256,7 @@ BFD32_BACKENDS = \
ns32knetbsd.lo \
oasys.lo \
pc532-mach.lo \
+ pdp11.lo \
pe-arm.lo \
pei-arm.lo \
pe-i386.lo \
@@ -292,7 +313,6 @@ BFD32_BACKENDS_CFILES = \
coff-m68k.c \
coff-m88k.c \
coff-mips.c \
- coff-pmac.c \
coff-rs6000.c \
coff-sh.c \
coff-sparc.c \
@@ -320,6 +340,7 @@ BFD32_BACKENDS_CFILES = \
elf32-d30v.c \
elf32-fr30.c \
elf32-gen.c \
+ elf32-h8300.c \
elf32-hppa.c \
elf32-i370.c \
elf32-i386.c \
@@ -334,14 +355,20 @@ BFD32_BACKENDS_CFILES = \
elf-m10300.c \
elf32-mcore.c \
elf32-mips.c \
+ elf32-openrisc.c \
elf32-pj.c \
elf32-ppc.c \
+ elf32-s390.c \
elf32-sh.c \
elf32-sh-lin.c \
+ elf32-sh-nbsd.c \
elf32-sparc.c \
elf32-v850.c \
+ elf32-xstormy16.c \
elf32.c \
elflink.c \
+ elf-strtab.c \
+ elf-eh-frame.c \
epoc-pe-arm.c \
epoc-pei-arm.c \
hp300bsd.c \
@@ -373,6 +400,7 @@ BFD32_BACKENDS_CFILES = \
ns32knetbsd.c \
oasys.c \
pc532-mach.c \
+ pdp11.c \
pe-arm.c \
pei-arm.c \
pe-i386.c \
@@ -416,8 +444,12 @@ BFD64_BACKENDS = \
elf64-ia64.lo \
elf64-gen.lo \
elf64-mips.lo \
+ elf64-mmix.lo \
+ elf64-ppc.lo \
+ elf64-s390.lo \
elf64-sparc.lo \
elf64.lo \
+ mmo.lo \
nlm32-alpha.lo \
nlm64.lo \
pepigen.lo
@@ -433,8 +465,12 @@ BFD64_BACKENDS_CFILES = \
elf64-hppa.c \
elf64-gen.c \
elf64-mips.c \
+ elf64-mmix.c \
+ elf64-ppc.c \
+ elf64-s390.c \
elf64-sparc.c \
elf64.c \
+ mmo.c \
nlm32-alpha.c \
nlm64.c
@@ -462,6 +498,7 @@ OPTIONAL_BACKENDS_CFILES = \
WORDSIZE = @wordsize@
ALL_BACKENDS = @all_backends@
BFD_BACKENDS = @bfd_backends@
+BFD_LIBS = @bfd_libs@
BFD_MACHINES = @bfd_machines@
TDEFAULTS = @tdefaults@
@@ -469,7 +506,8 @@ INCLUDES = -D_GNU_SOURCE @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES
# C source files that correspond to .o's.
SOURCE_CFILES = \
- $(BFD_LIBS_CFILES) \
+ $(BFD32_LIBS_CFILES) \
+ $(BFD64_LIBS_CFILES) \
$(ALL_MACHINES_CFILES) \
$(BFD32_BACKENDS_CFILES) \
$(BFD64_BACKENDS_CFILES) \
@@ -487,7 +525,8 @@ SOURCE_HFILES = \
elfcode.h elfcore.h elflink.h freebsd.h genlink.h go32stub.h \
libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \
libieee.h libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h \
- nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h xcoff-target.h
+ nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h libxcoff.h \
+ xcoff-target.h version.h
## ... and all .h files which are in the build tree.
BUILD_HFILES = \
@@ -499,12 +538,12 @@ SRC_POTFILES = $(SOURCE_CFILES) $(SOURCE_HFILES)
BLD_POTFILES = $(BUILD_CFILES) $(BUILD_HFILES)
po/SRC-POTFILES.in: @MAINT@ Makefile $(SRC_POTFILES)
- for file in $(SRC_POTFILES); do echo $$file; done | sort > tmp \
- && mv tmp $(srcdir)/po/SRC-POTFILES.in
+ for file in $(SRC_POTFILES); do echo $$file; done | sort > tmp.src \
+ && mv tmp.src $(srcdir)/po/SRC-POTFILES.in
po/BLD-POTFILES.in: @MAINT@ Makefile $(BLD_POTFILES)
- for file in $(BLD_POTFILES); do echo $$file; done | sort > tmp \
- && mv tmp $(srcdir)/po/BLD-POTFILES.in
+ for file in $(BLD_POTFILES); do echo $$file; done | sort > tmp.bld \
+ && mv tmp.bld $(srcdir)/po/BLD-POTFILES.in
# The following target is retained for upgrade purposes.
# This target used to exist in older versions of this makefile, and was
@@ -539,7 +578,7 @@ stamp-ofiles: Makefile
ofiles: stamp-ofiles ; @true
-libbfd_la_SOURCES = $(BFD_LIBS_CFILES)
+libbfd_la_SOURCES = $(BFD32_LIBS_CFILES) $(BFD64_LIBS_CFILES)
libbfd_la_DEPENDENCIES = $(OFILES) ofiles
libbfd_la_LIBADD = `cat ofiles` @WIN32LIBADD@
libbfd_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@
@@ -610,12 +649,14 @@ pepigen.c : peXXigen.c
sed -e s/XX/pep/g < $(srcdir)/peXXigen.c > pepigen.new
mv -f pepigen.new pepigen.c
-BFD_H_DEPS= $(INCDIR)/ansidecl.h
+BFD_H_DEPS= $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
LOCAL_H_DEPS= libbfd.h sysdep.h config.h
-$(BFD_LIBS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
-$(BFD_MACHINES): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
-$(BFD_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
-$(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
+$(BFD32_LIBS) \
+ $(BFD64_LIBS) \
+ $(ALL_MACHINES) \
+ $(BFD32_BACKENDS) \
+ $(BFD64_BACKENDS) \
+ $(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
# Install BFD include file, and others that it needs.
install-data-local: $(BFD_H)
@@ -623,8 +664,10 @@ install-data-local: $(BFD_H)
$(mkinstalldirs) $(DESTDIR)$(includedir)
$(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(includedir)/bfd.h
$(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(includedir)/ansidecl.h
+ $(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(includedir)/symcat.h
$(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(includedir)/bfdlink.h
+Makefile: $(srcdir)/configure.in
# Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES).
DEP: dep.sed $(CFILES) $(HFILES) bfd.h
@@ -684,7 +727,8 @@ stmp-bfd-h: bfd-in3.h
touch stmp-bfd-h
BFD_H_FILES = bfd-in.h init.c opncls.c libbfd.c section.c archures.c \
- reloc.c syms.c bfd.c archive.c corefile.c targets.c format.c
+ reloc.c syms.c bfd.c archive.c corefile.c targets.c format.c version.h
+BFD64_H_FILES = archive64.c
LIBBFD_H_FILES = libbfd-in.h init.c libbfd.c cache.c reloc.c archures.c elf.c
LIBCOFF_H_FILES = libcoff-in.h coffcode.h
@@ -702,7 +746,7 @@ headers:
# configured with --enable-maintainer-mode.
$(srcdir)/bfd-in2.h: @MAINT@ stmp-bin2-h ; @true
-stmp-bin2-h: $(BFD_H_FILES)
+stmp-bin2-h: $(BFD_H_FILES) $(BFD64_H_FILES)
(cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) bfd.h)
cp $(docdir)/bfd.h bfd-in2.h-new
$(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h
@@ -739,12 +783,13 @@ config.status: $(srcdir)/configure $(srcdir)/config.bfd $(srcdir)/configure.host
# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
archive.lo: archive.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \
- $(INCDIR)/aout/ranlib.h
-archures.lo: archures.c $(INCDIR)/filenames.h
+ $(INCDIR)/aout/ranlib.h $(INCDIR)/safe-ctype.h
+archures.lo: archures.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h
bfd.lo: bfd.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \
- libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h
+ $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/sym.h libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h
cache.lo: cache.c $(INCDIR)/filenames.h
coffgen.lo: coffgen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
libcoff.h $(INCDIR)/bfdlink.h
@@ -755,24 +800,28 @@ libbfd.lo: libbfd.c $(INCDIR)/filenames.h
opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h
reloc.lo: reloc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h
section.lo: section.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h
-syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
+syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
targets.lo: targets.c $(INCDIR)/filenames.h $(INCDIR)/fnmatch.h \
targmatch.h
hash.lo: hash.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h
linker.lo: linker.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
genlink.h
-srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
-binary.lo: binary.c $(INCDIR)/filenames.h
+srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/safe-ctype.h
+binary.lo: binary.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h
tekhex.lo: tekhex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
-ihex.lo: ihex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
+ihex.lo: ihex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/safe-ctype.h
stabs.lo: stabs.c $(INCDIR)/filenames.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def
+ $(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h
stab-syms.lo: stab-syms.c libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab.def
+merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
dwarf2.lo: dwarf2.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
+archive64.lo: archive64.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h
cpu-a29k.lo: cpu-a29k.c $(INCDIR)/filenames.h
cpu-alpha.lo: cpu-alpha.c $(INCDIR)/filenames.h
cpu-arc.lo: cpu-arc.c $(INCDIR)/filenames.h
@@ -800,47 +849,55 @@ cpu-m10200.lo: cpu-m10200.c $(INCDIR)/filenames.h
cpu-m10300.lo: cpu-m10300.c $(INCDIR)/filenames.h
cpu-mcore.lo: cpu-mcore.c $(INCDIR)/filenames.h
cpu-mips.lo: cpu-mips.c $(INCDIR)/filenames.h
+cpu-mmix.lo: cpu-mmix.c $(INCDIR)/filenames.h
cpu-ns32k.lo: cpu-ns32k.c $(INCDIR)/filenames.h ns32k.h
+cpu-openrisc.lo: cpu-openrisc.c $(INCDIR)/filenames.h
+cpu-pdp11.lo: cpu-pdp11.c $(INCDIR)/filenames.h
cpu-pj.lo: cpu-pj.c $(INCDIR)/filenames.h
cpu-powerpc.lo: cpu-powerpc.c $(INCDIR)/filenames.h
cpu-rs6000.lo: cpu-rs6000.c $(INCDIR)/filenames.h
+cpu-s390.lo: cpu-s390.c $(INCDIR)/filenames.h
cpu-sh.lo: cpu-sh.c $(INCDIR)/filenames.h
cpu-sparc.lo: cpu-sparc.c $(INCDIR)/filenames.h
cpu-tic30.lo: cpu-tic30.c $(INCDIR)/filenames.h
cpu-tic54x.lo: cpu-tic54x.c $(INCDIR)/filenames.h
cpu-tic80.lo: cpu-tic80.c $(INCDIR)/filenames.h
-cpu-v850.lo: cpu-v850.c $(INCDIR)/filenames.h
+cpu-v850.lo: cpu-v850.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h
cpu-vax.lo: cpu-vax.c $(INCDIR)/filenames.h
cpu-we32k.lo: cpu-we32k.c $(INCDIR)/filenames.h
cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h
+cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h
cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h
aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/aout/adobe.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \
$(INCDIR)/bfdlink.h
aout-arm.lo: aout-arm.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aoutx.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- aout-target.h
+ $(INCDIR)/safe-ctype.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
+ $(INCDIR)/aout/ar.h aout-target.h
aout-cris.lo: aout-cris.c aout32.c aoutx.h $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- aout-target.h
+ $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h libaout.h \
+ $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
+ $(INCDIR)/aout/ar.h aout-target.h
aout-ns32k.lo: aout-ns32k.c $(INCDIR)/aout/aout64.h \
- ns32k.h libaout.h $(INCDIR)/bfdlink.h
+ ns32k.h libaout.h $(INCDIR)/bfdlink.h aoutx.h $(INCDIR)/filenames.h \
+ $(INCDIR)/safe-ctype.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
+ $(INCDIR)/aout/ar.h
aout-sparcle.lo: aout-sparcle.c $(INCDIR)/bfdlink.h \
libaout.h aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
$(INCDIR)/aout/ar.h aout-target.h
aout-tic30.lo: aout-tic30.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aoutx.h
+ $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aoutx.h \
+ $(INCDIR)/safe-ctype.h
aout0.lo: aout0.c aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \
libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
aout-target.h
-aout32.lo: aout32.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- libaout.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
+aout32.lo: aout32.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
+ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
armnetbsd.lo: armnetbsd.c netbsd.h $(INCDIR)/filenames.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
@@ -848,94 +905,94 @@ bout.lo: bout.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
genlink.h $(INCDIR)/bout.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def libaout.h
cf-i386lynx.lo: cf-i386lynx.c $(INCDIR)/filenames.h \
- coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
+ coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
+ coffcode.h coffswap.h
cf-m68klynx.lo: cf-m68klynx.c coff-m68k.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/m68k.h $(INCDIR)/coff/internal.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h coffswap.h
+ $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
cf-sparclynx.lo: cf-sparclynx.c coff-sparc.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/sparc.h $(INCDIR)/coff/internal.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h coffswap.h
+ $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-a29k.lo: coff-a29k.c $(INCDIR)/filenames.h $(INCDIR)/coff/a29k.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-apollo.lo: coff-apollo.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/apollo.h $(INCDIR)/coff/internal.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h coffswap.h
+ $(INCDIR)/coff/apollo.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-arm.lo: coff-arm.c $(INCDIR)/filenames.h $(INCDIR)/coff/arm.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
-coff-aux.lo: coff-aux.c $(INCDIR)/filenames.h $(INCDIR)/coff/aux-coff.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h coff-m68k.c \
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
+coff-aux.lo: coff-aux.c $(INCDIR)/filenames.h $(INCDIR)/coff/aux-coff.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \
+ coff-m68k.c libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ coffswap.h
coff-h8300.lo: coff-h8300.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- genlink.h $(INCDIR)/coff/h8300.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
+ genlink.h $(INCDIR)/coff/h8300.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
coff-h8500.lo: coff-h8500.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/h8500.h $(INCDIR)/coff/internal.h libcoff.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h coffcode.h coffswap.h
coff-i386.lo: coff-i386.c $(INCDIR)/filenames.h $(INCDIR)/coff/i386.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-i860.lo: coff-i860.c $(INCDIR)/filenames.h $(INCDIR)/coff/i860.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-go32.lo: coff-go32.c coff-i386.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h coffswap.h
+ $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-i960.lo: coff-i960.c $(INCDIR)/filenames.h $(INCDIR)/coff/i960.h \
$(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
coffcode.h coffswap.h
coff-m68k.lo: coff-m68k.c $(INCDIR)/filenames.h $(INCDIR)/coff/m68k.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-m88k.lo: coff-m88k.c $(INCDIR)/filenames.h $(INCDIR)/coff/m88k.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-mips.lo: coff-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
- $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h libcoff.h \
- libecoff.h coffswap.h ecoffswap.h
-coff-pmac.lo: coff-pmac.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/rs6000.h libcoff.h $(INCDIR)/bfdlink.h \
- xcoff-target.h coffcode.h coffswap.h
+ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \
+ libcoff.h libecoff.h coffswap.h ecoffswap.h
coff-rs6000.lo: coff-rs6000.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h libcoff.h \
- $(INCDIR)/bfdlink.h xcoff-target.h coffcode.h coffswap.h
-coff-sh.lo: coff-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/sh.h $(INCDIR)/coff/internal.h libcoff.h \
- coffcode.h coffswap.h
+ $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \
+ $(INCDIR)/coff/rs6000.h libcoff.h libxcoff.h coffcode.h \
+ coffswap.h
+coff-sh.lo: coff-sh.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
coff-sparc.lo: coff-sparc.c $(INCDIR)/filenames.h $(INCDIR)/coff/sparc.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-stgo32.lo: coff-stgo32.c coff-i386.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/go32exe.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h \
- go32stub.h
+ $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/go32exe.h libcoff.h $(INCDIR)/bfdlink.h \
+ coffcode.h coffswap.h go32stub.h
coff-svm68k.lo: coff-svm68k.c coff-m68k.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/m68k.h $(INCDIR)/coff/internal.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h coffswap.h
+ $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-tic30.lo: coff-tic30.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/tic30.h $(INCDIR)/coff/internal.h libcoff.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h coffcode.h coffswap.h
coff-tic54x.lo: coff-tic54x.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \
$(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
coff-tic80.lo: coff-tic80.c $(INCDIR)/bfdlink.h $(INCDIR)/filenames.h \
- $(INCDIR)/coff/tic80.h $(INCDIR)/coff/internal.h libcoff.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h coffcode.h coffswap.h
coff-u68k.lo: coff-u68k.c coff-m68k.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/m68k.h $(INCDIR)/coff/internal.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h coffswap.h
+ $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-we32k.lo: coff-we32k.c $(INCDIR)/filenames.h $(INCDIR)/coff/we32k.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-w65.lo: coff-w65.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/w65.h $(INCDIR)/coff/internal.h libcoff.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h coffcode.h coffswap.h
coff-z8k.lo: coff-z8k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/z8k.h $(INCDIR)/coff/internal.h libcoff.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h coffcode.h coffswap.h
cofflink.lo: cofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/internal.h libcoff.h
dwarf1.lo: dwarf1.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
@@ -951,16 +1008,16 @@ ecofflink.lo: ecofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
$(INCDIR)/coff/ecoff.h libcoff.h libecoff.h
efi-app-ia32.lo: efi-app-ia32.c $(INCDIR)/filenames.h \
- coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
+ coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
elf.lo: elf.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h
+ $(INCDIR)/elf/external.h $(INCDIR)/libiberty.h
elf32-arc.lo: elf32-arc.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
+ $(INCDIR)/libiberty.h elf32-target.h
elfarm-oabi.lo: elfarm-oabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \
$(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
@@ -992,6 +1049,10 @@ elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h elf-bfd.h \
elf32-gen.lo: elf32-gen.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h elf32-target.h
+elf32-h8300.lo: elf32-h8300.c $(INCDIR)/filenames.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/h8.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-hppa.lo: elf32-hppa.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \
@@ -1045,7 +1106,12 @@ elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
genlink.h elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \
$(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h ecoffswap.h \
+ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \
+ ecoffswap.h elf32-target.h
+elf32-openrisc.lo: elf32-openrisc.c $(INCDIR)/filenames.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/openrisc.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
elf32-target.h
elf32-pj.lo: elf32-pj.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
@@ -1055,11 +1121,19 @@ elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
+elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.h
elf32-sh.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
-elf32-sh-lin.lo: elf32-sh-lin.c elf32-sh.c $(INCDIR)/filenames.h \
+elf32-sh-lin.lo: elf32-sh-lin.c $(INCDIR)/filenames.h \
+ $(INCDIR)/elf/internal.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-sh.c \
+ $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-sh-nbsd.lo: elf32-sh-nbsd.c elf32-sh.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
@@ -1071,28 +1145,41 @@ elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
elf32-v850.lo: elf32-v850.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/libiberty.h elf32-target.h
+elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h elfcore.h elflink.h
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
+ elf32-target.h
+elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \
+ elflink.h
elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h
+elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h
+elf-eh-frame.lo: elf-eh-frame.c $(INCDIR)/filenames.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
epoc-pe-arm.lo: epoc-pe-arm.c pe-arm.c $(INCDIR)/filenames.h \
- coff-arm.c $(INCDIR)/coff/arm.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
+ coff-arm.c $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
epoc-pei-arm.lo: epoc-pei-arm.c pei-arm.c $(INCDIR)/filenames.h \
- coff-arm.c $(INCDIR)/coff/arm.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
+ coff-arm.c $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
hp300bsd.lo: hp300bsd.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
hp300hpux.lo: hp300hpux.c $(INCDIR)/aout/hp300hpux.h \
- aoutx.h $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h libaout.h \
- $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
- $(INCDIR)/aout/ar.h aout-target.h
+ aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
+ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
+ aout-target.h
som.lo: som.c $(INCDIR)/alloca-conf.h $(INCDIR)/filenames.h
i386aout.lo: i386aout.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/stab_gnu.h \
@@ -1101,9 +1188,9 @@ i386bsd.lo: i386bsd.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
i386dynix.lo: i386dynix.c $(INCDIR)/aout/dynix3.h aoutx.h \
- $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h libaout.h \
- $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
- $(INCDIR)/aout/ar.h aout-target.h
+ $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h \
+ libaout.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
+ $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h
i386freebsd.lo: i386freebsd.c freebsd.h $(INCDIR)/filenames.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
@@ -1124,7 +1211,7 @@ i386mach3.lo: i386mach3.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
i386os9k.lo: i386os9k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
libaout.h $(INCDIR)/os9k.h
ieee.lo: ieee.c $(INCDIR)/filenames.h $(INCDIR)/ieee.h \
- libieee.h
+ libieee.h $(INCDIR)/safe-ctype.h
m68k4knetbsd.lo: m68k4knetbsd.c netbsd.h $(INCDIR)/filenames.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
@@ -1163,58 +1250,64 @@ nlm32.lo: nlm32.c nlmcode.h $(INCDIR)/filenames.h libnlm.h \
ns32knetbsd.lo: ns32knetbsd.c netbsd.h $(INCDIR)/filenames.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-oasys.lo: oasys.c $(INCDIR)/filenames.h $(INCDIR)/oasys.h \
- liboasys.h
+oasys.lo: oasys.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/oasys.h liboasys.h
pc532-mach.lo: pc532-mach.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
+pdp11.lo: pdp11.c $(INCDIR)/filenames.h libaout.h $(INCDIR)/bfdlink.h \
+ aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
+ $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h $(INCDIR)/safe-ctype.h
pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \
- $(INCDIR)/coff/arm.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h peicode.h \
- libpei.h
+ $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ peicode.h libpei.h
pei-arm.lo: pei-arm.c $(INCDIR)/filenames.h coff-arm.c \
- $(INCDIR)/coff/arm.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h peicode.h \
- libpei.h
+ $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ peicode.h libpei.h
pe-i386.lo: pe-i386.c $(INCDIR)/filenames.h coff-i386.c \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h peicode.h \
- libpei.h
+ $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ peicode.h libpei.h
pei-i386.lo: pei-i386.c $(INCDIR)/filenames.h coff-i386.c \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h peicode.h \
- libpei.h
+ $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ peicode.h libpei.h
pe-mcore.lo: pe-mcore.c $(INCDIR)/filenames.h coff-mcore.c \
- $(INCDIR)/coff/mcore.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h peicode.h \
- libpei.h
-pei-mcore.lo: pei-mcore.c $(INCDIR)/filenames.h coff-mcore.c \
- $(INCDIR)/coff/mcore.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h peicode.h \
- libpei.h
-pe-ppc.lo: pe-ppc.c $(INCDIR)/filenames.h coff-ppc.c \
- $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
peicode.h libpei.h
-pei-ppc.lo: pei-ppc.c $(INCDIR)/filenames.h coff-ppc.c \
- $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/internal.h \
+pei-mcore.lo: pei-mcore.c $(INCDIR)/filenames.h coff-mcore.c \
+ $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
peicode.h libpei.h
-pe-sh.lo: pe-sh.c $(INCDIR)/filenames.h coff-sh.c $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/sh.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
- libcoff.h coffcode.h peicode.h libpei.h
+pe-ppc.lo: pe-ppc.c $(INCDIR)/filenames.h coff-ppc.c \
+ $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
+pei-ppc.lo: pei-ppc.c $(INCDIR)/filenames.h coff-ppc.c \
+ $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
+pe-sh.lo: pe-sh.c $(INCDIR)/filenames.h coff-sh.c $(INCDIR)/libiberty.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ coffcode.h peicode.h libpei.h
pei-sh.lo: pei-sh.c $(INCDIR)/filenames.h coff-sh.c \
- $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/libiberty.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/pe.h libcoff.h coffcode.h peicode.h \
libpei.h
pe-mips.lo: pe-mips.c $(INCDIR)/filenames.h $(INCDIR)/coff/mipspe.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ peicode.h libpei.h
pei-mips.lo: pei-mips.c $(INCDIR)/filenames.h pe-mips.c \
- $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h peicode.h \
- libpei.h
-ppcboot.lo: ppcboot.c $(INCDIR)/filenames.h
+ $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ peicode.h libpei.h
+ppcboot.lo: ppcboot.c $(INCDIR)/safe-ctype.h $(INCDIR)/filenames.h
reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
genlink.h $(INCDIR)/coff/internal.h libcoff.h
riscix.lo: riscix.c $(INCDIR)/filenames.h libaout.h \
@@ -1243,31 +1336,33 @@ vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
vms-gsd.lo: vms-gsd.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
vms.h
vms-hdr.lo: vms-hdr.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- vms.h
+ $(INCDIR)/safe-ctype.h vms.h
vms-misc.lo: vms-misc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
vms.h
vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
vms.h
xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/internal.h libcoff.h
-aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- libaout.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \
+ libxcoff.h
+aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
+ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
coff-alpha.lo: coff-alpha.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h \
libcoff.h libecoff.h coffswap.h ecoffswap.h
coff64-rs6000.lo: coff64-rs6000.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6k64.h libcoff.h \
- $(INCDIR)/bfdlink.h xcoff-target.h coffcode.h coffswap.h
+ $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \
+ $(INCDIR)/coff/rs6k64.h libcoff.h libxcoff.h coffcode.h \
+ coffswap.h
demo64.lo: demo64.c aoutf1.h $(INCDIR)/filenames.h \
$(INCDIR)/aout/sun4.h libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
$(INCDIR)/aout/ar.h aout-target.h
efi-app-ia64.lo: efi-app-ia64.c $(INCDIR)/filenames.h \
- coff-ia64.c $(INCDIR)/coff/ia64.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
+ coff-ia64.c $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
elf64-x86-64.lo: elf64-x86-64.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/x86-64.h \
@@ -1293,14 +1388,29 @@ elf64-mips.lo: elf64-mips.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h \
ecoffswap.h elf64-target.h
+elf64-mmix.lo: elf64-mmix.c $(INCDIR)/filenames.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h \
+ $(INCDIR)/opcode/mmix.h elf64-target.h
+elf64-ppc.lo: elf64-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \
+ elf64-ppc.h elf64-target.h
+elf64-s390.lo: elf64-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \
+ elf64-target.h
elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/sparc.h \
$(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \
elf64-target.h
-elf64.lo: elf64.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h elfcore.h elflink.h
+elf64.lo: elf64.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \
+ elflink.h
+mmo.lo: mmo.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/mmix.h
nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \
$(INCDIR)/nlm/alpha-ext.h libnlm.h $(INCDIR)/nlm/common.h \
$(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h nlmswap.h \
@@ -1308,8 +1418,8 @@ nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \
nlm64.lo: nlm64.c nlmcode.h $(INCDIR)/filenames.h libnlm.h \
$(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h
aix386-core.lo: aix386-core.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h libcoff.h \
- $(INCDIR)/bfdlink.h
+ $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h
hpux-core.lo: hpux-core.c $(INCDIR)/filenames.h
irix-core.lo: irix-core.c $(INCDIR)/filenames.h
lynx-core.lo: lynx-core.c $(INCDIR)/filenames.h
@@ -1328,9 +1438,9 @@ elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \
$(INCDIR)/elf/reloc-macros.h elf64-target.h
peigen.lo: peigen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/pe.h libcoff.h \
- $(INCDIR)/bfdlink.h libpei.h
+ $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/pe.h \
+ libcoff.h $(INCDIR)/bfdlink.h libpei.h
pepigen.lo: pepigen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/ia64.h $(INCDIR)/coff/pe.h libcoff.h \
- $(INCDIR)/bfdlink.h libpei.h
+ $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h $(INCDIR)/coff/pe.h \
+ libcoff.h $(INCDIR)/bfdlink.h libpei.h
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/contrib/binutils/bfd/Makefile.in b/contrib/binutils/bfd/Makefile.in
index 10beb2d..7333ca7 100644
--- a/contrib/binutils/bfd/Makefile.in
+++ b/contrib/binutils/bfd/Makefile.in
@@ -114,7 +114,12 @@ WIN32LDFLAGS = @WIN32LDFLAGS@
WIN32LIBADD = @WIN32LIBADD@
all_backends = @all_backends@
bfd_backends = @bfd_backends@
+bfd_default_target_size = @bfd_default_target_size@
+bfd_libs = @bfd_libs@
bfd_machines = @bfd_machines@
+bfd_version = @bfd_version@
+bfd_version_date = @bfd_version_date@
+bfd_version_string = @bfd_version_string@
l = @l@
tdefaults = @tdefaults@
wordsize = @wordsize@
@@ -144,21 +149,25 @@ BFD_H = bfd.h
# for the debugger, so if you are downloading things as S-records you
# need two copies of the executable, one to download and one for the
# debugger).
-BFD_LIBS = \
+BFD32_LIBS = \
archive.lo archures.lo bfd.lo cache.lo coffgen.lo corefile.lo \
format.lo init.lo libbfd.lo opncls.lo reloc.lo \
section.lo syms.lo targets.lo hash.lo linker.lo \
srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo \
- dwarf2.lo
+ merge.lo dwarf2.lo
-BFD_LIBS_CFILES = \
+BFD64_LIBS = archive64.lo
+
+BFD32_LIBS_CFILES = \
archive.c archures.c bfd.c cache.c coffgen.c corefile.c \
format.c init.c libbfd.c opncls.c reloc.c \
section.c syms.c targets.c hash.c linker.c \
srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \
- dwarf2.c
+ merge.c dwarf2.c
+
+BFD64_LIBS_CFILES = archive64.c
# This list is alphabetized to make it easier to keep in sync
# with the decls and initializer in archures.c.
@@ -189,10 +198,14 @@ ALL_MACHINES = \
cpu-m10300.lo \
cpu-mcore.lo \
cpu-mips.lo \
+ cpu-mmix.lo \
cpu-ns32k.lo \
+ cpu-openrisc.lo \
+ cpu-pdp11.lo \
cpu-pj.lo \
cpu-powerpc.lo \
cpu-rs6000.lo \
+ cpu-s390.lo \
cpu-sh.lo \
cpu-sparc.lo \
cpu-tic30.lo \
@@ -202,6 +215,7 @@ ALL_MACHINES = \
cpu-vax.lo \
cpu-we32k.lo \
cpu-w65.lo \
+ cpu-xstormy16.lo \
cpu-z8k.lo
@@ -232,10 +246,14 @@ ALL_MACHINES_CFILES = \
cpu-m10300.c \
cpu-mcore.c \
cpu-mips.c \
+ cpu-mmix.c \
cpu-ns32k.c \
+ cpu-openrisc.c \
+ cpu-pdp11.c \
cpu-pj.c \
cpu-powerpc.c \
cpu-rs6000.c \
+ cpu-s390.c \
cpu-sh.c \
cpu-sparc.c \
cpu-tic30.c \
@@ -245,6 +263,7 @@ ALL_MACHINES_CFILES = \
cpu-vax.c \
cpu-we32k.c \
cpu-w65.c \
+ cpu-xstormy16.c \
cpu-z8k.c
@@ -277,7 +296,6 @@ BFD32_BACKENDS = \
coff-m68k.lo \
coff-m88k.lo \
coff-mips.lo \
- coff-pmac.lo \
coff-rs6000.lo \
coff-sh.lo \
coff-sparc.lo \
@@ -305,6 +323,7 @@ BFD32_BACKENDS = \
elf32-d30v.lo \
elf32-fr30.lo \
elf32-gen.lo \
+ elf32-h8300.lo \
elf32-hppa.lo \
elf32-i370.lo \
elf32-i386.lo \
@@ -320,14 +339,20 @@ BFD32_BACKENDS = \
elf-m10300.lo \
elf32-mcore.lo \
elf32-mips.lo \
+ elf32-openrisc.lo \
elf32-pj.lo \
elf32-ppc.lo \
+ elf32-s390.lo \
elf32-sh.lo \
elf32-sh-lin.lo \
+ elf32-sh-nbsd.lo \
elf32-sparc.lo \
elf32-v850.lo \
+ elf32-xstormy16.lo \
elf32.lo \
elflink.lo \
+ elf-strtab.lo \
+ elf-eh-frame.lo \
epoc-pe-arm.lo \
epoc-pei-arm.lo \
hp300bsd.lo \
@@ -359,6 +384,7 @@ BFD32_BACKENDS = \
ns32knetbsd.lo \
oasys.lo \
pc532-mach.lo \
+ pdp11.lo \
pe-arm.lo \
pei-arm.lo \
pe-i386.lo \
@@ -416,7 +442,6 @@ BFD32_BACKENDS_CFILES = \
coff-m68k.c \
coff-m88k.c \
coff-mips.c \
- coff-pmac.c \
coff-rs6000.c \
coff-sh.c \
coff-sparc.c \
@@ -444,6 +469,7 @@ BFD32_BACKENDS_CFILES = \
elf32-d30v.c \
elf32-fr30.c \
elf32-gen.c \
+ elf32-h8300.c \
elf32-hppa.c \
elf32-i370.c \
elf32-i386.c \
@@ -458,14 +484,20 @@ BFD32_BACKENDS_CFILES = \
elf-m10300.c \
elf32-mcore.c \
elf32-mips.c \
+ elf32-openrisc.c \
elf32-pj.c \
elf32-ppc.c \
+ elf32-s390.c \
elf32-sh.c \
elf32-sh-lin.c \
+ elf32-sh-nbsd.c \
elf32-sparc.c \
elf32-v850.c \
+ elf32-xstormy16.c \
elf32.c \
elflink.c \
+ elf-strtab.c \
+ elf-eh-frame.c \
epoc-pe-arm.c \
epoc-pei-arm.c \
hp300bsd.c \
@@ -497,6 +529,7 @@ BFD32_BACKENDS_CFILES = \
ns32knetbsd.c \
oasys.c \
pc532-mach.c \
+ pdp11.c \
pe-arm.c \
pei-arm.c \
pe-i386.c \
@@ -541,8 +574,12 @@ BFD64_BACKENDS = \
elf64-ia64.lo \
elf64-gen.lo \
elf64-mips.lo \
+ elf64-mmix.lo \
+ elf64-ppc.lo \
+ elf64-s390.lo \
elf64-sparc.lo \
elf64.lo \
+ mmo.lo \
nlm32-alpha.lo \
nlm64.lo \
pepigen.lo
@@ -559,8 +596,12 @@ BFD64_BACKENDS_CFILES = \
elf64-hppa.c \
elf64-gen.c \
elf64-mips.c \
+ elf64-mmix.c \
+ elf64-ppc.c \
+ elf64-s390.c \
elf64-sparc.c \
elf64.c \
+ mmo.c \
nlm32-alpha.c \
nlm64.c
@@ -591,6 +632,7 @@ OPTIONAL_BACKENDS_CFILES = \
WORDSIZE = @wordsize@
ALL_BACKENDS = @all_backends@
BFD_BACKENDS = @bfd_backends@
+BFD_LIBS = @bfd_libs@
BFD_MACHINES = @bfd_machines@
TDEFAULTS = @tdefaults@
@@ -598,7 +640,8 @@ INCLUDES = -D_GNU_SOURCE @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES
# C source files that correspond to .o's.
SOURCE_CFILES = \
- $(BFD_LIBS_CFILES) \
+ $(BFD32_LIBS_CFILES) \
+ $(BFD64_LIBS_CFILES) \
$(ALL_MACHINES_CFILES) \
$(BFD32_BACKENDS_CFILES) \
$(BFD64_BACKENDS_CFILES) \
@@ -617,7 +660,8 @@ SOURCE_HFILES = \
elfcode.h elfcore.h elflink.h freebsd.h genlink.h go32stub.h \
libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \
libieee.h libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h \
- nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h xcoff-target.h
+ nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h libxcoff.h \
+ xcoff-target.h version.h
BUILD_HFILES = \
@@ -635,7 +679,7 @@ BLD_POTFILES = $(BUILD_CFILES) $(BUILD_HFILES)
# COREFILE Core file routines for a native configuration
OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@
-libbfd_la_SOURCES = $(BFD_LIBS_CFILES)
+libbfd_la_SOURCES = $(BFD32_LIBS_CFILES) $(BFD64_LIBS_CFILES)
libbfd_la_DEPENDENCIES = $(OFILES) ofiles
libbfd_la_LIBADD = `cat ofiles` @WIN32LIBADD@
libbfd_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@
@@ -648,12 +692,13 @@ libbfd_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@
noinst_LIBRARIES = libbfd.a
libbfd_a_SOURCES =
-BFD_H_DEPS = $(INCDIR)/ansidecl.h
+BFD_H_DEPS = $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
LOCAL_H_DEPS = libbfd.h sysdep.h config.h
BFD_H_FILES = bfd-in.h init.c opncls.c libbfd.c section.c archures.c \
- reloc.c syms.c bfd.c archive.c corefile.c targets.c format.c
+ reloc.c syms.c bfd.c archive.c corefile.c targets.c format.c version.h
+BFD64_H_FILES = archive64.c
LIBBFD_H_FILES = libbfd-in.h init.c libbfd.c cache.c reloc.c archures.c elf.c
LIBCOFF_H_FILES = libcoff-in.h coffcode.h
@@ -672,6 +717,7 @@ LIBRARIES = $(noinst_LIBRARIES)
DEFS = @DEFS@ -I. -I$(srcdir) -I.
+#DEFS = @DEFS@ @elf_dynamic_interpreter@ -I. -I$(srcdir) -I.
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
@@ -682,7 +728,7 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
libbfd_la_OBJECTS = archive.lo archures.lo bfd.lo cache.lo coffgen.lo \
corefile.lo format.lo init.lo libbfd.lo opncls.lo reloc.lo section.lo \
syms.lo targets.lo hash.lo linker.lo srec.lo binary.lo tekhex.lo \
-ihex.lo stabs.lo stab-syms.lo dwarf2.lo
+ihex.lo stabs.lo stab-syms.lo merge.lo dwarf2.lo archive64.lo
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -1074,12 +1120,12 @@ maintainer-clean-generic clean mostlyclean distclean maintainer-clean
po/SRC-POTFILES.in: @MAINT@ Makefile $(SRC_POTFILES)
- for file in $(SRC_POTFILES); do echo $$file; done | sort > tmp \
- && mv tmp $(srcdir)/po/SRC-POTFILES.in
+ for file in $(SRC_POTFILES); do echo $$file; done | sort > tmp.src \
+ && mv tmp.src $(srcdir)/po/SRC-POTFILES.in
po/BLD-POTFILES.in: @MAINT@ Makefile $(BLD_POTFILES)
- for file in $(BLD_POTFILES); do echo $$file; done | sort > tmp \
- && mv tmp $(srcdir)/po/BLD-POTFILES.in
+ for file in $(BLD_POTFILES); do echo $$file; done | sort > tmp.bld \
+ && mv tmp.bld $(srcdir)/po/BLD-POTFILES.in
# The following target is retained for upgrade purposes.
# This target used to exist in older versions of this makefile, and was
@@ -1164,10 +1210,12 @@ pepigen.c : peXXigen.c
rm -f pepigen.c
sed -e s/XX/pep/g < $(srcdir)/peXXigen.c > pepigen.new
mv -f pepigen.new pepigen.c
-$(BFD_LIBS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
-$(BFD_MACHINES): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
-$(BFD_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
-$(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
+$(BFD32_LIBS) \
+ $(BFD64_LIBS) \
+ $(ALL_MACHINES) \
+ $(BFD32_BACKENDS) \
+ $(BFD64_BACKENDS) \
+ $(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
# Install BFD include file, and others that it needs.
install-data-local: $(BFD_H)
@@ -1175,8 +1223,11 @@ install-data-local: $(BFD_H)
$(mkinstalldirs) $(DESTDIR)$(includedir)
$(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(includedir)/bfd.h
$(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(includedir)/ansidecl.h
+ $(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(includedir)/symcat.h
$(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(includedir)/bfdlink.h
+Makefile: $(srcdir)/configure.in
+
# Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES).
DEP: dep.sed $(CFILES) $(HFILES) bfd.h
rm -f DEP1
@@ -1248,7 +1299,7 @@ headers:
# configured with --enable-maintainer-mode.
$(srcdir)/bfd-in2.h: @MAINT@ stmp-bin2-h ; @true
-stmp-bin2-h: $(BFD_H_FILES)
+stmp-bin2-h: $(BFD_H_FILES) $(BFD64_H_FILES)
(cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) bfd.h)
cp $(docdir)/bfd.h bfd-in2.h-new
$(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h
@@ -1277,12 +1328,13 @@ config.status: $(srcdir)/configure $(srcdir)/config.bfd $(srcdir)/configure.host
# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
archive.lo: archive.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \
- $(INCDIR)/aout/ranlib.h
-archures.lo: archures.c $(INCDIR)/filenames.h
+ $(INCDIR)/aout/ranlib.h $(INCDIR)/safe-ctype.h
+archures.lo: archures.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h
bfd.lo: bfd.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
- $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \
- libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h
+ $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/sym.h libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h
cache.lo: cache.c $(INCDIR)/filenames.h
coffgen.lo: coffgen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
libcoff.h $(INCDIR)/bfdlink.h
@@ -1293,24 +1345,28 @@ libbfd.lo: libbfd.c $(INCDIR)/filenames.h
opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h
reloc.lo: reloc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h
section.lo: section.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h
-syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
+syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
targets.lo: targets.c $(INCDIR)/filenames.h $(INCDIR)/fnmatch.h \
targmatch.h
hash.lo: hash.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h
linker.lo: linker.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
genlink.h
-srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
-binary.lo: binary.c $(INCDIR)/filenames.h
+srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/safe-ctype.h
+binary.lo: binary.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h
tekhex.lo: tekhex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
-ihex.lo: ihex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h
+ihex.lo: ihex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/safe-ctype.h
stabs.lo: stabs.c $(INCDIR)/filenames.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def
+ $(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h
stab-syms.lo: stab-syms.c libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab.def
+merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h
dwarf2.lo: dwarf2.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
+archive64.lo: archive64.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h
cpu-a29k.lo: cpu-a29k.c $(INCDIR)/filenames.h
cpu-alpha.lo: cpu-alpha.c $(INCDIR)/filenames.h
cpu-arc.lo: cpu-arc.c $(INCDIR)/filenames.h
@@ -1338,47 +1394,55 @@ cpu-m10200.lo: cpu-m10200.c $(INCDIR)/filenames.h
cpu-m10300.lo: cpu-m10300.c $(INCDIR)/filenames.h
cpu-mcore.lo: cpu-mcore.c $(INCDIR)/filenames.h
cpu-mips.lo: cpu-mips.c $(INCDIR)/filenames.h
+cpu-mmix.lo: cpu-mmix.c $(INCDIR)/filenames.h
cpu-ns32k.lo: cpu-ns32k.c $(INCDIR)/filenames.h ns32k.h
+cpu-openrisc.lo: cpu-openrisc.c $(INCDIR)/filenames.h
+cpu-pdp11.lo: cpu-pdp11.c $(INCDIR)/filenames.h
cpu-pj.lo: cpu-pj.c $(INCDIR)/filenames.h
cpu-powerpc.lo: cpu-powerpc.c $(INCDIR)/filenames.h
cpu-rs6000.lo: cpu-rs6000.c $(INCDIR)/filenames.h
+cpu-s390.lo: cpu-s390.c $(INCDIR)/filenames.h
cpu-sh.lo: cpu-sh.c $(INCDIR)/filenames.h
cpu-sparc.lo: cpu-sparc.c $(INCDIR)/filenames.h
cpu-tic30.lo: cpu-tic30.c $(INCDIR)/filenames.h
cpu-tic54x.lo: cpu-tic54x.c $(INCDIR)/filenames.h
cpu-tic80.lo: cpu-tic80.c $(INCDIR)/filenames.h
-cpu-v850.lo: cpu-v850.c $(INCDIR)/filenames.h
+cpu-v850.lo: cpu-v850.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h
cpu-vax.lo: cpu-vax.c $(INCDIR)/filenames.h
cpu-we32k.lo: cpu-we32k.c $(INCDIR)/filenames.h
cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h
+cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h
cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h
aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/aout/adobe.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \
$(INCDIR)/bfdlink.h
aout-arm.lo: aout-arm.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aoutx.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- aout-target.h
+ $(INCDIR)/safe-ctype.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
+ $(INCDIR)/aout/ar.h aout-target.h
aout-cris.lo: aout-cris.c aout32.c aoutx.h $(INCDIR)/filenames.h \
- $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
- aout-target.h
+ $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h libaout.h \
+ $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
+ $(INCDIR)/aout/ar.h aout-target.h
aout-ns32k.lo: aout-ns32k.c $(INCDIR)/aout/aout64.h \
- ns32k.h libaout.h $(INCDIR)/bfdlink.h
+ ns32k.h libaout.h $(INCDIR)/bfdlink.h aoutx.h $(INCDIR)/filenames.h \
+ $(INCDIR)/safe-ctype.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
+ $(INCDIR)/aout/ar.h
aout-sparcle.lo: aout-sparcle.c $(INCDIR)/bfdlink.h \
libaout.h aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
$(INCDIR)/aout/ar.h aout-target.h
aout-tic30.lo: aout-tic30.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aoutx.h
+ $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aoutx.h \
+ $(INCDIR)/safe-ctype.h
aout0.lo: aout0.c aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \
libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
aout-target.h
-aout32.lo: aout32.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- libaout.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
+aout32.lo: aout32.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
+ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
armnetbsd.lo: armnetbsd.c netbsd.h $(INCDIR)/filenames.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
@@ -1386,94 +1450,94 @@ bout.lo: bout.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
genlink.h $(INCDIR)/bout.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def libaout.h
cf-i386lynx.lo: cf-i386lynx.c $(INCDIR)/filenames.h \
- coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
+ coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
+ coffcode.h coffswap.h
cf-m68klynx.lo: cf-m68klynx.c coff-m68k.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/m68k.h $(INCDIR)/coff/internal.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h coffswap.h
+ $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
cf-sparclynx.lo: cf-sparclynx.c coff-sparc.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/sparc.h $(INCDIR)/coff/internal.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h coffswap.h
+ $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-a29k.lo: coff-a29k.c $(INCDIR)/filenames.h $(INCDIR)/coff/a29k.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-apollo.lo: coff-apollo.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/apollo.h $(INCDIR)/coff/internal.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h coffswap.h
+ $(INCDIR)/coff/apollo.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-arm.lo: coff-arm.c $(INCDIR)/filenames.h $(INCDIR)/coff/arm.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
-coff-aux.lo: coff-aux.c $(INCDIR)/filenames.h $(INCDIR)/coff/aux-coff.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h coff-m68k.c \
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
+coff-aux.lo: coff-aux.c $(INCDIR)/filenames.h $(INCDIR)/coff/aux-coff.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \
+ coff-m68k.c libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ coffswap.h
coff-h8300.lo: coff-h8300.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- genlink.h $(INCDIR)/coff/h8300.h $(INCDIR)/coff/internal.h \
- libcoff.h coffcode.h coffswap.h
+ genlink.h $(INCDIR)/coff/h8300.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
coff-h8500.lo: coff-h8500.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/h8500.h $(INCDIR)/coff/internal.h libcoff.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h coffcode.h coffswap.h
coff-i386.lo: coff-i386.c $(INCDIR)/filenames.h $(INCDIR)/coff/i386.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-i860.lo: coff-i860.c $(INCDIR)/filenames.h $(INCDIR)/coff/i860.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-go32.lo: coff-go32.c coff-i386.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h coffswap.h
+ $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-i960.lo: coff-i960.c $(INCDIR)/filenames.h $(INCDIR)/coff/i960.h \
$(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
coffcode.h coffswap.h
coff-m68k.lo: coff-m68k.c $(INCDIR)/filenames.h $(INCDIR)/coff/m68k.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-m88k.lo: coff-m88k.c $(INCDIR)/filenames.h $(INCDIR)/coff/m88k.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-mips.lo: coff-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
- $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h libcoff.h \
- libecoff.h coffswap.h ecoffswap.h
-coff-pmac.lo: coff-pmac.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/rs6000.h libcoff.h $(INCDIR)/bfdlink.h \
- xcoff-target.h coffcode.h coffswap.h
+ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \
+ libcoff.h libecoff.h coffswap.h ecoffswap.h
coff-rs6000.lo: coff-rs6000.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h libcoff.h \
- $(INCDIR)/bfdlink.h xcoff-target.h coffcode.h coffswap.h
-coff-sh.lo: coff-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/sh.h $(INCDIR)/coff/internal.h libcoff.h \
- coffcode.h coffswap.h
+ $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \
+ $(INCDIR)/coff/rs6000.h libcoff.h libxcoff.h coffcode.h \
+ coffswap.h
+coff-sh.lo: coff-sh.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
coff-sparc.lo: coff-sparc.c $(INCDIR)/filenames.h $(INCDIR)/coff/sparc.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-stgo32.lo: coff-stgo32.c coff-i386.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/go32exe.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h \
- go32stub.h
+ $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/go32exe.h libcoff.h $(INCDIR)/bfdlink.h \
+ coffcode.h coffswap.h go32stub.h
coff-svm68k.lo: coff-svm68k.c coff-m68k.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/m68k.h $(INCDIR)/coff/internal.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h coffswap.h
+ $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-tic30.lo: coff-tic30.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/tic30.h $(INCDIR)/coff/internal.h libcoff.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h coffcode.h coffswap.h
coff-tic54x.lo: coff-tic54x.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \
$(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
coff-tic80.lo: coff-tic80.c $(INCDIR)/bfdlink.h $(INCDIR)/filenames.h \
- $(INCDIR)/coff/tic80.h $(INCDIR)/coff/internal.h libcoff.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h coffcode.h coffswap.h
coff-u68k.lo: coff-u68k.c coff-m68k.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/m68k.h $(INCDIR)/coff/internal.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h coffswap.h
+ $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-we32k.lo: coff-we32k.c $(INCDIR)/filenames.h $(INCDIR)/coff/we32k.h \
- $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h
coff-w65.lo: coff-w65.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/w65.h $(INCDIR)/coff/internal.h libcoff.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h coffcode.h coffswap.h
coff-z8k.lo: coff-z8k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/z8k.h $(INCDIR)/coff/internal.h libcoff.h \
- coffcode.h coffswap.h
+ $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h coffcode.h coffswap.h
cofflink.lo: cofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/internal.h libcoff.h
dwarf1.lo: dwarf1.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
@@ -1489,16 +1553,16 @@ ecofflink.lo: ecofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
$(INCDIR)/coff/ecoff.h libcoff.h libecoff.h
efi-app-ia32.lo: efi-app-ia32.c $(INCDIR)/filenames.h \
- coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
+ coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
elf.lo: elf.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h
+ $(INCDIR)/elf/external.h $(INCDIR)/libiberty.h
elf32-arc.lo: elf32-arc.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
+ $(INCDIR)/libiberty.h elf32-target.h
elfarm-oabi.lo: elfarm-oabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \
$(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
@@ -1530,6 +1594,10 @@ elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h elf-bfd.h \
elf32-gen.lo: elf32-gen.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h elf32-target.h
+elf32-h8300.lo: elf32-h8300.c $(INCDIR)/filenames.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/h8.h \
+ $(INCDIR)/elf/reloc-macros.h elf32-target.h
elf32-hppa.lo: elf32-hppa.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \
@@ -1583,7 +1651,12 @@ elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
genlink.h elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \
$(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h ecoffswap.h \
+ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \
+ ecoffswap.h elf32-target.h
+elf32-openrisc.lo: elf32-openrisc.c $(INCDIR)/filenames.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/openrisc.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
elf32-target.h
elf32-pj.lo: elf32-pj.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
@@ -1593,11 +1666,19 @@ elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
+elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.h
elf32-sh.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
elf32-target.h
-elf32-sh-lin.lo: elf32-sh-lin.c elf32-sh.c $(INCDIR)/filenames.h \
+elf32-sh-lin.lo: elf32-sh-lin.c $(INCDIR)/filenames.h \
+ $(INCDIR)/elf/internal.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-sh.c \
+ $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-sh-nbsd.lo: elf32-sh-nbsd.c elf32-sh.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \
$(INCDIR)/elf/reloc-macros.h elf32-target.h
@@ -1609,28 +1690,41 @@ elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
elf32-v850.lo: elf32-v850.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h
-elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/libiberty.h elf32-target.h
+elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h elfcore.h elflink.h
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \
+ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \
+ elf32-target.h
+elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \
+ elflink.h
elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h
+elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h
+elf-eh-frame.lo: elf-eh-frame.c $(INCDIR)/filenames.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
epoc-pe-arm.lo: epoc-pe-arm.c pe-arm.c $(INCDIR)/filenames.h \
- coff-arm.c $(INCDIR)/coff/arm.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
+ coff-arm.c $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
epoc-pei-arm.lo: epoc-pei-arm.c pei-arm.c $(INCDIR)/filenames.h \
- coff-arm.c $(INCDIR)/coff/arm.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
+ coff-arm.c $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
hp300bsd.lo: hp300bsd.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
hp300hpux.lo: hp300hpux.c $(INCDIR)/aout/hp300hpux.h \
- aoutx.h $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h libaout.h \
- $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
- $(INCDIR)/aout/ar.h aout-target.h
+ aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
+ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \
+ aout-target.h
som.lo: som.c $(INCDIR)/alloca-conf.h $(INCDIR)/filenames.h
i386aout.lo: i386aout.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/stab_gnu.h \
@@ -1639,9 +1733,9 @@ i386bsd.lo: i386bsd.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
i386dynix.lo: i386dynix.c $(INCDIR)/aout/dynix3.h aoutx.h \
- $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h libaout.h \
- $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
- $(INCDIR)/aout/ar.h aout-target.h
+ $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h \
+ libaout.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
+ $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h
i386freebsd.lo: i386freebsd.c freebsd.h $(INCDIR)/filenames.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
@@ -1662,7 +1756,7 @@ i386mach3.lo: i386mach3.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
i386os9k.lo: i386os9k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
libaout.h $(INCDIR)/os9k.h
ieee.lo: ieee.c $(INCDIR)/filenames.h $(INCDIR)/ieee.h \
- libieee.h
+ libieee.h $(INCDIR)/safe-ctype.h
m68k4knetbsd.lo: m68k4knetbsd.c netbsd.h $(INCDIR)/filenames.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
@@ -1701,58 +1795,64 @@ nlm32.lo: nlm32.c nlmcode.h $(INCDIR)/filenames.h libnlm.h \
ns32knetbsd.lo: ns32knetbsd.c netbsd.h $(INCDIR)/filenames.h \
libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
-oasys.lo: oasys.c $(INCDIR)/filenames.h $(INCDIR)/oasys.h \
- liboasys.h
+oasys.lo: oasys.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/oasys.h liboasys.h
pc532-mach.lo: pc532-mach.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
+pdp11.lo: pdp11.c $(INCDIR)/filenames.h libaout.h $(INCDIR)/bfdlink.h \
+ aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
+ $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h $(INCDIR)/safe-ctype.h
pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \
- $(INCDIR)/coff/arm.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h peicode.h \
- libpei.h
+ $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ peicode.h libpei.h
pei-arm.lo: pei-arm.c $(INCDIR)/filenames.h coff-arm.c \
- $(INCDIR)/coff/arm.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h peicode.h \
- libpei.h
+ $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ peicode.h libpei.h
pe-i386.lo: pe-i386.c $(INCDIR)/filenames.h coff-i386.c \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h peicode.h \
- libpei.h
+ $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ peicode.h libpei.h
pei-i386.lo: pei-i386.c $(INCDIR)/filenames.h coff-i386.c \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h peicode.h \
- libpei.h
+ $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ peicode.h libpei.h
pe-mcore.lo: pe-mcore.c $(INCDIR)/filenames.h coff-mcore.c \
- $(INCDIR)/coff/mcore.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h peicode.h \
- libpei.h
-pei-mcore.lo: pei-mcore.c $(INCDIR)/filenames.h coff-mcore.c \
- $(INCDIR)/coff/mcore.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h peicode.h \
- libpei.h
-pe-ppc.lo: pe-ppc.c $(INCDIR)/filenames.h coff-ppc.c \
- $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
peicode.h libpei.h
-pei-ppc.lo: pei-ppc.c $(INCDIR)/filenames.h coff-ppc.c \
- $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/internal.h \
+pei-mcore.lo: pei-mcore.c $(INCDIR)/filenames.h coff-mcore.c \
+ $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
peicode.h libpei.h
-pe-sh.lo: pe-sh.c $(INCDIR)/filenames.h coff-sh.c $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/sh.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
- libcoff.h coffcode.h peicode.h libpei.h
+pe-ppc.lo: pe-ppc.c $(INCDIR)/filenames.h coff-ppc.c \
+ $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
+pei-ppc.lo: pei-ppc.c $(INCDIR)/filenames.h coff-ppc.c \
+ $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
+pe-sh.lo: pe-sh.c $(INCDIR)/filenames.h coff-sh.c $(INCDIR)/libiberty.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ coffcode.h peicode.h libpei.h
pei-sh.lo: pei-sh.c $(INCDIR)/filenames.h coff-sh.c \
- $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/libiberty.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/pe.h libcoff.h coffcode.h peicode.h \
libpei.h
pe-mips.lo: pe-mips.c $(INCDIR)/filenames.h $(INCDIR)/coff/mipspe.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
- $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ peicode.h libpei.h
pei-mips.lo: pei-mips.c $(INCDIR)/filenames.h pe-mips.c \
- $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
- libcoff.h $(INCDIR)/bfdlink.h coffcode.h peicode.h \
- libpei.h
-ppcboot.lo: ppcboot.c $(INCDIR)/filenames.h
+ $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ peicode.h libpei.h
+ppcboot.lo: ppcboot.c $(INCDIR)/safe-ctype.h $(INCDIR)/filenames.h
reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
genlink.h $(INCDIR)/coff/internal.h libcoff.h
riscix.lo: riscix.c $(INCDIR)/filenames.h libaout.h \
@@ -1781,31 +1881,33 @@ vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
vms-gsd.lo: vms-gsd.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
vms.h
vms-hdr.lo: vms-hdr.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- vms.h
+ $(INCDIR)/safe-ctype.h vms.h
vms-misc.lo: vms-misc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
vms.h
vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
vms.h
xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- $(INCDIR)/coff/internal.h libcoff.h
-aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- libaout.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \
+ libxcoff.h
+aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \
+ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
coff-alpha.lo: coff-alpha.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h \
libcoff.h libecoff.h coffswap.h ecoffswap.h
coff64-rs6000.lo: coff64-rs6000.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6k64.h libcoff.h \
- $(INCDIR)/bfdlink.h xcoff-target.h coffcode.h coffswap.h
+ $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \
+ $(INCDIR)/coff/rs6k64.h libcoff.h libxcoff.h coffcode.h \
+ coffswap.h
demo64.lo: demo64.c aoutf1.h $(INCDIR)/filenames.h \
$(INCDIR)/aout/sun4.h libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
$(INCDIR)/aout/ar.h aout-target.h
efi-app-ia64.lo: efi-app-ia64.c $(INCDIR)/filenames.h \
- coff-ia64.c $(INCDIR)/coff/ia64.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
+ coff-ia64.c $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
elf64-x86-64.lo: elf64-x86-64.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/x86-64.h \
@@ -1831,14 +1933,29 @@ elf64-mips.lo: elf64-mips.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \
$(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h \
ecoffswap.h elf64-target.h
+elf64-mmix.lo: elf64-mmix.c $(INCDIR)/filenames.h elf-bfd.h \
+ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
+ $(INCDIR)/bfdlink.h $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h \
+ $(INCDIR)/opcode/mmix.h elf64-target.h
+elf64-ppc.lo: elf64-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \
+ elf64-ppc.h elf64-target.h
+elf64-s390.lo: elf64-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
+ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+ $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \
+ elf64-target.h
elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/sparc.h \
$(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \
elf64-target.h
-elf64.lo: elf64.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
- elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h elfcore.h elflink.h
+elf64.lo: elf64.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
+ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \
+ elflink.h
+mmo.lo: mmo.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/mmix.h
nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \
$(INCDIR)/nlm/alpha-ext.h libnlm.h $(INCDIR)/nlm/common.h \
$(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h nlmswap.h \
@@ -1846,8 +1963,8 @@ nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \
nlm64.lo: nlm64.c nlmcode.h $(INCDIR)/filenames.h libnlm.h \
$(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h
aix386-core.lo: aix386-core.c $(INCDIR)/filenames.h \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/internal.h libcoff.h \
- $(INCDIR)/bfdlink.h
+ $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ libcoff.h $(INCDIR)/bfdlink.h
hpux-core.lo: hpux-core.c $(INCDIR)/filenames.h
irix-core.lo: irix-core.c $(INCDIR)/filenames.h
lynx-core.lo: lynx-core.c $(INCDIR)/filenames.h
@@ -1866,11 +1983,11 @@ elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \
$(INCDIR)/elf/reloc-macros.h elf64-target.h
peigen.lo: peigen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/i386.h $(INCDIR)/coff/pe.h libcoff.h \
- $(INCDIR)/bfdlink.h libpei.h
+ $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/pe.h \
+ libcoff.h $(INCDIR)/bfdlink.h libpei.h
pepigen.lo: pepigen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/ia64.h $(INCDIR)/coff/pe.h libcoff.h \
- $(INCDIR)/bfdlink.h libpei.h
+ $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h $(INCDIR)/coff/pe.h \
+ libcoff.h $(INCDIR)/bfdlink.h libpei.h
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/contrib/binutils/bfd/README b/contrib/binutils/bfd/README
index 992c285..fe6b6f3 100644
--- a/contrib/binutils/bfd/README
+++ b/contrib/binutils/bfd/README
@@ -1,4 +1,4 @@
-BFD is a an object file library. It permits applications to use the
+BFD is an object file library. It permits applications to use the
same routines to process object files regardless of their format.
BFD is used by the GNU debugger, assembler, linker, and the binary
diff --git a/contrib/binutils/bfd/aout-arm.c b/contrib/binutils/bfd/aout-arm.c
index ddb0325..b87e09c 100644
--- a/contrib/binutils/bfd/aout-arm.c
+++ b/contrib/binutils/bfd/aout-arm.c
@@ -1,5 +1,5 @@
/* BFD back-end for raw ARM a.out binaries.
- Copyright 1994, 1995, 1997, 1998, 1999, 2000
+ Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
@@ -19,80 +19,90 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#define N_TXTADDR(x) \
- ((N_MAGIC(x) == NMAGIC) ? 0x8000 : \
- (N_MAGIC(x) != ZMAGIC) ? 0 : \
- (N_SHARED_LIB(x)) ? ((x).a_entry & ~(TARGET_PAGE_SIZE - 1)) : \
- TEXT_START_ADDR)
+#include "bfd.h"
+#include "sysdep.h"
+
+/* Avoid multiple defininitions from aoutx if supporting standarad a.out
+ as well as our own. */
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define NAME(x,y) CONCAT3 (aoutarm,_32_,y)
+
+#define N_TXTADDR(x) \
+ ((N_MAGIC (x) == NMAGIC) \
+ ? (bfd_vma) 0x8000 \
+ : ((N_MAGIC (x) != ZMAGIC) \
+ ? (bfd_vma) 0 \
+ : ((N_SHARED_LIB (x)) \
+ ? ((x).a_entry & ~(bfd_vma) (TARGET_PAGE_SIZE - 1)) \
+ : (bfd_vma) TEXT_START_ADDR)))
#define TEXT_START_ADDR 0x8000
#define TARGET_PAGE_SIZE 0x8000
#define SEGMENT_SIZE TARGET_PAGE_SIZE
#define DEFAULT_ARCH bfd_arch_arm
-#define MY(OP) CAT(aoutarm_,OP)
+#define MY(OP) CONCAT2 (aoutarm_,OP)
#define N_BADMAG(x) ((((x).a_info & ~007200) != ZMAGIC) && \
(((x).a_info & ~006000) != OMAGIC) && \
((x).a_info != NMAGIC))
#define N_MAGIC(x) ((x).a_info & ~07200)
-#include "bfd.h"
-#include "sysdep.h"
-
-#define MYARM(OP) CAT(aoutarm_,OP)
-reloc_howto_type *MYARM(bfd_reloc_type_lookup)
- PARAMS((bfd *, bfd_reloc_code_real_type));
-static boolean MYARM(write_object_contents) PARAMS((bfd *));
-
-/* Avoid multiple defininitions from aoutx if supporting standarad a.out
- as well as our own. */
-#define NAME(x,y) CAT3(aoutarm,_32_,y)
-
#define MY_bfd_reloc_type_lookup aoutarm_bfd_reloc_type_lookup
#include "libaout.h"
#include "aout/aout64.h"
-static bfd_reloc_status_type
-MY(fix_pcrel_26_done) PARAMS ((bfd *, arelent *, asymbol *, PTR,
- asection *, bfd *, char **));
-
-static bfd_reloc_status_type
-MY(fix_pcrel_26) PARAMS ((bfd *, arelent *, asymbol *, PTR,
- asection *, bfd *, char **));
-static void MY(swap_std_reloc_in) PARAMS ((bfd *, struct reloc_std_external *,
- arelent *, asymbol **,
- bfd_size_type));
-void MY(swap_std_reloc_out) PARAMS ((bfd *, arelent *,
- struct reloc_std_external *));
-
+static boolean MY(write_object_contents)
+ PARAMS ((bfd *));
+static bfd_reloc_status_type MY(fix_pcrel_26_done)
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type MY(fix_pcrel_26)
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static void MY(swap_std_reloc_in)
+ PARAMS ((bfd *, struct reloc_std_external *, arelent *, asymbol **,
+ bfd_size_type));
+reloc_howto_type *MY(bfd_reloc_type_lookup)
+ PARAMS ((bfd *, bfd_reloc_code_real_type));
+reloc_howto_type * MY(reloc_howto)
+ PARAMS ((bfd *, struct reloc_std_external *, int *, int *, int *));
+void MY(put_reloc)
+ PARAMS ((bfd *, int, int, bfd_vma, reloc_howto_type *,
+ struct reloc_std_external *));
+void MY(relocatable_reloc)
+ PARAMS ((reloc_howto_type *, bfd *, struct reloc_std_external *, bfd_vma *,
+ bfd_vma));
+void MY(swap_std_reloc_out)
+ PARAMS ((bfd *, arelent *, struct reloc_std_external *));
+
reloc_howto_type MY(howto_table)[] =
-{
- /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask
- pcdone */
- HOWTO (0, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "8", true,
- 0x000000ff, 0x000000ff, false),
- HOWTO (1, 0, 1, 16, false, 0, complain_overflow_bitfield, 0, "16", true,
- 0x0000ffff, 0x0000ffff, false),
- HOWTO (2, 0, 2, 32, false, 0, complain_overflow_bitfield, 0, "32", true,
- 0xffffffff, 0xffffffff, false),
- HOWTO (3, 2, 2, 26, true, 0, complain_overflow_signed, MY(fix_pcrel_26),
- "ARM26", true, 0x00ffffff, 0x00ffffff, true),
- HOWTO (4, 0, 0, 8, true, 0, complain_overflow_signed, 0, "DISP8", true,
- 0x000000ff, 0x000000ff, true),
- HOWTO (5, 0, 1, 16, true, 0, complain_overflow_signed, 0, "DISP16", true,
- 0x0000ffff, 0x0000ffff, true),
- HOWTO (6, 0, 2, 32, true, 0, complain_overflow_signed, 0, "DISP32", true,
- 0xffffffff, 0xffffffff, true),
- HOWTO (7, 2, 2, 26, false, 0, complain_overflow_signed,
- MY(fix_pcrel_26_done), "ARM26D", true, 0x0, 0x0,
- false),
- EMPTY_HOWTO (-1),
- HOWTO (9, 0, -1, 16, false, 0, complain_overflow_bitfield, 0, "NEG16", true,
- 0x0000ffff, 0x0000ffff, false),
- HOWTO (10, 0, -2, 32, false, 0, complain_overflow_bitfield, 0, "NEG32", true,
- 0xffffffff, 0xffffffff, false)
-};
+ {
+ /* Type rs size bsz pcrel bitpos ovrf sf name part_inpl
+ readmask setmask pcdone. */
+ HOWTO (0, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "8", true,
+ 0x000000ff, 0x000000ff, false),
+ HOWTO (1, 0, 1, 16, false, 0, complain_overflow_bitfield, 0, "16", true,
+ 0x0000ffff, 0x0000ffff, false),
+ HOWTO (2, 0, 2, 32, false, 0, complain_overflow_bitfield, 0, "32", true,
+ 0xffffffff, 0xffffffff, false),
+ HOWTO (3, 2, 2, 26, true, 0, complain_overflow_signed, MY(fix_pcrel_26),
+ "ARM26", true, 0x00ffffff, 0x00ffffff, true),
+ HOWTO (4, 0, 0, 8, true, 0, complain_overflow_signed, 0, "DISP8", true,
+ 0x000000ff, 0x000000ff, true),
+ HOWTO (5, 0, 1, 16, true, 0, complain_overflow_signed, 0, "DISP16", true,
+ 0x0000ffff, 0x0000ffff, true),
+ HOWTO (6, 0, 2, 32, true, 0, complain_overflow_signed, 0, "DISP32", true,
+ 0xffffffff, 0xffffffff, true),
+ HOWTO (7, 2, 2, 26, false, 0, complain_overflow_signed,
+ MY(fix_pcrel_26_done), "ARM26D", true, 0x0, 0x0,
+ false),
+ EMPTY_HOWTO (-1),
+ HOWTO (9, 0, -1, 16, false, 0, complain_overflow_bitfield, 0, "NEG16", true,
+ 0x0000ffff, 0x0000ffff, false),
+ HOWTO (10, 0, -2, 32, false, 0, complain_overflow_bitfield, 0, "NEG32", true,
+ 0xffffffff, 0xffffffff, false)
+ };
#define RELOC_ARM_BITS_NEG_BIG ((unsigned int) 0x08)
#define RELOC_ARM_BITS_NEG_LITTLE ((unsigned int) 0x10)
@@ -148,7 +158,7 @@ MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc)
bfd *abfd;
int r_extern;
int r_index;
- long value;
+ bfd_vma value;
reloc_howto_type *howto;
struct reloc_std_external *reloc;
{
@@ -157,14 +167,16 @@ MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc)
int r_neg;
PUT_WORD (abfd, value, reloc->r_address);
- r_length = howto->size ; /* Size as a power of two */
+ /* Size as a power of two. */
+ r_length = howto->size;
/* Special case for branch relocations. */
if (howto->type == 3 || howto->type == 7)
r_length = 3;
- r_pcrel = howto->type & 4; /* PC Relative done? */
- r_neg = howto->type & 8; /* Negative relocation */
+ r_pcrel = howto->type & 4; /* PC Relative done? */
+ r_neg = howto->type & 8; /* Negative relocation. */
+
if (bfd_header_big_endian (abfd))
{
reloc->r_index[0] = r_index >> 16;
@@ -255,10 +267,10 @@ MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
{
bfd_vma relocation;
bfd_size_type addr = reloc_entry->address;
- long target = bfd_get_32 (abfd, (bfd_byte *) data + addr);
+ bfd_vma target = bfd_get_32 (abfd, (bfd_byte *) data + addr);
bfd_reloc_status_type flag = bfd_reloc_ok;
- /* If this is an undefined symbol, return error */
+ /* If this is an undefined symbol, return error. */
if (symbol->section == &bfd_und_section
&& (symbol->flags & BSF_WEAK) == 0)
return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined;
@@ -270,7 +282,7 @@ MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
return bfd_reloc_ok;
relocation = (target & 0x00ffffff) << 2;
- relocation = (relocation ^ 0x02000000) - 0x02000000; /* Sign extend */
+ relocation = (relocation ^ 0x02000000) - 0x02000000; /* Sign extend. */
relocation += symbol->value;
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
@@ -281,16 +293,16 @@ MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
if (relocation & 3)
return bfd_reloc_overflow;
- /* Check for overflow */
+ /* Check for overflow. */
if (relocation & 0x02000000)
{
if ((relocation & ~ (bfd_vma) 0x03ffffff) != ~ (bfd_vma) 0x03ffffff)
flag = bfd_reloc_overflow;
}
- else if (relocation & ~0x03ffffff)
+ else if (relocation & ~ (bfd_vma) 0x03ffffff)
flag = bfd_reloc_overflow;
- target &= ~0x00ffffff;
+ target &= ~ (bfd_vma) 0x00ffffff;
target |= (relocation >> 2) & 0x00ffffff;
bfd_put_32 (abfd, target, (bfd_byte *) data + addr);
@@ -313,7 +325,8 @@ MY(bfd_reloc_type_lookup) (abfd,code)
case 32:
code = BFD_RELOC_32;
break;
- default: return (CONST struct reloc_howto_struct *) 0;
+ default:
+ return (const struct reloc_howto_struct *) 0;
}
switch (code)
@@ -324,7 +337,8 @@ MY(bfd_reloc_type_lookup) (abfd,code)
ASTD (BFD_RELOC_8_PCREL, 4);
ASTD (BFD_RELOC_16_PCREL, 5);
ASTD (BFD_RELOC_32_PCREL, 6);
- default: return (CONST struct reloc_howto_struct *) 0;
+ default:
+ return (const struct reloc_howto_struct *) 0;
}
}
@@ -350,7 +364,7 @@ MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount)
int r_pcrel;
struct aoutdata *su = &(abfd->tdata.aout_data->a);
- cache_ptr->address = bfd_h_get_32 (abfd, bytes->r_address);
+ cache_ptr->address = H_GET_32 (abfd, bytes->r_address);
cache_ptr->howto = MY_reloc_howto (abfd, bytes, r_index, r_extern, r_pcrel);
@@ -419,25 +433,25 @@ MY_swap_std_reloc_out (abfd, g, natptr)
if (bfd_abs_section.symbol == sym)
{
/* Whoops, looked like an abs symbol, but is really an offset
- from the abs section */
+ from the abs section. */
r_index = 0;
r_extern = 0;
}
else
{
- /* Fill in symbol */
+ /* Fill in symbol. */
r_extern = 1;
r_index = (*(g->sym_ptr_ptr))->KEEPIT;
}
}
else
{
- /* Just an ordinary section */
+ /* Just an ordinary section. */
r_extern = 0;
r_index = output_section->target_index;
}
- /* now the fun stuff */
+ /* Now the fun stuff. */
if (bfd_header_big_endian (abfd))
{
natptr->r_index[0] = r_index >> 16;
@@ -469,83 +483,83 @@ MY_swap_std_reloc_out (abfd, g, natptr)
extern const bfd_target aout_arm_big_vec;
const bfd_target aout_arm_little_vec =
-{
- "a.out-arm-little", /* name */
- bfd_target_aout_flavour,
- BFD_ENDIAN_LITTLE, /* target byte order (little) */
- BFD_ENDIAN_LITTLE, /* target headers byte order (little) */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
- MY_symbol_leading_char,
- AR_PAD_CHAR, /* ar_pad_char */
- 15, /* ar_max_namelen */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
- bfd_getl64, bfd_getl_signed_64, bfd_putl64,
- bfd_getl32, bfd_getl_signed_32, bfd_putl32,
- bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
- {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
- bfd_generic_archive_p, MY_core_file_p},
- {bfd_false, MY_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, MY_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (MY),
- BFD_JUMP_TABLE_COPY (MY),
- BFD_JUMP_TABLE_CORE (MY),
- BFD_JUMP_TABLE_ARCHIVE (MY),
- BFD_JUMP_TABLE_SYMBOLS (MY),
- BFD_JUMP_TABLE_RELOCS (MY),
- BFD_JUMP_TABLE_WRITE (MY),
- BFD_JUMP_TABLE_LINK (MY),
- BFD_JUMP_TABLE_DYNAMIC (MY),
-
- & aout_arm_big_vec,
-
- (PTR) MY_backend_data,
-};
+ {
+ "a.out-arm-little", /* name */
+ bfd_target_aout_flavour,
+ BFD_ENDIAN_LITTLE, /* target byte order (little) */
+ BFD_ENDIAN_LITTLE, /* target headers byte order (little) */
+ (HAS_RELOC | EXEC_P | /* object flags */
+ HAS_LINENO | HAS_DEBUG |
+ HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
+ MY_symbol_leading_char,
+ AR_PAD_CHAR, /* ar_pad_char */
+ 15, /* ar_max_namelen */
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
+ {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
+ bfd_generic_archive_p, MY_core_file_p},
+ {bfd_false, MY_mkobject, /* bfd_set_format */
+ _bfd_generic_mkarchive, bfd_false},
+ {bfd_false, MY_write_object_contents, /* bfd_write_contents */
+ _bfd_write_archive_contents, bfd_false},
+
+ BFD_JUMP_TABLE_GENERIC (MY),
+ BFD_JUMP_TABLE_COPY (MY),
+ BFD_JUMP_TABLE_CORE (MY),
+ BFD_JUMP_TABLE_ARCHIVE (MY),
+ BFD_JUMP_TABLE_SYMBOLS (MY),
+ BFD_JUMP_TABLE_RELOCS (MY),
+ BFD_JUMP_TABLE_WRITE (MY),
+ BFD_JUMP_TABLE_LINK (MY),
+ BFD_JUMP_TABLE_DYNAMIC (MY),
+
+ & aout_arm_big_vec,
+
+ (PTR) MY_backend_data,
+ };
const bfd_target aout_arm_big_vec =
-{
- "a.out-arm-big", /* name */
- bfd_target_aout_flavour,
- BFD_ENDIAN_BIG, /* target byte order (big) */
- BFD_ENDIAN_BIG, /* target headers byte order (big) */
- (HAS_RELOC | EXEC_P | /* object flags */
- HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
- MY_symbol_leading_char,
- AR_PAD_CHAR, /* ar_pad_char */
- 15, /* ar_max_namelen */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
- bfd_getb64, bfd_getb_signed_64, bfd_putb64,
- bfd_getb32, bfd_getb_signed_32, bfd_putb32,
- bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
- {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
- bfd_generic_archive_p, MY_core_file_p},
- {bfd_false, MY_mkobject, /* bfd_set_format */
- _bfd_generic_mkarchive, bfd_false},
- {bfd_false, MY_write_object_contents, /* bfd_write_contents */
- _bfd_write_archive_contents, bfd_false},
-
- BFD_JUMP_TABLE_GENERIC (MY),
- BFD_JUMP_TABLE_COPY (MY),
- BFD_JUMP_TABLE_CORE (MY),
- BFD_JUMP_TABLE_ARCHIVE (MY),
- BFD_JUMP_TABLE_SYMBOLS (MY),
- BFD_JUMP_TABLE_RELOCS (MY),
- BFD_JUMP_TABLE_WRITE (MY),
- BFD_JUMP_TABLE_LINK (MY),
- BFD_JUMP_TABLE_DYNAMIC (MY),
-
- & aout_arm_little_vec,
-
- (PTR) MY_backend_data,
-};
+ {
+ "a.out-arm-big", /* name */
+ bfd_target_aout_flavour,
+ BFD_ENDIAN_BIG, /* target byte order (big) */
+ BFD_ENDIAN_BIG, /* target headers byte order (big) */
+ (HAS_RELOC | EXEC_P | /* object flags */
+ HAS_LINENO | HAS_DEBUG |
+ HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
+ MY_symbol_leading_char,
+ AR_PAD_CHAR, /* ar_pad_char */
+ 15, /* ar_max_namelen */
+ bfd_getb64, bfd_getb_signed_64, bfd_putb64,
+ bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+ bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
+ bfd_getb64, bfd_getb_signed_64, bfd_putb64,
+ bfd_getb32, bfd_getb_signed_32, bfd_putb32,
+ bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
+ {_bfd_dummy_target, MY_object_p, /* bfd_check_format */
+ bfd_generic_archive_p, MY_core_file_p},
+ {bfd_false, MY_mkobject, /* bfd_set_format */
+ _bfd_generic_mkarchive, bfd_false},
+ {bfd_false, MY_write_object_contents, /* bfd_write_contents */
+ _bfd_write_archive_contents, bfd_false},
+
+ BFD_JUMP_TABLE_GENERIC (MY),
+ BFD_JUMP_TABLE_COPY (MY),
+ BFD_JUMP_TABLE_CORE (MY),
+ BFD_JUMP_TABLE_ARCHIVE (MY),
+ BFD_JUMP_TABLE_SYMBOLS (MY),
+ BFD_JUMP_TABLE_RELOCS (MY),
+ BFD_JUMP_TABLE_WRITE (MY),
+ BFD_JUMP_TABLE_LINK (MY),
+ BFD_JUMP_TABLE_DYNAMIC (MY),
+
+ & aout_arm_little_vec,
+
+ (PTR) MY_backend_data,
+ };
diff --git a/contrib/binutils/bfd/aout-encap.c b/contrib/binutils/bfd/aout-encap.c
index 77d6358..84c46c6 100644
--- a/contrib/binutils/bfd/aout-encap.c
+++ b/contrib/binutils/bfd/aout-encap.c
@@ -1,5 +1,6 @@
/* BFD back-end for a.out files encapsulated with COFF headers.
- Copyright 1990, 1991, 1994, 1995, 2000 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1994, 1995, 2000, 2001
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -27,9 +28,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#endif
#include "bfd.h"
-#include <sysdep.h>
+#include "sysdep.h"
#include "libbfd.h"
-#include <aout/aout64.h>
+#include "aout/aout64.h"
#include "aout/stab_gnu.h"
#include "aout/ar.h"
#include "libaout.h" /* BFD a.out internal data structures */
@@ -45,39 +46,40 @@ encap_object_p (abfd)
short coff_magic;
struct external_exec exec_bytes;
struct internal_exec exec;
+ bfd_size_type amt = sizeof (magicbuf);
- if (bfd_read ((PTR)magicbuf, 1, sizeof (magicbuf), abfd) !=
- sizeof (magicbuf))
+ if (bfd_bread ((PTR) magicbuf, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return 0;
}
- coff_magic = bfd_h_get_16 (abfd, magicbuf);
+ coff_magic = H_GET_16 (abfd, magicbuf);
if (coff_magic != COFF_MAGIC)
return 0; /* Not an encap coff file */
- __header_offset_temp==COFF_MAGIC ? sizeof (struct coffheader) : 0)
- (fseek ((f), HEADER_OFFSET((f)), 1))
+ magic = H_GET_32 (abfd, magicbuf);
- magic = bfd_h_get_32 (abfd, magicbuf);
-
- if (N_BADMAG (*((struct internal_exec *) &magic))) return 0;
+ if (N_BADMAG (*((struct internal_exec *) &magic)))
+ return 0;
- struct external_exec exec_bytes;
- if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
- != EXEC_BYTES_SIZE) {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
+ if (bfd_seek (abfd, (file_ptr) sizeof (struct coffheader), SEEK_SET) != 0)
return 0;
- }
+
+ amt = EXEC_BYTES_SIZE;
+ if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt)
+ {
+ if (bfd_get_error () != bfd_error_system_call)
+ bfd_set_error (bfd_error_wrong_format);
+ return 0;
+ }
NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec);
return aout_32_some_aout_object_p (abfd, &exec, encap_realcallback);
}
-/* Finish up the reading of a encapsulated-coff a.out file header */
+/* Finish up the reading of an encapsulated-coff a.out file header. */
const bfd_target *
encap_real_callback (abfd)
bfd *abfd;
@@ -90,24 +92,26 @@ encap_real_callback (abfd)
text_start and exec_data_start. This is particularly useful
for remote debugging of embedded systems. */
if (N_FLAGS(exec_aouthdr) & N_FLAGS_COFF_ENCAPSULATE)
- {
- struct coffheader ch;
- int val;
- val = lseek (execchan, -(sizeof (AOUTHDR) + sizeof (ch)), 1);
- if (val == -1)
- perror_with_name (filename);
- val = myread (execchan, &ch, sizeof (ch));
- if (val < 0)
- perror_with_name (filename);
- text_start = ch.text_start;
- exec_data_start = ch.data_start;
- } else
- {
- text_start =
- IS_OBJECT_FILE (exec_aouthdr) ? 0 : N_TXTADDR (exec_aouthdr);
- exec_data_start = IS_OBJECT_FILE (exec_aouthdr)
- ? exec_aouthdr.a_text : N_DATADDR (exec_aouthdr);
- }
+ {
+ struct coffheader ch;
+ int val;
+ val = lseek (execchan, -(sizeof (AOUTHDR) + sizeof (ch)), 1);
+ if (val == -1)
+ perror_with_name (filename);
+ val = myread (execchan, &ch, sizeof (ch));
+ if (val < 0)
+ perror_with_name (filename);
+ text_start = ch.text_start;
+ exec_data_start = ch.data_start;
+ }
+ else
+ {
+ text_start =
+ IS_OBJECT_FILE (exec_aouthdr) ? 0 : N_TXTADDR (exec_aouthdr);
+ exec_data_start = (IS_OBJECT_FILE (exec_aouthdr)
+ ? exec_aouthdr.a_text
+ : N_DATADDR (exec_aouthdr));
+ }
/* Determine the architecture and machine type of the object file. */
bfd_default_set_arch_mach(abfd, bfd_arch_m68k, 0); /* FIXME */
@@ -127,10 +131,10 @@ encap_write_object_contents (abfd)
struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd);
-/****** FIXME: Fragments from the old GNU LD program for dealing with
- encap coff. */
-struct coffheader coffheader;
-int need_coff_header;
+ /* FIXME: Fragments from the old GNU LD program for dealing with
+ encap coff. */
+ struct coffheader coffheader;
+ int need_coff_header;
/* Determine whether to count the header as part of
the text size, and initialize the text size accordingly.
diff --git a/contrib/binutils/bfd/aout-sparcle.c b/contrib/binutils/bfd/aout-sparcle.c
index d8ad8a5..7772c29 100644
--- a/contrib/binutils/bfd/aout-sparcle.c
+++ b/contrib/binutils/bfd/aout-sparcle.c
@@ -1,5 +1,5 @@
/* BFD backend for sparc little-endian aout binaries.
- Copyright 1996 Free Software Foundation, Inc.
+ Copyright 1996, 2001 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,7 +19,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define TARGETNAME "a.out-sparc-little"
-#define MY(OP) CAT(sparcle_aout_,OP)
+
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define MY(OP) CONCAT2 (sparcle_aout_,OP)
#include "bfd.h"
#include "bfdlink.h"
diff --git a/contrib/binutils/bfd/aout-target.h b/contrib/binutils/bfd/aout-target.h
index 2e74e37..ccedb93 100644
--- a/contrib/binutils/bfd/aout-target.h
+++ b/contrib/binutils/bfd/aout-target.h
@@ -88,9 +88,9 @@ MY(callback) (abfd)
/* Determine the architecture and machine type of the object file. */
#ifdef SET_ARCH_MACH
- SET_ARCH_MACH(abfd, *execp);
+ SET_ARCH_MACH (abfd, *execp);
#else
- bfd_default_set_arch_mach(abfd, DEFAULT_ARCH, 0);
+ bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0);
#endif
/* The number of relocation records. This must be called after
@@ -146,18 +146,19 @@ MY(object_p) (abfd)
struct external_exec exec_bytes; /* Raw exec header from file */
struct internal_exec exec; /* Cleaned-up exec header */
const bfd_target *target;
+ bfd_size_type amt = EXEC_BYTES_SIZE;
- if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
- != EXEC_BYTES_SIZE) {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- return 0;
- }
+ if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt)
+ {
+ if (bfd_get_error () != bfd_error_system_call)
+ bfd_set_error (bfd_error_wrong_format);
+ return 0;
+ }
#ifdef SWAP_MAGIC
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
#else
- exec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info);
+ exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info);
#endif /* SWAP_MAGIC */
if (N_BADMAG (exec)) return 0;
@@ -250,6 +251,8 @@ MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
file header, symbols, and relocation. */
#ifndef MY_write_object_contents
+static boolean MY(write_object_contents) PARAMS ((bfd *));
+
static boolean
MY(write_object_contents) (abfd)
bfd *abfd;
@@ -326,7 +329,7 @@ MY(set_sizes) (abfd)
#define MY_finish_dynamic_link 0
#endif
-static CONST struct aout_backend_data MY(backend_data) = {
+static const struct aout_backend_data MY(backend_data) = {
MY_zmagic_contiguous,
MY_text_includes_header,
MY_entry_is_text_address,
@@ -507,6 +510,9 @@ MY_bfd_final_link (abfd, info)
#ifndef MY_bfd_gc_sections
#define MY_bfd_gc_sections bfd_generic_gc_sections
#endif
+#ifndef MY_bfd_merge_sections
+#define MY_bfd_merge_sections bfd_generic_merge_sections
+#endif
#ifndef MY_bfd_reloc_type_lookup
#define MY_bfd_reloc_type_lookup NAME(aout,reloc_type_lookup)
#endif
diff --git a/contrib/binutils/bfd/aout0.c b/contrib/binutils/bfd/aout0.c
index 1d4c66e..731d476 100644
--- a/contrib/binutils/bfd/aout0.c
+++ b/contrib/binutils/bfd/aout0.c
@@ -1,5 +1,5 @@
/* BFD backend for SunOS style a.out with flags set to 0
- Copyright 1990, 1991, 1992, 1993, 1994, 1995
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -20,7 +20,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define TARGETNAME "a.out-zero-big"
-#define MY(OP) CAT(aout0_big_,OP)
+
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define MY(OP) CONCAT2 (aout0_big_,OP)
#include "bfd.h"
diff --git a/contrib/binutils/bfd/aoutf1.h b/contrib/binutils/bfd/aoutf1.h
index a62c68d..0f773a1 100644
--- a/contrib/binutils/bfd/aoutf1.h
+++ b/contrib/binutils/bfd/aoutf1.h
@@ -1,5 +1,6 @@
/* A.out "format 1" file handling code for BFD.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
+ 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -75,7 +76,7 @@ The name put into the target vector.
#endif
static boolean sunos_merge_private_bfd_data PARAMS ((bfd *, bfd *));
-static void sunos_set_arch_mach PARAMS ((bfd *, int));
+static void sunos_set_arch_mach PARAMS ((bfd *, enum machine_type));
static void choose_reloc_size PARAMS ((bfd *));
static boolean sunos_write_object_contents PARAMS ((bfd *));
static const bfd_target *sunos4_core_file_p PARAMS ((bfd *));
@@ -113,11 +114,11 @@ sunos_merge_private_bfd_data (ibfd, obfd)
static void
sunos_set_arch_mach (abfd, machtype)
bfd *abfd;
- int machtype;
+ enum machine_type machtype;
{
/* Determine the architecture and machine type of the object file. */
enum bfd_architecture arch;
- long machine;
+ unsigned long machine;
switch (machtype)
{
@@ -259,7 +260,7 @@ sunos_write_object_contents (abfd)
N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags);
- N_SET_DYNAMIC (*execp, bfd_get_file_flags (abfd) & DYNAMIC);
+ N_SET_DYNAMIC (*execp, (long)(bfd_get_file_flags (abfd) & DYNAMIC));
WRITE_HEADERS (abfd, execp);
@@ -422,8 +423,8 @@ swapcore_sun3 (abfd, ext, intcore)
{
struct external_sun3_core *extcore = (struct external_sun3_core *) ext;
- intcore->c_magic = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_magic);
- intcore->c_len = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_len);
+ intcore->c_magic = H_GET_32 (abfd, &extcore->c_magic);
+ intcore->c_len = H_GET_32 (abfd, &extcore->c_len);
intcore->c_regs_pos = (long) (((struct external_sun3_core *) 0)->c_regs);
intcore->c_regs_size = sizeof (extcore->c_regs);
#if ARCH_SIZE == 64
@@ -432,20 +433,21 @@ swapcore_sun3 (abfd, ext, intcore)
aout_32_swap_exec_header_in
#endif
(abfd, &extcore->c_aouthdr, &intcore->c_aouthdr);
- intcore->c_signo = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_signo);
- intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_tsize);
- intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_dsize);
+ intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo);
+ intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize);
+ intcore->c_dsize = H_GET_32 (abfd, &extcore->c_dsize);
intcore->c_data_addr = N_DATADDR (intcore->c_aouthdr);
- intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_ssize);
+ intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize);
memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
intcore->fp_stuff_pos = (long) (((struct external_sun3_core *) 0)->fp_stuff);
/* FP stuff takes up whole rest of struct, except c_ucode. */
intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
(file_ptr) (((struct external_sun3_core *) 0)->fp_stuff);
/* Ucode is the last thing in the struct -- just before the end */
- intcore->c_ucode =
- bfd_h_get_32 (abfd,
- intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *) extcore);
+ intcore->c_ucode = H_GET_32 (abfd,
+ (intcore->c_len
+ - sizeof (extcore->c_ucode)
+ + (unsigned char *) extcore));
intcore->c_stacktop = 0x0E000000; /* By experimentation */
}
@@ -458,8 +460,8 @@ swapcore_sparc (abfd, ext, intcore)
{
struct external_sparc_core *extcore = (struct external_sparc_core *) ext;
- intcore->c_magic = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_magic);
- intcore->c_len = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_len);
+ intcore->c_magic = H_GET_32 (abfd, &extcore->c_magic);
+ intcore->c_len = H_GET_32 (abfd, &extcore->c_len);
intcore->c_regs_pos = (long) (((struct external_sparc_core *) 0)->c_regs);
intcore->c_regs_size = sizeof (extcore->c_regs);
#if ARCH_SIZE == 64
@@ -468,20 +470,21 @@ swapcore_sparc (abfd, ext, intcore)
aout_32_swap_exec_header_in
#endif
(abfd, &extcore->c_aouthdr, &intcore->c_aouthdr);
- intcore->c_signo = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_signo);
- intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_tsize);
- intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_dsize);
+ intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo);
+ intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize);
+ intcore->c_dsize = H_GET_32 (abfd, &extcore->c_dsize);
intcore->c_data_addr = N_DATADDR (intcore->c_aouthdr);
- intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_ssize);
+ intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize);
memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
intcore->fp_stuff_pos = (long) (((struct external_sparc_core *) 0)->fp_stuff);
/* FP stuff takes up whole rest of struct, except c_ucode. */
intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
(file_ptr) (((struct external_sparc_core *) 0)->fp_stuff);
/* Ucode is the last thing in the struct -- just before the end */
- intcore->c_ucode =
- bfd_h_get_32 (abfd,
- intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *) extcore);
+ intcore->c_ucode = H_GET_32 (abfd,
+ (intcore->c_len
+ - sizeof (extcore->c_ucode)
+ + (unsigned char *) extcore));
/* Supposedly the user stack grows downward from the bottom of kernel memory.
Presuming that this remains true, this definition will work. */
@@ -499,8 +502,7 @@ swapcore_sparc (abfd, ext, intcore)
#define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000)
#define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000)
{
- bfd_vma sp = bfd_h_get_32
- (abfd, (unsigned char *) &((struct regs *) &extcore->c_regs[0])->r_o6);
+ bfd_vma sp = H_GET_32 (abfd, &((struct regs *) &extcore->c_regs[0])->r_o6);
if (sp < SPARC_USRSTACK_SPARC10)
intcore->c_stacktop = SPARC_USRSTACK_SPARC10;
else
@@ -518,8 +520,8 @@ swapcore_solaris_bcp (abfd, ext, intcore)
struct external_solaris_bcp_core *extcore =
(struct external_solaris_bcp_core *) ext;
- intcore->c_magic = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_magic);
- intcore->c_len = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_len);
+ intcore->c_magic = H_GET_32 (abfd, &extcore->c_magic);
+ intcore->c_len = H_GET_32 (abfd, &extcore->c_len);
intcore->c_regs_pos = (long) (((struct external_solaris_bcp_core *) 0)->c_regs);
intcore->c_regs_size = sizeof (extcore->c_regs);
@@ -534,12 +536,11 @@ swapcore_solaris_bcp (abfd, ext, intcore)
the data section is written from address zero instead of the data
start address. */
memset ((PTR) &intcore->c_aouthdr, 0, sizeof (struct internal_exec));
- intcore->c_data_addr =
- bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_exdata_datorg);
- intcore->c_signo = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_signo);
- intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_tsize);
- intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_dsize);
- intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_ssize);
+ intcore->c_data_addr = H_GET_32 (abfd, &extcore->c_exdata_datorg);
+ intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo);
+ intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize);
+ intcore->c_dsize = H_GET_32 (abfd, &extcore->c_dsize);
+ intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize);
memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
intcore->fp_stuff_pos =
(long) (((struct external_solaris_bcp_core *) 0)->fp_stuff);
@@ -547,9 +548,10 @@ swapcore_solaris_bcp (abfd, ext, intcore)
intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
(file_ptr) (((struct external_solaris_bcp_core *) 0)->fp_stuff);
/* Ucode is the last thing in the struct -- just before the end */
- intcore->c_ucode =
- bfd_h_get_32 (abfd,
- intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *) extcore);
+ intcore->c_ucode = H_GET_32 (abfd,
+ (intcore->c_len
+ - sizeof (extcore->c_ucode)
+ + (unsigned char *) extcore));
/* Supposedly the user stack grows downward from the bottom of kernel memory.
Presuming that this remains true, this definition will work. */
@@ -567,8 +569,7 @@ swapcore_solaris_bcp (abfd, ext, intcore)
#define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000)
#define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000)
{
- bfd_vma sp = bfd_h_get_32
- (abfd, (unsigned char *) &((struct regs *) &extcore->c_regs[0])->r_o6);
+ bfd_vma sp = H_GET_32 (abfd, &((struct regs *) &extcore->c_regs[0])->r_o6);
if (sp < SPARC_USRSTACK_SPARC10)
intcore->c_stacktop = SPARC_USRSTACK_SPARC10;
else
@@ -598,7 +599,7 @@ sunos4_core_file_p (abfd)
bfd *abfd;
{
unsigned char longbuf[4]; /* Raw bytes of various header fields */
- bfd_size_type core_size;
+ bfd_size_type core_size, amt;
unsigned long core_mag;
struct internal_sunos_core *core;
char *extcore;
@@ -607,38 +608,41 @@ sunos4_core_file_p (abfd)
struct sun_core_struct suncoredata;
struct internal_sunos_core internal_sunos_core;
char external_core[1];
- }
- *mergem;
+ } *mergem;
- if (bfd_read ((PTR) longbuf, 1, sizeof (longbuf), abfd) !=
- sizeof (longbuf))
+ if (bfd_bread ((PTR) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
+ != sizeof (longbuf))
return 0;
- core_mag = bfd_h_get_32 (abfd, longbuf);
+ core_mag = H_GET_32 (abfd, longbuf);
if (core_mag != CORE_MAGIC)
return 0;
/* SunOS core headers can vary in length; second word is size; */
- if (bfd_read ((PTR) longbuf, 1, sizeof (longbuf), abfd) !=
- sizeof (longbuf))
+ if (bfd_bread ((PTR) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
+ != sizeof (longbuf))
return 0;
- core_size = bfd_h_get_32 (abfd, longbuf);
+ core_size = H_GET_32 (abfd, longbuf);
/* Sanity check */
if (core_size > 20000)
return 0;
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) < 0)
+ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
return 0;
- mergem = (struct mergem *) bfd_zalloc (abfd, core_size + sizeof (struct mergem));
+ amt = core_size + sizeof (struct mergem);
+ mergem = (struct mergem *) bfd_zalloc (abfd, amt);
if (mergem == NULL)
return 0;
extcore = mergem->external_core;
- if ((bfd_read ((PTR) extcore, 1, core_size, abfd)) != core_size)
+ if ((bfd_bread ((PTR) extcore, core_size, abfd)) != core_size)
{
+ loser:
bfd_release (abfd, (char *) mergem);
+ abfd->tdata.any = NULL;
+ bfd_section_list_clear (abfd);
return 0;
}
@@ -659,47 +663,29 @@ sunos4_core_file_p (abfd)
break;
default:
bfd_set_error (bfd_error_system_call); /* FIXME */
- bfd_release (abfd, (char *) mergem);
- return 0;
+ goto loser;
}
abfd->tdata.sun_core_data = &mergem->suncoredata;
abfd->tdata.sun_core_data->hdr = core;
- /* create the sections. This is raunchy, but bfd_close wants to reclaim
- them */
- core_stacksec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
+ /* Create the sections. */
+ core_stacksec (abfd) = bfd_make_section_anyway (abfd, ".stack");
if (core_stacksec (abfd) == NULL)
- {
- loser:
- bfd_release (abfd, (char *) mergem);
- return 0;
- }
- core_datasec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
+ /* bfd_release frees everything allocated after it's arg. */
+ goto loser;
+
+ core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data");
if (core_datasec (abfd) == NULL)
- {
- loser1:
- bfd_release (abfd, core_stacksec (abfd));
- goto loser;
- }
- core_regsec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
+ goto loser;
+
+ core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
if (core_regsec (abfd) == NULL)
- {
- loser2:
- bfd_release (abfd, core_datasec (abfd));
- goto loser1;
- }
- core_reg2sec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
- if (core_reg2sec (abfd) == NULL)
- {
- bfd_release (abfd, core_regsec (abfd));
- goto loser2;
- }
+ goto loser;
- core_stacksec (abfd)->name = ".stack";
- core_datasec (abfd)->name = ".data";
- core_regsec (abfd)->name = ".reg";
- core_reg2sec (abfd)->name = ".reg2";
+ core_reg2sec (abfd) = bfd_make_section_anyway (abfd, ".reg2");
+ if (core_reg2sec (abfd) == NULL)
+ goto loser;
core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
@@ -728,13 +714,6 @@ sunos4_core_file_p (abfd)
core_regsec (abfd)->alignment_power = 2;
core_reg2sec (abfd)->alignment_power = 2;
- abfd->sections = core_stacksec (abfd);
- core_stacksec (abfd)->next = core_datasec (abfd);
- core_datasec (abfd)->next = core_regsec (abfd);
- core_regsec (abfd)->next = core_reg2sec (abfd);
-
- abfd->section_count = 4;
-
return abfd->xvec;
}
@@ -822,7 +801,7 @@ sunos4_set_sizes (abfd)
#define MY_finish_dynamic_link 0
#endif
-static CONST struct aout_backend_data sunos4_aout_backend =
+static const struct aout_backend_data sunos4_aout_backend =
{
0, /* zmagic files are not contiguous */
1, /* text includes header */
diff --git a/contrib/binutils/bfd/aoutx.h b/contrib/binutils/bfd/aoutx.h
index 490ead7..0a3c05a 100644
--- a/contrib/binutils/bfd/aoutx.h
+++ b/contrib/binutils/bfd/aoutx.h
@@ -120,9 +120,9 @@ DESCRIPTION
#define KEEPIT udata.i
-#include <ctype.h>
#include "bfd.h"
#include "sysdep.h"
+#include "safe-ctype.h"
#include "bfdlink.h"
#include "libaout.h"
@@ -139,6 +139,8 @@ static boolean translate_to_native_sym_flags
static void adjust_o_magic PARAMS ((bfd *, struct internal_exec *));
static void adjust_z_magic PARAMS ((bfd *, struct internal_exec *));
static void adjust_n_magic PARAMS ((bfd *, struct internal_exec *));
+reloc_howto_type * NAME(aout,reloc_type_lookup)
+ PARAMS ((bfd *, bfd_reloc_code_real_type));
/*
SUBSECTION
@@ -156,9 +158,10 @@ DESCRIPTION
*/
#ifndef CTOR_TABLE_RELOC_HOWTO
#define CTOR_TABLE_RELOC_IDX 2
-#define CTOR_TABLE_RELOC_HOWTO(BFD) ((obj_reloc_entry_size(BFD) == RELOC_EXT_SIZE \
- ? howto_table_ext : howto_table_std) \
- + CTOR_TABLE_RELOC_IDX)
+#define CTOR_TABLE_RELOC_HOWTO(BFD) \
+ ((obj_reloc_entry_size (BFD) == RELOC_EXT_SIZE \
+ ? howto_table_ext : howto_table_std) \
+ + CTOR_TABLE_RELOC_IDX)
#endif
#ifndef MY_swap_std_reloc_in
@@ -225,23 +228,23 @@ reloc_howto_type howto_table_ext[] =
reloc_howto_type howto_table_std[] = {
/* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */
-HOWTO( 0, 0, 0, 8, false, 0, complain_overflow_bitfield,0,"8", true, 0x000000ff,0x000000ff, false),
-HOWTO( 1, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"16", true, 0x0000ffff,0x0000ffff, false),
-HOWTO( 2, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"32", true, 0xffffffff,0xffffffff, false),
-HOWTO( 3, 0, 4, 64, false, 0, complain_overflow_bitfield,0,"64", true, 0xdeaddead,0xdeaddead, false),
-HOWTO( 4, 0, 0, 8, true, 0, complain_overflow_signed, 0,"DISP8", true, 0x000000ff,0x000000ff, false),
-HOWTO( 5, 0, 1, 16, true, 0, complain_overflow_signed, 0,"DISP16", true, 0x0000ffff,0x0000ffff, false),
-HOWTO( 6, 0, 2, 32, true, 0, complain_overflow_signed, 0,"DISP32", true, 0xffffffff,0xffffffff, false),
-HOWTO( 7, 0, 4, 64, true, 0, complain_overflow_signed, 0,"DISP64", true, 0xfeedface,0xfeedface, false),
-HOWTO( 8, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"GOT_REL", false, 0,0x00000000, false),
-HOWTO( 9, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"BASE16", false,0xffffffff,0xffffffff, false),
-HOWTO(10, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"BASE32", false,0xffffffff,0xffffffff, false),
+HOWTO ( 0, 0, 0, 8, false, 0, complain_overflow_bitfield,0,"8", true, 0x000000ff,0x000000ff, false),
+HOWTO ( 1, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"16", true, 0x0000ffff,0x0000ffff, false),
+HOWTO ( 2, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"32", true, 0xffffffff,0xffffffff, false),
+HOWTO ( 3, 0, 4, 64, false, 0, complain_overflow_bitfield,0,"64", true, 0xdeaddead,0xdeaddead, false),
+HOWTO ( 4, 0, 0, 8, true, 0, complain_overflow_signed, 0,"DISP8", true, 0x000000ff,0x000000ff, false),
+HOWTO ( 5, 0, 1, 16, true, 0, complain_overflow_signed, 0,"DISP16", true, 0x0000ffff,0x0000ffff, false),
+HOWTO ( 6, 0, 2, 32, true, 0, complain_overflow_signed, 0,"DISP32", true, 0xffffffff,0xffffffff, false),
+HOWTO ( 7, 0, 4, 64, true, 0, complain_overflow_signed, 0,"DISP64", true, 0xfeedface,0xfeedface, false),
+HOWTO ( 8, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"GOT_REL", false, 0,0x00000000, false),
+HOWTO ( 9, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"BASE16", false,0xffffffff,0xffffffff, false),
+HOWTO (10, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"BASE32", false,0xffffffff,0xffffffff, false),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
- HOWTO(16, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"JMP_TABLE", false, 0,0x00000000, false),
+ HOWTO (16, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"JMP_TABLE", false, 0,0x00000000, false),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
@@ -257,7 +260,7 @@ EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
- HOWTO(32, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"RELATIVE", false, 0,0x00000000, false),
+ HOWTO (32, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"RELATIVE", false, 0,0x00000000, false),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
@@ -265,18 +268,18 @@ EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
EMPTY_HOWTO (-1),
- HOWTO(40, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"BASEREL", false, 0,0x00000000, false),
+ HOWTO (40, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"BASEREL", false, 0,0x00000000, false),
};
-#define TABLE_SIZE(TABLE) (sizeof (TABLE)/sizeof (TABLE[0]))
+#define TABLE_SIZE(TABLE) (sizeof (TABLE) / sizeof (TABLE[0]))
reloc_howto_type *
NAME(aout,reloc_type_lookup) (abfd,code)
bfd *abfd;
bfd_reloc_code_real_type code;
{
-#define EXT(i,j) case i: return &howto_table_ext[j]
-#define STD(i,j) case i: return &howto_table_std[j]
+#define EXT(i, j) case i: return &howto_table_ext[j]
+#define STD(i, j) case i: return &howto_table_std[j]
int ext = obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE;
if (code == BFD_RELOC_CTOR)
switch (bfd_get_arch_info (abfd)->bits_per_address)
@@ -366,7 +369,7 @@ NAME(aout,swap_exec_header_in) (abfd, raw_bytes, execp)
are memcmp'd, and thus the contents do matter. */
memset ((PTR) execp, 0, sizeof (struct internal_exec));
/* Now fill in fields in the execp, from the bytes in the raw data. */
- execp->a_info = bfd_h_get_32 (abfd, bytes->e_info);
+ execp->a_info = H_GET_32 (abfd, bytes->e_info);
execp->a_text = GET_WORD (abfd, bytes->e_text);
execp->a_data = GET_WORD (abfd, bytes->e_data);
execp->a_bss = GET_WORD (abfd, bytes->e_bss);
@@ -401,7 +404,7 @@ NAME(aout,swap_exec_header_out) (abfd, execp, raw_bytes)
struct external_exec *bytes = (struct external_exec *)raw_bytes;
/* Now fill in fields in the raw data, from the fields in the exec struct. */
- bfd_h_put_32 (abfd, execp->a_info , bytes->e_info);
+ H_PUT_32 (abfd, execp->a_info , bytes->e_info);
PUT_WORD (abfd, execp->a_text , bytes->e_text);
PUT_WORD (abfd, execp->a_data , bytes->e_data);
PUT_WORD (abfd, execp->a_bss , bytes->e_bss);
@@ -454,8 +457,9 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
{
struct aout_data_struct *rawptr, *oldrawptr;
const bfd_target *result;
+ bfd_size_type amt = sizeof (struct aout_data_struct);
- rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, sizeof (struct aout_data_struct ));
+ rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt);
if (rawptr == NULL)
return 0;
@@ -480,7 +484,7 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
/* Setting of EXEC_P has been deferred to the bottom of this function */
if (execp->a_syms)
abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS;
- if (N_DYNAMIC(*execp))
+ if (N_DYNAMIC (*execp))
abfd->flags |= DYNAMIC;
if (N_MAGIC (*execp) == ZMAGIC)
@@ -557,37 +561,38 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
struct exec *execp = exec_hdr (abfd);
- obj_textsec (abfd)->size = N_TXTSIZE(*execp);
- obj_textsec (abfd)->raw_size = N_TXTSIZE(*execp);
+ obj_textsec (abfd)->size = N_TXTSIZE (*execp);
+ obj_textsec (abfd)->raw_size = N_TXTSIZE (*execp);
/* data and bss are already filled in since they're so standard */
/* The virtual memory addresses of the sections */
- obj_textsec (abfd)->vma = N_TXTADDR(*execp);
- obj_datasec (abfd)->vma = N_DATADDR(*execp);
- obj_bsssec (abfd)->vma = N_BSSADDR(*execp);
+ obj_textsec (abfd)->vma = N_TXTADDR (*execp);
+ obj_datasec (abfd)->vma = N_DATADDR (*execp);
+ obj_bsssec (abfd)->vma = N_BSSADDR (*execp);
/* The file offsets of the sections */
- obj_textsec (abfd)->filepos = N_TXTOFF(*execp);
- obj_datasec (abfd)->filepos = N_DATOFF(*execp);
+ obj_textsec (abfd)->filepos = N_TXTOFF (*execp);
+ obj_datasec (abfd)->filepos = N_DATOFF (*execp);
/* The file offsets of the relocation info */
- obj_textsec (abfd)->rel_filepos = N_TRELOFF(*execp);
- obj_datasec (abfd)->rel_filepos = N_DRELOFF(*execp);
+ obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp);
+ obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp);
/* The file offsets of the string table and symbol table. */
obj_str_filepos (abfd) = N_STROFF (*execp);
obj_sym_filepos (abfd) = N_SYMOFF (*execp);
/* Determine the architecture and machine type of the object file. */
- switch (N_MACHTYPE (*exec_hdr (abfd))) {
- default:
- abfd->obj_arch = bfd_arch_obscure;
- break;
- }
+ switch (N_MACHTYPE (*exec_hdr (abfd)))
+ {
+ default:
+ abfd->obj_arch = bfd_arch_obscure;
+ break;
+ }
- adata(abfd)->page_size = TARGET_PAGE_SIZE;
- adata(abfd)->segment_size = SEGMENT_SIZE;
- adata(abfd)->exec_bytes_size = EXEC_BYTES_SIZE;
+ adata (abfd)->page_size = TARGET_PAGE_SIZE;
+ adata (abfd)->segment_size = SEGMENT_SIZE;
+ adata (abfd)->exec_bytes_size = EXEC_BYTES_SIZE;
return abfd->xvec;
@@ -619,8 +624,9 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
sets the entry point, and that is likely to be non-zero for most systems. */
if (execp->a_entry != 0
- || (execp->a_entry >= obj_textsec(abfd)->vma
- && execp->a_entry < obj_textsec(abfd)->vma + obj_textsec(abfd)->_raw_size))
+ || (execp->a_entry >= obj_textsec (abfd)->vma
+ && execp->a_entry < (obj_textsec (abfd)->vma
+ + obj_textsec (abfd)->_raw_size)))
abfd->flags |= EXEC_P;
#ifdef STAT_FOR_EXEC
else
@@ -636,7 +642,7 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
issue. Many kernels are loaded at non standard addresses. */
if (abfd->iostream != NULL
&& (abfd->flags & BFD_IN_MEMORY) == 0
- && (fstat(fileno((FILE *) (abfd->iostream)), &stat_buf) == 0)
+ && (fstat (fileno ((FILE *) (abfd->iostream)), &stat_buf) == 0)
&& ((stat_buf.st_mode & 0111) != 0))
abfd->flags |= EXEC_P;
}
@@ -673,22 +679,21 @@ boolean
NAME(aout,mkobject) (abfd)
bfd *abfd;
{
- struct aout_data_struct *rawptr;
+ struct aout_data_struct *rawptr;
+ bfd_size_type amt = sizeof (struct aout_data_struct);
bfd_set_error (bfd_error_system_call);
- /* Use an intermediate variable for clarity */
- rawptr = (struct aout_data_struct *)bfd_zalloc (abfd, sizeof (struct aout_data_struct ));
-
+ rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt);
if (rawptr == NULL)
return false;
abfd->tdata.aout_data = rawptr;
exec_hdr (abfd) = &(rawptr->e);
- obj_textsec (abfd) = (asection *)NULL;
- obj_datasec (abfd) = (asection *)NULL;
- obj_bsssec (abfd) = (asection *)NULL;
+ obj_textsec (abfd) = (asection *) NULL;
+ obj_datasec (abfd) = (asection *) NULL;
+ obj_bsssec (abfd) = (asection *) NULL;
return true;
}
@@ -723,95 +728,102 @@ NAME(aout,machine_type) (arch, machine, unknown)
arch_flags = M_UNKNOWN;
*unknown = true;
- switch (arch) {
- case bfd_arch_sparc:
- if (machine == 0
- || machine == bfd_mach_sparc
- || machine == bfd_mach_sparc_sparclite
- || machine == bfd_mach_sparc_sparclite_le
- || machine == bfd_mach_sparc_v9)
- arch_flags = M_SPARC;
- else if (machine == bfd_mach_sparc_sparclet)
- arch_flags = M_SPARCLET;
- break;
-
- case bfd_arch_m68k:
- switch (machine) {
- case 0: arch_flags = M_68010; break;
- case bfd_mach_m68000: arch_flags = M_UNKNOWN; *unknown = false; break;
- case bfd_mach_m68010: arch_flags = M_68010; break;
- case bfd_mach_m68020: arch_flags = M_68020; break;
- default: arch_flags = M_UNKNOWN; break;
- }
- break;
-
- case bfd_arch_i386:
- if (machine == 0) arch_flags = M_386;
- break;
-
- case bfd_arch_a29k:
- if (machine == 0) arch_flags = M_29K;
- break;
-
- case bfd_arch_arm:
- if (machine == 0) arch_flags = M_ARM;
- break;
-
- case bfd_arch_mips:
- switch (machine) {
- case 0:
- case bfd_mach_mips3000:
- case bfd_mach_mips3900:
- arch_flags = M_MIPS1;
+ switch (arch)
+ {
+ case bfd_arch_sparc:
+ if (machine == 0
+ || machine == bfd_mach_sparc
+ || machine == bfd_mach_sparc_sparclite
+ || machine == bfd_mach_sparc_sparclite_le
+ || machine == bfd_mach_sparc_v9)
+ arch_flags = M_SPARC;
+ else if (machine == bfd_mach_sparc_sparclet)
+ arch_flags = M_SPARCLET;
break;
- case bfd_mach_mips6000:
- arch_flags = M_MIPS2;
+
+ case bfd_arch_m68k:
+ switch (machine)
+ {
+ case 0: arch_flags = M_68010; break;
+ case bfd_mach_m68000: arch_flags = M_UNKNOWN; *unknown = false; break;
+ case bfd_mach_m68010: arch_flags = M_68010; break;
+ case bfd_mach_m68020: arch_flags = M_68020; break;
+ default: arch_flags = M_UNKNOWN; break;
+ }
break;
- case bfd_mach_mips4000:
- case bfd_mach_mips4010:
- case bfd_mach_mips4100:
- case bfd_mach_mips4300:
- case bfd_mach_mips4400:
- case bfd_mach_mips4600:
- case bfd_mach_mips4650:
- case bfd_mach_mips8000:
- case bfd_mach_mips10000:
- case bfd_mach_mips12000:
- case bfd_mach_mips16:
- case bfd_mach_mips32:
- case bfd_mach_mips32_4k:
- case bfd_mach_mips5:
- case bfd_mach_mips64:
- case bfd_mach_mips_sb1:
- /* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc. */
- arch_flags = M_MIPS2;
+
+ case bfd_arch_i386:
+ if (machine == 0)
+ arch_flags = M_386;
break;
- default:
- arch_flags = M_UNKNOWN;
+
+ case bfd_arch_a29k:
+ if (machine == 0)
+ arch_flags = M_29K;
break;
- }
- break;
-
- case bfd_arch_ns32k:
- switch (machine) {
- case 0: arch_flags = M_NS32532; break;
- case 32032: arch_flags = M_NS32032; break;
- case 32532: arch_flags = M_NS32532; break;
- default: arch_flags = M_UNKNOWN; break;
- }
- break;
- case bfd_arch_vax:
- *unknown = false;
- break;
+ case bfd_arch_arm:
+ if (machine == 0)
+ arch_flags = M_ARM;
+ break;
- case bfd_arch_cris:
- if (machine == 0 || machine == 255) arch_flags = M_CRIS;
- break;
+ case bfd_arch_mips:
+ switch (machine)
+ {
+ case 0:
+ case bfd_mach_mips3000:
+ case bfd_mach_mips3900:
+ arch_flags = M_MIPS1;
+ break;
+ case bfd_mach_mips6000:
+ arch_flags = M_MIPS2;
+ break;
+ case bfd_mach_mips4000:
+ case bfd_mach_mips4010:
+ case bfd_mach_mips4100:
+ case bfd_mach_mips4300:
+ case bfd_mach_mips4400:
+ case bfd_mach_mips4600:
+ case bfd_mach_mips4650:
+ case bfd_mach_mips8000:
+ case bfd_mach_mips10000:
+ case bfd_mach_mips12000:
+ case bfd_mach_mips16:
+ case bfd_mach_mipsisa32:
+ case bfd_mach_mips5:
+ case bfd_mach_mipsisa64:
+ case bfd_mach_mips_sb1:
+ /* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc. */
+ arch_flags = M_MIPS2;
+ break;
+ default:
+ arch_flags = M_UNKNOWN;
+ break;
+ }
+ break;
- default:
- arch_flags = M_UNKNOWN;
- }
+ case bfd_arch_ns32k:
+ switch (machine)
+ {
+ case 0: arch_flags = M_NS32532; break;
+ case 32032: arch_flags = M_NS32032; break;
+ case 32532: arch_flags = M_NS32532; break;
+ default: arch_flags = M_UNKNOWN; break;
+ }
+ break;
+
+ case bfd_arch_vax:
+ *unknown = false;
+ break;
+
+ case bfd_arch_cris:
+ if (machine == 0 || machine == 255)
+ arch_flags = M_CRIS;
+ break;
+
+ default:
+ arch_flags = M_UNKNOWN;
+ }
if (arch_flags != M_UNKNOWN)
*unknown = false;
@@ -854,18 +866,19 @@ NAME(aout,set_arch_mach) (abfd, arch, machine)
}
/* Determine the size of a relocation entry */
- switch (arch) {
- case bfd_arch_sparc:
- case bfd_arch_a29k:
- case bfd_arch_mips:
- obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
- break;
- default:
- obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
- break;
- }
+ switch (arch)
+ {
+ case bfd_arch_sparc:
+ case bfd_arch_a29k:
+ case bfd_arch_mips:
+ obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
+ break;
+ default:
+ obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
+ break;
+ }
- return (*aout_backend_info(abfd)->set_sizes) (abfd);
+ return (*aout_backend_info (abfd)->set_sizes) (abfd);
}
static void
@@ -878,46 +891,46 @@ adjust_o_magic (abfd, execp)
int pad = 0;
/* Text. */
- obj_textsec(abfd)->filepos = pos;
- if (!obj_textsec(abfd)->user_set_vma)
- obj_textsec(abfd)->vma = vma;
+ obj_textsec (abfd)->filepos = pos;
+ if (!obj_textsec (abfd)->user_set_vma)
+ obj_textsec (abfd)->vma = vma;
else
- vma = obj_textsec(abfd)->vma;
+ vma = obj_textsec (abfd)->vma;
- pos += obj_textsec(abfd)->_raw_size;
- vma += obj_textsec(abfd)->_raw_size;
+ pos += obj_textsec (abfd)->_raw_size;
+ vma += obj_textsec (abfd)->_raw_size;
/* Data. */
- if (!obj_datasec(abfd)->user_set_vma)
+ if (!obj_datasec (abfd)->user_set_vma)
{
#if 0 /* ?? Does alignment in the file image really matter? */
- pad = align_power (vma, obj_datasec(abfd)->alignment_power) - vma;
+ pad = align_power (vma, obj_datasec (abfd)->alignment_power) - vma;
#endif
- obj_textsec(abfd)->_raw_size += pad;
+ obj_textsec (abfd)->_raw_size += pad;
pos += pad;
vma += pad;
- obj_datasec(abfd)->vma = vma;
+ obj_datasec (abfd)->vma = vma;
}
else
- vma = obj_datasec(abfd)->vma;
- obj_datasec(abfd)->filepos = pos;
- pos += obj_datasec(abfd)->_raw_size;
- vma += obj_datasec(abfd)->_raw_size;
+ vma = obj_datasec (abfd)->vma;
+ obj_datasec (abfd)->filepos = pos;
+ pos += obj_datasec (abfd)->_raw_size;
+ vma += obj_datasec (abfd)->_raw_size;
/* BSS. */
- if (!obj_bsssec(abfd)->user_set_vma)
+ if (!obj_bsssec (abfd)->user_set_vma)
{
#if 0
- pad = align_power (vma, obj_bsssec(abfd)->alignment_power) - vma;
+ pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma;
#endif
- obj_datasec(abfd)->_raw_size += pad;
+ obj_datasec (abfd)->_raw_size += pad;
pos += pad;
vma += pad;
- obj_bsssec(abfd)->vma = vma;
+ obj_bsssec (abfd)->vma = vma;
}
else
{
- /* The VMA of the .bss section is set by the the VMA of the
+ /* The VMA of the .bss section is set by the VMA of the
.data section plus the size of the .data section. We may
need to add padding bytes to make this true. */
pad = obj_bsssec (abfd)->vma - vma;
@@ -927,12 +940,12 @@ adjust_o_magic (abfd, execp)
pos += pad;
}
}
- obj_bsssec(abfd)->filepos = pos;
+ obj_bsssec (abfd)->filepos = pos;
/* Fix up the exec header. */
- execp->a_text = obj_textsec(abfd)->_raw_size;
- execp->a_data = obj_datasec(abfd)->_raw_size;
- execp->a_bss = obj_bsssec(abfd)->_raw_size;
+ execp->a_text = obj_textsec (abfd)->_raw_size;
+ execp->a_data = obj_datasec (abfd)->_raw_size;
+ execp->a_bss = obj_bsssec (abfd)->_raw_size;
N_SET_MAGIC (*execp, OMAGIC);
}
@@ -943,7 +956,7 @@ adjust_z_magic (abfd, execp)
{
bfd_size_type data_pad, text_pad;
file_ptr text_end;
- CONST struct aout_backend_data *abdp;
+ const struct aout_backend_data *abdp;
int ztih; /* Nonzero if text includes exec header. */
abdp = aout_backend_info (abfd);
@@ -952,18 +965,18 @@ adjust_z_magic (abfd, execp)
ztih = (abdp != NULL
&& (abdp->text_includes_header
|| obj_aout_subformat (abfd) == q_magic_format));
- obj_textsec(abfd)->filepos = (ztih
- ? adata(abfd).exec_bytes_size
- : adata(abfd).zmagic_disk_block_size);
- if (! obj_textsec(abfd)->user_set_vma)
+ obj_textsec (abfd)->filepos = (ztih
+ ? adata (abfd).exec_bytes_size
+ : adata (abfd).zmagic_disk_block_size);
+ if (! obj_textsec (abfd)->user_set_vma)
{
/* ?? Do we really need to check for relocs here? */
- obj_textsec(abfd)->vma = ((abfd->flags & HAS_RELOC)
- ? 0
- : (ztih
- ? (abdp->default_text_vma
- + adata(abfd).exec_bytes_size)
- : abdp->default_text_vma));
+ obj_textsec (abfd)->vma = ((abfd->flags & HAS_RELOC)
+ ? 0
+ : (ztih
+ ? (abdp->default_text_vma
+ + adata (abfd).exec_bytes_size)
+ : abdp->default_text_vma));
text_pad = 0;
}
else
@@ -994,47 +1007,51 @@ adjust_z_magic (abfd, execp)
text_pad += BFD_ALIGN (text_end, adata (abfd).page_size) - text_end;
text_end += obj_textsec (abfd)->filepos;
}
- obj_textsec(abfd)->_raw_size += text_pad;
+ obj_textsec (abfd)->_raw_size += text_pad;
text_end += text_pad;
/* Data. */
- if (!obj_datasec(abfd)->user_set_vma)
+ if (!obj_datasec (abfd)->user_set_vma)
{
bfd_vma vma;
- vma = obj_textsec(abfd)->vma + obj_textsec(abfd)->_raw_size;
- obj_datasec(abfd)->vma = BFD_ALIGN (vma, adata(abfd).segment_size);
+ vma = obj_textsec (abfd)->vma + obj_textsec (abfd)->_raw_size;
+ obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size);
}
if (abdp && abdp->zmagic_mapped_contiguous)
{
- text_pad = (obj_datasec(abfd)->vma
- - obj_textsec(abfd)->vma
- - obj_textsec(abfd)->_raw_size);
- obj_textsec(abfd)->_raw_size += text_pad;
+ asection * text = obj_textsec (abfd);
+ asection * data = obj_datasec (abfd);
+
+ text_pad = data->vma - (text->vma + text->_raw_size);
+ /* Only pad the text section if the data
+ section is going to be placed after it. */
+ if (text_pad > 0)
+ text->_raw_size += text_pad;
}
- obj_datasec(abfd)->filepos = (obj_textsec(abfd)->filepos
- + obj_textsec(abfd)->_raw_size);
+ obj_datasec (abfd)->filepos = (obj_textsec (abfd)->filepos
+ + obj_textsec (abfd)->_raw_size);
/* Fix up exec header while we're at it. */
- execp->a_text = obj_textsec(abfd)->_raw_size;
+ execp->a_text = obj_textsec (abfd)->_raw_size;
if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted)))
- execp->a_text += adata(abfd).exec_bytes_size;
+ execp->a_text += adata (abfd).exec_bytes_size;
if (obj_aout_subformat (abfd) == q_magic_format)
N_SET_MAGIC (*execp, QMAGIC);
else
N_SET_MAGIC (*execp, ZMAGIC);
/* Spec says data section should be rounded up to page boundary. */
- obj_datasec(abfd)->_raw_size
- = align_power (obj_datasec(abfd)->_raw_size,
- obj_bsssec(abfd)->alignment_power);
- execp->a_data = BFD_ALIGN (obj_datasec(abfd)->_raw_size,
- adata(abfd).page_size);
- data_pad = execp->a_data - obj_datasec(abfd)->_raw_size;
+ obj_datasec (abfd)->_raw_size
+ = align_power (obj_datasec (abfd)->_raw_size,
+ obj_bsssec (abfd)->alignment_power);
+ execp->a_data = BFD_ALIGN (obj_datasec (abfd)->_raw_size,
+ adata (abfd).page_size);
+ data_pad = execp->a_data - obj_datasec (abfd)->_raw_size;
/* BSS. */
- if (!obj_bsssec(abfd)->user_set_vma)
- obj_bsssec(abfd)->vma = (obj_datasec(abfd)->vma
- + obj_datasec(abfd)->_raw_size);
+ if (!obj_bsssec (abfd)->user_set_vma)
+ obj_bsssec (abfd)->vma = (obj_datasec (abfd)->vma
+ + obj_datasec (abfd)->_raw_size);
/* If the BSS immediately follows the data section and extra space
in the page is left after the data section, fudge data
in the header so that the bss section looks smaller by that
@@ -1042,12 +1059,12 @@ adjust_z_magic (abfd, execp)
(Note that a linker script, as well as the above assignment,
could have explicitly set the BSS vma to immediately follow
the data section.) */
- if (align_power (obj_bsssec(abfd)->vma, obj_bsssec(abfd)->alignment_power)
- == obj_datasec(abfd)->vma + obj_datasec(abfd)->_raw_size)
- execp->a_bss = (data_pad > obj_bsssec(abfd)->_raw_size) ? 0 :
- obj_bsssec(abfd)->_raw_size - data_pad;
+ if (align_power (obj_bsssec (abfd)->vma, obj_bsssec (abfd)->alignment_power)
+ == obj_datasec (abfd)->vma + obj_datasec (abfd)->_raw_size)
+ execp->a_bss = (data_pad > obj_bsssec (abfd)->_raw_size
+ ? 0 : obj_bsssec (abfd)->_raw_size - data_pad);
else
- execp->a_bss = obj_bsssec(abfd)->_raw_size;
+ execp->a_bss = obj_bsssec (abfd)->_raw_size;
}
static void
@@ -1055,41 +1072,41 @@ adjust_n_magic (abfd, execp)
bfd *abfd;
struct internal_exec *execp;
{
- file_ptr pos = adata(abfd).exec_bytes_size;
+ file_ptr pos = adata (abfd).exec_bytes_size;
bfd_vma vma = 0;
int pad;
/* Text. */
- obj_textsec(abfd)->filepos = pos;
- if (!obj_textsec(abfd)->user_set_vma)
- obj_textsec(abfd)->vma = vma;
+ obj_textsec (abfd)->filepos = pos;
+ if (!obj_textsec (abfd)->user_set_vma)
+ obj_textsec (abfd)->vma = vma;
else
- vma = obj_textsec(abfd)->vma;
- pos += obj_textsec(abfd)->_raw_size;
- vma += obj_textsec(abfd)->_raw_size;
+ vma = obj_textsec (abfd)->vma;
+ pos += obj_textsec (abfd)->_raw_size;
+ vma += obj_textsec (abfd)->_raw_size;
/* Data. */
- obj_datasec(abfd)->filepos = pos;
- if (!obj_datasec(abfd)->user_set_vma)
- obj_datasec(abfd)->vma = BFD_ALIGN (vma, adata(abfd).segment_size);
- vma = obj_datasec(abfd)->vma;
+ obj_datasec (abfd)->filepos = pos;
+ if (!obj_datasec (abfd)->user_set_vma)
+ obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size);
+ vma = obj_datasec (abfd)->vma;
/* Since BSS follows data immediately, see if it needs alignment. */
- vma += obj_datasec(abfd)->_raw_size;
- pad = align_power (vma, obj_bsssec(abfd)->alignment_power) - vma;
- obj_datasec(abfd)->_raw_size += pad;
- pos += obj_datasec(abfd)->_raw_size;
+ vma += obj_datasec (abfd)->_raw_size;
+ pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma;
+ obj_datasec (abfd)->_raw_size += pad;
+ pos += obj_datasec (abfd)->_raw_size;
/* BSS. */
- if (!obj_bsssec(abfd)->user_set_vma)
- obj_bsssec(abfd)->vma = vma;
+ if (!obj_bsssec (abfd)->user_set_vma)
+ obj_bsssec (abfd)->vma = vma;
else
- vma = obj_bsssec(abfd)->vma;
+ vma = obj_bsssec (abfd)->vma;
/* Fix up exec header. */
- execp->a_text = obj_textsec(abfd)->_raw_size;
- execp->a_data = obj_datasec(abfd)->_raw_size;
- execp->a_bss = obj_bsssec(abfd)->_raw_size;
+ execp->a_text = obj_textsec (abfd)->_raw_size;
+ execp->a_data = obj_datasec (abfd)->_raw_size;
+ execp->a_bss = obj_bsssec (abfd)->_raw_size;
N_SET_MAGIC (*execp, NMAGIC);
}
@@ -1104,12 +1121,12 @@ NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end)
if (! NAME(aout,make_sections) (abfd))
return false;
- if (adata(abfd).magic != undecided_magic)
+ if (adata (abfd).magic != undecided_magic)
return true;
- obj_textsec(abfd)->_raw_size =
- align_power(obj_textsec(abfd)->_raw_size,
- obj_textsec(abfd)->alignment_power);
+ obj_textsec (abfd)->_raw_size =
+ align_power (obj_textsec (abfd)->_raw_size,
+ obj_textsec (abfd)->alignment_power);
*text_size = obj_textsec (abfd)->_raw_size;
/* Rule (heuristic) for when to pad to a new page. Note that there
@@ -1130,34 +1147,35 @@ NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end)
if (abfd->flags & D_PAGED)
/* Whether or not WP_TEXT is set -- let D_PAGED override. */
- adata(abfd).magic = z_magic;
+ adata (abfd).magic = z_magic;
else if (abfd->flags & WP_TEXT)
- adata(abfd).magic = n_magic;
+ adata (abfd).magic = n_magic;
else
- adata(abfd).magic = o_magic;
+ adata (abfd).magic = o_magic;
#ifdef BFD_AOUT_DEBUG /* requires gcc2 */
#if __GNUC__ >= 2
fprintf (stderr, "%s text=<%x,%x,%x> data=<%x,%x,%x> bss=<%x,%x,%x>\n",
({ char *str;
- switch (adata(abfd).magic) {
- case n_magic: str = "NMAGIC"; break;
- case o_magic: str = "OMAGIC"; break;
- case z_magic: str = "ZMAGIC"; break;
- default: abort ();
- }
+ switch (adata (abfd).magic)
+ {
+ case n_magic: str = "NMAGIC"; break;
+ case o_magic: str = "OMAGIC"; break;
+ case z_magic: str = "ZMAGIC"; break;
+ default: abort ();
+ }
str;
}),
- obj_textsec(abfd)->vma, obj_textsec(abfd)->_raw_size,
- obj_textsec(abfd)->alignment_power,
- obj_datasec(abfd)->vma, obj_datasec(abfd)->_raw_size,
- obj_datasec(abfd)->alignment_power,
- obj_bsssec(abfd)->vma, obj_bsssec(abfd)->_raw_size,
- obj_bsssec(abfd)->alignment_power);
+ obj_textsec (abfd)->vma, obj_textsec (abfd)->_raw_size,
+ obj_textsec (abfd)->alignment_power,
+ obj_datasec (abfd)->vma, obj_datasec (abfd)->_raw_size,
+ obj_datasec (abfd)->alignment_power,
+ obj_bsssec (abfd)->vma, obj_bsssec (abfd)->_raw_size,
+ obj_bsssec (abfd)->alignment_power);
#endif
#endif
- switch (adata(abfd).magic)
+ switch (adata (abfd).magic)
{
case o_magic:
adjust_o_magic (abfd, execp);
@@ -1174,11 +1192,11 @@ NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end)
#ifdef BFD_AOUT_DEBUG
fprintf (stderr, " text=<%x,%x,%x> data=<%x,%x,%x> bss=<%x,%x>\n",
- obj_textsec(abfd)->vma, obj_textsec(abfd)->_raw_size,
- obj_textsec(abfd)->filepos,
- obj_datasec(abfd)->vma, obj_datasec(abfd)->_raw_size,
- obj_datasec(abfd)->filepos,
- obj_bsssec(abfd)->vma, obj_bsssec(abfd)->_raw_size);
+ obj_textsec (abfd)->vma, obj_textsec (abfd)->_raw_size,
+ obj_textsec (abfd)->filepos,
+ obj_datasec (abfd)->vma, obj_datasec (abfd)->_raw_size,
+ obj_datasec (abfd)->filepos,
+ obj_bsssec (abfd)->vma, obj_bsssec (abfd)->_raw_size);
#endif
return true;
@@ -1203,24 +1221,27 @@ NAME(aout,new_section_hook) (abfd, newsect)
asection *newsect;
{
/* align to double at least */
- newsect->alignment_power = bfd_get_arch_info(abfd)->section_align_power;
+ newsect->alignment_power = bfd_get_arch_info (abfd)->section_align_power;
if (bfd_get_format (abfd) == bfd_object)
{
- if (obj_textsec(abfd) == NULL && !strcmp(newsect->name, ".text")) {
- obj_textsec(abfd)= newsect;
+ if (obj_textsec (abfd) == NULL && !strcmp (newsect->name, ".text"))
+ {
+ obj_textsec (abfd)= newsect;
newsect->target_index = N_TEXT;
return true;
}
- if (obj_datasec(abfd) == NULL && !strcmp(newsect->name, ".data")) {
- obj_datasec(abfd) = newsect;
+ if (obj_datasec (abfd) == NULL && !strcmp (newsect->name, ".data"))
+ {
+ obj_datasec (abfd) = newsect;
newsect->target_index = N_DATA;
return true;
}
- if (obj_bsssec(abfd) == NULL && !strcmp(newsect->name, ".bss")) {
- obj_bsssec(abfd) = newsect;
+ if (obj_bsssec (abfd) == NULL && !strcmp (newsect->name, ".bss"))
+ {
+ obj_bsssec (abfd) = newsect;
newsect->target_index = N_BSS;
return true;
}
@@ -1267,7 +1288,7 @@ NAME(aout,set_section_contents) (abfd, section, location, offset, count)
if (count != 0)
{
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
- || bfd_write (location, 1, count, abfd) != count)
+ || bfd_bwrite (location, count, abfd) != count)
return false;
}
@@ -1284,6 +1305,7 @@ aout_get_external_symbols (abfd)
{
bfd_size_type count;
struct external_nlist *syms;
+ bfd_size_type amt;
count = exec_hdr (abfd)->a_syms / EXTERNAL_NLIST_SIZE;
@@ -1298,13 +1320,13 @@ aout_get_external_symbols (abfd)
later on. If we put them on the objalloc it might not be
possible to free them. */
syms = ((struct external_nlist *)
- bfd_malloc ((size_t) count * EXTERNAL_NLIST_SIZE));
+ bfd_malloc (count * EXTERNAL_NLIST_SIZE));
if (syms == (struct external_nlist *) NULL && count != 0)
return false;
+ amt = exec_hdr (abfd)->a_syms;
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
- || (bfd_read (syms, 1, exec_hdr (abfd)->a_syms, abfd)
- != exec_hdr (abfd)->a_syms))
+ || bfd_bread (syms, amt, abfd) != amt)
{
free (syms);
return false;
@@ -1321,11 +1343,11 @@ aout_get_external_symbols (abfd)
unsigned char string_chars[BYTES_IN_WORD];
bfd_size_type stringsize;
char *strings;
+ bfd_size_type amt = BYTES_IN_WORD;
/* Get the size of the strings. */
if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0
- || (bfd_read ((PTR) string_chars, BYTES_IN_WORD, 1, abfd)
- != BYTES_IN_WORD))
+ || bfd_bread ((PTR) string_chars, amt, abfd) != amt)
return false;
stringsize = GET_WORD (abfd, string_chars);
@@ -1335,15 +1357,14 @@ aout_get_external_symbols (abfd)
return false;
strings = (char *) obj_aout_string_window (abfd).data;
#else
- strings = (char *) bfd_malloc ((size_t) stringsize + 1);
+ strings = (char *) bfd_malloc (stringsize + 1);
if (strings == NULL)
return false;
/* Skip space for the string count in the buffer for convenience
when using indexes. */
- if (bfd_read (strings + BYTES_IN_WORD, 1, stringsize - BYTES_IN_WORD,
- abfd)
- != stringsize - BYTES_IN_WORD)
+ amt = stringsize - BYTES_IN_WORD;
+ if (bfd_bread (strings + BYTES_IN_WORD, amt, abfd) != amt)
{
free (strings);
return false;
@@ -1474,6 +1495,7 @@ translate_from_native_sym_flags (abfd, cache_ptr)
asection *section;
arelent_chain *reloc;
asection *into_section;
+ bfd_size_type amt;
/* This is a set symbol. The name of the symbol is the name
of the set (e.g., __CTOR_LIST__). The value of the symbol
@@ -1490,7 +1512,8 @@ translate_from_native_sym_flags (abfd, cache_ptr)
{
char *copy;
- copy = bfd_alloc (abfd, strlen (cache_ptr->symbol.name) + 1);
+ amt = strlen (cache_ptr->symbol.name) + 1;
+ copy = bfd_alloc (abfd, amt);
if (copy == NULL)
return false;
@@ -1500,7 +1523,8 @@ translate_from_native_sym_flags (abfd, cache_ptr)
return false;
}
- reloc = (arelent_chain *) bfd_alloc (abfd, sizeof (arelent_chain));
+ amt = sizeof (arelent_chain);
+ reloc = (arelent_chain *) bfd_alloc (abfd, amt);
if (reloc == NULL)
return false;
@@ -1545,7 +1569,7 @@ translate_from_native_sym_flags (abfd, cache_ptr)
reloc->relent.address = section->_raw_size;
section->_raw_size += BYTES_IN_WORD;
- reloc->relent.howto = CTOR_TABLE_RELOC_HOWTO(abfd);
+ reloc->relent.howto = CTOR_TABLE_RELOC_HOWTO (abfd);
#endif /* 0 */
@@ -1720,7 +1744,7 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
sym_pointer->e_type[0] = type;
}
- PUT_WORD(abfd, value, sym_pointer->e_value);
+ PUT_WORD (abfd, value, sym_pointer->e_value);
return true;
}
@@ -1731,8 +1755,8 @@ asymbol *
NAME(aout,make_empty_symbol) (abfd)
bfd *abfd;
{
- aout_symbol_type *new =
- (aout_symbol_type *)bfd_zalloc (abfd, sizeof (aout_symbol_type));
+ bfd_size_type amt = sizeof (aout_symbol_type);
+ aout_symbol_type *new = (aout_symbol_type *) bfd_zalloc (abfd, amt);
if (!new)
return NULL;
new->symbol.the_bfd = abfd;
@@ -1775,9 +1799,9 @@ NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic)
return false;
in->symbol.value = GET_SWORD (abfd, ext->e_value);
- in->desc = bfd_h_get_16 (abfd, ext->e_desc);
- in->other = bfd_h_get_8 (abfd, ext->e_other);
- in->type = bfd_h_get_8 (abfd, ext->e_type);
+ in->desc = H_GET_16 (abfd, ext->e_desc);
+ in->other = H_GET_8 (abfd, ext->e_other);
+ in->type = H_GET_8 (abfd, ext->e_type);
in->symbol.udata.p = NULL;
if (! translate_from_native_sym_flags (abfd, in))
@@ -1800,7 +1824,7 @@ NAME(aout,slurp_symbol_table) (abfd)
{
struct external_nlist *old_external_syms;
aout_symbol_type *cached;
- size_t cached_size;
+ bfd_size_type cached_size;
/* If there's no work to be done, don't do any */
if (obj_aout_symbols (abfd) != (aout_symbol_type *) NULL)
@@ -1811,13 +1835,13 @@ NAME(aout,slurp_symbol_table) (abfd)
if (! aout_get_external_symbols (abfd))
return false;
- cached_size = (obj_aout_external_sym_count (abfd)
- * sizeof (aout_symbol_type));
+ cached_size = obj_aout_external_sym_count (abfd);
+ cached_size *= sizeof (aout_symbol_type);
cached = (aout_symbol_type *) bfd_malloc (cached_size);
if (cached == NULL && cached_size != 0)
return false;
if (cached_size != 0)
- memset (cached, 0, cached_size);
+ memset (cached, 0, (size_t) cached_size);
/* Convert from external symbol information to internal. */
if (! (NAME(aout,translate_symbol_table)
@@ -1911,10 +1935,11 @@ emit_stringtab (abfd, tab)
struct bfd_strtab_hash *tab;
{
bfd_byte buffer[BYTES_IN_WORD];
+ bfd_size_type amt = BYTES_IN_WORD;
/* The string table starts with the size. */
PUT_WORD (abfd, _bfd_stringtab_size (tab) + BYTES_IN_WORD, buffer);
- if (bfd_write ((PTR) buffer, 1, BYTES_IN_WORD, abfd) != BYTES_IN_WORD)
+ if (bfd_bwrite ((PTR) buffer, amt, abfd) != amt)
return false;
return _bfd_stringtab_emit (abfd, tab);
@@ -1937,30 +1962,31 @@ NAME(aout,write_syms) (abfd)
asymbol *g = generic[count];
bfd_size_type indx;
struct external_nlist nsp;
+ bfd_size_type amt;
indx = add_to_stringtab (abfd, strtab, g->name, false);
if (indx == (bfd_size_type) -1)
goto error_return;
PUT_WORD (abfd, indx, (bfd_byte *) nsp.e_strx);
- if (bfd_asymbol_flavour(g) == abfd->xvec->flavour)
+ if (bfd_asymbol_flavour (g) == abfd->xvec->flavour)
{
- bfd_h_put_16(abfd, aout_symbol(g)->desc, nsp.e_desc);
- bfd_h_put_8(abfd, aout_symbol(g)->other, nsp.e_other);
- bfd_h_put_8(abfd, aout_symbol(g)->type, nsp.e_type);
+ H_PUT_16 (abfd, aout_symbol (g)->desc, nsp.e_desc);
+ H_PUT_8 (abfd, aout_symbol (g)->other, nsp.e_other);
+ H_PUT_8 (abfd, aout_symbol (g)->type, nsp.e_type);
}
else
{
- bfd_h_put_16(abfd,0, nsp.e_desc);
- bfd_h_put_8(abfd, 0, nsp.e_other);
- bfd_h_put_8(abfd, 0, nsp.e_type);
+ H_PUT_16 (abfd, 0, nsp.e_desc);
+ H_PUT_8 (abfd, 0, nsp.e_other);
+ H_PUT_8 (abfd, 0, nsp.e_type);
}
if (! translate_to_native_sym_flags (abfd, g, &nsp))
goto error_return;
- if (bfd_write((PTR)&nsp,1,EXTERNAL_NLIST_SIZE, abfd)
- != EXTERNAL_NLIST_SIZE)
+ amt = EXTERNAL_NLIST_SIZE;
+ if (bfd_bwrite ((PTR) &nsp, amt, abfd) != amt)
goto error_return;
/* NB: `KEEPIT' currently overlays `udata.p', so set this only
@@ -1991,8 +2017,10 @@ NAME(aout,get_symtab) (abfd, location)
if (!NAME(aout,slurp_symbol_table) (abfd))
return -1;
- for (symbase = obj_aout_symbols(abfd); counter++ < bfd_get_symcount (abfd);)
- *(location++) = (asymbol *) ( symbase++);
+ for (symbase = obj_aout_symbols (abfd);
+ counter++ < bfd_get_symcount (abfd);
+ )
+ *(location++) = (asymbol *) (symbase++);
*location++ =0;
return bfd_get_symcount (abfd);
}
@@ -2017,7 +2045,7 @@ NAME(aout,swap_std_reloc_out) (abfd, g, natptr)
int r_baserel, r_jmptable, r_relative;
asection *output_section = sym->section->output_section;
- PUT_WORD(abfd, g->address, natptr->r_address);
+ PUT_WORD (abfd, g->address, natptr->r_address);
r_length = g->howto->size ; /* Size as a power of two */
r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */
@@ -2068,29 +2096,30 @@ NAME(aout,swap_std_reloc_out) (abfd, g, natptr)
}
/* now the fun stuff */
- if (bfd_header_big_endian (abfd)) {
+ if (bfd_header_big_endian (abfd))
+ {
natptr->r_index[0] = r_index >> 16;
natptr->r_index[1] = r_index >> 8;
natptr->r_index[2] = r_index;
- natptr->r_type[0] =
- (r_extern? RELOC_STD_BITS_EXTERN_BIG: 0)
- | (r_pcrel? RELOC_STD_BITS_PCREL_BIG: 0)
- | (r_baserel? RELOC_STD_BITS_BASEREL_BIG: 0)
- | (r_jmptable? RELOC_STD_BITS_JMPTABLE_BIG: 0)
- | (r_relative? RELOC_STD_BITS_RELATIVE_BIG: 0)
- | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG);
- } else {
- natptr->r_index[2] = r_index >> 16;
- natptr->r_index[1] = r_index >> 8;
- natptr->r_index[0] = r_index;
- natptr->r_type[0] =
- (r_extern? RELOC_STD_BITS_EXTERN_LITTLE: 0)
- | (r_pcrel? RELOC_STD_BITS_PCREL_LITTLE: 0)
- | (r_baserel? RELOC_STD_BITS_BASEREL_LITTLE: 0)
- | (r_jmptable? RELOC_STD_BITS_JMPTABLE_LITTLE: 0)
- | (r_relative? RELOC_STD_BITS_RELATIVE_LITTLE: 0)
- | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE);
- }
+ natptr->r_type[0] = ((r_extern ? RELOC_STD_BITS_EXTERN_BIG : 0)
+ | (r_pcrel ? RELOC_STD_BITS_PCREL_BIG : 0)
+ | (r_baserel ? RELOC_STD_BITS_BASEREL_BIG : 0)
+ | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_BIG : 0)
+ | (r_relative ? RELOC_STD_BITS_RELATIVE_BIG : 0)
+ | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG));
+ }
+ else
+ {
+ natptr->r_index[2] = r_index >> 16;
+ natptr->r_index[1] = r_index >> 8;
+ natptr->r_index[0] = r_index;
+ natptr->r_type[0] = ((r_extern ? RELOC_STD_BITS_EXTERN_LITTLE : 0)
+ | (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE : 0)
+ | (r_baserel ? RELOC_STD_BITS_BASEREL_LITTLE : 0)
+ | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_LITTLE : 0)
+ | (r_relative ? RELOC_STD_BITS_RELATIVE_LITTLE : 0)
+ | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE));
+ }
}
/* Extended stuff */
@@ -2108,7 +2137,7 @@ NAME(aout,swap_ext_reloc_out) (abfd, g, natptr)
int r_index;
int r_extern;
unsigned int r_type;
- unsigned int r_addend;
+ bfd_vma r_addend;
asymbol *sym = *(g->sym_ptr_ptr);
asection *output_section = sym->section->output_section;
@@ -2149,21 +2178,22 @@ NAME(aout,swap_ext_reloc_out) (abfd, g, natptr)
}
/* now the fun stuff */
- if (bfd_header_big_endian (abfd)) {
- natptr->r_index[0] = r_index >> 16;
- natptr->r_index[1] = r_index >> 8;
- natptr->r_index[2] = r_index;
- natptr->r_type[0] =
- ((r_extern? RELOC_EXT_BITS_EXTERN_BIG: 0)
- | (r_type << RELOC_EXT_BITS_TYPE_SH_BIG));
- } else {
- natptr->r_index[2] = r_index >> 16;
- natptr->r_index[1] = r_index >> 8;
- natptr->r_index[0] = r_index;
- natptr->r_type[0] =
- (r_extern? RELOC_EXT_BITS_EXTERN_LITTLE: 0)
- | (r_type << RELOC_EXT_BITS_TYPE_SH_LITTLE);
- }
+ if (bfd_header_big_endian (abfd))
+ {
+ natptr->r_index[0] = r_index >> 16;
+ natptr->r_index[1] = r_index >> 8;
+ natptr->r_index[2] = r_index;
+ natptr->r_type[0] = ((r_extern ? RELOC_EXT_BITS_EXTERN_BIG : 0)
+ | (r_type << RELOC_EXT_BITS_TYPE_SH_BIG));
+ }
+ else
+ {
+ natptr->r_index[2] = r_index >> 16;
+ natptr->r_index[1] = r_index >> 8;
+ natptr->r_index[0] = r_index;
+ natptr->r_type[0] = ((r_extern ? RELOC_EXT_BITS_EXTERN_LITTLE : 0)
+ | (r_type << RELOC_EXT_BITS_TYPE_SH_LITTLE));
+ }
PUT_WORD (abfd, r_addend, natptr->r_addend);
}
@@ -2174,40 +2204,44 @@ NAME(aout,swap_ext_reloc_out) (abfd, g, natptr)
Aout keeps all it's symbols based from zero, so the symbol would
contain 60. This macro subs the base of each section from the value
- to give the true offset from the section */
-
-#define MOVE_ADDRESS(ad) \
- if (r_extern) { \
- /* undefined symbol */ \
- cache_ptr->sym_ptr_ptr = symbols + r_index; \
- cache_ptr->addend = ad; \
- } else { \
- /* defined, section relative. replace symbol with pointer to \
- symbol which points to section */ \
- switch (r_index) { \
- case N_TEXT: \
- case N_TEXT | N_EXT: \
- cache_ptr->sym_ptr_ptr = obj_textsec(abfd)->symbol_ptr_ptr; \
- cache_ptr->addend = ad - su->textsec->vma; \
- break; \
- case N_DATA: \
- case N_DATA | N_EXT: \
- cache_ptr->sym_ptr_ptr = obj_datasec(abfd)->symbol_ptr_ptr; \
- cache_ptr->addend = ad - su->datasec->vma; \
- break; \
- case N_BSS: \
- case N_BSS | N_EXT: \
- cache_ptr->sym_ptr_ptr = obj_bsssec(abfd)->symbol_ptr_ptr; \
- cache_ptr->addend = ad - su->bsssec->vma; \
- break; \
- default: \
- case N_ABS: \
- case N_ABS | N_EXT: \
- cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; \
+ to give the true offset from the section. */
+
+#define MOVE_ADDRESS(ad) \
+ if (r_extern) \
+ { \
+ /* Undefined symbol. */ \
+ cache_ptr->sym_ptr_ptr = symbols + r_index; \
cache_ptr->addend = ad; \
- break; \
} \
- } \
+ else \
+ { \
+ /* Defined, section relative. Replace symbol with pointer to \
+ symbol which points to section. */ \
+ switch (r_index) \
+ { \
+ case N_TEXT: \
+ case N_TEXT | N_EXT: \
+ cache_ptr->sym_ptr_ptr = obj_textsec (abfd)->symbol_ptr_ptr; \
+ cache_ptr->addend = ad - su->textsec->vma; \
+ break; \
+ case N_DATA: \
+ case N_DATA | N_EXT: \
+ cache_ptr->sym_ptr_ptr = obj_datasec (abfd)->symbol_ptr_ptr; \
+ cache_ptr->addend = ad - su->datasec->vma; \
+ break; \
+ case N_BSS: \
+ case N_BSS | N_EXT: \
+ cache_ptr->sym_ptr_ptr = obj_bsssec (abfd)->symbol_ptr_ptr; \
+ cache_ptr->addend = ad - su->bsssec->vma; \
+ break; \
+ default: \
+ case N_ABS: \
+ case N_ABS | N_EXT: \
+ cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; \
+ cache_ptr->addend = ad; \
+ break; \
+ } \
+ }
void
NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
@@ -2225,21 +2259,24 @@ NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
cache_ptr->address = (GET_SWORD (abfd, bytes->r_address));
/* now the fun stuff */
- if (bfd_header_big_endian (abfd)) {
- r_index = (bytes->r_index[0] << 16)
- | (bytes->r_index[1] << 8)
- | bytes->r_index[2];
- r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG));
- r_type = (bytes->r_type[0] & RELOC_EXT_BITS_TYPE_BIG)
- >> RELOC_EXT_BITS_TYPE_SH_BIG;
- } else {
- r_index = (bytes->r_index[2] << 16)
- | (bytes->r_index[1] << 8)
- | bytes->r_index[0];
- r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE));
- r_type = (bytes->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE)
- >> RELOC_EXT_BITS_TYPE_SH_LITTLE;
- }
+ if (bfd_header_big_endian (abfd))
+ {
+ r_index = ((bytes->r_index[0] << 16)
+ | (bytes->r_index[1] << 8)
+ | bytes->r_index[2]);
+ r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG));
+ r_type = ((bytes->r_type[0] & RELOC_EXT_BITS_TYPE_BIG)
+ >> RELOC_EXT_BITS_TYPE_SH_BIG);
+ }
+ else
+ {
+ r_index = ((bytes->r_index[2] << 16)
+ | (bytes->r_index[1] << 8)
+ | bytes->r_index[0]);
+ r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE));
+ r_type = ((bytes->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE)
+ >> RELOC_EXT_BITS_TYPE_SH_LITTLE);
+ }
cache_ptr->howto = howto_table_ext + r_type;
@@ -2259,7 +2296,7 @@ NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
r_index = N_ABS;
}
- MOVE_ADDRESS(GET_SWORD(abfd, bytes->r_addend));
+ MOVE_ADDRESS (GET_SWORD (abfd, bytes->r_addend));
}
void
@@ -2278,35 +2315,38 @@ NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
struct aoutdata *su = &(abfd->tdata.aout_data->a);
unsigned int howto_idx;
- cache_ptr->address = bfd_h_get_32 (abfd, bytes->r_address);
+ cache_ptr->address = H_GET_32 (abfd, bytes->r_address);
/* now the fun stuff */
- if (bfd_header_big_endian (abfd)) {
- r_index = (bytes->r_index[0] << 16)
- | (bytes->r_index[1] << 8)
- | bytes->r_index[2];
- r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_BIG));
- r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_BIG));
- r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_BIG));
- r_jmptable= (0 != (bytes->r_type[0] & RELOC_STD_BITS_JMPTABLE_BIG));
- r_relative= (0 != (bytes->r_type[0] & RELOC_STD_BITS_RELATIVE_BIG));
- r_length = (bytes->r_type[0] & RELOC_STD_BITS_LENGTH_BIG)
- >> RELOC_STD_BITS_LENGTH_SH_BIG;
- } else {
- r_index = (bytes->r_index[2] << 16)
- | (bytes->r_index[1] << 8)
- | bytes->r_index[0];
- r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE));
- r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE));
- r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_LITTLE));
- r_jmptable= (0 != (bytes->r_type[0] & RELOC_STD_BITS_JMPTABLE_LITTLE));
- r_relative= (0 != (bytes->r_type[0] & RELOC_STD_BITS_RELATIVE_LITTLE));
- r_length = (bytes->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE)
- >> RELOC_STD_BITS_LENGTH_SH_LITTLE;
- }
+ if (bfd_header_big_endian (abfd))
+ {
+ r_index = ((bytes->r_index[0] << 16)
+ | (bytes->r_index[1] << 8)
+ | bytes->r_index[2]);
+ r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_BIG));
+ r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_BIG));
+ r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_BIG));
+ r_jmptable= (0 != (bytes->r_type[0] & RELOC_STD_BITS_JMPTABLE_BIG));
+ r_relative= (0 != (bytes->r_type[0] & RELOC_STD_BITS_RELATIVE_BIG));
+ r_length = ((bytes->r_type[0] & RELOC_STD_BITS_LENGTH_BIG)
+ >> RELOC_STD_BITS_LENGTH_SH_BIG);
+ }
+ else
+ {
+ r_index = ((bytes->r_index[2] << 16)
+ | (bytes->r_index[1] << 8)
+ | bytes->r_index[0]);
+ r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE));
+ r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE));
+ r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_LITTLE));
+ r_jmptable= (0 != (bytes->r_type[0] & RELOC_STD_BITS_JMPTABLE_LITTLE));
+ r_relative= (0 != (bytes->r_type[0] & RELOC_STD_BITS_RELATIVE_LITTLE));
+ r_length = ((bytes->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE)
+ >> RELOC_STD_BITS_LENGTH_SH_LITTLE);
+ }
- howto_idx = r_length + 4 * r_pcrel + 8 * r_baserel
- + 16 * r_jmptable + 32 * r_relative;
+ howto_idx = (r_length + 4 * r_pcrel + 8 * r_baserel
+ + 16 * r_jmptable + 32 * r_relative);
BFD_ASSERT (howto_idx < TABLE_SIZE (howto_table_std));
cache_ptr->howto = howto_table_std + howto_idx;
BFD_ASSERT (cache_ptr->howto->type != (unsigned int) -1);
@@ -2325,7 +2365,7 @@ NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount)
r_index = N_ABS;
}
- MOVE_ADDRESS(0);
+ MOVE_ADDRESS (0);
}
/* Read and swap the relocs for a section. */
@@ -2336,13 +2376,14 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
sec_ptr asect;
asymbol **symbols;
{
- unsigned int count;
+ bfd_size_type count;
bfd_size_type reloc_size;
PTR relocs;
arelent *reloc_cache;
size_t each_size;
unsigned int counter = 0;
arelent *cache_ptr;
+ bfd_size_type amt;
if (asect->relocation)
return true;
@@ -2351,9 +2392,9 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
return true;
if (asect == obj_datasec (abfd))
- reloc_size = exec_hdr(abfd)->a_drsize;
+ reloc_size = exec_hdr (abfd)->a_drsize;
else if (asect == obj_textsec (abfd))
- reloc_size = exec_hdr(abfd)->a_trsize;
+ reloc_size = exec_hdr (abfd)->a_trsize;
else if (asect == obj_bsssec (abfd))
reloc_size = 0;
else
@@ -2369,19 +2410,20 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
count = reloc_size / each_size;
- reloc_cache = (arelent *) bfd_malloc ((size_t) (count * sizeof (arelent)));
+ amt = count * sizeof (arelent);
+ reloc_cache = (arelent *) bfd_malloc (amt);
if (reloc_cache == NULL && count != 0)
return false;
- memset (reloc_cache, 0, count * sizeof (arelent));
+ memset (reloc_cache, 0, (size_t) amt);
- relocs = bfd_malloc ((size_t) reloc_size);
+ relocs = bfd_malloc (reloc_size);
if (relocs == NULL && reloc_size != 0)
{
free (reloc_cache);
return false;
}
- if (bfd_read (relocs, 1, reloc_size, abfd) != reloc_size)
+ if (bfd_bread (relocs, reloc_size, abfd) != reloc_size)
{
free (relocs);
free (reloc_cache);
@@ -2391,21 +2433,19 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
cache_ptr = reloc_cache;
if (each_size == RELOC_EXT_SIZE)
{
- register struct reloc_ext_external *rptr =
- (struct reloc_ext_external *) relocs;
+ struct reloc_ext_external *rptr = (struct reloc_ext_external *) relocs;
for (; counter < count; counter++, rptr++, cache_ptr++)
MY_swap_ext_reloc_in (abfd, rptr, cache_ptr, symbols,
- bfd_get_symcount (abfd));
+ (bfd_size_type) bfd_get_symcount (abfd));
}
else
{
- register struct reloc_std_external *rptr =
- (struct reloc_std_external *) relocs;
+ struct reloc_std_external *rptr = (struct reloc_std_external *) relocs;
for (; counter < count; counter++, rptr++, cache_ptr++)
MY_swap_std_reloc_in (abfd, rptr, cache_ptr, symbols,
- bfd_get_symcount (abfd));
+ (bfd_size_type) bfd_get_symcount (abfd));
}
free (relocs);
@@ -2428,13 +2468,13 @@ NAME(aout,squirt_out_relocs) (abfd, section)
size_t each_size;
unsigned int count = section->reloc_count;
- size_t natsize;
+ bfd_size_type natsize;
if (count == 0 || section->orelocation == NULL)
return true;
each_size = obj_reloc_entry_size (abfd);
- natsize = each_size * count;
+ natsize = (bfd_size_type) each_size * count;
native = (unsigned char *) bfd_zalloc (abfd, natsize);
if (!native)
return false;
@@ -2454,13 +2494,15 @@ NAME(aout,squirt_out_relocs) (abfd, section)
for (natptr = native;
count != 0;
--count, natptr += each_size, ++generic)
- MY_swap_std_reloc_out(abfd, *generic, (struct reloc_std_external *)natptr);
+ MY_swap_std_reloc_out (abfd, *generic,
+ (struct reloc_std_external *) natptr);
}
- if ( bfd_write ((PTR) native, 1, natsize, abfd) != natsize) {
- bfd_release(abfd, native);
- return false;
- }
+ if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize)
+ {
+ bfd_release (abfd, native);
+ return false;
+ }
bfd_release (abfd, native);
return true;
@@ -2486,21 +2528,24 @@ NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols)
if (!(tblptr || NAME(aout,slurp_reloc_table) (abfd, section, symbols)))
return -1;
- if (section->flags & SEC_CONSTRUCTOR) {
- arelent_chain *chain = section->constructor_chain;
- for (count = 0; count < section->reloc_count; count ++) {
- *relptr ++ = &chain->relent;
- chain = chain->next;
+ if (section->flags & SEC_CONSTRUCTOR)
+ {
+ arelent_chain *chain = section->constructor_chain;
+ for (count = 0; count < section->reloc_count; count ++)
+ {
+ *relptr ++ = &chain->relent;
+ chain = chain->next;
+ }
}
- }
- else {
- tblptr = section->relocation;
+ else
+ {
+ tblptr = section->relocation;
- for (count = 0; count++ < section->reloc_count;)
- {
- *relptr++ = tblptr++;
- }
- }
+ for (count = 0; count++ < section->reloc_count; )
+ {
+ *relptr++ = tblptr++;
+ }
+ }
*relptr = 0;
return section->reloc_count;
@@ -2511,22 +2556,24 @@ NAME(aout,get_reloc_upper_bound) (abfd, asect)
bfd *abfd;
sec_ptr asect;
{
- if (bfd_get_format (abfd) != bfd_object) {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
- if (asect->flags & SEC_CONSTRUCTOR) {
- return (sizeof (arelent *) * (asect->reloc_count+1));
- }
+ if (bfd_get_format (abfd) != bfd_object)
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ return -1;
+ }
+ if (asect->flags & SEC_CONSTRUCTOR)
+ {
+ return (sizeof (arelent *) * (asect->reloc_count+1));
+ }
if (asect == obj_datasec (abfd))
return (sizeof (arelent *)
- * ((exec_hdr(abfd)->a_drsize / obj_reloc_entry_size (abfd))
+ * ((exec_hdr (abfd)->a_drsize / obj_reloc_entry_size (abfd))
+ 1));
if (asect == obj_textsec (abfd))
return (sizeof (arelent *)
- * ((exec_hdr(abfd)->a_trsize / obj_reloc_entry_size (abfd))
+ * ((exec_hdr (abfd)->a_trsize / obj_reloc_entry_size (abfd))
+ 1));
if (asect == obj_bsssec (abfd))
@@ -2549,7 +2596,7 @@ NAME(aout,get_symtab_upper_bound) (abfd)
return (bfd_get_symcount (abfd)+1) * (sizeof (aout_symbol_type *));
}
- alent *
+alent *
NAME(aout,get_lineno) (ignore_abfd, ignore_symbol)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
asymbol *ignore_symbol ATTRIBUTE_UNUSED;
@@ -2567,7 +2614,7 @@ NAME(aout,get_symbol_info) (ignore_abfd, symbol, ret)
if (ret->type == '?')
{
- int type_code = aout_symbol(symbol)->type & 0xff;
+ int type_code = aout_symbol (symbol)->type & 0xff;
const char *stab_name = bfd_get_stab_name (type_code);
static char buf[10];
@@ -2578,47 +2625,49 @@ NAME(aout,get_symbol_info) (ignore_abfd, symbol, ret)
}
ret->type = '-';
ret->stab_type = type_code;
- ret->stab_other = (unsigned) (aout_symbol(symbol)->other & 0xff);
- ret->stab_desc = (unsigned) (aout_symbol(symbol)->desc & 0xffff);
+ ret->stab_other = (unsigned) (aout_symbol (symbol)->other & 0xff);
+ ret->stab_desc = (unsigned) (aout_symbol (symbol)->desc & 0xffff);
ret->stab_name = stab_name;
}
}
void
-NAME(aout,print_symbol) (ignore_abfd, afile, symbol, how)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
+NAME(aout,print_symbol) (abfd, afile, symbol, how)
+ bfd *abfd;
PTR afile;
asymbol *symbol;
bfd_print_symbol_type how;
{
FILE *file = (FILE *)afile;
- switch (how) {
- case bfd_print_symbol_name:
- if (symbol->name)
- fprintf (file,"%s", symbol->name);
- break;
- case bfd_print_symbol_more:
- fprintf (file,"%4x %2x %2x",(unsigned) (aout_symbol(symbol)->desc & 0xffff),
- (unsigned) (aout_symbol(symbol)->other & 0xff),
- (unsigned) (aout_symbol(symbol)->type));
- break;
- case bfd_print_symbol_all:
+ switch (how)
{
- CONST char *section_name = symbol->section->name;
+ case bfd_print_symbol_name:
+ if (symbol->name)
+ fprintf (file,"%s", symbol->name);
+ break;
+ case bfd_print_symbol_more:
+ fprintf (file,"%4x %2x %2x",
+ (unsigned) (aout_symbol (symbol)->desc & 0xffff),
+ (unsigned) (aout_symbol (symbol)->other & 0xff),
+ (unsigned) (aout_symbol (symbol)->type));
+ break;
+ case bfd_print_symbol_all:
+ {
+ const char *section_name = symbol->section->name;
- bfd_print_symbol_vandf((PTR)file,symbol);
+ bfd_print_symbol_vandf (abfd, (PTR)file, symbol);
- fprintf (file," %-5s %04x %02x %02x",
- section_name,
- (unsigned) (aout_symbol(symbol)->desc & 0xffff),
- (unsigned) (aout_symbol(symbol)->other & 0xff),
- (unsigned) (aout_symbol(symbol)->type & 0xff));
- if (symbol->name)
- fprintf (file," %s", symbol->name);
+ fprintf (file," %-5s %04x %02x %02x",
+ section_name,
+ (unsigned) (aout_symbol (symbol)->desc & 0xffff),
+ (unsigned) (aout_symbol (symbol)->other & 0xff),
+ (unsigned) (aout_symbol (symbol)->type & 0xff));
+ if (symbol->name)
+ fprintf (file," %s", symbol->name);
+ }
+ break;
}
- break;
- }
}
/* If we don't have to allocate more than 1MB to hold the generic
@@ -2706,123 +2755,126 @@ NAME(aout,find_nearest_line)
asection *section;
asymbol **symbols;
bfd_vma offset;
- CONST char **filename_ptr;
- CONST char **functionname_ptr;
+ const char **filename_ptr;
+ const char **functionname_ptr;
unsigned int *line_ptr;
{
/* Run down the file looking for the filename, function and linenumber */
asymbol **p;
- CONST char *directory_name = NULL;
- CONST char *main_file_name = NULL;
- CONST char *current_file_name = NULL;
- CONST char *line_file_name = NULL; /* Value of current_file_name at line number. */
- CONST char *line_directory_name = NULL; /* Value of directory_name at line number. */
+ const char *directory_name = NULL;
+ const char *main_file_name = NULL;
+ const char *current_file_name = NULL;
+ const char *line_file_name = NULL; /* Value of current_file_name at line number. */
+ const char *line_directory_name = NULL; /* Value of directory_name at line number. */
bfd_vma low_line_vma = 0;
bfd_vma low_func_vma = 0;
asymbol *func = 0;
- size_t filelen, funclen;
+ bfd_size_type filelen, funclen;
char *buf;
*filename_ptr = abfd->filename;
*functionname_ptr = 0;
*line_ptr = 0;
- if (symbols != (asymbol **)NULL) {
- for (p = symbols; *p; p++) {
- aout_symbol_type *q = (aout_symbol_type *) (*p);
- next:
- switch (q->type){
- case N_TEXT:
- /* If this looks like a file name symbol, and it comes after
- the line number we have found so far, but before the
- offset, then we have probably not found the right line
- number. */
- if (q->symbol.value <= offset
- && ((q->symbol.value > low_line_vma
- && (line_file_name != NULL
- || *line_ptr != 0))
- || (q->symbol.value > low_func_vma
- && func != NULL)))
- {
- const char *symname;
+ if (symbols != (asymbol **)NULL)
+ {
+ for (p = symbols; *p; p++)
+ {
+ aout_symbol_type *q = (aout_symbol_type *) (*p);
+ next:
+ switch (q->type)
+ {
+ case N_TEXT:
+ /* If this looks like a file name symbol, and it comes after
+ the line number we have found so far, but before the
+ offset, then we have probably not found the right line
+ number. */
+ if (q->symbol.value <= offset
+ && ((q->symbol.value > low_line_vma
+ && (line_file_name != NULL
+ || *line_ptr != 0))
+ || (q->symbol.value > low_func_vma
+ && func != NULL)))
+ {
+ const char *symname;
- symname = q->symbol.name;
- if (strcmp (symname + strlen (symname) - 2, ".o") == 0)
- {
- if (q->symbol.value > low_line_vma)
- {
- *line_ptr = 0;
- line_file_name = NULL;
- }
- if (q->symbol.value > low_func_vma)
- func = NULL;
- }
- }
- break;
+ symname = q->symbol.name;
+ if (strcmp (symname + strlen (symname) - 2, ".o") == 0)
+ {
+ if (q->symbol.value > low_line_vma)
+ {
+ *line_ptr = 0;
+ line_file_name = NULL;
+ }
+ if (q->symbol.value > low_func_vma)
+ func = NULL;
+ }
+ }
+ break;
- case N_SO:
- /* If this symbol is less than the offset, but greater than
- the line number we have found so far, then we have not
- found the right line number. */
- if (q->symbol.value <= offset)
- {
- if (q->symbol.value > low_line_vma)
- {
- *line_ptr = 0;
- line_file_name = NULL;
- }
- if (q->symbol.value > low_func_vma)
- func = NULL;
- }
+ case N_SO:
+ /* If this symbol is less than the offset, but greater than
+ the line number we have found so far, then we have not
+ found the right line number. */
+ if (q->symbol.value <= offset)
+ {
+ if (q->symbol.value > low_line_vma)
+ {
+ *line_ptr = 0;
+ line_file_name = NULL;
+ }
+ if (q->symbol.value > low_func_vma)
+ func = NULL;
+ }
- main_file_name = current_file_name = q->symbol.name;
- /* Look ahead to next symbol to check if that too is an N_SO. */
- p++;
- if (*p == NULL)
- break;
- q = (aout_symbol_type *) (*p);
- if (q->type != (int)N_SO)
- goto next;
-
- /* Found a second N_SO First is directory; second is filename. */
- directory_name = current_file_name;
- main_file_name = current_file_name = q->symbol.name;
- if (obj_textsec(abfd) != section)
- goto done;
- break;
- case N_SOL:
- current_file_name = q->symbol.name;
- break;
+ main_file_name = current_file_name = q->symbol.name;
+ /* Look ahead to next symbol to check if that too is an N_SO. */
+ p++;
+ if (*p == NULL)
+ break;
+ q = (aout_symbol_type *) (*p);
+ if (q->type != (int)N_SO)
+ goto next;
+
+ /* Found a second N_SO First is directory; second is filename. */
+ directory_name = current_file_name;
+ main_file_name = current_file_name = q->symbol.name;
+ if (obj_textsec (abfd) != section)
+ goto done;
+ break;
+ case N_SOL:
+ current_file_name = q->symbol.name;
+ break;
- case N_SLINE:
+ case N_SLINE:
- case N_DSLINE:
- case N_BSLINE:
- /* We'll keep this if it resolves nearer than the one we have
- already. */
- if (q->symbol.value >= low_line_vma
- && q->symbol.value <= offset)
- {
- *line_ptr = q->desc;
- low_line_vma = q->symbol.value;
- line_file_name = current_file_name;
- line_directory_name = directory_name;
- }
- break;
- case N_FUN:
- {
- /* We'll keep this if it is nearer than the one we have already */
- if (q->symbol.value >= low_func_vma &&
- q->symbol.value <= offset) {
- low_func_vma = q->symbol.value;
- func = (asymbol *)q;
- }
- else if (q->symbol.value > offset)
- goto done;
+ case N_DSLINE:
+ case N_BSLINE:
+ /* We'll keep this if it resolves nearer than the one we have
+ already. */
+ if (q->symbol.value >= low_line_vma
+ && q->symbol.value <= offset)
+ {
+ *line_ptr = q->desc;
+ low_line_vma = q->symbol.value;
+ line_file_name = current_file_name;
+ line_directory_name = directory_name;
+ }
+ break;
+ case N_FUN:
+ {
+ /* We'll keep this if it is nearer than the one we have already */
+ if (q->symbol.value >= low_func_vma &&
+ q->symbol.value <= offset) {
+ low_func_vma = q->symbol.value;
+ func = (asymbol *)q;
+ }
+ else if (q->symbol.value > offset)
+ goto done;
+ }
+ break;
+ }
}
- break;
- }
}
- }
done:
if (*line_ptr != 0)
@@ -2869,7 +2921,7 @@ NAME(aout,find_nearest_line)
if (func)
{
const char *function = func->name;
- char *p;
+ char *colon;
/* The caller expects a symbol name. We actually have a
function name, without the leading underscore. Put the
@@ -2882,9 +2934,9 @@ NAME(aout,find_nearest_line)
strcpy (buf + 1, function);
}
/* Have to remove : stuff */
- p = strchr (buf, ':');
- if (p != NULL)
- *p = '\0';
+ colon = strchr (buf, ':');
+ if (colon != NULL)
+ *colon = '\0';
*functionname_ptr = buf;
}
@@ -2896,7 +2948,7 @@ NAME(aout,sizeof_headers) (abfd, execable)
bfd *abfd;
boolean execable ATTRIBUTE_UNUSED;
{
- return adata(abfd).exec_bytes_size;
+ return adata (abfd).exec_bytes_size;
}
/* Free all information we have cached for this BFD. We can always
@@ -2994,9 +3046,9 @@ NAME(aout,link_hash_table_create) (abfd)
bfd *abfd;
{
struct aout_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct aout_link_hash_table);
- ret = ((struct aout_link_hash_table *)
- bfd_alloc (abfd, sizeof (struct aout_link_hash_table)));
+ ret = (struct aout_link_hash_table *) bfd_alloc (abfd, amt);
if (ret == NULL)
return (struct bfd_link_hash_table *) NULL;
if (! NAME(aout,link_hash_table_init) (ret, abfd,
@@ -3132,7 +3184,7 @@ aout_link_check_ar_symbols (abfd, info, pneeded)
strings = obj_aout_external_strings (abfd);
for (; p < pend; p++)
{
- int type = bfd_h_get_8 (abfd, p->e_type);
+ int type = H_GET_8 (abfd, p->e_type);
const char *name;
struct bfd_link_hash_entry *h;
@@ -3296,6 +3348,7 @@ aout_link_add_symbols (abfd, info)
struct aout_link_hash_entry **sym_hash;
register struct external_nlist *p;
struct external_nlist *pend;
+ bfd_size_type amt;
syms = obj_aout_external_syms (abfd);
sym_count = obj_aout_external_sym_count (abfd);
@@ -3316,10 +3369,8 @@ aout_link_add_symbols (abfd, info)
to particular symbols. We could just look them up in the hash
table, but keeping the list is more efficient. Perhaps this
should be conditional on info->keep_memory. */
- sym_hash = ((struct aout_link_hash_entry **)
- bfd_alloc (abfd,
- ((size_t) sym_count
- * sizeof (struct aout_link_hash_entry *))));
+ amt = sym_count * sizeof (struct aout_link_hash_entry *);
+ sym_hash = (struct aout_link_hash_entry **) bfd_alloc (abfd, amt);
if (sym_hash == NULL && sym_count != 0)
return false;
obj_aout_sym_hashes (abfd) = sym_hash;
@@ -3341,7 +3392,7 @@ aout_link_add_symbols (abfd, info)
*sym_hash = NULL;
- type = bfd_h_get_8 (abfd, p->e_type);
+ type = H_GET_8 (abfd, p->e_type);
/* Ignore debugging symbols. */
if ((type & N_STAB) != 0)
@@ -3525,8 +3576,8 @@ struct aout_link_includes_entry
/* Look up an entry in an the header file hash table. */
-#define aout_link_includes_lookup(table, string, create, copy) \
- ((struct aout_link_includes_entry *) \
+#define aout_link_includes_lookup(table, string, create, copy) \
+ ((struct aout_link_includes_entry *) \
bfd_hash_lookup (&(table)->root, (string), (create), (copy)))
/* During the final link step we need to pass around a bunch of
@@ -3631,9 +3682,9 @@ NAME(aout,final_link) (abfd, info, callback)
boolean includes_hash_initialized = false;
register bfd *sub;
bfd_size_type trsize, drsize;
- size_t max_contents_size;
- size_t max_relocs_size;
- size_t max_sym_count;
+ bfd_size_type max_contents_size;
+ bfd_size_type max_relocs_size;
+ bfd_size_type max_sym_count;
bfd_size_type text_size;
file_ptr text_end;
register struct bfd_link_order *p;
@@ -3665,7 +3716,7 @@ NAME(aout,final_link) (abfd, info, callback)
max_sym_count = 0;
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
{
- size_t sz;
+ bfd_size_type sz;
if (info->relocateable)
{
@@ -3934,14 +3985,12 @@ NAME(aout,final_link) (abfd, info, callback)
&& obj_datasec (abfd)->reloc_count == 0)
{
bfd_byte b;
+ file_ptr pos;
b = 0;
- if (bfd_seek (abfd,
- (obj_datasec (abfd)->filepos
- + exec_hdr (abfd)->a_data
- - 1),
- SEEK_SET) != 0
- || bfd_write (&b, 1, 1, abfd) != 1)
+ pos = obj_datasec (abfd)->filepos + exec_hdr (abfd)->a_data - 1;
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0
+ || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
goto error_return;
}
@@ -4062,9 +4111,9 @@ aout_link_write_symbols (finfo, input_bfd)
false, false) != NULL)
&& discard != discard_all)
{
- bfd_h_put_8 (output_bfd, N_TEXT, outsym->e_type);
- bfd_h_put_8 (output_bfd, 0, outsym->e_other);
- bfd_h_put_16 (output_bfd, (bfd_vma) 0, outsym->e_desc);
+ H_PUT_8 (output_bfd, N_TEXT, outsym->e_type);
+ H_PUT_8 (output_bfd, 0, outsym->e_other);
+ H_PUT_16 (output_bfd, 0, outsym->e_desc);
strtab_index = add_to_stringtab (output_bfd, finfo->strtab,
input_bfd->filename, false);
if (strtab_index == (bfd_size_type) -1)
@@ -4085,7 +4134,7 @@ aout_link_write_symbols (finfo, input_bfd)
sym_end = sym + sym_count;
sym_hash = obj_aout_sym_hashes (input_bfd);
symbol_map = finfo->symbol_map;
- memset (symbol_map, 0, sym_count * sizeof *symbol_map);
+ memset (symbol_map, 0, (size_t) sym_count * sizeof *symbol_map);
for (; sym < sym_end; sym++, sym_hash++, symbol_map++)
{
const char *name;
@@ -4108,7 +4157,7 @@ aout_link_write_symbols (finfo, input_bfd)
we do copy the symbol over. */
*symbol_map = -1;
- type = bfd_h_get_8 (input_bfd, sym->e_type);
+ type = H_GET_8 (input_bfd, sym->e_type);
name = strings + GET_WORD (input_bfd, sym->e_strx);
h = NULL;
@@ -4342,6 +4391,7 @@ aout_link_write_symbols (finfo, input_bfd)
switch (discard)
{
case discard_none:
+ case discard_sec_merge:
break;
case discard_l:
if ((type & N_STAB) == 0
@@ -4378,7 +4428,7 @@ aout_link_write_symbols (finfo, input_bfd)
{
int incl_type;
- incl_type = bfd_h_get_8 (input_bfd, incl_sym->e_type);
+ incl_type = H_GET_8 (input_bfd, incl_sym->e_type);
if (incl_type == N_EINCL)
{
if (nest == 0)
@@ -4399,7 +4449,7 @@ aout_link_write_symbols (finfo, input_bfd)
{
/* Skip the file number. */
++s;
- while (isdigit ((unsigned char) *s))
+ while (ISDIGIT (*s))
++s;
--s;
}
@@ -4447,7 +4497,7 @@ aout_link_write_symbols (finfo, input_bfd)
{
int incl_type;
- incl_type = bfd_h_get_8 (input_bfd, incl_sym->e_type);
+ incl_type = H_GET_8 (input_bfd, incl_sym->e_type);
if (incl_type == N_EINCL)
{
if (nest == 0)
@@ -4468,11 +4518,9 @@ aout_link_write_symbols (finfo, input_bfd)
/* Copy this symbol into the list of symbols we are going to
write out. */
- bfd_h_put_8 (output_bfd, type, outsym->e_type);
- bfd_h_put_8 (output_bfd, bfd_h_get_8 (input_bfd, sym->e_other),
- outsym->e_other);
- bfd_h_put_16 (output_bfd, bfd_h_get_16 (input_bfd, sym->e_desc),
- outsym->e_desc);
+ H_PUT_8 (output_bfd, type, outsym->e_type);
+ H_PUT_8 (output_bfd, H_GET_8 (input_bfd, sym->e_other), outsym->e_other);
+ H_PUT_16 (output_bfd, H_GET_16 (input_bfd, sym->e_desc), outsym->e_desc);
copy = false;
if (! finfo->info->keep_memory)
{
@@ -4498,17 +4546,16 @@ aout_link_write_symbols (finfo, input_bfd)
/* Write out the output symbols we have just constructed. */
if (outsym > finfo->output_syms)
{
- bfd_size_type outsym_count;
+ bfd_size_type outsym_size;
if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0)
return false;
- outsym_count = outsym - finfo->output_syms;
- if (bfd_write ((PTR) finfo->output_syms,
- (bfd_size_type) EXTERNAL_NLIST_SIZE,
- (bfd_size_type) outsym_count, output_bfd)
- != outsym_count * EXTERNAL_NLIST_SIZE)
+ outsym_size = outsym - finfo->output_syms;
+ outsym_size *= EXTERNAL_NLIST_SIZE;
+ if (bfd_bwrite ((PTR) finfo->output_syms, outsym_size, output_bfd)
+ != outsym_size)
return false;
- finfo->symoff += outsym_count * EXTERNAL_NLIST_SIZE;
+ finfo->symoff += outsym_size;
}
return true;
@@ -4528,6 +4575,7 @@ aout_link_write_other_symbol (h, data)
bfd_vma val;
struct external_nlist outsym;
bfd_size_type indx;
+ bfd_size_type amt;
output_bfd = finfo->output_bfd;
@@ -4604,12 +4652,12 @@ aout_link_write_other_symbol (h, data)
return true;
}
- bfd_h_put_8 (output_bfd, type, outsym.e_type);
- bfd_h_put_8 (output_bfd, 0, outsym.e_other);
- bfd_h_put_16 (output_bfd, 0, outsym.e_desc);
+ H_PUT_8 (output_bfd, type, outsym.e_type);
+ H_PUT_8 (output_bfd, 0, outsym.e_other);
+ H_PUT_16 (output_bfd, 0, outsym.e_desc);
indx = add_to_stringtab (output_bfd, finfo->strtab, h->root.root.string,
false);
- if (indx == (bfd_size_type) -1)
+ if (indx == - (bfd_size_type) 1)
{
/* FIXME: No way to handle errors. */
abort ();
@@ -4617,9 +4665,9 @@ aout_link_write_other_symbol (h, data)
PUT_WORD (output_bfd, indx, outsym.e_strx);
PUT_WORD (output_bfd, val, outsym.e_value);
+ amt = EXTERNAL_NLIST_SIZE;
if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0
- || bfd_write ((PTR) &outsym, (bfd_size_type) EXTERNAL_NLIST_SIZE,
- (bfd_size_type) 1, output_bfd) != EXTERNAL_NLIST_SIZE)
+ || bfd_bwrite ((PTR) &outsym, amt, output_bfd) != amt)
{
/* FIXME: No way to handle errors. */
abort ();
@@ -4663,7 +4711,7 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
if (rel_size > 0)
{
if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0
- || bfd_read (relocs, 1, rel_size, input_bfd) != rel_size)
+ || bfd_bread (relocs, rel_size, input_bfd) != rel_size)
return false;
}
}
@@ -4688,7 +4736,7 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
if (! bfd_set_section_contents (finfo->output_bfd,
input_section->output_section,
(PTR) finfo->contents,
- input_section->output_offset,
+ (file_ptr) input_section->output_offset,
input_size))
return false;
@@ -4698,8 +4746,7 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
{
if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0)
return false;
- if (bfd_write (relocs, (bfd_size_type) 1, rel_size, finfo->output_bfd)
- != rel_size)
+ if (bfd_bwrite (relocs, rel_size, finfo->output_bfd) != rel_size)
return false;
*reloff_ptr += rel_size;
@@ -4798,7 +4845,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
r_addr = GET_SWORD (input_bfd, rel->r_address);
#ifdef MY_reloc_howto
- howto = MY_reloc_howto(input_bfd, rel, r_index, r_extern, r_pcrel);
+ howto = MY_reloc_howto (input_bfd, rel, r_index, r_extern, r_pcrel);
#else
{
int r_jmptable;
@@ -5357,7 +5404,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
/* For base relative relocs, r_index is always an index
into the symbol table, even if r_extern is 0. */
sym = syms + r_index;
- type = bfd_h_get_8 (input_bfd, sym->e_type);
+ type = H_GET_8 (input_bfd, sym->e_type);
if ((type & N_TYPE) == N_TEXT
|| type == N_WEAKT)
r_section = obj_textsec (input_bfd);
@@ -5518,6 +5565,7 @@ aout_link_reloc_link_order (finfo, o, p)
struct reloc_std_external srel;
struct reloc_ext_external erel;
PTR rel_ptr;
+ bfd_size_type amt;
pr = p->u.reloc.p;
@@ -5583,8 +5631,8 @@ aout_link_reloc_link_order (finfo, o, p)
if (obj_reloc_entry_size (finfo->output_bfd) == RELOC_STD_SIZE)
{
#ifdef MY_put_reloc
- MY_put_reloc(finfo->output_bfd, r_extern, r_index, p->offset, howto,
- &srel);
+ MY_put_reloc (finfo->output_bfd, r_extern, r_index, p->offset, howto,
+ &srel);
#else
{
int r_pcrel;
@@ -5647,7 +5695,7 @@ aout_link_reloc_link_order (finfo, o, p)
if (buf == (bfd_byte *) NULL)
return false;
r = MY_relocate_contents (howto, finfo->output_bfd,
- pr->addend, buf);
+ (bfd_vma) pr->addend, buf);
switch (r)
{
case bfd_reloc_ok:
@@ -5670,10 +5718,8 @@ aout_link_reloc_link_order (finfo, o, p)
}
break;
}
- ok = bfd_set_section_contents (finfo->output_bfd, o,
- (PTR) buf,
- (file_ptr) p->offset,
- size);
+ ok = bfd_set_section_contents (finfo->output_bfd, o, (PTR) buf,
+ (file_ptr) p->offset, size);
free (buf);
if (! ok)
return false;
@@ -5706,17 +5752,15 @@ aout_link_reloc_link_order (finfo, o, p)
| (howto->type << RELOC_EXT_BITS_TYPE_SH_LITTLE);
}
- PUT_WORD (finfo->output_bfd, pr->addend, erel.r_addend);
+ PUT_WORD (finfo->output_bfd, (bfd_vma) pr->addend, erel.r_addend);
#endif /* MY_put_ext_reloc */
rel_ptr = (PTR) &erel;
}
+ amt = obj_reloc_entry_size (finfo->output_bfd);
if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0
- || (bfd_write (rel_ptr, (bfd_size_type) 1,
- obj_reloc_entry_size (finfo->output_bfd),
- finfo->output_bfd)
- != obj_reloc_entry_size (finfo->output_bfd)))
+ || bfd_bwrite (rel_ptr, amt, finfo->output_bfd) != amt)
return false;
*reloff_ptr += obj_reloc_entry_size (finfo->output_bfd);
diff --git a/contrib/binutils/bfd/archive.c b/contrib/binutils/bfd/archive.c
index 0a6f023..fc2ba45 100644
--- a/contrib/binutils/bfd/archive.c
+++ b/contrib/binutils/bfd/archive.c
@@ -1,6 +1,6 @@
/* BFD back-end for archive files (libraries).
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000
+ 2000, 2001
Free Software Foundation, Inc.
Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault.
@@ -132,7 +132,7 @@ DESCRIPTION
#include "libbfd.h"
#include "aout/ar.h"
#include "aout/ranlib.h"
-#include <ctype.h>
+#include "safe-ctype.h"
#ifndef errno
extern int errno;
@@ -142,12 +142,6 @@ extern int errno;
#define BFD_GNU960_ARMAG(abfd) (BFD_COFF_FILE_P((abfd)) ? ARMAG : ARMAGB)
#endif
-/* Define offsetof for those systems which lack it */
-
-#ifndef offsetof
-#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
-#endif
-
/* We keep a cache of archive filepointers to archive elements to
speed up searching the archive by filepos. We only add an entry to
the cache when we actually read one. We also don't sort the cache;
@@ -170,6 +164,7 @@ static char *get_extended_arelt_filename PARAMS ((bfd *arch,
const char *name));
static boolean do_slurp_bsd_armap PARAMS ((bfd *abfd));
static boolean do_slurp_coff_armap PARAMS ((bfd *abfd));
+boolean bfd_elf64_archive_slurp_armap PARAMS ((bfd *abfd));
static const char *normalize PARAMS ((bfd *, const char *file));
static struct areltdata *bfd_ar_hdr_from_filesystem PARAMS ((bfd *abfd,
const char *,
@@ -179,9 +174,9 @@ boolean
_bfd_generic_mkarchive (abfd)
bfd *abfd;
{
- abfd->tdata.aout_ar_data = ((struct artdata *)
- bfd_zalloc (abfd, sizeof (struct artdata)));
+ bfd_size_type amt = sizeof (struct artdata);
+ abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt);
if (bfd_ardata (abfd) == NULL)
return false;
@@ -290,10 +285,9 @@ _bfd_add_bfd_to_archive_cache (arch_bfd, filepos, new_elt)
bfd *arch_bfd, *new_elt;
file_ptr filepos;
{
- struct ar_cache *new_cache = ((struct ar_cache *)
- bfd_zalloc (arch_bfd,
- sizeof (struct ar_cache)));
+ bfd_size_type amt = sizeof (struct ar_cache);
+ struct ar_cache *new_cache = (struct ar_cache *) bfd_zalloc (arch_bfd, amt);
if (new_cache == NULL)
return false;
@@ -364,14 +358,14 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag)
{
struct ar_hdr hdr;
char *hdrp = (char *) &hdr;
- unsigned int parsed_size;
+ size_t parsed_size;
struct areltdata *ared;
char *filename = NULL;
- unsigned int namelen = 0;
- unsigned int allocsize = sizeof (struct areltdata) + sizeof (struct ar_hdr);
+ bfd_size_type namelen = 0;
+ bfd_size_type allocsize = sizeof (struct areltdata) + sizeof (struct ar_hdr);
char *allocptr = 0;
- if (bfd_read ((PTR) hdrp, 1, sizeof (struct ar_hdr), abfd)
+ if (bfd_bread ((PTR) hdrp, (bfd_size_type) sizeof (struct ar_hdr), abfd)
!= sizeof (struct ar_hdr))
{
if (bfd_get_error () != bfd_error_system_call)
@@ -414,7 +408,7 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag)
else if (hdr.ar_name[0] == '#'
&& hdr.ar_name[1] == '1'
&& hdr.ar_name[2] == '/'
- && isdigit ((unsigned char) hdr.ar_name[3]))
+ && ISDIGIT (hdr.ar_name[3]))
{
/* BSD-4.4 extended name */
namelen = atoi (&hdr.ar_name[3]);
@@ -427,7 +421,7 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag)
filename = (allocptr
+ sizeof (struct areltdata)
+ sizeof (struct ar_hdr));
- if (bfd_read (filename, 1, namelen, abfd) != namelen)
+ if (bfd_bread (filename, namelen, abfd) != namelen)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_no_more_archived_files);
@@ -482,7 +476,7 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag)
ared->filename = allocptr + (sizeof (struct areltdata) +
sizeof (struct ar_hdr));
if (namelen)
- memcpy (ared->filename, hdr.ar_name, namelen);
+ memcpy (ared->filename, hdr.ar_name, (size_t) namelen);
ared->filename[namelen] = '\0';
}
@@ -607,10 +601,11 @@ bfd_generic_archive_p (abfd)
{
struct artdata *tdata_hold;
char armag[SARMAG + 1];
+ bfd_size_type amt;
tdata_hold = abfd->tdata.aout_ar_data;
- if (bfd_read ((PTR) armag, 1, SARMAG, abfd) != SARMAG)
+ if (bfd_bread ((PTR) armag, (bfd_size_type) SARMAG, abfd) != SARMAG)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
@@ -628,8 +623,8 @@ bfd_generic_archive_p (abfd)
/* We are setting bfd_ardata(abfd) here, but since bfd_ardata
involves a cast, we can't do it as the left operand of assignment. */
- abfd->tdata.aout_ar_data = ((struct artdata *)
- bfd_zalloc (abfd, sizeof (struct artdata)));
+ amt = sizeof (struct artdata);
+ abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt);
if (bfd_ardata (abfd) == NULL)
return NULL;
@@ -684,15 +679,19 @@ bfd_generic_archive_p (abfd)
if (bfd_check_format (first, bfd_object)
&& first->xvec != abfd->xvec)
{
+#if 0
+ /* We ought to close `first' here, but we can't, because
+ we have no way to remove it from the archive cache.
+ It's close to impossible to figure out when we can
+ release bfd_ardata. FIXME. */
(void) bfd_close (first);
bfd_release (abfd, bfd_ardata (abfd));
abfd->tdata.aout_ar_data = tdata_hold;
- bfd_set_error (bfd_error_wrong_format);
+#endif
+ bfd_set_error (bfd_error_wrong_object_format);
return NULL;
}
-
- /* We ought to close first here, but we can't, because we
- have no way to remove it from the archive cache. FIXME. */
+ /* And we ought to close `first' here too. */
}
}
@@ -702,7 +701,7 @@ bfd_generic_archive_p (abfd)
/* Some constants for a 32 bit BSD archive structure. We do not
support 64 bit archives presently; so far as I know, none actually
exist. Supporting them would require changing these constants, and
- changing some bfd_h_get_32 to bfd_h_get_64. */
+ changing some H_GET_32 to H_GET_64. */
/* The size of an external symdef structure. */
#define BSD_SYMDEF_SIZE 8
@@ -727,7 +726,7 @@ do_slurp_bsd_armap (abfd)
bfd_byte *raw_armap, *rbase;
struct artdata *ardata = bfd_ardata (abfd);
char *stringbase;
- unsigned int parsed_size;
+ bfd_size_type parsed_size, amt;
carsym *set;
mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
@@ -740,7 +739,7 @@ do_slurp_bsd_armap (abfd)
if (raw_armap == (bfd_byte *) NULL)
return false;
- if (bfd_read ((PTR) raw_armap, 1, parsed_size, abfd) != parsed_size)
+ if (bfd_bread ((PTR) raw_armap, parsed_size, abfd) != parsed_size)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
@@ -749,7 +748,7 @@ do_slurp_bsd_armap (abfd)
return false;
}
- ardata->symdef_count = bfd_h_get_32 (abfd, raw_armap) / BSD_SYMDEF_SIZE;
+ ardata->symdef_count = H_GET_32 (abfd, raw_armap) / BSD_SYMDEF_SIZE;
if (ardata->symdef_count * BSD_SYMDEF_SIZE >
parsed_size - BSD_SYMDEF_COUNT_SIZE)
@@ -764,9 +763,8 @@ do_slurp_bsd_armap (abfd)
stringbase = ((char *) rbase
+ ardata->symdef_count * BSD_SYMDEF_SIZE
+ BSD_STRING_COUNT_SIZE);
- ardata->symdefs = (carsym *) bfd_alloc (abfd,
- (ardata->symdef_count
- * sizeof (carsym)));
+ amt = (bfd_size_type) ardata->symdef_count * sizeof (carsym);
+ ardata->symdefs = (carsym *) bfd_alloc (abfd, amt);
if (!ardata->symdefs)
return false;
@@ -774,8 +772,8 @@ do_slurp_bsd_armap (abfd)
counter < ardata->symdef_count;
counter++, set++, rbase += BSD_SYMDEF_SIZE)
{
- set->name = bfd_h_get_32 (abfd, rbase) + stringbase;
- set->file_offset = bfd_h_get_32 (abfd, rbase + BSD_SYMDEF_OFFSET_SIZE);
+ set->name = H_GET_32 (abfd, rbase) + stringbase;
+ set->file_offset = H_GET_32 (abfd, rbase + BSD_SYMDEF_OFFSET_SIZE);
}
ardata->first_file_filepos = bfd_tell (abfd);
@@ -798,13 +796,14 @@ do_slurp_coff_armap (abfd)
int *raw_armap, *rawptr;
struct artdata *ardata = bfd_ardata (abfd);
char *stringbase;
- unsigned int stringsize;
+ bfd_size_type stringsize;
unsigned int parsed_size;
carsym *carsyms;
- unsigned int nsymz; /* Number of symbols in armap. */
+ bfd_size_type nsymz; /* Number of symbols in armap. */
bfd_vma (*swap) PARAMS ((const bfd_byte *));
char int_buf[sizeof (long)];
- unsigned int carsym_size, ptrsize, i;
+ bfd_size_type carsym_size, ptrsize;
+ unsigned int i;
mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
if (mapdata == NULL)
@@ -812,7 +811,7 @@ do_slurp_coff_armap (abfd)
parsed_size = mapdata->parsed_size;
bfd_release (abfd, (PTR) mapdata); /* Don't need it any more. */
- if (bfd_read ((PTR) int_buf, 1, 4, abfd) != 4)
+ if (bfd_bread ((PTR) int_buf, (bfd_size_type) 4, abfd) != 4)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
@@ -857,8 +856,8 @@ do_slurp_coff_armap (abfd)
raw_armap = (int *) bfd_alloc (abfd, ptrsize);
if (raw_armap == NULL)
goto release_symdefs;
- if (bfd_read ((PTR) raw_armap, 1, ptrsize, abfd) != ptrsize
- || bfd_read ((PTR) stringbase, 1, stringsize, abfd) != stringsize)
+ if (bfd_bread ((PTR) raw_armap, ptrsize, abfd) != ptrsize
+ || (bfd_bread ((PTR) stringbase, stringsize, abfd) != stringsize))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
@@ -888,7 +887,7 @@ do_slurp_coff_armap (abfd)
{
struct areltdata *tmp;
- bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET);
+ bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET);
tmp = (struct areltdata *) _bfd_read_ar_hdr (abfd);
if (tmp != NULL)
{
@@ -896,7 +895,7 @@ do_slurp_coff_armap (abfd)
&& tmp->arch_header[1] == ' ')
{
ardata->first_file_filepos +=
- (tmp->parsed_size + sizeof (struct ar_hdr) + 1) & ~1;
+ (tmp->parsed_size + sizeof (struct ar_hdr) + 1) & ~(unsigned) 1;
}
bfd_release (abfd, tmp);
}
@@ -919,14 +918,14 @@ bfd_slurp_armap (abfd)
bfd *abfd;
{
char nextname[17];
- int i = bfd_read ((PTR) nextname, 1, 16, abfd);
+ int i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd);
if (i == 0)
return true;
if (i != 16)
return false;
- if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0)
+ if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
return false;
if (!strncmp (nextname, "__.SYMDEF ", 16)
@@ -936,9 +935,13 @@ bfd_slurp_armap (abfd)
return do_slurp_coff_armap (abfd);
else if (!strncmp (nextname, "/SYM64/ ", 16))
{
- /* Irix 6 archive--must be recognized by code in elf64-mips.c. */
+ /* 64bit ELF (Irix 6) archive. */
+#ifdef BFD64
+ return bfd_elf64_archive_slurp_armap (abfd);
+#else
bfd_set_error (bfd_error_wrong_format);
return false;
+#endif
}
bfd_has_map (abfd) = false;
@@ -963,8 +966,9 @@ bfd_slurp_bsd_armap_f2 (abfd)
struct artdata *ardata = bfd_ardata (abfd);
char *stringbase;
unsigned int stringsize;
+ bfd_size_type amt;
carsym *set;
- int i = bfd_read ((PTR) nextname, 1, 16, abfd);
+ int i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd);
if (i == 0)
return true;
@@ -972,7 +976,7 @@ bfd_slurp_bsd_armap_f2 (abfd)
return false;
/* The archive has at least 16 bytes in it. */
- if (bfd_seek (abfd, -16L, SEEK_CUR) != 0)
+ if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
return false;
if (!strncmp (nextname, "__.SYMDEF ", 16)
@@ -989,7 +993,8 @@ bfd_slurp_bsd_armap_f2 (abfd)
if (mapdata == NULL)
return false;
- raw_armap = (bfd_byte *) bfd_zalloc (abfd, mapdata->parsed_size);
+ amt = mapdata->parsed_size;
+ raw_armap = (bfd_byte *) bfd_zalloc (abfd, amt);
if (raw_armap == NULL)
{
byebye:
@@ -997,8 +1002,7 @@ bfd_slurp_bsd_armap_f2 (abfd)
return false;
}
- if (bfd_read ((PTR) raw_armap, 1, mapdata->parsed_size, abfd) !=
- mapdata->parsed_size)
+ if (bfd_bread ((PTR) raw_armap, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
@@ -1007,7 +1011,7 @@ bfd_slurp_bsd_armap_f2 (abfd)
goto byebye;
}
- ardata->symdef_count = bfd_h_get_16 (abfd, (PTR) raw_armap);
+ ardata->symdef_count = H_GET_16 (abfd, (PTR) raw_armap);
if (ardata->symdef_count * BSD_SYMDEF_SIZE
> mapdata->parsed_size - HPUX_SYMDEF_COUNT_SIZE)
@@ -1019,15 +1023,14 @@ bfd_slurp_bsd_armap_f2 (abfd)
ardata->cache = 0;
- stringsize = bfd_h_get_32 (abfd, raw_armap + HPUX_SYMDEF_COUNT_SIZE);
+ stringsize = H_GET_32 (abfd, raw_armap + HPUX_SYMDEF_COUNT_SIZE);
/* Skip sym count and string sz. */
stringbase = ((char *) raw_armap
+ HPUX_SYMDEF_COUNT_SIZE
+ BSD_STRING_COUNT_SIZE);
rbase = (bfd_byte *) stringbase + stringsize;
- ardata->symdefs = (carsym *) bfd_alloc (abfd,
- (ardata->symdef_count
- * BSD_SYMDEF_SIZE));
+ amt = (bfd_size_type) ardata->symdef_count * BSD_SYMDEF_SIZE;
+ ardata->symdefs = (carsym *) bfd_alloc (abfd, amt);
if (!ardata->symdefs)
return false;
@@ -1035,8 +1038,8 @@ bfd_slurp_bsd_armap_f2 (abfd)
counter < ardata->symdef_count;
counter++, set++, rbase += BSD_SYMDEF_SIZE)
{
- set->name = bfd_h_get_32 (abfd, rbase) + stringbase;
- set->file_offset = bfd_h_get_32 (abfd, rbase + BSD_SYMDEF_OFFSET_SIZE);
+ set->name = H_GET_32 (abfd, rbase) + stringbase;
+ set->file_offset = H_GET_32 (abfd, rbase + BSD_SYMDEF_OFFSET_SIZE);
}
ardata->first_file_filepos = bfd_tell (abfd);
@@ -1067,13 +1070,14 @@ _bfd_slurp_extended_name_table (abfd)
{
char nextname[17];
struct areltdata *namedata;
+ bfd_size_type amt;
/* FIXME: Formatting sucks here, and in case of failure of BFD_READ,
we probably don't want to return true. */
bfd_seek (abfd, bfd_ardata (abfd)->first_file_filepos, SEEK_SET);
- if (bfd_read ((PTR) nextname, 1, 16, abfd) == 16)
+ if (bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd) == 16)
{
- if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0)
+ if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
return false;
if (strncmp (nextname, "ARFILENAMES/ ", 16) != 0 &&
@@ -1087,8 +1091,8 @@ _bfd_slurp_extended_name_table (abfd)
if (namedata == NULL)
return false;
- bfd_ardata (abfd)->extended_names =
- bfd_zalloc (abfd, namedata->parsed_size);
+ amt = namedata->parsed_size;
+ bfd_ardata (abfd)->extended_names = bfd_zalloc (abfd, amt);
if (bfd_ardata (abfd)->extended_names == NULL)
{
byebye:
@@ -1096,8 +1100,7 @@ _bfd_slurp_extended_name_table (abfd)
return false;
}
- if (bfd_read ((PTR) bfd_ardata (abfd)->extended_names, 1,
- namedata->parsed_size, abfd) != namedata->parsed_size)
+ if (bfd_bread ((PTR) bfd_ardata (abfd)->extended_names, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
@@ -1147,8 +1150,8 @@ normalize (abfd, file)
bfd *abfd;
const char *file;
{
- CONST char *first;
- CONST char *last;
+ const char *first;
+ const char *last;
char *copy;
first = file + strlen (file) - 1;
@@ -1166,7 +1169,7 @@ normalize (abfd, file)
first--;
}
- copy = (char *) bfd_alloc (abfd, last - first + 1);
+ copy = (char *) bfd_alloc (abfd, (bfd_size_type) (last - first + 1));
if (copy == NULL)
return NULL;
@@ -1244,7 +1247,7 @@ _bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen)
bfd_size_type *tablen;
{
unsigned int maxname = abfd->xvec->ar_max_namelen;
- unsigned int total_namelen = 0;
+ bfd_size_type total_namelen = 0;
bfd *current;
char *strptr;
@@ -1392,6 +1395,7 @@ bfd_ar_hdr_from_filesystem (abfd, filename, member)
struct areltdata *ared;
struct ar_hdr *hdr;
char *temp, *temp1;
+ bfd_size_type amt;
if (member && (member->flags & BFD_IN_MEMORY) != 0)
{
@@ -1409,8 +1413,8 @@ bfd_ar_hdr_from_filesystem (abfd, filename, member)
return NULL;
}
- ared = (struct areltdata *) bfd_zalloc (abfd, sizeof (struct ar_hdr) +
- sizeof (struct areltdata));
+ amt = sizeof (struct ar_hdr) + sizeof (struct areltdata);
+ ared = (struct areltdata *) bfd_zalloc (abfd, amt);
if (ared == NULL)
return NULL;
hdr = (struct ar_hdr *) (((char *) ared) + sizeof (struct areltdata));
@@ -1537,7 +1541,7 @@ bfd_generic_stat_arch_elt (abfd, buf)
void
bfd_dont_truncate_arname (abfd, pathname, arhdr)
bfd *abfd;
- CONST char *pathname;
+ const char *pathname;
char *arhdr;
{
/* FIXME: This interacts unpleasantly with ar's quick-append option.
@@ -1577,13 +1581,13 @@ bfd_dont_truncate_arname (abfd, pathname, arhdr)
void
bfd_bsd_truncate_arname (abfd, pathname, arhdr)
bfd *abfd;
- CONST char *pathname;
+ const char *pathname;
char *arhdr;
{
struct ar_hdr *hdr = (struct ar_hdr *) arhdr;
- int length;
- CONST char *filename = strrchr (pathname, '/');
- int maxlen = ar_maxnamelen (abfd);
+ size_t length;
+ const char *filename = strrchr (pathname, '/');
+ size_t maxlen = ar_maxnamelen (abfd);
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
{
@@ -1628,13 +1632,13 @@ bfd_bsd_truncate_arname (abfd, pathname, arhdr)
void
bfd_gnu_truncate_arname (abfd, pathname, arhdr)
bfd *abfd;
- CONST char *pathname;
+ const char *pathname;
char *arhdr;
{
struct ar_hdr *hdr = (struct ar_hdr *) arhdr;
- int length;
- CONST char *filename = strrchr (pathname, '/');
- int maxlen = ar_maxnamelen (abfd);
+ size_t length;
+ const char *filename = strrchr (pathname, '/');
+ size_t maxlen = ar_maxnamelen (abfd);
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
{
@@ -1733,16 +1737,16 @@ _bfd_write_archive_contents (arch)
if (bfd_seek (arch, (file_ptr) 0, SEEK_SET) != 0)
return false;
#ifdef GNU960
- wrote = bfd_write (BFD_GNU960_ARMAG (arch), 1, SARMAG, arch);
+ wrote = bfd_bwrite (BFD_GNU960_ARMAG (arch), (bfd_size_type) SARMAG, arch);
#else
- wrote = bfd_write (ARMAG, 1, SARMAG, arch);
+ wrote = bfd_bwrite (ARMAG, (bfd_size_type) SARMAG, arch);
#endif
if (wrote != SARMAG)
return false;
if (makemap && hasobjects)
{
- if (_bfd_compute_and_write_armap (arch, elength) != true)
+ if (_bfd_compute_and_write_armap (arch, (unsigned int) elength) != true)
return false;
}
@@ -1754,18 +1758,18 @@ _bfd_write_archive_contents (arch)
strcpy (hdr.ar_name, ename);
/* Round size up to even number in archive header. */
sprintf (&(hdr.ar_size[0]), "%-10d",
- (int) ((elength + 1) & ~1));
+ (int) ((elength + 1) & ~(bfd_size_type) 1));
strncpy (hdr.ar_fmag, ARFMAG, 2);
for (i = 0; i < sizeof (struct ar_hdr); i++)
if (((char *) (&hdr))[i] == '\0')
(((char *) (&hdr))[i]) = ' ';
- if ((bfd_write ((char *) &hdr, 1, sizeof (struct ar_hdr), arch)
+ if ((bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
- || bfd_write (etable, 1, elength, arch) != elength)
+ || bfd_bwrite (etable, elength, arch) != elength)
return false;
if ((elength % 2) == 1)
{
- if (bfd_write ("\012", 1, 1, arch) != 1)
+ if (bfd_bwrite ("\012", (bfd_size_type) 1, arch) != 1)
return false;
}
}
@@ -1777,7 +1781,8 @@ _bfd_write_archive_contents (arch)
struct ar_hdr *hdr = arch_hdr (current);
/* Write ar header. */
- if (bfd_write ((char *) hdr, 1, sizeof (*hdr), arch) != sizeof (*hdr))
+ if (bfd_bwrite ((PTR) hdr, (bfd_size_type) sizeof (*hdr), arch)
+ != sizeof (*hdr))
return false;
if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0)
return false;
@@ -1787,19 +1792,19 @@ _bfd_write_archive_contents (arch)
if (amt > remaining)
amt = remaining;
errno = 0;
- if (bfd_read (buffer, amt, 1, current) != amt)
+ if (bfd_bread (buffer, (bfd_size_type) amt, current) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
return false;
}
- if (bfd_write (buffer, amt, 1, arch) != amt)
+ if (bfd_bwrite (buffer, (bfd_size_type) amt, arch) != amt)
return false;
remaining -= amt;
}
if ((arelt_size (current) % 2) == 1)
{
- if (bfd_write ("\012", 1, 1, arch) != 1)
+ if (bfd_bwrite ("\012", (bfd_size_type) 1, arch) != 1)
return false;
}
}
@@ -1837,25 +1842,27 @@ _bfd_compute_and_write_armap (arch, elength)
bfd *current;
file_ptr elt_no = 0;
struct orl *map = NULL;
- int orl_max = 1024; /* fine initial default */
- int orl_count = 0;
+ unsigned int orl_max = 1024; /* fine initial default */
+ unsigned int orl_count = 0;
int stridx = 0; /* string index */
asymbol **syms = NULL;
long syms_max = 0;
boolean ret;
+ bfd_size_type amt;
/* Dunno if this is the best place for this info... */
if (elength != 0)
elength += sizeof (struct ar_hdr);
elength += elength % 2;
- map = (struct orl *) bfd_malloc (orl_max * sizeof (struct orl));
+ amt = (bfd_size_type) orl_max * sizeof (struct orl);
+ map = (struct orl *) bfd_malloc (amt);
if (map == NULL)
goto error_return;
/* We put the symbol names on the arch objalloc, and then discard
them when done. */
- first_name = bfd_alloc (arch, 1);
+ first_name = bfd_alloc (arch, (bfd_size_type) 1);
if (first_name == NULL)
goto error_return;
@@ -1887,7 +1894,7 @@ _bfd_compute_and_write_armap (arch, elength)
if (syms_max > 0)
free (syms);
syms_max = storage;
- syms = (asymbol **) bfd_malloc ((size_t) syms_max);
+ syms = (asymbol **) bfd_malloc ((bfd_size_type) syms_max);
if (syms == NULL)
goto error_return;
}
@@ -1908,16 +1915,15 @@ _bfd_compute_and_write_armap (arch, elength)
bfd_is_com_section (sec))
&& ! bfd_is_und_section (sec))
{
- size_t namelen;
+ bfd_size_type namelen;
struct orl *new_map;
/* This symbol will go into the archive header. */
if (orl_count == orl_max)
{
orl_max *= 2;
- new_map =
- ((struct orl *)
- bfd_realloc (map, orl_max * sizeof (struct orl)));
+ amt = (bfd_size_type) orl_max * sizeof (struct orl);
+ new_map = (struct orl *) bfd_realloc (map, amt);
if (new_map == (struct orl *) NULL)
goto error_return;
@@ -1925,17 +1931,16 @@ _bfd_compute_and_write_armap (arch, elength)
}
namelen = strlen (syms[src_count]->name);
- map[orl_count].name = ((char **)
- bfd_alloc (arch,
- sizeof (char *)));
+ amt = sizeof (char *);
+ map[orl_count].name = (char **) bfd_alloc (arch, amt);
if (map[orl_count].name == NULL)
goto error_return;
*(map[orl_count].name) = bfd_alloc (arch, namelen + 1);
if (*(map[orl_count].name) == NULL)
goto error_return;
strcpy (*(map[orl_count].name), syms[src_count]->name);
- (map[orl_count]).pos = (file_ptr) current;
- (map[orl_count]).namidx = stridx;
+ map[orl_count].u.abfd = current;
+ map[orl_count].namidx = stridx;
stridx += namelen + 1;
++orl_count;
@@ -2013,18 +2018,18 @@ bsd_write_armap (arch, elength, map, orl_count, stridx)
for (i = 0; i < sizeof (struct ar_hdr); i++)
if (((char *) (&hdr))[i] == '\0')
(((char *) (&hdr))[i]) = ' ';
- if (bfd_write ((char *) &hdr, 1, sizeof (struct ar_hdr), arch)
+ if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
return false;
- bfd_h_put_32 (arch, (bfd_vma) ranlibsize, temp);
- if (bfd_write (temp, 1, sizeof (temp), arch) != sizeof (temp))
+ H_PUT_32 (arch, ranlibsize, temp);
+ if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), arch) != sizeof (temp))
return false;
for (count = 0; count < orl_count; count++)
{
bfd_byte buf[BSD_SYMDEF_SIZE];
- if (((bfd *) (map[count]).pos) != last_elt)
+ if (map[count].u.abfd != last_elt)
{
do
{
@@ -2032,25 +2037,26 @@ bsd_write_armap (arch, elength, map, orl_count, stridx)
firstreal += firstreal % 2;
current = current->next;
}
- while (current != (bfd *) (map[count]).pos);
+ while (current != map[count].u.abfd);
} /* if new archive element */
last_elt = current;
- bfd_h_put_32 (arch, map[count].namidx, buf);
- bfd_h_put_32 (arch, firstreal, buf + BSD_SYMDEF_OFFSET_SIZE);
- if (bfd_write (buf, BSD_SYMDEF_SIZE, 1, arch) != BSD_SYMDEF_SIZE)
+ H_PUT_32 (arch, map[count].namidx, buf);
+ H_PUT_32 (arch, firstreal, buf + BSD_SYMDEF_OFFSET_SIZE);
+ if (bfd_bwrite (buf, (bfd_size_type) BSD_SYMDEF_SIZE, arch)
+ != BSD_SYMDEF_SIZE)
return false;
}
/* Now write the strings themselves. */
- bfd_h_put_32 (arch, stringsize, temp);
- if (bfd_write (temp, 1, sizeof (temp), arch) != sizeof (temp))
+ H_PUT_32 (arch, stringsize, temp);
+ if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), arch) != sizeof (temp))
return false;
for (count = 0; count < orl_count; count++)
{
size_t len = strlen (*map[count].name) + 1;
- if (bfd_write (*map[count].name, 1, len, arch) != len)
+ if (bfd_bwrite (*map[count].name, (bfd_size_type) len, arch) != len)
return false;
}
@@ -2058,7 +2064,7 @@ bsd_write_armap (arch, elength, map, orl_count, stridx)
bug-compatible for sun's ar we use a null. */
if (padit)
{
- if (bfd_write ("", 1, 1, arch) != 1)
+ if (bfd_bwrite ("", (bfd_size_type) 1, arch) != 1)
return false;
}
@@ -2107,7 +2113,7 @@ _bfd_archive_bsd_update_armap_timestamp (arch)
bfd_ardata (arch)->armap_datepos = (SARMAG
+ offsetof (struct ar_hdr, ar_date[0]));
if (bfd_seek (arch, bfd_ardata (arch)->armap_datepos, SEEK_SET) != 0
- || (bfd_write (hdr.ar_date, sizeof (hdr.ar_date), 1, arch)
+ || (bfd_bwrite (hdr.ar_date, (bfd_size_type) sizeof (hdr.ar_date), arch)
!= sizeof (hdr.ar_date)))
{
/* FIXME: bfd can't call perror. */
@@ -2144,11 +2150,11 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
int stridx;
{
/* The size of the ranlib is the number of exported symbols in the
- archive * the number of bytes in a int, + an int for the count. */
+ archive * the number of bytes in an int, + an int for the count. */
unsigned int ranlibsize = (symbol_count * 4) + 4;
unsigned int stringsize = stridx;
unsigned int mapsize = stringsize + ranlibsize;
- file_ptr archive_member_file_ptr;
+ unsigned int archive_member_file_ptr;
bfd *current = arch->archive_head;
unsigned int count;
struct ar_hdr hdr;
@@ -2180,7 +2186,7 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
/* Write the ar header for this item and the number of symbols. */
- if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), arch)
+ if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
return false;
@@ -2199,7 +2205,7 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
/* For each symbol which is used defined in this object, write
out the object file's address in the archive. */
- while (count < symbol_count && ((bfd *) (map[count]).pos) == current)
+ while (count < symbol_count && map[count].u.abfd == current)
{
bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr);
count++;
@@ -2217,7 +2223,7 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
{
size_t len = strlen (*map[count].name) + 1;
- if (bfd_write (*map[count].name, 1, len, arch) != len)
+ if (bfd_bwrite (*map[count].name, (bfd_size_type) len, arch) != len)
return false;
}
@@ -2225,7 +2231,7 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
bug-compatible for arc960 we use a null. */
if (padit)
{
- if (bfd_write ("", 1, 1, arch) != 1)
+ if (bfd_bwrite ("", (bfd_size_type) 1, arch) != 1)
return false;
}
diff --git a/contrib/binutils/bfd/archive64.c b/contrib/binutils/bfd/archive64.c
new file mode 100644
index 0000000..ea94c6a
--- /dev/null
+++ b/contrib/binutils/bfd/archive64.c
@@ -0,0 +1,245 @@
+/* MIPS-specific support for 64-bit ELF
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
+ Ian Lance Taylor, Cygnus Support
+ Linker support added by Mark Mitchell, CodeSourcery, LLC.
+ <mark@codesourcery.com>
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* This file supports the 64-bit (MIPS) ELF archives. */
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+#include "aout/ar.h"
+
+/* Irix 6 defines a 64bit archive map format, so that they can
+ have archives more than 4 GB in size. */
+
+boolean bfd_elf64_archive_slurp_armap PARAMS ((bfd *));
+boolean bfd_elf64_archive_write_armap
+ PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
+
+/* Read an Irix 6 armap. */
+
+boolean
+bfd_elf64_archive_slurp_armap (abfd)
+ bfd *abfd;
+{
+ struct artdata *ardata = bfd_ardata (abfd);
+ char nextname[17];
+ file_ptr arhdrpos;
+ bfd_size_type i, parsed_size, nsymz, stringsize, carsym_size, ptrsize;
+ struct areltdata *mapdata;
+ bfd_byte int_buf[8];
+ char *stringbase;
+ bfd_byte *raw_armap = NULL;
+ carsym *carsyms;
+ bfd_size_type amt;
+
+ ardata->symdefs = NULL;
+
+ /* Get the name of the first element. */
+ arhdrpos = bfd_tell (abfd);
+ i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd);
+ if (i == 0)
+ return true;
+ if (i != 16)
+ return false;
+
+ if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0)
+ return false;
+
+ /* Archives with traditional armaps are still permitted. */
+ if (strncmp (nextname, "/ ", 16) == 0)
+ return bfd_slurp_armap (abfd);
+
+ if (strncmp (nextname, "/SYM64/ ", 16) != 0)
+ {
+ bfd_has_map (abfd) = false;
+ return true;
+ }
+
+ mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
+ if (mapdata == NULL)
+ return false;
+ parsed_size = mapdata->parsed_size;
+ bfd_release (abfd, (PTR) mapdata);
+
+ if (bfd_bread (int_buf, (bfd_size_type) 8, abfd) != 8)
+ {
+ if (bfd_get_error () != bfd_error_system_call)
+ bfd_set_error (bfd_error_malformed_archive);
+ return false;
+ }
+
+ nsymz = bfd_getb64 (int_buf);
+ stringsize = parsed_size - 8 * nsymz - 8;
+
+ carsym_size = nsymz * sizeof (carsym);
+ ptrsize = 8 * nsymz;
+
+ amt = carsym_size + stringsize + 1;
+ ardata->symdefs = (carsym *) bfd_zalloc (abfd, amt);
+ if (ardata->symdefs == NULL)
+ return false;
+ carsyms = ardata->symdefs;
+ stringbase = ((char *) ardata->symdefs) + carsym_size;
+
+ raw_armap = (bfd_byte *) bfd_alloc (abfd, ptrsize);
+ if (raw_armap == NULL)
+ goto release_symdefs;
+
+ if (bfd_bread (raw_armap, ptrsize, abfd) != ptrsize
+ || bfd_bread (stringbase, stringsize, abfd) != stringsize)
+ {
+ if (bfd_get_error () != bfd_error_system_call)
+ bfd_set_error (bfd_error_malformed_archive);
+ goto release_raw_armap;
+ }
+
+ for (i = 0; i < nsymz; i++)
+ {
+ carsyms->file_offset = bfd_getb64 (raw_armap + i * 8);
+ carsyms->name = stringbase;
+ stringbase += strlen (stringbase) + 1;
+ ++carsyms;
+ }
+ *stringbase = '\0';
+
+ ardata->symdef_count = nsymz;
+ ardata->first_file_filepos = bfd_tell (abfd);
+ /* Pad to an even boundary if you have to. */
+ ardata->first_file_filepos += (ardata->first_file_filepos) % 2;
+
+ bfd_has_map (abfd) = true;
+ bfd_release (abfd, raw_armap);
+
+ return true;
+
+release_raw_armap:
+ bfd_release (abfd, raw_armap);
+release_symdefs:
+ bfd_release (abfd, ardata->symdefs);
+ return false;
+}
+
+/* Write out an Irix 6 armap. The Irix 6 tools are supposed to be
+ able to handle ordinary ELF armaps, but at least on Irix 6.2 the
+ linker crashes. */
+
+boolean
+bfd_elf64_archive_write_armap (arch, elength, map, symbol_count, stridx)
+ bfd *arch;
+ unsigned int elength;
+ struct orl *map;
+ unsigned int symbol_count;
+ int stridx;
+{
+ unsigned int ranlibsize = (symbol_count * 8) + 8;
+ unsigned int stringsize = stridx;
+ unsigned int mapsize = stringsize + ranlibsize;
+ file_ptr archive_member_file_ptr;
+ bfd *current = arch->archive_head;
+ unsigned int count;
+ struct ar_hdr hdr;
+ unsigned int i;
+ int padding;
+ bfd_byte buf[8];
+
+ padding = BFD_ALIGN (mapsize, 8) - mapsize;
+ mapsize += padding;
+
+ /* work out where the first object file will go in the archive */
+ archive_member_file_ptr = (mapsize
+ + elength
+ + sizeof (struct ar_hdr)
+ + SARMAG);
+
+ memset ((char *) (&hdr), 0, sizeof (struct ar_hdr));
+ strcpy (hdr.ar_name, "/SYM64/");
+ sprintf (hdr.ar_size, "%-10d", (int) mapsize);
+ sprintf (hdr.ar_date, "%ld", (long) time (NULL));
+ /* This, at least, is what Intel coff sets the values to.: */
+ sprintf ((hdr.ar_uid), "%d", 0);
+ sprintf ((hdr.ar_gid), "%d", 0);
+ sprintf ((hdr.ar_mode), "%-7o", (unsigned) 0);
+ strncpy (hdr.ar_fmag, ARFMAG, 2);
+
+ for (i = 0; i < sizeof (struct ar_hdr); i++)
+ if (((char *) (&hdr))[i] == '\0')
+ (((char *) (&hdr))[i]) = ' ';
+
+ /* Write the ar header for this item and the number of symbols */
+
+ if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), arch)
+ != sizeof (struct ar_hdr))
+ return false;
+
+ bfd_putb64 ((bfd_vma) symbol_count, buf);
+ if (bfd_bwrite (buf, (bfd_size_type) 8, arch) != 8)
+ return false;
+
+ /* Two passes, first write the file offsets for each symbol -
+ remembering that each offset is on a two byte boundary. */
+
+ /* Write out the file offset for the file associated with each
+ symbol, and remember to keep the offsets padded out. */
+
+ current = arch->archive_head;
+ count = 0;
+ while (current != (bfd *) NULL && count < symbol_count)
+ {
+ /* For each symbol which is used defined in this object, write out
+ the object file's address in the archive */
+
+ while (map[count].u.abfd == current)
+ {
+ bfd_putb64 ((bfd_vma) archive_member_file_ptr, buf);
+ if (bfd_bwrite (buf, (bfd_size_type) 8, arch) != 8)
+ return false;
+ count++;
+ }
+ /* Add size of this archive entry */
+ archive_member_file_ptr += (arelt_size (current)
+ + sizeof (struct ar_hdr));
+ /* remember about the even alignment */
+ archive_member_file_ptr += archive_member_file_ptr % 2;
+ current = current->next;
+ }
+
+ /* now write the strings themselves */
+ for (count = 0; count < symbol_count; count++)
+ {
+ size_t len = strlen (*map[count].name) + 1;
+
+ if (bfd_bwrite (*map[count].name, (bfd_size_type) len, arch) != len)
+ return false;
+ }
+
+ /* The spec says that this should be padded to an 8 byte boundary.
+ However, the Irix 6.2 tools do not appear to do this. */
+ while (padding != 0)
+ {
+ if (bfd_bwrite ("", (bfd_size_type) 1, arch) != 1)
+ return false;
+ --padding;
+ }
+
+ return true;
+}
diff --git a/contrib/binutils/bfd/archures.c b/contrib/binutils/bfd/archures.c
index 8f7f9de..19d862e 100644
--- a/contrib/binutils/bfd/archures.c
+++ b/contrib/binutils/bfd/archures.c
@@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
-#include <ctype.h>
+#include "safe-ctype.h"
/*
@@ -137,11 +137,10 @@ DESCRIPTION
.#define bfd_mach_mips10000 10000
.#define bfd_mach_mips12000 12000
.#define bfd_mach_mips16 16
-.#define bfd_mach_mips32 32
-.#define bfd_mach_mips32_4k 3204113 {* 32, 04, octal 'K' *}
.#define bfd_mach_mips5 5
-.#define bfd_mach_mips64 64
.#define bfd_mach_mips_sb1 12310201 {* octal 'SB', 01 *}
+.#define bfd_mach_mipsisa32 32
+.#define bfd_mach_mipsisa64 64
. bfd_arch_i386, {* Intel 386 *}
.#define bfd_mach_i386_i386 0
.#define bfd_mach_i386_i8086 1
@@ -161,6 +160,7 @@ DESCRIPTION
.#define bfd_mach_h8300 1
.#define bfd_mach_h8300h 2
.#define bfd_mach_h8300s 3
+. bfd_arch_pdp11, {* DEC PDP-11 *}
. bfd_arch_powerpc, {* PowerPC *}
.#define bfd_mach_ppc 0
.#define bfd_mach_ppc_403 403
@@ -254,6 +254,13 @@ DESCRIPTION
.#define bfd_mach_avr4 4
.#define bfd_mach_avr5 5
. bfd_arch_cris, {* Axis CRIS *}
+. bfd_arch_s390, {* IBM s390 *}
+.#define bfd_mach_s390_esa 0
+.#define bfd_mach_s390_esame 1
+. bfd_arch_openrisc, {* OpenRISC *}
+. bfd_arch_mmix, {* Donald Knuth's educational processor *}
+. bfd_arch_xstormy16,
+.#define bfd_mach_xstormy16 0
. bfd_arch_last
. };
*/
@@ -311,6 +318,7 @@ extern const bfd_arch_info_type bfd_m88k_arch;
extern const bfd_arch_info_type bfd_mips_arch;
extern const bfd_arch_info_type bfd_mn10200_arch;
extern const bfd_arch_info_type bfd_mn10300_arch;
+extern const bfd_arch_info_type bfd_pdp11_arch;
extern const bfd_arch_info_type bfd_powerpc_arch;
extern const bfd_arch_info_type bfd_rs6000_arch;
extern const bfd_arch_info_type bfd_pj_arch;
@@ -329,6 +337,10 @@ extern const bfd_arch_info_type bfd_fr30_arch;
extern const bfd_arch_info_type bfd_mcore_arch;
extern const bfd_arch_info_type bfd_avr_arch;
extern const bfd_arch_info_type bfd_ia64_arch;
+extern const bfd_arch_info_type bfd_s390_arch;
+extern const bfd_arch_info_type bfd_openrisc_arch;
+extern const bfd_arch_info_type bfd_mmix_arch;
+extern const bfd_arch_info_type bfd_xstormy16_arch;
static const bfd_arch_info_type * const bfd_archures_list[] = {
#ifdef SELECT_ARCHITECTURES
@@ -356,6 +368,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] = {
&bfd_mips_arch,
&bfd_mn10200_arch,
&bfd_mn10300_arch,
+ &bfd_pdp11_arch,
&bfd_powerpc_arch,
&bfd_rs6000_arch,
&bfd_sh_arch,
@@ -373,6 +386,10 @@ static const bfd_arch_info_type * const bfd_archures_list[] = {
&bfd_mcore_arch,
&bfd_avr_arch,
&bfd_ia64_arch,
+ &bfd_s390_arch,
+ &bfd_openrisc_arch,
+ &bfd_mmix_arch,
+ &bfd_xstormy16_arch,
#endif
0
};
@@ -448,6 +465,7 @@ bfd_arch_list ()
const char **name_ptr;
const char **name_list;
const bfd_arch_info_type * const *app;
+ bfd_size_type amt;
/* Determine the number of architectures. */
vec_length = 0;
@@ -460,8 +478,8 @@ bfd_arch_list ()
}
}
- name_list = (const char **)
- bfd_malloc ((vec_length + 1) * sizeof (char **));
+ amt = (vec_length + 1) * sizeof (char **);
+ name_list = (const char **) bfd_malloc (amt);
if (name_list == NULL)
return NULL;
@@ -717,7 +735,7 @@ DESCRIPTION
boolean
bfd_default_scan (info, string)
- const struct bfd_arch_info *info;
+ const bfd_arch_info_type *info;
const char *string;
{
const char *ptr_src;
@@ -741,7 +759,7 @@ bfd_default_scan (info, string)
printable_name_colon = strchr (info->printable_name, ':');
if (printable_name_colon == NULL)
{
- int strlen_arch_name = strlen (info->arch_name);
+ size_t strlen_arch_name = strlen (info->arch_name);
if (strncasecmp (string, info->arch_name, strlen_arch_name) == 0)
{
if (string[strlen_arch_name] == ':')
@@ -763,7 +781,7 @@ bfd_default_scan (info, string)
Attempt to match: <arch> <mach>? */
if (printable_name_colon != NULL)
{
- int colon_index = printable_name_colon - info->printable_name;
+ size_t colon_index = printable_name_colon - info->printable_name;
if (strncasecmp (string, info->printable_name, colon_index) == 0
&& strcasecmp (string + colon_index,
info->printable_name + colon_index + 1) == 0)
@@ -802,7 +820,7 @@ bfd_default_scan (info, string)
}
number = 0;
- while (isdigit ((unsigned char) *ptr_src))
+ while (ISDIGIT (*ptr_src))
{
number = number * 10 + *ptr_src - '0';
ptr_src++;
diff --git a/contrib/binutils/bfd/armnetbsd.c b/contrib/binutils/bfd/armnetbsd.c
index aa6a882..e899adb 100644
--- a/contrib/binutils/bfd/armnetbsd.c
+++ b/contrib/binutils/bfd/armnetbsd.c
@@ -1,5 +1,5 @@
/* BFD back-end for NetBSD/ARM a.out-ish binaries.
- Copyright 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -27,12 +27,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define DEFAULT_MID M_ARM6_NETBSD
/*#define MACHTYPE_OK(mtype) ((mtype) == M_ARM6_NETBSD)*/
-#define MY(OP) CAT (armnetbsd_, OP)
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define MY(OP) CONCAT2 (armnetbsd_, OP)
+
/* This needs to start with a.out so GDB knows it is an a.out variant. */
#define TARGETNAME "a.out-arm-netbsd"
#if 0
-#define NAME(x,y) CAT3(aoutarm,_32_,y)
+#define NAME(x,y) CONCAT3 (aoutarm,_32_,y)
#define aoutarm_32_get_section_contents aout_32_get_section_contents
diff --git a/contrib/binutils/bfd/bfd-in.h b/contrib/binutils/bfd/bfd-in.h
index 62ce58b..c6f2b41 100644
--- a/contrib/binutils/bfd/bfd-in.h
+++ b/contrib/binutils/bfd/bfd-in.h
@@ -4,10 +4,6 @@
Free Software Foundation, Inc.
Contributed by Cygnus Support.
-** NOTE: bfd.h and bfd-in2.h are GENERATED files. Don't change them;
-** instead, change bfd-in.h or the other BFD source files processed to
-** generate these files.
-
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
@@ -24,25 +20,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-/* bfd.h -- The only header file required by users of the bfd library
-
-The bfd.h file is generated from bfd-in.h and various .c files; if you
-change it, your changes will probably be lost.
-
-All the prototypes and definitions following the comment "THE FOLLOWING
-IS EXTRACTED FROM THE SOURCE" are extracted from the source files for
-BFD. If you change it, someone oneday will extract it from the source
-again, and your changes will be lost. To save yourself from this bind,
-change the definitions in the source in the bfd directory. Type "make
-docs" and then "make headers" in that directory, and magically this file
-will change to reflect your changes.
-
-If you don't have the tools to perform the extraction, then you are
-safe from someone on your system trampling over your header files.
-You should still maintain the equivalence between the source and this
-file though; every change you make to the .c file should be reflected
-here. */
-
#ifndef __BFD_H_SEEN__
#define __BFD_H_SEEN__
@@ -51,10 +28,31 @@ extern "C" {
#endif
#include "ansidecl.h"
+#include "symcat.h"
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#ifndef SABER
+/* This hack is to avoid a problem with some strict ANSI C preprocessors.
+ The problem is, "32_" is not a valid preprocessing token, and we don't
+ want extra underscores (e.g., "nlm_32_"). The XCONCAT2 macro will
+ cause the inner CONCAT2 macros to be evaluated first, producing
+ still-valid pp-tokens. Then the final concatenation can be done. */
+#undef CONCAT4
+#define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d))
+#endif
+#endif
+
+#define BFD_VERSION @bfd_version@
+#define BFD_VERSION_DATE @bfd_version_date@
+#define BFD_VERSION_STRING @bfd_version_string@
-/* These two lines get substitutions done by commands in Makefile.in. */
-#define BFD_VERSION "@VERSION@"
+/* The word size used by BFD on the host. This may be 64 with a 32
+ bit target if the host is 64 bit, or if other 64 bit targets have
+ been selected with --enable-targets, or if --enable-64-bit-bfd. */
#define BFD_ARCH_SIZE @wordsize@
+
+/* The word size of the default bfd target. */
+#define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@
+
#define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@
#if @BFD_HOST_64_BIT_DEFINED@
#define BFD_HOST_64_BIT @BFD_HOST_64_BIT@
@@ -106,16 +104,6 @@ typedef enum bfd_boolean {false, true} boolean;
typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
#endif
-/* A pointer to a position in a file. */
-/* FIXME: This should be using off_t from <sys/types.h>.
- For now, try to avoid breaking stuff by not including <sys/types.h> here.
- This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
- Probably the best long-term answer is to avoid using file_ptr AND off_t
- in this header file, and to handle this in the BFD implementation
- rather than in its interface. */
-/* typedef off_t file_ptr; */
-typedef long int file_ptr;
-
/* Support for different sizes of target format ints and addresses.
If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be
set to 1 above. Otherwise, if gcc is being used, this code will
@@ -183,7 +171,22 @@ typedef unsigned long bfd_size_type;
#endif /* not BFD64 */
+/* A pointer to a position in a file. */
+/* FIXME: This should be using off_t from <sys/types.h>.
+ For now, try to avoid breaking stuff by not including <sys/types.h> here.
+ This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
+ Probably the best long-term answer is to avoid using file_ptr AND off_t
+ in this header file, and to handle this in the BFD implementation
+ rather than in its interface. */
+/* typedef off_t file_ptr; */
+typedef bfd_signed_vma file_ptr;
+typedef bfd_vma ufile_ptr;
+
+extern void bfd_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
+extern void bfd_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
+
#define printf_vma(x) fprintf_vma(stdout,x)
+#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
typedef unsigned int flagword; /* 32 bits of flags */
typedef unsigned char bfd_byte;
@@ -289,7 +292,10 @@ typedef struct carsym {
Perhaps just a forward definition would do? */
struct orl { /* output ranlib */
char **name; /* symbol name */
- file_ptr pos; /* bfd* or file position */
+ union {
+ file_ptr pos;
+ bfd *abfd;
+ } u; /* bfd* or file position */
int namidx; /* index into string table */
};
@@ -298,7 +304,7 @@ typedef struct lineno_cache_entry {
unsigned int line_number; /* Linenumber from start of function*/
union {
struct symbol_cache_entry *sym; /* Function name */
- unsigned long offset; /* Offset into section */
+ bfd_vma offset; /* Offset into section */
} u;
} alent;
@@ -341,11 +347,11 @@ typedef struct _symbol_info
{
symvalue value;
char type;
- CONST char *name; /* Symbol name. */
+ const char *name; /* Symbol name. */
unsigned char stab_type; /* Stab type. */
char stab_other; /* Stab other. */
short stab_desc; /* Stab desc. */
- CONST char *stab_name; /* String for stab type. */
+ const char *stab_name; /* String for stab type. */
} symbol_info;
/* Get the name of a stabs type code. */
@@ -438,47 +444,39 @@ extern void bfd_hash_traverse PARAMS ((struct bfd_hash_table *,
boolean (*) (struct bfd_hash_entry *,
PTR),
PTR info));
-
-/* Semi-portable string concatenation in cpp.
- The CAT4 hack is to avoid a problem with some strict ANSI C preprocessors.
- The problem is, "32_" is not a valid preprocessing token, and we don't
- want extra underscores (e.g., "nlm_32_"). The XCAT2 macro will cause the
- inner CAT macros to be evaluated first, producing still-valid pp-tokens.
- Then the final concatenation can be done. (Sigh.) */
-#ifndef CAT
-#ifdef SABER
-#define CAT(a,b) a##b
-#define CAT3(a,b,c) a##b##c
-#define CAT4(a,b,c,d) a##b##c##d
-#else
-#if defined(__STDC__) || defined(ALMOST_STDC)
-#define CAT(a,b) a##b
-#define CAT3(a,b,c) a##b##c
-#define XCAT2(a,b) CAT(a,b)
-#define CAT4(a,b,c,d) XCAT2(CAT(a,b),CAT(c,d))
-#else
-#define CAT(a,b) a/**/b
-#define CAT3(a,b,c) a/**/b/**/c
-#define CAT4(a,b,c,d) a/**/b/**/c/**/d
-#endif
-#endif
-#endif
#define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table
-
+
/* User program access to BFD facilities */
/* Direct I/O routines, for programs which know more about the object
file than BFD does. Use higher level routines if possible. */
-extern bfd_size_type bfd_read
- PARAMS ((PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd));
-extern bfd_size_type bfd_write
- PARAMS ((const PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd));
-extern int bfd_seek PARAMS ((bfd *abfd, file_ptr fp, int direction));
-extern long bfd_tell PARAMS ((bfd *abfd));
-extern int bfd_flush PARAMS ((bfd *abfd));
-extern int bfd_stat PARAMS ((bfd *abfd, struct stat *));
+extern bfd_size_type bfd_bread PARAMS ((PTR, bfd_size_type, bfd *));
+extern bfd_size_type bfd_bwrite PARAMS ((const PTR, bfd_size_type, bfd *));
+extern int bfd_seek PARAMS ((bfd *, file_ptr, int));
+extern ufile_ptr bfd_tell PARAMS ((bfd *));
+extern int bfd_flush PARAMS ((bfd *));
+extern int bfd_stat PARAMS ((bfd *, struct stat *));
+
+/* Deprecated old routines. */
+#if __GNUC__
+#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \
+ (warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__), \
+ bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
+#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \
+ (warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__), \
+ bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
+#else
+#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \
+ (warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \
+ bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
+#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \
+ (warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\
+ bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
+#endif
+extern void warn_deprecated
+ PARAMS ((const char *, const char *, int, const char *));
/* Cast from const char * to char * so that caller can assign to
a char * without a warning. */
@@ -514,6 +512,9 @@ extern int bfd_stat PARAMS ((bfd *abfd, struct stat *));
#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean) (bool)), true)
+extern boolean bfd_cache_close PARAMS ((bfd *abfd));
+/* NB: This declaration should match the autogenerated one in libbfd.h. */
+
extern boolean bfd_record_phdr
PARAMS ((bfd *, unsigned long, boolean, flagword, boolean, bfd_vma,
boolean, boolean, unsigned int, struct sec **));
@@ -622,11 +623,11 @@ extern struct bfd_link_needed_list *bfd_elf_get_needed_list
extern boolean bfd_elf_get_bfd_needed_list
PARAMS ((bfd *, struct bfd_link_needed_list **));
extern boolean bfd_elf32_size_dynamic_sections
- PARAMS ((bfd *, const char *, const char *, boolean, const char *,
+ PARAMS ((bfd *, const char *, const char *, const char *,
const char * const *, struct bfd_link_info *, struct sec **,
struct bfd_elf_version_tree *));
extern boolean bfd_elf64_size_dynamic_sections
- PARAMS ((bfd *, const char *, const char *, boolean, const char *,
+ PARAMS ((bfd *, const char *, const char *, const char *,
const char * const *, struct bfd_link_info *, struct sec **,
struct bfd_elf_version_tree *));
extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
@@ -634,6 +635,10 @@ extern void bfd_elf_set_dt_needed_soname PARAMS ((bfd *, const char *));
extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_elf32_discard_info
+ PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_elf64_discard_info
+ PARAMS ((bfd *, struct bfd_link_info *));
/* Return an upper bound on the number of bytes required to store a
copy of ABFD's program header table entries. Return -1 if an error
@@ -708,10 +713,9 @@ extern boolean bfd_xcoff_link_record_set
bfd_size_type));
extern boolean bfd_xcoff_import_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
- bfd_vma, const char *, const char *, const char *));
+ bfd_vma, const char *, const char *, const char *, unsigned int));
extern boolean bfd_xcoff_export_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
- boolean));
+ PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *));
extern boolean bfd_xcoff_link_count_reloc
PARAMS ((bfd *, struct bfd_link_info *, const char *));
extern boolean bfd_xcoff_record_link_assignment
@@ -720,6 +724,8 @@ extern boolean bfd_xcoff_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *,
unsigned long, unsigned long, unsigned long, boolean,
int, boolean, boolean, struct sec **));
+extern boolean bfd_xcoff_link_generate_rtinit
+ PARAMS ((bfd *, const char *, const char *));
/* Externally visible COFF routines. */
diff --git a/contrib/binutils/bfd/bfd-in2.h b/contrib/binutils/bfd/bfd-in2.h
index 08456db..e48a20d 100644
--- a/contrib/binutils/bfd/bfd-in2.h
+++ b/contrib/binutils/bfd/bfd-in2.h
@@ -1,13 +1,15 @@
+/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically
+ generated from "bfd-in.h", "init.c", "opncls.c", "libbfd.c",
+ "section.c", "archures.c", "reloc.c", "syms.c", "bfd.c", "archive.c",
+ "corefile.c", "targets.c" and "format.c".
+ Run "make headers" in your build bfd/ to regenerate. */
+
/* Main header file for the bfd library -- portable access to object files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001
Free Software Foundation, Inc.
Contributed by Cygnus Support.
-** NOTE: bfd.h and bfd-in2.h are GENERATED files. Don't change them;
-** instead, change bfd-in.h or the other BFD source files processed to
-** generate these files.
-
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
@@ -24,25 +26,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-/* bfd.h -- The only header file required by users of the bfd library
-
-The bfd.h file is generated from bfd-in.h and various .c files; if you
-change it, your changes will probably be lost.
-
-All the prototypes and definitions following the comment "THE FOLLOWING
-IS EXTRACTED FROM THE SOURCE" are extracted from the source files for
-BFD. If you change it, someone oneday will extract it from the source
-again, and your changes will be lost. To save yourself from this bind,
-change the definitions in the source in the bfd directory. Type "make
-docs" and then "make headers" in that directory, and magically this file
-will change to reflect your changes.
-
-If you don't have the tools to perform the extraction, then you are
-safe from someone on your system trampling over your header files.
-You should still maintain the equivalence between the source and this
-file though; every change you make to the .c file should be reflected
-here. */
-
#ifndef __BFD_H_SEEN__
#define __BFD_H_SEEN__
@@ -51,10 +34,31 @@ extern "C" {
#endif
#include "ansidecl.h"
+#include "symcat.h"
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#ifndef SABER
+/* This hack is to avoid a problem with some strict ANSI C preprocessors.
+ The problem is, "32_" is not a valid preprocessing token, and we don't
+ want extra underscores (e.g., "nlm_32_"). The XCONCAT2 macro will
+ cause the inner CONCAT2 macros to be evaluated first, producing
+ still-valid pp-tokens. Then the final concatenation can be done. */
+#undef CONCAT4
+#define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d))
+#endif
+#endif
-/* These two lines get substitutions done by commands in Makefile.in. */
-#define BFD_VERSION "@VERSION@"
+#define BFD_VERSION @bfd_version@
+#define BFD_VERSION_DATE @bfd_version_date@
+#define BFD_VERSION_STRING @bfd_version_string@
+
+/* The word size used by BFD on the host. This may be 64 with a 32
+ bit target if the host is 64 bit, or if other 64 bit targets have
+ been selected with --enable-targets, or if --enable-64-bit-bfd. */
#define BFD_ARCH_SIZE @wordsize@
+
+/* The word size of the default bfd target. */
+#define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@
+
#define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@
#if @BFD_HOST_64_BIT_DEFINED@
#define BFD_HOST_64_BIT @BFD_HOST_64_BIT@
@@ -106,16 +110,6 @@ typedef enum bfd_boolean {false, true} boolean;
typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
#endif
-/* A pointer to a position in a file. */
-/* FIXME: This should be using off_t from <sys/types.h>.
- For now, try to avoid breaking stuff by not including <sys/types.h> here.
- This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
- Probably the best long-term answer is to avoid using file_ptr AND off_t
- in this header file, and to handle this in the BFD implementation
- rather than in its interface. */
-/* typedef off_t file_ptr; */
-typedef long int file_ptr;
-
/* Support for different sizes of target format ints and addresses.
If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be
set to 1 above. Otherwise, if gcc is being used, this code will
@@ -183,7 +177,22 @@ typedef unsigned long bfd_size_type;
#endif /* not BFD64 */
+/* A pointer to a position in a file. */
+/* FIXME: This should be using off_t from <sys/types.h>.
+ For now, try to avoid breaking stuff by not including <sys/types.h> here.
+ This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
+ Probably the best long-term answer is to avoid using file_ptr AND off_t
+ in this header file, and to handle this in the BFD implementation
+ rather than in its interface. */
+/* typedef off_t file_ptr; */
+typedef bfd_signed_vma file_ptr;
+typedef bfd_vma ufile_ptr;
+
+extern void bfd_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
+extern void bfd_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
+
#define printf_vma(x) fprintf_vma(stdout,x)
+#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
typedef unsigned int flagword; /* 32 bits of flags */
typedef unsigned char bfd_byte;
@@ -289,7 +298,10 @@ typedef struct carsym {
Perhaps just a forward definition would do? */
struct orl { /* output ranlib */
char **name; /* symbol name */
- file_ptr pos; /* bfd* or file position */
+ union {
+ file_ptr pos;
+ bfd *abfd;
+ } u; /* bfd* or file position */
int namidx; /* index into string table */
};
@@ -298,7 +310,7 @@ typedef struct lineno_cache_entry {
unsigned int line_number; /* Linenumber from start of function*/
union {
struct symbol_cache_entry *sym; /* Function name */
- unsigned long offset; /* Offset into section */
+ bfd_vma offset; /* Offset into section */
} u;
} alent;
@@ -341,11 +353,11 @@ typedef struct _symbol_info
{
symvalue value;
char type;
- CONST char *name; /* Symbol name. */
+ const char *name; /* Symbol name. */
unsigned char stab_type; /* Stab type. */
char stab_other; /* Stab other. */
short stab_desc; /* Stab desc. */
- CONST char *stab_name; /* String for stab type. */
+ const char *stab_name; /* String for stab type. */
} symbol_info;
/* Get the name of a stabs type code. */
@@ -438,47 +450,39 @@ extern void bfd_hash_traverse PARAMS ((struct bfd_hash_table *,
boolean (*) (struct bfd_hash_entry *,
PTR),
PTR info));
-
-/* Semi-portable string concatenation in cpp.
- The CAT4 hack is to avoid a problem with some strict ANSI C preprocessors.
- The problem is, "32_" is not a valid preprocessing token, and we don't
- want extra underscores (e.g., "nlm_32_"). The XCAT2 macro will cause the
- inner CAT macros to be evaluated first, producing still-valid pp-tokens.
- Then the final concatenation can be done. (Sigh.) */
-#ifndef CAT
-#ifdef SABER
-#define CAT(a,b) a##b
-#define CAT3(a,b,c) a##b##c
-#define CAT4(a,b,c,d) a##b##c##d
-#else
-#if defined(__STDC__) || defined(ALMOST_STDC)
-#define CAT(a,b) a##b
-#define CAT3(a,b,c) a##b##c
-#define XCAT2(a,b) CAT(a,b)
-#define CAT4(a,b,c,d) XCAT2(CAT(a,b),CAT(c,d))
-#else
-#define CAT(a,b) a/**/b
-#define CAT3(a,b,c) a/**/b/**/c
-#define CAT4(a,b,c,d) a/**/b/**/c/**/d
-#endif
-#endif
-#endif
#define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table
-
+
/* User program access to BFD facilities */
/* Direct I/O routines, for programs which know more about the object
file than BFD does. Use higher level routines if possible. */
-extern bfd_size_type bfd_read
- PARAMS ((PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd));
-extern bfd_size_type bfd_write
- PARAMS ((const PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd));
-extern int bfd_seek PARAMS ((bfd *abfd, file_ptr fp, int direction));
-extern long bfd_tell PARAMS ((bfd *abfd));
-extern int bfd_flush PARAMS ((bfd *abfd));
-extern int bfd_stat PARAMS ((bfd *abfd, struct stat *));
+extern bfd_size_type bfd_bread PARAMS ((PTR, bfd_size_type, bfd *));
+extern bfd_size_type bfd_bwrite PARAMS ((const PTR, bfd_size_type, bfd *));
+extern int bfd_seek PARAMS ((bfd *, file_ptr, int));
+extern ufile_ptr bfd_tell PARAMS ((bfd *));
+extern int bfd_flush PARAMS ((bfd *));
+extern int bfd_stat PARAMS ((bfd *, struct stat *));
+
+/* Deprecated old routines. */
+#if __GNUC__
+#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \
+ (warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__), \
+ bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
+#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \
+ (warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__), \
+ bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
+#else
+#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \
+ (warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \
+ bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
+#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \
+ (warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\
+ bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
+#endif
+extern void warn_deprecated
+ PARAMS ((const char *, const char *, int, const char *));
/* Cast from const char * to char * so that caller can assign to
a char * without a warning. */
@@ -514,6 +518,9 @@ extern int bfd_stat PARAMS ((bfd *abfd, struct stat *));
#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean) (bool)), true)
+extern boolean bfd_cache_close PARAMS ((bfd *abfd));
+/* NB: This declaration should match the autogenerated one in libbfd.h. */
+
extern boolean bfd_record_phdr
PARAMS ((bfd *, unsigned long, boolean, flagword, boolean, bfd_vma,
boolean, boolean, unsigned int, struct sec **));
@@ -622,11 +629,11 @@ extern struct bfd_link_needed_list *bfd_elf_get_needed_list
extern boolean bfd_elf_get_bfd_needed_list
PARAMS ((bfd *, struct bfd_link_needed_list **));
extern boolean bfd_elf32_size_dynamic_sections
- PARAMS ((bfd *, const char *, const char *, boolean, const char *,
+ PARAMS ((bfd *, const char *, const char *, const char *,
const char * const *, struct bfd_link_info *, struct sec **,
struct bfd_elf_version_tree *));
extern boolean bfd_elf64_size_dynamic_sections
- PARAMS ((bfd *, const char *, const char *, boolean, const char *,
+ PARAMS ((bfd *, const char *, const char *, const char *,
const char * const *, struct bfd_link_info *, struct sec **,
struct bfd_elf_version_tree *));
extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
@@ -634,6 +641,10 @@ extern void bfd_elf_set_dt_needed_soname PARAMS ((bfd *, const char *));
extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_elf32_discard_info
+ PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean bfd_elf64_discard_info
+ PARAMS ((bfd *, struct bfd_link_info *));
/* Return an upper bound on the number of bytes required to store a
copy of ABFD's program header table entries. Return -1 if an error
@@ -708,10 +719,9 @@ extern boolean bfd_xcoff_link_record_set
bfd_size_type));
extern boolean bfd_xcoff_import_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
- bfd_vma, const char *, const char *, const char *));
+ bfd_vma, const char *, const char *, const char *, unsigned int));
extern boolean bfd_xcoff_export_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
- boolean));
+ PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *));
extern boolean bfd_xcoff_link_count_reloc
PARAMS ((bfd *, struct bfd_link_info *, const char *));
extern boolean bfd_xcoff_record_link_assignment
@@ -720,6 +730,8 @@ extern boolean bfd_xcoff_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *,
unsigned long, unsigned long, unsigned long, boolean,
int, boolean, boolean, struct sec **));
+extern boolean bfd_xcoff_link_generate_rtinit
+ PARAMS ((bfd *, const char *, const char *));
/* Externally visible COFF routines. */
@@ -783,16 +795,16 @@ void
bfd_init PARAMS ((void));
bfd *
-bfd_openr PARAMS ((CONST char *filename, CONST char *target));
+bfd_openr PARAMS ((const char *filename, const char *target));
bfd *
-bfd_fdopenr PARAMS ((CONST char *filename, CONST char *target, int fd));
+bfd_fdopenr PARAMS ((const char *filename, const char *target, int fd));
bfd *
bfd_openstreamr PARAMS ((const char *, const char *, PTR));
bfd *
-bfd_openw PARAMS ((CONST char *filename, CONST char *target));
+bfd_openw PARAMS ((const char *filename, const char *target));
boolean
bfd_close PARAMS ((bfd *abfd));
@@ -801,7 +813,7 @@ boolean
bfd_close_all_done PARAMS ((bfd *));
bfd *
-bfd_create PARAMS ((CONST char *filename, bfd *templ));
+bfd_create PARAMS ((const char *filename, bfd *templ));
boolean
bfd_make_writable PARAMS ((bfd *abfd));
@@ -817,9 +829,9 @@ bfd_make_readable PARAMS ((bfd *abfd));
#define bfd_put_signed_8 \
bfd_put_8
#define bfd_get_8(abfd, ptr) \
- (*(unsigned char *) (ptr))
+ (*(unsigned char *) (ptr) & 0xff)
#define bfd_get_signed_8(abfd, ptr) \
- ((*(unsigned char *) (ptr) ^ 0x80) - 0x80)
+ (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
#define bfd_put_16(abfd, val, ptr) \
BFD_SEND(abfd, bfd_putx16, ((val),(ptr)))
@@ -849,14 +861,14 @@ bfd_make_readable PARAMS ((bfd *abfd));
BFD_SEND(abfd, bfd_getx_signed_64, (ptr))
#define bfd_get(bits, abfd, ptr) \
- ((bits) == 8 ? bfd_get_8 (abfd, ptr) \
+ ( (bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \
: (bits) == 16 ? bfd_get_16 (abfd, ptr) \
: (bits) == 32 ? bfd_get_32 (abfd, ptr) \
: (bits) == 64 ? bfd_get_64 (abfd, ptr) \
: (abort (), (bfd_vma) - 1))
#define bfd_put(bits, abfd, val, ptr) \
- ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \
+ ( (bits) == 8 ? bfd_put_8 (abfd, val, ptr) \
: (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \
: (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \
: (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
@@ -866,40 +878,88 @@ bfd_make_readable PARAMS ((bfd *abfd));
/* Byte swapping macros for file header data. */
#define bfd_h_put_8(abfd, val, ptr) \
- bfd_put_8 (abfd, val, ptr)
+ bfd_put_8 (abfd, val, ptr)
#define bfd_h_put_signed_8(abfd, val, ptr) \
- bfd_put_8 (abfd, val, ptr)
+ bfd_put_8 (abfd, val, ptr)
#define bfd_h_get_8(abfd, ptr) \
- bfd_get_8 (abfd, ptr)
+ bfd_get_8 (abfd, ptr)
#define bfd_h_get_signed_8(abfd, ptr) \
- bfd_get_signed_8 (abfd, ptr)
+ bfd_get_signed_8 (abfd, ptr)
#define bfd_h_put_16(abfd, val, ptr) \
- BFD_SEND(abfd, bfd_h_putx16,(val,ptr))
+ BFD_SEND (abfd, bfd_h_putx16, (val, ptr))
#define bfd_h_put_signed_16 \
- bfd_h_put_16
+ bfd_h_put_16
#define bfd_h_get_16(abfd, ptr) \
- BFD_SEND(abfd, bfd_h_getx16,(ptr))
+ BFD_SEND (abfd, bfd_h_getx16, (ptr))
#define bfd_h_get_signed_16(abfd, ptr) \
- BFD_SEND(abfd, bfd_h_getx_signed_16, (ptr))
+ BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr))
#define bfd_h_put_32(abfd, val, ptr) \
- BFD_SEND(abfd, bfd_h_putx32,(val,ptr))
+ BFD_SEND (abfd, bfd_h_putx32, (val, ptr))
#define bfd_h_put_signed_32 \
- bfd_h_put_32
+ bfd_h_put_32
#define bfd_h_get_32(abfd, ptr) \
- BFD_SEND(abfd, bfd_h_getx32,(ptr))
+ BFD_SEND (abfd, bfd_h_getx32, (ptr))
#define bfd_h_get_signed_32(abfd, ptr) \
- BFD_SEND(abfd, bfd_h_getx_signed_32, (ptr))
+ BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr))
#define bfd_h_put_64(abfd, val, ptr) \
- BFD_SEND(abfd, bfd_h_putx64,(val, ptr))
+ BFD_SEND (abfd, bfd_h_putx64, (val, ptr))
#define bfd_h_put_signed_64 \
- bfd_h_put_64
+ bfd_h_put_64
#define bfd_h_get_64(abfd, ptr) \
- BFD_SEND(abfd, bfd_h_getx64,(ptr))
+ BFD_SEND (abfd, bfd_h_getx64, (ptr))
#define bfd_h_get_signed_64(abfd, ptr) \
- BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr))
+ BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))
+
+/* Refinements on the above, which should eventually go away. Save
+ cluttering the source with (bfd_vma) and (bfd_byte *) casts. */
+
+#define H_PUT_64(abfd, val, where) \
+ bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_32(abfd, val, where) \
+ bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_16(abfd, val, where) \
+ bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_8 bfd_h_put_8
+
+#define H_PUT_S64(abfd, val, where) \
+ bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_S32(abfd, val, where) \
+ bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_S16(abfd, val, where) \
+ bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_S8 bfd_h_put_signed_8
+
+#define H_GET_64(abfd, where) \
+ bfd_h_get_64 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_32(abfd, where) \
+ bfd_h_get_32 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_16(abfd, where) \
+ bfd_h_get_16 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_8 bfd_h_get_8
+
+#define H_GET_S64(abfd, where) \
+ bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_S32(abfd, where) \
+ bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_S16(abfd, where) \
+ bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_S8 bfd_h_get_signed_8
+
/* This structure is used for a comdat section, as in PE. A comdat
section is associated with a particular symbol. When the linker
@@ -929,7 +989,7 @@ typedef struct sec
int id;
- /* Which section is it; 0..nth. */
+ /* Which section in the bfd; 0..n-1 as sections are created in a bfd. */
int index;
@@ -957,9 +1017,11 @@ typedef struct sec
some relocation information too. */
#define SEC_RELOC 0x004
-#if 0 /* Obsolete ? */
-#define SEC_BALIGN 0x008
-#endif
+ /* ELF reserves 4 processor specific bits and 8 operating system
+ specific bits in sh_flags; at present we can get away with just
+ one in communicating between the assembler and BFD, but this
+ isn't a good long-term solution. */
+#define SEC_ARCH_BIT_0 0x008
/* A signal to the OS that the section contains read only data. */
#define SEC_READONLY 0x010
@@ -1042,9 +1104,10 @@ typedef struct sec
objects are to be further relocated. */
#define SEC_EXCLUDE 0x40000
- /* The contents of this section are to be sorted by the
- based on the address specified in the associated symbol
- table. */
+ /* The contents of this section are to be sorted based on the sum of
+ the symbol and addend values specified by the associated relocation
+ entries. Entries without associated relocation entries will be
+ appended to the end of the section in an unspecified order. */
#define SEC_SORT_ENTRIES 0x80000
/* When linking, duplicate sections of the same name should be
@@ -1102,6 +1165,18 @@ typedef struct sec
references found to any symbol in the section. */
#define SEC_CLINK 0x10000000
+ /* Attempt to merge identical entities in the section.
+ Entity size is given in the entsize field. */
+#define SEC_MERGE 0x20000000
+
+ /* If given with SEC_MERGE, entities to merge are zero terminated
+ strings where entsize specifies character size instead of fixed
+ size entries. */
+#define SEC_STRINGS 0x40000000
+
+ /* This section contains data about section groups. */
+#define SEC_GROUP 0x80000000
+
/* End of section flags. */
/* Some internal packed boolean fields. */
@@ -1116,13 +1191,14 @@ typedef struct sec
unsigned int linker_mark : 1;
/* Another mark flag used by some of the linker backends. Set for
- output sections that have a input section. */
+ output sections that have an input section. */
unsigned int linker_has_input : 1;
/* A mark flag used by some linker backends for garbage collection. */
unsigned int gc_mark : 1;
- /* Used by the ELF code to mark sections which have been allocated to segments. */
+ /* Used by the ELF code to mark sections which have been allocated
+ to segments. */
unsigned int segment_mark : 1;
/* End of internal packed boolean fields. */
@@ -1218,14 +1294,14 @@ typedef struct sec
unsigned int lineno_count;
+ /* Entity size for merging purposes. */
+
+ unsigned int entsize;
+
/* Optional information about a COMDAT entry; NULL if not COMDAT. */
struct bfd_comdat_info *comdat;
- /* Points to the kept section if this section is a link-once section,
- and is discarded. */
- struct sec *kept_section;
-
/* When a section is being output, this value changes as more
linenumbers are written out. */
@@ -1280,6 +1356,12 @@ extern const asection bfd_ind_section;
#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
+#define bfd_is_const_section(SEC) \
+ ( ((SEC) == bfd_abs_section_ptr) \
+ || ((SEC) == bfd_und_section_ptr) \
+ || ((SEC) == bfd_com_section_ptr) \
+ || ((SEC) == bfd_ind_section_ptr))
+
extern const struct symbol_cache_entry * const bfd_abs_symbol;
extern const struct symbol_cache_entry * const bfd_com_symbol;
extern const struct symbol_cache_entry * const bfd_und_symbol;
@@ -1290,6 +1372,35 @@ extern const struct symbol_cache_entry * const bfd_ind_symbol;
#define bfd_get_section_size_after_reloc(section) \
((section)->reloc_done ? (section)->_cooked_size \
: (abort (), (bfd_size_type) 1))
+
+/* Macros to handle insertion and deletion of a bfd's sections. These
+ only handle the list pointers, ie. do not adjust section_count,
+ target_index etc. */
+#define bfd_section_list_remove(ABFD, PS) \
+ do \
+ { \
+ asection **_ps = PS; \
+ asection *_s = *_ps; \
+ *_ps = _s->next; \
+ if (_s->next == NULL) \
+ (ABFD)->section_tail = _ps; \
+ } \
+ while (0)
+#define bfd_section_list_insert(ABFD, PS, S) \
+ do \
+ { \
+ asection **_ps = PS; \
+ asection *_s = S; \
+ _s->next = *_ps; \
+ *_ps = _s; \
+ if (_s->next == NULL) \
+ (ABFD)->section_tail = &_s->next; \
+ } \
+ while (0)
+
+void
+bfd_section_list_clear PARAMS ((bfd *));
+
asection *
bfd_get_section_by_name PARAMS ((bfd *abfd, const char *name));
@@ -1321,18 +1432,18 @@ boolean
bfd_set_section_size PARAMS ((bfd *abfd, asection *sec, bfd_size_type val));
boolean
-bfd_set_section_contents PARAMS ((bfd *abfd,
- asection *section,
- PTR data,
- file_ptr offset,
+bfd_set_section_contents PARAMS ((bfd *abfd, asection *section,
+ PTR data, file_ptr offset,
bfd_size_type count));
boolean
-bfd_get_section_contents PARAMS ((bfd *abfd, asection *section, PTR location,
- file_ptr offset, bfd_size_type count));
+bfd_get_section_contents PARAMS ((bfd *abfd, asection *section,
+ PTR location, file_ptr offset,
+ bfd_size_type count));
boolean
-bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec, bfd *obfd, asection *osec));
+bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec,
+ bfd *obfd, asection *osec));
#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
BFD_SEND (obfd, _bfd_copy_private_section_data, \
@@ -1410,11 +1521,10 @@ enum bfd_architecture
#define bfd_mach_mips10000 10000
#define bfd_mach_mips12000 12000
#define bfd_mach_mips16 16
-#define bfd_mach_mips32 32
-#define bfd_mach_mips32_4k 3204113 /* 32, 04, octal 'K' */
#define bfd_mach_mips5 5
-#define bfd_mach_mips64 64
#define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */
+#define bfd_mach_mipsisa32 32
+#define bfd_mach_mipsisa64 64
bfd_arch_i386, /* Intel 386 */
#define bfd_mach_i386_i386 0
#define bfd_mach_i386_i8086 1
@@ -1434,6 +1544,7 @@ enum bfd_architecture
#define bfd_mach_h8300 1
#define bfd_mach_h8300h 2
#define bfd_mach_h8300s 3
+ bfd_arch_pdp11, /* DEC PDP-11 */
bfd_arch_powerpc, /* PowerPC */
#define bfd_mach_ppc 0
#define bfd_mach_ppc_403 403
@@ -1527,6 +1638,13 @@ enum bfd_architecture
#define bfd_mach_avr4 4
#define bfd_mach_avr5 5
bfd_arch_cris, /* Axis CRIS */
+ bfd_arch_s390, /* IBM s390 */
+#define bfd_mach_s390_esa 0
+#define bfd_mach_s390_esame 1
+ bfd_arch_openrisc, /* OpenRISC */
+ bfd_arch_mmix, /* Donald Knuth's educational processor */
+ bfd_arch_xstormy16,
+#define bfd_mach_xstormy16 0
bfd_arch_last
};
@@ -1599,31 +1717,31 @@ bfd_arch_mach_octets_per_byte PARAMS ((enum bfd_architecture arch,
typedef enum bfd_reloc_status
{
- /* No errors detected */
+ /* No errors detected */
bfd_reloc_ok,
- /* The relocation was performed, but there was an overflow. */
+ /* The relocation was performed, but there was an overflow. */
bfd_reloc_overflow,
- /* The address to relocate was not within the section supplied. */
+ /* The address to relocate was not within the section supplied. */
bfd_reloc_outofrange,
- /* Used by special functions */
+ /* Used by special functions */
bfd_reloc_continue,
- /* Unsupported relocation size requested. */
+ /* Unsupported relocation size requested. */
bfd_reloc_notsupported,
- /* Unused */
+ /* Unused */
bfd_reloc_other,
- /* The symbol to relocate against was undefined. */
+ /* The symbol to relocate against was undefined. */
bfd_reloc_undefined,
- /* The relocation was performed, but may not be ok - presently
- generated only when linking i960 coff files with i960 b.out
- symbols. If this type is returned, the error_message argument
- to bfd_perform_relocation will be set. */
+ /* The relocation was performed, but may not be ok - presently
+ generated only when linking i960 coff files with i960 b.out
+ symbols. If this type is returned, the error_message argument
+ to bfd_perform_relocation will be set. */
bfd_reloc_dangerous
}
bfd_reloc_status_type;
@@ -1631,155 +1749,156 @@ typedef enum bfd_reloc_status
typedef struct reloc_cache_entry
{
- /* A pointer into the canonical table of pointers */
+ /* A pointer into the canonical table of pointers */
struct symbol_cache_entry **sym_ptr_ptr;
- /* offset in section */
+ /* offset in section */
bfd_size_type address;
- /* addend for relocation value */
+ /* addend for relocation value */
bfd_vma addend;
- /* Pointer to how to perform the required relocation */
+ /* Pointer to how to perform the required relocation */
reloc_howto_type *howto;
} arelent;
enum complain_overflow
{
- /* Do not complain on overflow. */
+ /* Do not complain on overflow. */
complain_overflow_dont,
- /* Complain if the bitfield overflows, whether it is considered
- as signed or unsigned. */
+ /* Complain if the bitfield overflows, whether it is considered
+ as signed or unsigned. */
complain_overflow_bitfield,
- /* Complain if the value overflows when considered as signed
- number. */
+ /* Complain if the value overflows when considered as signed
+ number. */
complain_overflow_signed,
- /* Complain if the value overflows when considered as an
- unsigned number. */
+ /* Complain if the value overflows when considered as an
+ unsigned number. */
complain_overflow_unsigned
};
struct reloc_howto_struct
{
- /* The type field has mainly a documentary use - the back end can
- do what it wants with it, though normally the back end's
- external idea of what a reloc number is stored
- in this field. For example, a PC relative word relocation
- in a coff environment has the type 023 - because that's
- what the outside world calls a R_PCRWORD reloc. */
+ /* The type field has mainly a documentary use - the back end can
+ do what it wants with it, though normally the back end's
+ external idea of what a reloc number is stored
+ in this field. For example, a PC relative word relocation
+ in a coff environment has the type 023 - because that's
+ what the outside world calls a R_PCRWORD reloc. */
unsigned int type;
- /* The value the final relocation is shifted right by. This drops
- unwanted data from the relocation. */
+ /* The value the final relocation is shifted right by. This drops
+ unwanted data from the relocation. */
unsigned int rightshift;
- /* The size of the item to be relocated. This is *not* a
- power-of-two measure. To get the number of bytes operated
- on by a type of relocation, use bfd_get_reloc_size. */
+ /* The size of the item to be relocated. This is *not* a
+ power-of-two measure. To get the number of bytes operated
+ on by a type of relocation, use bfd_get_reloc_size. */
int size;
- /* The number of bits in the item to be relocated. This is used
- when doing overflow checking. */
+ /* The number of bits in the item to be relocated. This is used
+ when doing overflow checking. */
unsigned int bitsize;
- /* Notes that the relocation is relative to the location in the
- data section of the addend. The relocation function will
- subtract from the relocation value the address of the location
- being relocated. */
+ /* Notes that the relocation is relative to the location in the
+ data section of the addend. The relocation function will
+ subtract from the relocation value the address of the location
+ being relocated. */
boolean pc_relative;
- /* The bit position of the reloc value in the destination.
- The relocated value is left shifted by this amount. */
+ /* The bit position of the reloc value in the destination.
+ The relocated value is left shifted by this amount. */
unsigned int bitpos;
- /* What type of overflow error should be checked for when
- relocating. */
+ /* What type of overflow error should be checked for when
+ relocating. */
enum complain_overflow complain_on_overflow;
- /* If this field is non null, then the supplied function is
- called rather than the normal function. This allows really
- strange relocation methods to be accomodated (e.g., i960 callj
- instructions). */
+ /* If this field is non null, then the supplied function is
+ called rather than the normal function. This allows really
+ strange relocation methods to be accomodated (e.g., i960 callj
+ instructions). */
bfd_reloc_status_type (*special_function)
- PARAMS ((bfd *abfd,
- arelent *reloc_entry,
- struct symbol_cache_entry *symbol,
- PTR data,
- asection *input_section,
- bfd *output_bfd,
- char **error_message));
-
- /* The textual name of the relocation type. */
+ PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *,
+ bfd *, char **));
+
+ /* The textual name of the relocation type. */
char *name;
- /* Some formats record a relocation addend in the section contents
- rather than with the relocation. For ELF formats this is the
- distinction between USE_REL and USE_RELA (though the code checks
- for USE_REL == 1/0). The value of this field is TRUE if the
- addend is recorded with the section contents; when performing a
- partial link (ld -r) the section contents (the data) will be
- modified. The value of this field is FALSE if addends are
- recorded with the relocation (in arelent.addend); when performing
- a partial link the relocation will be modified.
- All relocations for all ELF USE_RELA targets should set this field
- to FALSE (values of TRUE should be looked on with suspicion).
- However, the converse is not true: not all relocations of all ELF
- USE_REL targets set this field to TRUE. Why this is so is peculiar
- to each particular target. For relocs that aren't used in partial
- links (e.g. GOT stuff) it doesn't matter what this is set to. */
+ /* Some formats record a relocation addend in the section contents
+ rather than with the relocation. For ELF formats this is the
+ distinction between USE_REL and USE_RELA (though the code checks
+ for USE_REL == 1/0). The value of this field is TRUE if the
+ addend is recorded with the section contents; when performing a
+ partial link (ld -r) the section contents (the data) will be
+ modified. The value of this field is FALSE if addends are
+ recorded with the relocation (in arelent.addend); when performing
+ a partial link the relocation will be modified.
+ All relocations for all ELF USE_RELA targets should set this field
+ to FALSE (values of TRUE should be looked on with suspicion).
+ However, the converse is not true: not all relocations of all ELF
+ USE_REL targets set this field to TRUE. Why this is so is peculiar
+ to each particular target. For relocs that aren't used in partial
+ links (e.g. GOT stuff) it doesn't matter what this is set to. */
boolean partial_inplace;
- /* The src_mask selects which parts of the read in data
- are to be used in the relocation sum. E.g., if this was an 8 bit
- byte of data which we read and relocated, this would be
- 0x000000ff. When we have relocs which have an addend, such as
- sun4 extended relocs, the value in the offset part of a
- relocating field is garbage so we never use it. In this case
- the mask would be 0x00000000. */
+ /* The src_mask selects which parts of the read in data
+ are to be used in the relocation sum. E.g., if this was an 8 bit
+ byte of data which we read and relocated, this would be
+ 0x000000ff. When we have relocs which have an addend, such as
+ sun4 extended relocs, the value in the offset part of a
+ relocating field is garbage so we never use it. In this case
+ the mask would be 0x00000000. */
bfd_vma src_mask;
- /* The dst_mask selects which parts of the instruction are replaced
- into the instruction. In most cases src_mask == dst_mask,
- except in the above special case, where dst_mask would be
- 0x000000ff, and src_mask would be 0x00000000. */
+ /* The dst_mask selects which parts of the instruction are replaced
+ into the instruction. In most cases src_mask == dst_mask,
+ except in the above special case, where dst_mask would be
+ 0x000000ff, and src_mask would be 0x00000000. */
bfd_vma dst_mask;
- /* When some formats create PC relative instructions, they leave
- the value of the pc of the place being relocated in the offset
- slot of the instruction, so that a PC relative relocation can
- be made just by adding in an ordinary offset (e.g., sun3 a.out).
- Some formats leave the displacement part of an instruction
- empty (e.g., m88k bcs); this flag signals the fact.*/
+ /* When some formats create PC relative instructions, they leave
+ the value of the pc of the place being relocated in the offset
+ slot of the instruction, so that a PC relative relocation can
+ be made just by adding in an ordinary offset (e.g., sun3 a.out).
+ Some formats leave the displacement part of an instruction
+ empty (e.g., m88k bcs); this flag signals the fact. */
boolean pcrel_offset;
-
};
-#define HOWTO(C, R,S,B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
- {(unsigned)C,R,S,B, P, BI, O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC}
-#define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,complain_overflow_dont,FUNCTION, NAME,false,0,0,IN)
+#define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
+ { (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC }
+#define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \
+ HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \
+ NAME, false, 0, 0, IN)
#define EMPTY_HOWTO(C) \
- HOWTO((C),0,0,0,false,0,complain_overflow_dont,NULL,NULL,false,0,0,false)
-
-#define HOWTO_PREPARE(relocation, symbol) \
- { \
- if (symbol != (asymbol *)NULL) { \
- if (bfd_is_com_section (symbol->section)) { \
- relocation = 0; \
- } \
- else { \
- relocation = symbol->value; \
- } \
- } \
-}
+ HOWTO ((C), 0, 0, 0, false, 0, complain_overflow_dont, NULL, \
+ NULL, false, 0, 0, false)
+
+#define HOWTO_PREPARE(relocation, symbol) \
+ { \
+ if (symbol != (asymbol *) NULL) \
+ { \
+ if (bfd_is_com_section (symbol->section)) \
+ { \
+ relocation = 0; \
+ } \
+ else \
+ { \
+ relocation = symbol->value; \
+ } \
+ } \
+ }
unsigned int
bfd_get_reloc_size PARAMS ((reloc_howto_type *));
-typedef struct relent_chain {
+typedef struct relent_chain
+{
arelent relent;
- struct relent_chain *next;
+ struct relent_chain *next;
} arelent_chain;
bfd_reloc_status_type
bfd_check_overflow PARAMS ((enum complain_overflow how,
@@ -1838,10 +1957,12 @@ The 24-bit relocation is used in some Intel 960 configurations. */
BFD_RELOC_HI16_GOTOFF,
BFD_RELOC_HI16_S_GOTOFF,
BFD_RELOC_8_GOTOFF,
+ BFD_RELOC_64_PLT_PCREL,
BFD_RELOC_32_PLT_PCREL,
BFD_RELOC_24_PLT_PCREL,
BFD_RELOC_16_PLT_PCREL,
BFD_RELOC_8_PLT_PCREL,
+ BFD_RELOC_64_PLTOFF,
BFD_RELOC_32_PLTOFF,
BFD_RELOC_16_PLTOFF,
BFD_RELOC_LO16_PLTOFF,
@@ -1932,6 +2053,7 @@ relocation types already defined. */
BFD_RELOC_SPARC_6,
BFD_RELOC_SPARC_5,
#define BFD_RELOC_SPARC_DISP64 BFD_RELOC_64_PCREL
+ BFD_RELOC_SPARC_PLT32,
BFD_RELOC_SPARC_PLT64,
BFD_RELOC_SPARC_HIX22,
BFD_RELOC_SPARC_LOX10,
@@ -1984,24 +2106,11 @@ as the absolute section symbol), and the "addend" indicates the type
of instruction using the register:
1 - "memory" fmt insn
2 - byte-manipulation (byte offset reg)
-3 - jsr (target of branch)
-
-The GNU linker currently doesn't do any of this optimizing. */
+3 - jsr (target of branch) */
BFD_RELOC_ALPHA_LITERAL,
BFD_RELOC_ALPHA_ELF_LITERAL,
BFD_RELOC_ALPHA_LITUSE,
-/* The BFD_RELOC_ALPHA_USER_* relocations are used by the assembler to
-process the explicit !<reloc>!sequence relocations, and are mapped
-into the normal relocations at the end of processing. */
- BFD_RELOC_ALPHA_USER_LITERAL,
- BFD_RELOC_ALPHA_USER_LITUSE_BASE,
- BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF,
- BFD_RELOC_ALPHA_USER_LITUSE_JSR,
- BFD_RELOC_ALPHA_USER_GPDISP,
- BFD_RELOC_ALPHA_USER_GPRELHIGH,
- BFD_RELOC_ALPHA_USER_GPRELLOW,
-
/* The HINT relocation indicates a value that should be filled into the
"hint" field of a jmp/jsr/ret instruction, for possible branch-
prediction logic which may be provided on some processors. */
@@ -2015,6 +2124,11 @@ which is filled by the linker. */
which is filled by the linker. */
BFD_RELOC_ALPHA_CODEADDR,
+/* The GPREL_HI/LO relocations together form a 32-bit offset from the
+GP register. */
+ BFD_RELOC_ALPHA_GPREL_HI16,
+ BFD_RELOC_ALPHA_GPREL_LO16,
+
/* Bits 27..2 of the relocation address shifted right 2 bits;
simple reloc otherwise. */
BFD_RELOC_MIPS_JMP,
@@ -2043,16 +2157,12 @@ to compensate for the borrow when the low bits are added. */
/* Like BFD_RELOC_LO16, but PC relative. */
BFD_RELOC_PCREL_LO16,
-/* Relocation relative to the global pointer. */
-#define BFD_RELOC_MIPS_GPREL BFD_RELOC_GPREL16
-
/* Relocation against a MIPS literal section. */
BFD_RELOC_MIPS_LITERAL,
/* MIPS ELF relocations. */
BFD_RELOC_MIPS_GOT16,
BFD_RELOC_MIPS_CALL16,
-#define BFD_RELOC_MIPS_GPREL32 BFD_RELOC_GPREL32
BFD_RELOC_MIPS_GOT_HI16,
BFD_RELOC_MIPS_GOT_LO16,
BFD_RELOC_MIPS_CALL_HI16,
@@ -2108,6 +2218,10 @@ to compensate for the borrow when the low bits are added. */
BFD_RELOC_NS32K_DISP_16_PCREL,
BFD_RELOC_NS32K_DISP_32_PCREL,
+/* PDP11 relocations */
+ BFD_RELOC_PDP11_DISP_8_PCREL,
+ BFD_RELOC_PDP11_DISP_6_PCREL,
+
/* Picojava relocs. Not all of these appear in object files. */
BFD_RELOC_PJ_CODE_HI16,
BFD_RELOC_PJ_CODE_LO16,
@@ -2147,6 +2261,29 @@ to compensate for the borrow when the low bits are added. */
BFD_RELOC_PPC_EMB_RELST_HA,
BFD_RELOC_PPC_EMB_BIT_FLD,
BFD_RELOC_PPC_EMB_RELSDA,
+ BFD_RELOC_PPC64_HIGHER,
+ BFD_RELOC_PPC64_HIGHER_S,
+ BFD_RELOC_PPC64_HIGHEST,
+ BFD_RELOC_PPC64_HIGHEST_S,
+ BFD_RELOC_PPC64_TOC16_LO,
+ BFD_RELOC_PPC64_TOC16_HI,
+ BFD_RELOC_PPC64_TOC16_HA,
+ BFD_RELOC_PPC64_TOC,
+ BFD_RELOC_PPC64_PLTGOT16,
+ BFD_RELOC_PPC64_PLTGOT16_LO,
+ BFD_RELOC_PPC64_PLTGOT16_HI,
+ BFD_RELOC_PPC64_PLTGOT16_HA,
+ BFD_RELOC_PPC64_ADDR16_DS,
+ BFD_RELOC_PPC64_ADDR16_LO_DS,
+ BFD_RELOC_PPC64_GOT16_DS,
+ BFD_RELOC_PPC64_GOT16_LO_DS,
+ BFD_RELOC_PPC64_PLT16_LO_DS,
+ BFD_RELOC_PPC64_SECTOFF_DS,
+ BFD_RELOC_PPC64_SECTOFF_LO_DS,
+ BFD_RELOC_PPC64_TOC16_DS,
+ BFD_RELOC_PPC64_TOC16_LO_DS,
+ BFD_RELOC_PPC64_PLTGOT16_DS,
+ BFD_RELOC_PPC64_PLTGOT16_LO_DS,
/* IBM 370/390 relocations */
BFD_RELOC_I370_D12,
@@ -2470,6 +2607,54 @@ short offset into 11 bits. */
BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2,
BFD_RELOC_MCORE_RVA,
+/* These are relocations for the GETA instruction. */
+ BFD_RELOC_MMIX_GETA,
+ BFD_RELOC_MMIX_GETA_1,
+ BFD_RELOC_MMIX_GETA_2,
+ BFD_RELOC_MMIX_GETA_3,
+
+/* These are relocations for a conditional branch instruction. */
+ BFD_RELOC_MMIX_CBRANCH,
+ BFD_RELOC_MMIX_CBRANCH_J,
+ BFD_RELOC_MMIX_CBRANCH_1,
+ BFD_RELOC_MMIX_CBRANCH_2,
+ BFD_RELOC_MMIX_CBRANCH_3,
+
+/* These are relocations for the PUSHJ instruction. */
+ BFD_RELOC_MMIX_PUSHJ,
+ BFD_RELOC_MMIX_PUSHJ_1,
+ BFD_RELOC_MMIX_PUSHJ_2,
+ BFD_RELOC_MMIX_PUSHJ_3,
+
+/* These are relocations for the JMP instruction. */
+ BFD_RELOC_MMIX_JMP,
+ BFD_RELOC_MMIX_JMP_1,
+ BFD_RELOC_MMIX_JMP_2,
+ BFD_RELOC_MMIX_JMP_3,
+
+/* This is a relocation for a relative address as in a GETA instruction or
+a branch. */
+ BFD_RELOC_MMIX_ADDR19,
+
+/* This is a relocation for a relative address as in a JMP instruction. */
+ BFD_RELOC_MMIX_ADDR27,
+
+/* This is a relocation for an instruction field that may be a general
+register or a value 0..255. */
+ BFD_RELOC_MMIX_REG_OR_BYTE,
+
+/* This is a relocation for an instruction field that may be a general
+register. */
+ BFD_RELOC_MMIX_REG,
+
+/* This is a relocation for two instruction fields holding a register and
+an offset, the equivalent of the relocation. */
+ BFD_RELOC_MMIX_BASE_PLUS_OFFSET,
+
+/* This relocation is an assertion that the expression is not allocated as
+a global register. It does not modify contents. */
+ BFD_RELOC_MMIX_LOCAL,
+
/* This is a 16 bit reloc for the AVR that stores 8 bit pc relative
short offset into 7 bits. */
BFD_RELOC_AVR_7_PCREL,
@@ -2538,6 +2723,57 @@ value of SUBI insn. */
into 22 bits. */
BFD_RELOC_AVR_CALL,
+/* Direct 12 bit. */
+ BFD_RELOC_390_12,
+
+/* 12 bit GOT offset. */
+ BFD_RELOC_390_GOT12,
+
+/* 32 bit PC relative PLT address. */
+ BFD_RELOC_390_PLT32,
+
+/* Copy symbol at runtime. */
+ BFD_RELOC_390_COPY,
+
+/* Create GOT entry. */
+ BFD_RELOC_390_GLOB_DAT,
+
+/* Create PLT entry. */
+ BFD_RELOC_390_JMP_SLOT,
+
+/* Adjust by program base. */
+ BFD_RELOC_390_RELATIVE,
+
+/* 32 bit PC relative offset to GOT. */
+ BFD_RELOC_390_GOTPC,
+
+/* 16 bit GOT offset. */
+ BFD_RELOC_390_GOT16,
+
+/* PC relative 16 bit shifted by 1. */
+ BFD_RELOC_390_PC16DBL,
+
+/* 16 bit PC rel. PLT shifted by 1. */
+ BFD_RELOC_390_PLT16DBL,
+
+/* PC relative 32 bit shifted by 1. */
+ BFD_RELOC_390_PC32DBL,
+
+/* 32 bit PC rel. PLT shifted by 1. */
+ BFD_RELOC_390_PLT32DBL,
+
+/* 32 bit PC rel. GOT shifted by 1. */
+ BFD_RELOC_390_GOTPCDBL,
+
+/* 64 bit GOT offset. */
+ BFD_RELOC_390_GOT64,
+
+/* 64 bit PC relative PLT address. */
+ BFD_RELOC_390_PLT64,
+
+/* 32 bit rel. offset to GOT entry. */
+ BFD_RELOC_390_GOTENT,
+
/* These two relocations are used by the linker to determine which of
the entries in a C++ virtual function table are actually used. When
the --gc-sections option is given, the linker will zero out the entries
@@ -2596,6 +2832,8 @@ this offset in the reloc's section offset. */
BFD_RELOC_IA64_PCREL64LSB,
BFD_RELOC_IA64_LTOFF_FPTR22,
BFD_RELOC_IA64_LTOFF_FPTR64I,
+ BFD_RELOC_IA64_LTOFF_FPTR32MSB,
+ BFD_RELOC_IA64_LTOFF_FPTR32LSB,
BFD_RELOC_IA64_LTOFF_FPTR64MSB,
BFD_RELOC_IA64_LTOFF_FPTR64LSB,
BFD_RELOC_IA64_SEGREL32MSB,
@@ -2644,6 +2882,33 @@ This is the 3 bits of a value. */
BFD_RELOC_CRIS_UNSIGNED_6,
BFD_RELOC_CRIS_UNSIGNED_4,
+/* Relocs used in ELF shared libraries for CRIS. */
+ BFD_RELOC_CRIS_COPY,
+ BFD_RELOC_CRIS_GLOB_DAT,
+ BFD_RELOC_CRIS_JUMP_SLOT,
+ BFD_RELOC_CRIS_RELATIVE,
+
+/* 32-bit offset to symbol-entry within GOT. */
+ BFD_RELOC_CRIS_32_GOT,
+
+/* 16-bit offset to symbol-entry within GOT. */
+ BFD_RELOC_CRIS_16_GOT,
+
+/* 32-bit offset to symbol-entry within GOT, with PLT handling. */
+ BFD_RELOC_CRIS_32_GOTPLT,
+
+/* 16-bit offset to symbol-entry within GOT, with PLT handling. */
+ BFD_RELOC_CRIS_16_GOTPLT,
+
+/* 32-bit offset to symbol, relative to GOT. */
+ BFD_RELOC_CRIS_32_GOTREL,
+
+/* 32-bit offset to symbol with PLT entry, relative to GOT. */
+ BFD_RELOC_CRIS_32_PLT_GOTREL,
+
+/* 32-bit offset to symbol with PLT entry, relative to this relocation. */
+ BFD_RELOC_CRIS_32_PLT_PCREL,
+
/* Intel i860 Relocations. */
BFD_RELOC_860_COPY,
BFD_RELOC_860_GLOB_DAT,
@@ -2677,6 +2942,22 @@ This is the 3 bits of a value. */
BFD_RELOC_860_HIGH,
BFD_RELOC_860_HIGOT,
BFD_RELOC_860_HIGOTOFF,
+
+/* OpenRISC Relocations. */
+ BFD_RELOC_OPENRISC_ABS_26,
+ BFD_RELOC_OPENRISC_REL_26,
+
+/* H8 elf Relocations. */
+ BFD_RELOC_H8_DIR16A8,
+ BFD_RELOC_H8_DIR16R8,
+ BFD_RELOC_H8_DIR24A8,
+ BFD_RELOC_H8_DIR24R8,
+ BFD_RELOC_H8_DIR32A16,
+
+/* Sony Xstormy16 Relocations. */
+ BFD_RELOC_XSTORMY16_REL_12,
+ BFD_RELOC_XSTORMY16_24,
+ BFD_RELOC_XSTORMY16_FPTR16,
BFD_RELOC_UNUSED };
typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
reloc_howto_type *
@@ -2702,7 +2983,7 @@ typedef struct symbol_cache_entry
/* The text of the symbol. The name is left alone, and not copied; the
application may not alter it. */
- CONST char *name;
+ const char *name;
/* The value of the symbol. This really should be a union of a
numeric value with a pointer, since some flags indicate that
@@ -2825,10 +3106,13 @@ boolean
bfd_set_symtab PARAMS ((bfd *abfd, asymbol **location, unsigned int count));
void
-bfd_print_symbol_vandf PARAMS ((PTR file, asymbol *symbol));
+bfd_print_symbol_vandf PARAMS ((bfd *abfd, PTR file, asymbol *symbol));
#define bfd_make_empty_symbol(abfd) \
BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
+asymbol *
+_bfd_generic_make_empty_symbol PARAMS ((bfd *));
+
#define bfd_make_debug_symbol(abfd,ptr,size) \
BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
int
@@ -2849,7 +3133,7 @@ bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymb
struct _bfd
{
/* The filename the application opened the BFD with. */
- CONST char *filename;
+ const char *filename;
/* A pointer to the target jump table. */
const struct bfd_target *xvec;
@@ -2882,7 +3166,7 @@ struct _bfd
/* When a file is closed by the caching routines, BFD retains
state information on the file here: */
- file_ptr where;
+ ufile_ptr where;
/* and here: (``once'' means at least once) */
@@ -2920,14 +3204,20 @@ struct _bfd
anything. I believe that this can become always an add of
origin, with origin set to 0 for non archive files. */
- file_ptr origin;
+ ufile_ptr origin;
/* Remember when output has begun, to stop strange things
from happening. */
boolean output_has_begun;
- /* Pointer to linked list of sections*/
- struct sec *sections;
+ /* A hash table for section names. */
+ struct bfd_hash_table section_htab;
+
+ /* Pointer to linked list of sections. */
+ struct sec *sections;
+
+ /* The place where we add to the section list. */
+ struct sec **section_tail;
/* The number of sections */
unsigned int section_count;
@@ -2979,6 +3269,7 @@ struct _bfd
struct elf_obj_tdata *elf_obj_data;
struct nlm_obj_tdata *nlm_obj_data;
struct bout_data_struct *bout_data;
+ struct mmo_data_struct *mmo_data;
struct sun_core_struct *sun_core_data;
struct sco5_core_struct *sco5_core_data;
struct trad_core_struct *trad_core_data;
@@ -3009,6 +3300,7 @@ typedef enum bfd_error
bfd_error_system_call,
bfd_error_invalid_target,
bfd_error_wrong_format,
+ bfd_error_wrong_object_format,
bfd_error_invalid_operation,
bfd_error_no_memory,
bfd_error_no_symbols,
@@ -3032,11 +3324,11 @@ bfd_get_error PARAMS ((void));
void
bfd_set_error PARAMS ((bfd_error_type error_tag));
-CONST char *
+const char *
bfd_errmsg PARAMS ((bfd_error_type error_tag));
void
-bfd_perror PARAMS ((CONST char *message));
+bfd_perror PARAMS ((const char *message));
typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...));
@@ -3049,6 +3341,9 @@ bfd_set_error_program_name PARAMS ((const char *));
bfd_error_handler_type
bfd_get_error_handler PARAMS ((void));
+const char *
+bfd_archive_filename PARAMS ((bfd *));
+
long
bfd_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect));
@@ -3081,14 +3376,14 @@ bfd_get_mtime PARAMS ((bfd *abfd));
long
bfd_get_size PARAMS ((bfd *abfd));
-int
+unsigned int
bfd_get_gp_size PARAMS ((bfd *abfd));
void
-bfd_set_gp_size PARAMS ((bfd *abfd, int i));
+bfd_set_gp_size PARAMS ((bfd *abfd, unsigned int i));
bfd_vma
-bfd_scan_vma PARAMS ((CONST char *string, CONST char **end, int base));
+bfd_scan_vma PARAMS ((const char *string, const char **end, int base));
boolean
bfd_copy_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
@@ -3140,6 +3435,9 @@ bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
#define bfd_gc_sections(abfd, link_info) \
BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
+#define bfd_merge_sections(abfd, link_info) \
+ BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
+
#define bfd_link_hash_table_create(abfd) \
BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
@@ -3172,6 +3470,9 @@ extern bfd_byte *bfd_get_relocated_section_contents
struct bfd_link_order *, bfd_byte *,
boolean, asymbol **));
+boolean
+bfd_alt_mach_code PARAMS ((bfd *abfd, int index));
+
symindex
bfd_get_next_mapent PARAMS ((bfd *abfd, symindex previous, carsym **sym));
@@ -3181,7 +3482,7 @@ bfd_set_archive_head PARAMS ((bfd *output, bfd *new_head));
bfd *
bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous));
-CONST char *
+const char *
bfd_core_file_failing_command PARAMS ((bfd *abfd));
int
@@ -3228,7 +3529,8 @@ enum bfd_flavour {
bfd_target_versados_flavour,
bfd_target_msdos_flavour,
bfd_target_ovax_flavour,
- bfd_target_evax_flavour
+ bfd_target_evax_flavour,
+ bfd_target_mmo_flavour
};
enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
@@ -3247,237 +3549,232 @@ typedef struct bfd_target
char symbol_leading_char;
char ar_pad_char;
unsigned short ar_max_namelen;
- bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *));
+ bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *));
bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
- void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
- bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *));
+ void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
+ bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *));
bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *));
- void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
- bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *));
+ void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
+ bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *));
bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *));
- void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
- bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *));
+ void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
+ bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *));
bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *));
- void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
- bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *));
+ void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
+ bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *));
bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *));
- void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
- bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *));
+ void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
+ bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *));
bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *));
- void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
+ void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
- boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
- boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
+ boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
+ boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
/* Generic entry points. */
-#define BFD_JUMP_TABLE_GENERIC(NAME)\
-CAT(NAME,_close_and_cleanup),\
-CAT(NAME,_bfd_free_cached_info),\
-CAT(NAME,_new_section_hook),\
-CAT(NAME,_get_section_contents),\
-CAT(NAME,_get_section_contents_in_window)
+#define BFD_JUMP_TABLE_GENERIC(NAME) \
+CONCAT2 (NAME,_close_and_cleanup), \
+CONCAT2 (NAME,_bfd_free_cached_info), \
+CONCAT2 (NAME,_new_section_hook), \
+CONCAT2 (NAME,_get_section_contents), \
+CONCAT2 (NAME,_get_section_contents_in_window)
/* Called when the BFD is being closed to do any necessary cleanup. */
- boolean (*_close_and_cleanup) PARAMS ((bfd *));
+ boolean (*_close_and_cleanup) PARAMS ((bfd *));
/* Ask the BFD to free all cached information. */
- boolean (*_bfd_free_cached_info) PARAMS ((bfd *));
+ boolean (*_bfd_free_cached_info) PARAMS ((bfd *));
/* Called when a new section is created. */
- boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
+ boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
/* Read the contents of a section. */
- boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
- file_ptr, bfd_size_type));
- boolean (*_bfd_get_section_contents_in_window)
- PARAMS ((bfd *, sec_ptr, bfd_window *,
- file_ptr, bfd_size_type));
+ boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
+ file_ptr, bfd_size_type));
+ boolean (*_bfd_get_section_contents_in_window)
+ PARAMS ((bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type));
/* Entry points to copy private data. */
-#define BFD_JUMP_TABLE_COPY(NAME)\
-CAT(NAME,_bfd_copy_private_bfd_data),\
-CAT(NAME,_bfd_merge_private_bfd_data),\
-CAT(NAME,_bfd_copy_private_section_data),\
-CAT(NAME,_bfd_copy_private_symbol_data),\
-CAT(NAME,_bfd_set_private_flags),\
-CAT(NAME,_bfd_print_private_bfd_data)\
+#define BFD_JUMP_TABLE_COPY(NAME) \
+CONCAT2 (NAME,_bfd_copy_private_bfd_data), \
+CONCAT2 (NAME,_bfd_merge_private_bfd_data), \
+CONCAT2 (NAME,_bfd_copy_private_section_data), \
+CONCAT2 (NAME,_bfd_copy_private_symbol_data), \
+CONCAT2 (NAME,_bfd_set_private_flags), \
+CONCAT2 (NAME,_bfd_print_private_bfd_data) \
/* Called to copy BFD general private data from one object file
to another. */
- boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
+ boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
/* Called to merge BFD general private data from one object file
to a common output file when linking. */
- boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
+ boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
/* Called to copy BFD private section data from one object file
to another. */
- boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
- bfd *, sec_ptr));
+ boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
+ bfd *, sec_ptr));
/* Called to copy BFD private symbol data from one symbol
to another. */
- boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
- bfd *, asymbol *));
+ boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
+ bfd *, asymbol *));
/* Called to set private backend flags */
- boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
+ boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
/* Called to print private BFD data */
- boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
+ boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
/* Core file entry points. */
-#define BFD_JUMP_TABLE_CORE(NAME)\
-CAT(NAME,_core_file_failing_command),\
-CAT(NAME,_core_file_failing_signal),\
-CAT(NAME,_core_file_matches_executable_p)
+#define BFD_JUMP_TABLE_CORE(NAME) \
+CONCAT2 (NAME,_core_file_failing_command), \
+CONCAT2 (NAME,_core_file_failing_signal), \
+CONCAT2 (NAME,_core_file_matches_executable_p)
char * (*_core_file_failing_command) PARAMS ((bfd *));
int (*_core_file_failing_signal) PARAMS ((bfd *));
boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
/* Archive entry points. */
-#define BFD_JUMP_TABLE_ARCHIVE(NAME)\
-CAT(NAME,_slurp_armap),\
-CAT(NAME,_slurp_extended_name_table),\
-CAT(NAME,_construct_extended_name_table),\
-CAT(NAME,_truncate_arname),\
-CAT(NAME,_write_armap),\
-CAT(NAME,_read_ar_hdr),\
-CAT(NAME,_openr_next_archived_file),\
-CAT(NAME,_get_elt_at_index),\
-CAT(NAME,_generic_stat_arch_elt),\
-CAT(NAME,_update_armap_timestamp)
+#define BFD_JUMP_TABLE_ARCHIVE(NAME) \
+CONCAT2 (NAME,_slurp_armap), \
+CONCAT2 (NAME,_slurp_extended_name_table), \
+CONCAT2 (NAME,_construct_extended_name_table), \
+CONCAT2 (NAME,_truncate_arname), \
+CONCAT2 (NAME,_write_armap), \
+CONCAT2 (NAME,_read_ar_hdr), \
+CONCAT2 (NAME,_openr_next_archived_file), \
+CONCAT2 (NAME,_get_elt_at_index), \
+CONCAT2 (NAME,_generic_stat_arch_elt), \
+CONCAT2 (NAME,_update_armap_timestamp)
boolean (*_bfd_slurp_armap) PARAMS ((bfd *));
boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
boolean (*_bfd_construct_extended_name_table)
- PARAMS ((bfd *, char **, bfd_size_type *, const char **));
- void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *));
- boolean (*write_armap) PARAMS ((bfd *arch,
- unsigned int elength,
- struct orl *map,
- unsigned int orl_count,
- int stridx));
- PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
- bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
+ PARAMS ((bfd *, char **, bfd_size_type *, const char **));
+ void (*_bfd_truncate_arname) PARAMS ((bfd *, const char *, char *));
+ boolean (*write_armap)
+ PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
+ PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
+ bfd * (*openr_next_archived_file) PARAMS ((bfd *, bfd *));
#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i))
bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex));
int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
/* Entry points used for symbols. */
-#define BFD_JUMP_TABLE_SYMBOLS(NAME)\
-CAT(NAME,_get_symtab_upper_bound),\
-CAT(NAME,_get_symtab),\
-CAT(NAME,_make_empty_symbol),\
-CAT(NAME,_print_symbol),\
-CAT(NAME,_get_symbol_info),\
-CAT(NAME,_bfd_is_local_label_name),\
-CAT(NAME,_get_lineno),\
-CAT(NAME,_find_nearest_line),\
-CAT(NAME,_bfd_make_debug_symbol),\
-CAT(NAME,_read_minisymbols),\
-CAT(NAME,_minisymbol_to_symbol)
- long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
- long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
- struct symbol_cache_entry **));
- struct symbol_cache_entry *
- (*_bfd_make_empty_symbol) PARAMS ((bfd *));
- void (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
- struct symbol_cache_entry *,
- bfd_print_symbol_type));
+#define BFD_JUMP_TABLE_SYMBOLS(NAME) \
+CONCAT2 (NAME,_get_symtab_upper_bound), \
+CONCAT2 (NAME,_get_symtab), \
+CONCAT2 (NAME,_make_empty_symbol), \
+CONCAT2 (NAME,_print_symbol), \
+CONCAT2 (NAME,_get_symbol_info), \
+CONCAT2 (NAME,_bfd_is_local_label_name), \
+CONCAT2 (NAME,_get_lineno), \
+CONCAT2 (NAME,_find_nearest_line), \
+CONCAT2 (NAME,_bfd_make_debug_symbol), \
+CONCAT2 (NAME,_read_minisymbols), \
+CONCAT2 (NAME,_minisymbol_to_symbol)
+ long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
+ long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
+ struct symbol_cache_entry **));
+ struct symbol_cache_entry *
+ (*_bfd_make_empty_symbol) PARAMS ((bfd *));
+ void (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
+ struct symbol_cache_entry *,
+ bfd_print_symbol_type));
#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))
- void (*_bfd_get_symbol_info) PARAMS ((bfd *,
- struct symbol_cache_entry *,
- symbol_info *));
+ void (*_bfd_get_symbol_info) PARAMS ((bfd *,
+ struct symbol_cache_entry *,
+ symbol_info *));
#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e))
- boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *));
+ boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *));
- alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
- boolean (*_bfd_find_nearest_line) PARAMS ((bfd *abfd,
- struct sec *section, struct symbol_cache_entry **symbols,
- bfd_vma offset, CONST char **file, CONST char **func,
- unsigned int *line));
+ alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
+ boolean (*_bfd_find_nearest_line)
+ PARAMS ((bfd *, struct sec *, struct symbol_cache_entry **, bfd_vma,
+ const char **, const char **, unsigned int *));
/* Back-door to allow format-aware applications to create debug symbols
while using BFD for everything else. Currently used by the assembler
when creating COFF files. */
- asymbol * (*_bfd_make_debug_symbol) PARAMS ((
- bfd *abfd,
- void *ptr,
- unsigned long size));
+ asymbol *(*_bfd_make_debug_symbol) PARAMS ((bfd *, void *,
+ unsigned long size));
#define bfd_read_minisymbols(b, d, m, s) \
BFD_SEND (b, _read_minisymbols, (b, d, m, s))
- long (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *,
- unsigned int *));
+ long (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *,
+ unsigned int *));
#define bfd_minisymbol_to_symbol(b, d, m, f) \
BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
asymbol *));
/* Routines for relocs. */
-#define BFD_JUMP_TABLE_RELOCS(NAME)\
-CAT(NAME,_get_reloc_upper_bound),\
-CAT(NAME,_canonicalize_reloc),\
-CAT(NAME,_bfd_reloc_type_lookup)
- long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
- long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
- struct symbol_cache_entry **));
+#define BFD_JUMP_TABLE_RELOCS(NAME) \
+CONCAT2 (NAME,_get_reloc_upper_bound), \
+CONCAT2 (NAME,_canonicalize_reloc), \
+CONCAT2 (NAME,_bfd_reloc_type_lookup)
+ long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
+ long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
+ struct symbol_cache_entry **));
/* See documentation on reloc types. */
reloc_howto_type *
- (*reloc_type_lookup) PARAMS ((bfd *abfd,
- bfd_reloc_code_real_type code));
+ (*reloc_type_lookup) PARAMS ((bfd *, bfd_reloc_code_real_type));
/* Routines used when writing an object file. */
-#define BFD_JUMP_TABLE_WRITE(NAME)\
-CAT(NAME,_set_arch_mach),\
-CAT(NAME,_set_section_contents)
- boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,
- unsigned long));
- boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
- file_ptr, bfd_size_type));
+#define BFD_JUMP_TABLE_WRITE(NAME) \
+CONCAT2 (NAME,_set_arch_mach), \
+CONCAT2 (NAME,_set_section_contents)
+ boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,
+ unsigned long));
+ boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
+ file_ptr, bfd_size_type));
/* Routines used by the linker. */
-#define BFD_JUMP_TABLE_LINK(NAME)\
-CAT(NAME,_sizeof_headers),\
-CAT(NAME,_bfd_get_relocated_section_contents),\
-CAT(NAME,_bfd_relax_section),\
-CAT(NAME,_bfd_link_hash_table_create),\
-CAT(NAME,_bfd_link_add_symbols),\
-CAT(NAME,_bfd_final_link),\
-CAT(NAME,_bfd_link_split_section),\
-CAT(NAME,_bfd_gc_sections)
- int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
- bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *,
- struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *data, boolean relocateable,
- struct symbol_cache_entry **));
-
- boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *,
- struct bfd_link_info *, boolean *again));
+#define BFD_JUMP_TABLE_LINK(NAME) \
+CONCAT2 (NAME,_sizeof_headers), \
+CONCAT2 (NAME,_bfd_get_relocated_section_contents), \
+CONCAT2 (NAME,_bfd_relax_section), \
+CONCAT2 (NAME,_bfd_link_hash_table_create), \
+CONCAT2 (NAME,_bfd_link_add_symbols), \
+CONCAT2 (NAME,_bfd_final_link), \
+CONCAT2 (NAME,_bfd_link_split_section), \
+CONCAT2 (NAME,_bfd_gc_sections), \
+CONCAT2 (NAME,_bfd_merge_sections)
+ int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
+ bfd_byte *(*_bfd_get_relocated_section_contents)
+ PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
+ bfd_byte *, boolean, struct symbol_cache_entry **));
+
+ boolean (*_bfd_relax_section)
+ PARAMS ((bfd *, struct sec *, struct bfd_link_info *, boolean *));
/* Create a hash table for the linker. Different backends store
different information in this table. */
struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));
/* Add symbols from this object file into the hash table. */
- boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
+ boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
/* Do a link based on the link_order structures attached to each
section of the BFD. */
- boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
+ boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
/* Should this section be split up into smaller pieces during linking. */
- boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
+ boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
/* Remove sections that are not referenced from the output. */
- boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));
+ boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));
+
+ /* Attempt to merge SEC_MERGE sections. */
+ boolean (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *));
/* Routines to handle dynamic symbols and relocs. */
-#define BFD_JUMP_TABLE_DYNAMIC(NAME)\
-CAT(NAME,_get_dynamic_symtab_upper_bound),\
-CAT(NAME,_canonicalize_dynamic_symtab),\
-CAT(NAME,_get_dynamic_reloc_upper_bound),\
-CAT(NAME,_canonicalize_dynamic_reloc)
+#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
+CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \
+CONCAT2 (NAME,_canonicalize_dynamic_symtab), \
+CONCAT2 (NAME,_get_dynamic_reloc_upper_bound), \
+CONCAT2 (NAME,_canonicalize_dynamic_reloc)
/* Get the amount of memory required to hold the dynamic symbols. */
- long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *));
+ long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *));
/* Read in the dynamic symbols. */
- long (*_bfd_canonicalize_dynamic_symtab)
+ long (*_bfd_canonicalize_dynamic_symtab)
PARAMS ((bfd *, struct symbol_cache_entry **));
/* Get the amount of memory required to hold the dynamic relocs. */
- long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *));
+ long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *));
/* Read in the dynamic relocs. */
- long (*_bfd_canonicalize_dynamic_reloc)
+ long (*_bfd_canonicalize_dynamic_reloc)
PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
/* Opposite endian version of this target. */
@@ -3490,7 +3787,7 @@ boolean
bfd_set_default_target PARAMS ((const char *name));
const bfd_target *
-bfd_find_target PARAMS ((CONST char *target_name, bfd *abfd));
+bfd_find_target PARAMS ((const char *target_name, bfd *abfd));
const char **
bfd_target_list PARAMS ((void));
@@ -3507,7 +3804,7 @@ bfd_check_format_matches PARAMS ((bfd *abfd, bfd_format format, char ***matching
boolean
bfd_set_format PARAMS ((bfd *abfd, bfd_format format));
-CONST char *
+const char *
bfd_format_string PARAMS ((bfd_format format));
#ifdef __cplusplus
diff --git a/contrib/binutils/bfd/bfd.c b/contrib/binutils/bfd/bfd.c
index 3afcd3d..122f523 100644
--- a/contrib/binutils/bfd/bfd.c
+++ b/contrib/binutils/bfd/bfd.c
@@ -37,7 +37,7 @@ CODE_FRAGMENT
.struct _bfd
.{
. {* The filename the application opened the BFD with. *}
-. CONST char *filename;
+. const char *filename;
.
. {* A pointer to the target jump table. *}
. const struct bfd_target *xvec;
@@ -70,7 +70,7 @@ CODE_FRAGMENT
. {* When a file is closed by the caching routines, BFD retains
. state information on the file here: *}
.
-. file_ptr where;
+. ufile_ptr where;
.
. {* and here: (``once'' means at least once) *}
.
@@ -108,14 +108,20 @@ CODE_FRAGMENT
. anything. I believe that this can become always an add of
. origin, with origin set to 0 for non archive files. *}
.
-. file_ptr origin;
+. ufile_ptr origin;
.
. {* Remember when output has begun, to stop strange things
. from happening. *}
. boolean output_has_begun;
.
-. {* Pointer to linked list of sections*}
-. struct sec *sections;
+. {* A hash table for section names. *}
+. struct bfd_hash_table section_htab;
+.
+. {* Pointer to linked list of sections. *}
+. struct sec *sections;
+.
+. {* The place where we add to the section list. *}
+. struct sec **section_tail;
.
. {* The number of sections *}
. unsigned int section_count;
@@ -167,6 +173,7 @@ CODE_FRAGMENT
. struct elf_obj_tdata *elf_obj_data;
. struct nlm_obj_tdata *nlm_obj_data;
. struct bout_data_struct *bout_data;
+. struct mmo_data_struct *mmo_data;
. struct sun_core_struct *sun_core_data;
. struct sco5_core_struct *sco5_core_data;
. struct trad_core_struct *trad_core_data;
@@ -203,6 +210,7 @@ CODE_FRAGMENT
#endif
#include "libiberty.h"
+#include "safe-ctype.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "coff/internal.h"
@@ -211,8 +219,6 @@ CODE_FRAGMENT
#include "libecoff.h"
#undef obj_symbols
#include "elf-bfd.h"
-
-#include <ctype.h>
/* provide storage for subsystem, stack and heap data which may have been
passed in on the command line. Ld puts this data into a bfd_link_info
@@ -248,6 +254,7 @@ CODE_FRAGMENT
. bfd_error_system_call,
. bfd_error_invalid_target,
. bfd_error_wrong_format,
+. bfd_error_wrong_object_format,
. bfd_error_invalid_operation,
. bfd_error_no_memory,
. bfd_error_no_symbols,
@@ -269,27 +276,29 @@ CODE_FRAGMENT
static bfd_error_type bfd_error = bfd_error_no_error;
-CONST char *CONST bfd_errmsgs[] = {
- N_("No error"),
- N_("System call error"),
- N_("Invalid bfd target"),
- N_("File in wrong format"),
- N_("Invalid operation"),
- N_("Memory exhausted"),
- N_("No symbols"),
- N_("Archive has no index; run ranlib to add one"),
- N_("No more archived files"),
- N_("Malformed archive"),
- N_("File format not recognized"),
- N_("File format is ambiguous"),
- N_("Section has no contents"),
- N_("Nonrepresentable section on output"),
- N_("Symbol needs debug section which does not exist"),
- N_("Bad value"),
- N_("File truncated"),
- N_("File too big"),
- N_("#<Invalid error code>")
- };
+const char *const bfd_errmsgs[] =
+{
+ N_("No error"),
+ N_("System call error"),
+ N_("Invalid bfd target"),
+ N_("File in wrong format"),
+ N_("Archive object file in wrong format"),
+ N_("Invalid operation"),
+ N_("Memory exhausted"),
+ N_("No symbols"),
+ N_("Archive has no index; run ranlib to add one"),
+ N_("No more archived files"),
+ N_("Malformed archive"),
+ N_("File format not recognized"),
+ N_("File format is ambiguous"),
+ N_("Section has no contents"),
+ N_("Nonrepresentable section on output"),
+ N_("Symbol needs debug section which does not exist"),
+ N_("Bad value"),
+ N_("File truncated"),
+ N_("File too big"),
+ N_("#<Invalid error code>")
+};
/*
FUNCTION
@@ -331,14 +340,14 @@ FUNCTION
bfd_errmsg
SYNOPSIS
- CONST char *bfd_errmsg (bfd_error_type error_tag);
+ const char *bfd_errmsg (bfd_error_type error_tag);
DESCRIPTION
Return a string describing the error @var{error_tag}, or
the system error if @var{error_tag} is <<bfd_error_system_call>>.
*/
-CONST char *
+const char *
bfd_errmsg (error_tag)
bfd_error_type error_tag;
{
@@ -348,8 +357,8 @@ bfd_errmsg (error_tag)
if (error_tag == bfd_error_system_call)
return xstrerror (errno);
- if ((((int)error_tag <(int) bfd_error_no_error) ||
- ((int)error_tag > (int)bfd_error_invalid_error_code)))
+ if ((((int) error_tag < (int) bfd_error_no_error) ||
+ ((int) error_tag > (int) bfd_error_invalid_error_code)))
error_tag = bfd_error_invalid_error_code;/* sanity check */
return _(bfd_errmsgs [(int)error_tag]);
@@ -360,7 +369,7 @@ FUNCTION
bfd_perror
SYNOPSIS
- void bfd_perror (CONST char *message);
+ void bfd_perror (const char *message);
DESCRIPTION
Print to the standard error stream a string describing the
@@ -372,16 +381,18 @@ DESCRIPTION
void
bfd_perror (message)
- CONST char *message;
+ const char *message;
{
if (bfd_get_error () == bfd_error_system_call)
- perror((char *)message); /* must be system error then... */
- else {
- if (message == NULL || *message == '\0')
- fprintf (stderr, "%s\n", bfd_errmsg (bfd_get_error ()));
- else
- fprintf (stderr, "%s: %s\n", message, bfd_errmsg (bfd_get_error ()));
- }
+ /* Must be a system error then. */
+ perror ((char *)message);
+ else
+ {
+ if (message == NULL || *message == '\0')
+ fprintf (stderr, "%s\n", bfd_errmsg (bfd_get_error ()));
+ else
+ fprintf (stderr, "%s: %s\n", message, bfd_errmsg (bfd_get_error ()));
+ }
}
/*
@@ -406,57 +417,24 @@ static const char *_bfd_error_program_name;
/* This is the default routine to handle BFD error messages. */
-#ifdef ANSI_PROTOTYPES
-
static void _bfd_default_error_handler PARAMS ((const char *s, ...));
static void
-_bfd_default_error_handler (const char *s, ...)
-{
- va_list p;
-
- if (_bfd_error_program_name != NULL)
- fprintf (stderr, "%s: ", _bfd_error_program_name);
- else
- fprintf (stderr, "BFD: ");
-
- va_start (p, s);
-
- vfprintf (stderr, s, p);
-
- va_end (p);
-
- fprintf (stderr, "\n");
-}
-
-#else /* ! defined (ANSI_PROTOTYPES) */
-
-static void _bfd_default_error_handler ();
-
-static void
-_bfd_default_error_handler (va_alist)
- va_dcl
+_bfd_default_error_handler VPARAMS ((const char *s, ...))
{
- va_list p;
- const char *s;
-
if (_bfd_error_program_name != NULL)
fprintf (stderr, "%s: ", _bfd_error_program_name);
else
fprintf (stderr, "BFD: ");
- va_start (p);
-
- s = va_arg (p, const char *);
+ VA_OPEN (p, s);
+ VA_FIXEDARG (p, const char *, s);
vfprintf (stderr, s, p);
-
- va_end (p);
+ VA_CLOSE (p);
fprintf (stderr, "\n");
}
-#endif /* ! defined (ANSI_PROTOTYPES) */
-
/* This is a function pointer to the routine which should handle BFD
error messages. It is called when a BFD routine encounters an
error for which it wants to print a message. Going through a
@@ -525,6 +503,54 @@ bfd_get_error_handler ()
{
return _bfd_error_handler;
}
+
+/*
+FUNCTION
+ bfd_archive_filename
+
+SYNOPSIS
+ const char *bfd_archive_filename (bfd *);
+
+DESCRIPTION
+ For a BFD that is a component of an archive, returns a string
+ with both the archive name and file name. For other BFDs, just
+ returns the file name.
+*/
+
+const char *
+bfd_archive_filename (abfd)
+ bfd *abfd;
+{
+ if (abfd->my_archive)
+ {
+ static size_t curr = 0;
+ static char *buf;
+ size_t needed;
+
+ needed = (strlen (bfd_get_filename (abfd->my_archive))
+ + strlen (bfd_get_filename (abfd)) + 3);
+ if (needed > curr)
+ {
+ if (curr)
+ free (buf);
+ curr = needed + (needed >> 1);
+ buf = bfd_malloc ((bfd_size_type) curr);
+ /* If we can't malloc, fail safe by returning just the file
+ name. This function is only used when building error
+ messages. */
+ if (!buf)
+ {
+ curr = 0;
+ return bfd_get_filename (abfd);
+ }
+ }
+ sprintf (buf, "%s(%s)", bfd_get_filename (abfd->my_archive),
+ bfd_get_filename (abfd));
+ return buf;
+ }
+ else
+ return bfd_get_filename (abfd);
+}
/*
SECTION
@@ -550,10 +576,11 @@ bfd_get_reloc_upper_bound (abfd, asect)
bfd *abfd;
sec_ptr asect;
{
- if (abfd->format != bfd_object) {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
+ if (abfd->format != bfd_object)
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ return -1;
+ }
return BFD_SEND (abfd, _get_reloc_upper_bound, (abfd, asect));
}
@@ -589,10 +616,12 @@ bfd_canonicalize_reloc (abfd, asect, location, symbols)
arelent **location;
asymbol **symbols;
{
- if (abfd->format != bfd_object) {
- bfd_set_error (bfd_error_invalid_operation);
- return -1;
- }
+ if (abfd->format != bfd_object)
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ return -1;
+ }
+
return BFD_SEND (abfd, _bfd_canonicalize_reloc,
(abfd, asect, location, symbols));
}
@@ -648,23 +677,26 @@ bfd_set_file_flags (abfd, flags)
bfd *abfd;
flagword flags;
{
- if (abfd->format != bfd_object) {
- bfd_set_error (bfd_error_wrong_format);
- return false;
- }
+ if (abfd->format != bfd_object)
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return false;
+ }
- if (bfd_read_p (abfd)) {
- bfd_set_error (bfd_error_invalid_operation);
- return false;
- }
+ if (bfd_read_p (abfd))
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ return false;
+ }
bfd_get_file_flags (abfd) = flags;
- if ((flags & bfd_applicable_file_flags (abfd)) != flags) {
- bfd_set_error (bfd_error_invalid_operation);
- return false;
- }
+ if ((flags & bfd_applicable_file_flags (abfd)) != flags)
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ return false;
+ }
-return true;
+ return true;
}
void
@@ -672,7 +704,8 @@ bfd_assert (file, line)
const char *file;
int line;
{
- (*_bfd_error_handler) (_("bfd assertion fail %s:%d"), file, line);
+ (*_bfd_error_handler) (_("BFD %s assertion fail %s:%d"),
+ BFD_VERSION_STRING, file, line);
}
/* A more or less friendly abort message. In libbfd.h abort is
@@ -690,12 +723,12 @@ _bfd_abort (file, line, fn)
{
if (fn != NULL)
(*_bfd_error_handler)
- (_("BFD internal error, aborting at %s line %d in %s\n"),
- file, line, fn);
+ (_("BFD %s internal error, aborting at %s line %d in %s\n"),
+ BFD_VERSION_STRING, file, line, fn);
else
(*_bfd_error_handler)
- (_("BFD internal error, aborting at %s line %d\n"),
- file, line);
+ (_("BFD %s internal error, aborting at %s line %d\n"),
+ BFD_VERSION_STRING, file, line);
(*_bfd_error_handler) (_("Please report this bug.\n"));
xexit (EXIT_FAILURE);
}
@@ -752,9 +785,21 @@ int
bfd_get_sign_extend_vma (abfd)
bfd *abfd;
{
+ char *name;
+
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
return (get_elf_backend_data (abfd)->sign_extend_vma);
+ name = bfd_get_target (abfd);
+
+ /* Return a proper value for DJGPP COFF (an x86 COFF variant).
+ This function is required for DWARF2 support, but there is
+ no place to store this information in the COFF back end.
+ Should enough other COFF targets add support for DWARF2,
+ a place will have to be found. Until then, this hack will do. */
+ if (strncmp (name, "coff-go32", sizeof ("coff-go32") - 1) == 0)
+ return 1;
+
bfd_set_error (bfd_error_wrong_format);
return -1;
}
@@ -774,9 +819,9 @@ RETURNS
*/
boolean
-bfd_set_start_address(abfd, vma)
-bfd *abfd;
-bfd_vma vma;
+bfd_set_start_address (abfd, vma)
+ bfd *abfd;
+ bfd_vma vma;
{
abfd->start_address = vma;
return true;
@@ -857,7 +902,7 @@ bfd_get_size (abfd)
return ((struct bfd_in_memory *) abfd->iostream)->size;
fp = bfd_cache_lookup (abfd);
- if (0 != fstat (fileno (fp), &buf))
+ if (0 != fstat (fileno (fp), & buf))
return 0;
return buf.st_size;
@@ -868,7 +913,7 @@ FUNCTION
bfd_get_gp_size
SYNOPSIS
- int bfd_get_gp_size(bfd *abfd);
+ unsigned int bfd_get_gp_size(bfd *abfd);
DESCRIPTION
Return the maximum size of objects to be optimized using the GP
@@ -876,7 +921,7 @@ DESCRIPTION
argument to the compiler, assembler or linker.
*/
-int
+unsigned int
bfd_get_gp_size (abfd)
bfd *abfd;
{
@@ -895,7 +940,7 @@ FUNCTION
bfd_set_gp_size
SYNOPSIS
- void bfd_set_gp_size(bfd *abfd, int i);
+ void bfd_set_gp_size(bfd *abfd, unsigned int i);
DESCRIPTION
Set the maximum size of objects to be optimized using the GP
@@ -906,11 +951,12 @@ DESCRIPTION
void
bfd_set_gp_size (abfd, i)
bfd *abfd;
- int i;
+ unsigned int i;
{
- /* Don't try to set GP size on an archive or core file! */
+ /* Don't try to set GP size on an archive or core file! */
if (abfd->format != bfd_object)
return;
+
if (abfd->xvec->flavour == bfd_target_ecoff_flavour)
ecoff_data (abfd)->gp_size = i;
else if (abfd->xvec->flavour == bfd_target_elf_flavour)
@@ -925,13 +971,14 @@ bfd_vma
_bfd_get_gp_value (abfd)
bfd *abfd;
{
- if (abfd->format == bfd_object)
- {
- if (abfd->xvec->flavour == bfd_target_ecoff_flavour)
- return ecoff_data (abfd)->gp;
- else if (abfd->xvec->flavour == bfd_target_elf_flavour)
- return elf_gp (abfd);
- }
+ if (abfd->format != bfd_object)
+ return 0;
+
+ if (abfd->xvec->flavour == bfd_target_ecoff_flavour)
+ return ecoff_data (abfd)->gp;
+ else if (abfd->xvec->flavour == bfd_target_elf_flavour)
+ return elf_gp (abfd);
+
return 0;
}
@@ -944,6 +991,7 @@ _bfd_set_gp_value (abfd, v)
{
if (abfd->format != bfd_object)
return;
+
if (abfd->xvec->flavour == bfd_target_ecoff_flavour)
ecoff_data (abfd)->gp = v;
else if (abfd->xvec->flavour == bfd_target_elf_flavour)
@@ -955,7 +1003,7 @@ FUNCTION
bfd_scan_vma
SYNOPSIS
- bfd_vma bfd_scan_vma(CONST char *string, CONST char **end, int base);
+ bfd_vma bfd_scan_vma(const char *string, const char **end, int base);
DESCRIPTION
Convert, like <<strtoul>>, a numerical expression
@@ -972,8 +1020,8 @@ DESCRIPTION
bfd_vma
bfd_scan_vma (string, end, base)
- CONST char *string;
- CONST char **end;
+ const char *string;
+ const char **end;
int base;
{
bfd_vma value;
@@ -993,33 +1041,32 @@ bfd_scan_vma (string, end, base)
{
if ((string[1] == 'x') || (string[1] == 'X'))
base = 16;
- /* XXX should we also allow "0b" or "0B" to set base to 2? */
+ /* XXX should we also allow "0b" or "0B" to set base to 2? */
else
base = 8;
}
else
base = 10;
}
+
if ((base == 16) &&
(string[0] == '0') && ((string[1] == 'x') || (string[1] == 'X')))
string += 2;
- /* XXX should we also skip over "0b" or "0B" if base is 2? */
+ /* XXX should we also skip over "0b" or "0B" if base is 2? */
/* Speed could be improved with a table like hex_value[] in gas. */
#define HEX_VALUE(c) \
- (isxdigit ((unsigned char) c) \
- ? (isdigit ((unsigned char) c) \
+ (ISXDIGIT (c) \
+ ? (ISDIGIT (c) \
? (c - '0') \
- : (10 + c - (islower ((unsigned char) c) ? 'a' : 'A'))) \
+ : (10 + c - (ISLOWER (c) ? 'a' : 'A'))) \
: 42)
- for (value = 0; (digit = HEX_VALUE(*string)) < base; string++)
- {
- value = value * base + digit;
- }
+ for (value = 0; (digit = HEX_VALUE (* string)) < base; string ++)
+ value = value * base + digit;
if (end)
- *end = string;
+ * end = string;
return value;
}
@@ -1126,6 +1173,9 @@ DESCRIPTION
.#define bfd_gc_sections(abfd, link_info) \
. BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
.
+.#define bfd_merge_sections(abfd, link_info) \
+. BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
+.
.#define bfd_link_hash_table_create(abfd) \
. BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
.
@@ -1179,11 +1229,12 @@ bfd_get_relocated_section_contents (abfd, link_info, link_order, data,
if (link_order->type == bfd_indirect_link_order)
{
abfd2 = link_order->u.indirect.section->owner;
- if (abfd2 == 0)
+ if (abfd2 == NULL)
abfd2 = abfd;
}
else
abfd2 = abfd;
+
fn = abfd2->xvec->_bfd_get_relocated_section_contents;
return (*fn) (abfd, link_info, link_order, data, relocateable, symbols);
@@ -1206,14 +1257,14 @@ bfd_record_phdr (abfd, type, flags_valid, flags, at_valid, at,
asection **secs;
{
struct elf_segment_map *m, **pm;
+ bfd_size_type amt;
if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
return true;
- m = ((struct elf_segment_map *)
- bfd_alloc (abfd,
- (sizeof (struct elf_segment_map)
- + ((size_t) count - 1) * sizeof (asection *))));
+ amt = sizeof (struct elf_segment_map);
+ amt += ((bfd_size_type) count - 1) * sizeof (asection *);
+ m = (struct elf_segment_map *) bfd_alloc (abfd, amt);
if (m == NULL)
return false;
@@ -1235,3 +1286,82 @@ bfd_record_phdr (abfd, type, flags_valid, flags, at_valid, at,
return true;
}
+
+void
+bfd_sprintf_vma (abfd, buf, value)
+ bfd *abfd;
+ char *buf;
+ bfd_vma value;
+{
+ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+ get_elf_backend_data (abfd)->elf_backend_sprintf_vma (abfd, buf, value);
+ else
+ sprintf_vma (buf, value);
+}
+
+void
+bfd_fprintf_vma (abfd, stream, value)
+ bfd *abfd;
+ PTR stream;
+ bfd_vma value;
+{
+ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+ get_elf_backend_data (abfd)->elf_backend_fprintf_vma (abfd, stream, value);
+ else
+ fprintf_vma ((FILE *) stream, value);
+}
+
+/*
+FUNCTION
+ bfd_alt_mach_code
+
+SYNOPSIS
+ boolean bfd_alt_mach_code(bfd *abfd, int index);
+
+DESCRIPTION
+
+ When more than one machine code number is available for the
+ same machine type, this function can be used to switch between
+ the preferred one (index == 0) and any others. Currently,
+ only ELF supports this feature, with up to two alternate
+ machine codes.
+*/
+
+boolean
+bfd_alt_mach_code (abfd, index)
+ bfd *abfd;
+ int index;
+{
+ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+ {
+ int code;
+
+ switch (index)
+ {
+ case 0:
+ code = get_elf_backend_data (abfd)->elf_machine_code;
+ break;
+
+ case 1:
+ code = get_elf_backend_data (abfd)->elf_machine_alt1;
+ if (code == 0)
+ return false;
+ break;
+
+ case 2:
+ code = get_elf_backend_data (abfd)->elf_machine_alt2;
+ if (code == 0)
+ return false;
+ break;
+
+ default:
+ return false;
+ }
+
+ elf_elfheader (abfd)->e_machine = code;
+
+ return true;
+ }
+
+ return false;
+}
diff --git a/contrib/binutils/bfd/binary.c b/contrib/binutils/bfd/binary.c
index b80343b..705ac8f 100644
--- a/contrib/binutils/bfd/binary.c
+++ b/contrib/binutils/bfd/binary.c
@@ -1,5 +1,5 @@
/* BFD back-end for binary objects.
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
@@ -32,10 +32,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
the file. objcopy cooperates by specially setting the start
address to zero by default. */
-#include <ctype.h>
-
#include "bfd.h"
#include "sysdep.h"
+#include "safe-ctype.h"
#include "libbfd.h"
/* Any bfd we create by reading a binary file has three symbols:
@@ -49,12 +48,15 @@ static boolean binary_get_section_contents
static long binary_get_symtab_upper_bound PARAMS ((bfd *));
static char *mangle_name PARAMS ((bfd *, char *));
static long binary_get_symtab PARAMS ((bfd *, asymbol **));
-static asymbol *binary_make_empty_symbol PARAMS ((bfd *));
static void binary_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
static boolean binary_set_section_contents
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
static int binary_sizeof_headers PARAMS ((bfd *, boolean));
+/* Set by external programs - specifies the BFD architecture
+ to use when creating binary BFDs. */
+enum bfd_architecture bfd_external_binary_architecture = bfd_arch_unknown;
+
/* Create a binary object. Invoked via bfd_set_format. */
static boolean
@@ -101,6 +103,13 @@ binary_object_p (abfd)
abfd->tdata.any = (PTR) sec;
+ if (bfd_get_arch_info (abfd) != NULL)
+ {
+ if ((bfd_get_arch_info (abfd)->arch == bfd_arch_unknown)
+ && (bfd_external_binary_architecture != bfd_arch_unknown))
+ bfd_set_arch_info (abfd, bfd_lookup_arch (bfd_external_binary_architecture, 0));
+ }
+
return abfd->xvec;
}
@@ -119,7 +128,7 @@ binary_get_section_contents (abfd, section, location, offset, count)
bfd_size_type count;
{
if (bfd_seek (abfd, offset, SEEK_SET) != 0
- || bfd_read (location, 1, count, abfd) != count)
+ || bfd_bread (location, count, abfd) != count)
return false;
return true;
}
@@ -140,7 +149,7 @@ mangle_name (abfd, suffix)
bfd *abfd;
char *suffix;
{
- int size;
+ bfd_size_type size;
char *buf;
char *p;
@@ -156,7 +165,7 @@ mangle_name (abfd, suffix)
/* Change any non-alphanumeric characters to underscores. */
for (p = buf; *p; p++)
- if (! isalnum ((unsigned char) *p))
+ if (! ISALNUM (*p))
*p = '_';
return buf;
@@ -172,8 +181,9 @@ binary_get_symtab (abfd, alocation)
asection *sec = (asection *) abfd->tdata.any;
asymbol *syms;
unsigned int i;
+ bfd_size_type amt = BIN_SYMS * sizeof (asymbol);
- syms = (asymbol *) bfd_alloc (abfd, BIN_SYMS * sizeof (asymbol));
+ syms = (asymbol *) bfd_alloc (abfd, amt);
if (syms == NULL)
return false;
@@ -208,15 +218,7 @@ binary_get_symtab (abfd, alocation)
return BIN_SYMS;
}
-/* Make an empty symbol. */
-
-static asymbol *
-binary_make_empty_symbol (abfd)
- bfd *abfd;
-{
- return (asymbol *) bfd_alloc (abfd, sizeof (asymbol));
-}
-
+#define binary_make_empty_symbol _bfd_generic_make_empty_symbol
#define binary_print_symbol _bfd_nosymbols_print_symbol
/* Get information about a symbol. */
@@ -334,6 +336,7 @@ binary_sizeof_headers (abfd, exec)
bfd_generic_get_relocated_section_contents
#define binary_bfd_relax_section bfd_generic_relax_section
#define binary_bfd_gc_sections bfd_generic_gc_sections
+#define binary_bfd_merge_sections bfd_generic_merge_sections
#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define binary_bfd_final_link _bfd_generic_final_link
diff --git a/contrib/binutils/bfd/cache.c b/contrib/binutils/bfd/cache.c
index da16409..4e5ef2e 100644
--- a/contrib/binutils/bfd/cache.c
+++ b/contrib/binutils/bfd/cache.c
@@ -364,7 +364,9 @@ bfd_cache_lookup_worker (abfd)
{
if (bfd_open_file (abfd) == NULL)
return NULL;
- if (fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0)
+ if (abfd->where != (unsigned long) abfd->where)
+ return NULL;
+ if (fseek ((FILE *) abfd->iostream, (long) abfd->where, SEEK_SET) != 0)
return NULL;
}
diff --git a/contrib/binutils/bfd/coff-alpha.c b/contrib/binutils/bfd/coff-alpha.c
index b3cd0c7..4056e2c 100644
--- a/contrib/binutils/bfd/coff-alpha.c
+++ b/contrib/binutils/bfd/coff-alpha.c
@@ -76,32 +76,32 @@ static bfd *alpha_ecoff_get_elt_at_index PARAMS ((bfd *, symindex));
symbol, and lineno ones. Give them ecoff names. Define some
accessor macros for the large sizes used for Alpha ECOFF. */
-#define GET_FILEHDR_SYMPTR bfd_h_get_64
-#define PUT_FILEHDR_SYMPTR bfd_h_put_64
-#define GET_AOUTHDR_TSIZE bfd_h_get_64
-#define PUT_AOUTHDR_TSIZE bfd_h_put_64
-#define GET_AOUTHDR_DSIZE bfd_h_get_64
-#define PUT_AOUTHDR_DSIZE bfd_h_put_64
-#define GET_AOUTHDR_BSIZE bfd_h_get_64
-#define PUT_AOUTHDR_BSIZE bfd_h_put_64
-#define GET_AOUTHDR_ENTRY bfd_h_get_64
-#define PUT_AOUTHDR_ENTRY bfd_h_put_64
-#define GET_AOUTHDR_TEXT_START bfd_h_get_64
-#define PUT_AOUTHDR_TEXT_START bfd_h_put_64
-#define GET_AOUTHDR_DATA_START bfd_h_get_64
-#define PUT_AOUTHDR_DATA_START bfd_h_put_64
-#define GET_SCNHDR_PADDR bfd_h_get_64
-#define PUT_SCNHDR_PADDR bfd_h_put_64
-#define GET_SCNHDR_VADDR bfd_h_get_64
-#define PUT_SCNHDR_VADDR bfd_h_put_64
-#define GET_SCNHDR_SIZE bfd_h_get_64
-#define PUT_SCNHDR_SIZE bfd_h_put_64
-#define GET_SCNHDR_SCNPTR bfd_h_get_64
-#define PUT_SCNHDR_SCNPTR bfd_h_put_64
-#define GET_SCNHDR_RELPTR bfd_h_get_64
-#define PUT_SCNHDR_RELPTR bfd_h_put_64
-#define GET_SCNHDR_LNNOPTR bfd_h_get_64
-#define PUT_SCNHDR_LNNOPTR bfd_h_put_64
+#define GET_FILEHDR_SYMPTR H_GET_64
+#define PUT_FILEHDR_SYMPTR H_PUT_64
+#define GET_AOUTHDR_TSIZE H_GET_64
+#define PUT_AOUTHDR_TSIZE H_PUT_64
+#define GET_AOUTHDR_DSIZE H_GET_64
+#define PUT_AOUTHDR_DSIZE H_PUT_64
+#define GET_AOUTHDR_BSIZE H_GET_64
+#define PUT_AOUTHDR_BSIZE H_PUT_64
+#define GET_AOUTHDR_ENTRY H_GET_64
+#define PUT_AOUTHDR_ENTRY H_PUT_64
+#define GET_AOUTHDR_TEXT_START H_GET_64
+#define PUT_AOUTHDR_TEXT_START H_PUT_64
+#define GET_AOUTHDR_DATA_START H_GET_64
+#define PUT_AOUTHDR_DATA_START H_PUT_64
+#define GET_SCNHDR_PADDR H_GET_64
+#define PUT_SCNHDR_PADDR H_PUT_64
+#define GET_SCNHDR_VADDR H_GET_64
+#define PUT_SCNHDR_VADDR H_PUT_64
+#define GET_SCNHDR_SIZE H_GET_64
+#define PUT_SCNHDR_SIZE H_PUT_64
+#define GET_SCNHDR_SCNPTR H_GET_64
+#define PUT_SCNHDR_SCNPTR H_PUT_64
+#define GET_SCNHDR_RELPTR H_GET_64
+#define PUT_SCNHDR_RELPTR H_PUT_64
+#define GET_SCNHDR_LNNOPTR H_GET_64
+#define PUT_SCNHDR_LNNOPTR H_PUT_64
#define ALPHAECOFF
@@ -530,8 +530,8 @@ alpha_ecoff_swap_reloc_in (abfd, ext_ptr, intern)
{
const RELOC *ext = (RELOC *) ext_ptr;
- intern->r_vaddr = bfd_h_get_64 (abfd, (bfd_byte *) ext->r_vaddr);
- intern->r_symndx = bfd_h_get_32 (abfd, (bfd_byte *) ext->r_symndx);
+ intern->r_vaddr = H_GET_64 (abfd, ext->r_vaddr);
+ intern->r_symndx = H_GET_32 (abfd, ext->r_symndx);
BFD_ASSERT (bfd_header_little_endian (abfd));
@@ -603,8 +603,8 @@ alpha_ecoff_swap_reloc_out (abfd, intern, dst)
BFD_ASSERT (intern->r_extern
|| (intern->r_symndx >= 0 && intern->r_symndx <= 14));
- bfd_h_put_64 (abfd, intern->r_vaddr, (bfd_byte *) ext->r_vaddr);
- bfd_h_put_32 (abfd, symndx, (bfd_byte *) ext->r_symndx);
+ H_PUT_64 (abfd, intern->r_vaddr, ext->r_vaddr);
+ H_PUT_32 (abfd, symndx, ext->r_symndx);
BFD_ASSERT (bfd_header_little_endian (abfd));
@@ -771,7 +771,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
if (reloc_size < 0)
goto error_return;
- reloc_vector = (arelent **) bfd_malloc (reloc_size);
+ reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
if (reloc_vector == NULL && reloc_size != 0)
goto error_return;
@@ -1277,7 +1277,7 @@ alpha_convert_external_reloc (output_bfd, info, input_bfd, ext_rel, h)
hsec = h->root.u.def.section;
name = bfd_get_section_name (output_bfd, hsec->output_section);
- r_symndx = -1;
+ r_symndx = (unsigned long) -1;
switch (name[1])
{
case 'A':
@@ -1334,7 +1334,7 @@ alpha_convert_external_reloc (output_bfd, info, input_bfd, ext_rel, h)
break;
}
- if (r_symndx == -1)
+ if (r_symndx == (unsigned long) -1)
abort ();
/* Add the section VMA and the symbol value. */
@@ -1347,7 +1347,7 @@ alpha_convert_external_reloc (output_bfd, info, input_bfd, ext_rel, h)
/* Change the symndx value to the right one for
the output BFD. */
r_symndx = h->indx;
- if (r_symndx == -1)
+ if (r_symndx == (unsigned long) -1)
{
/* Caller must give an error. */
r_symndx = 0;
@@ -1356,8 +1356,7 @@ alpha_convert_external_reloc (output_bfd, info, input_bfd, ext_rel, h)
}
/* Write out the new r_symndx value. */
- bfd_h_put_32 (input_bfd, (bfd_vma) r_symndx,
- (bfd_byte *) ext_rel->r_symndx);
+ H_PUT_32 (input_bfd, r_symndx, ext_rel->r_symndx);
return relocation;
}
@@ -1384,6 +1383,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
int tos = 0;
struct external_reloc *ext_rel;
struct external_reloc *ext_rel_end;
+ bfd_size_type amt;
/* We keep a table mapping the symndx found in an internal reloc to
the appropriate section. This is faster than looking up the
@@ -1391,10 +1391,8 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
symndx_to_section = ecoff_data (input_bfd)->symndx_to_section;
if (symndx_to_section == (asection **) NULL)
{
- symndx_to_section = ((asection **)
- bfd_alloc (input_bfd,
- (NUM_RELOC_SECTIONS
- * sizeof (asection *))));
+ amt = NUM_RELOC_SECTIONS * sizeof (asection *);
+ symndx_to_section = (asection **) bfd_alloc (input_bfd, amt);
if (!symndx_to_section)
return false;
@@ -1451,9 +1449,9 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
lita_sec_data = ecoff_section_data (input_bfd, lita_sec);
if (lita_sec_data == NULL)
{
+ amt = sizeof (struct ecoff_section_tdata);
lita_sec_data = ((struct ecoff_section_tdata *)
- bfd_zalloc (input_bfd,
- sizeof (struct ecoff_section_tdata)));
+ bfd_zalloc (input_bfd, amt));
ecoff_section_data (input_bfd, lita_sec) = lita_sec_data;
}
@@ -1522,8 +1520,8 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
boolean gp_usedp;
bfd_vma addend;
- r_vaddr = bfd_h_get_64 (input_bfd, (bfd_byte *) ext_rel->r_vaddr);
- r_symndx = bfd_h_get_32 (input_bfd, (bfd_byte *) ext_rel->r_symndx);
+ r_vaddr = H_GET_64 (input_bfd, ext_rel->r_vaddr);
+ r_symndx = H_GET_32 (input_bfd, ext_rel->r_symndx);
r_type = ((ext_rel->r_bits[0] & RELOC_BITS0_TYPE_LITTLE)
>> RELOC_BITS0_TYPE_SH_LITTLE);
@@ -1552,9 +1550,8 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
address of the relocation does not appear to include the
section VMA, unlike the other relocation types. */
if (info->relocateable)
- bfd_h_put_64 (input_bfd,
- input_section->output_offset + r_vaddr,
- (bfd_byte *) ext_rel->r_vaddr);
+ H_PUT_64 (input_bfd, input_section->output_offset + r_vaddr,
+ ext_rel->r_vaddr);
adjust_addrp = false;
break;
@@ -1751,8 +1748,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
if (info->relocateable)
{
/* Adjust r_vaddr by the addend. */
- bfd_h_put_64 (input_bfd, addend,
- (bfd_byte *) ext_rel->r_vaddr);
+ H_PUT_64 (input_bfd, addend, ext_rel->r_vaddr);
}
else
{
@@ -1979,18 +1975,18 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
if (info->relocateable && adjust_addrp)
{
/* Change the address of the relocation. */
- bfd_h_put_64 (input_bfd,
- (input_section->output_section->vma
- + input_section->output_offset
- - input_section->vma
- + r_vaddr),
- (bfd_byte *) ext_rel->r_vaddr);
+ H_PUT_64 (input_bfd,
+ (input_section->output_section->vma
+ + input_section->output_offset
+ - input_section->vma
+ + r_vaddr),
+ ext_rel->r_vaddr);
}
if (gp_usedp && gp_undefined)
{
if (! ((*info->callbacks->reloc_dangerous)
- (info, _("GP relative relocation when GP not defined"),
+ (info, _("GP relative relocation used when GP not defined"),
input_bfd, input_section, r_vaddr - input_section->vma)))
return false;
/* Only give the error once per link. */
@@ -2062,12 +2058,12 @@ alpha_ecoff_read_ar_hdr (abfd)
/* This is a compressed file. We must set the size correctly.
The size is the eight bytes after the dummy file header. */
- if (bfd_seek (abfd, FILHSZ, SEEK_CUR) != 0
- || bfd_read (ab, 1, 8, abfd) != 8
- || bfd_seek (abfd, - (FILHSZ + 8), SEEK_CUR) != 0)
+ if (bfd_seek (abfd, (file_ptr) FILHSZ, SEEK_CUR) != 0
+ || bfd_bread (ab, (bfd_size_type) 8, abfd) != 8
+ || bfd_seek (abfd, (file_ptr) (- (FILHSZ + 8)), SEEK_CUR) != 0)
return NULL;
- ret->parsed_size = bfd_h_get_64 (abfd, ab);
+ ret->parsed_size = H_GET_64 (abfd, ab);
}
return (PTR) ret;
@@ -2105,20 +2101,20 @@ alpha_ecoff_get_elt_at_filepos (archive, filepos)
return nbfd;
/* We must uncompress this element. We do this by copying it into a
- memory buffer, and making bfd_read and bfd_seek use that buffer.
+ memory buffer, and making bfd_bread and bfd_seek use that buffer.
This can use a lot of memory, but it's simpler than getting a
temporary file, making that work with the file descriptor caching
code, and making sure that it is deleted at all appropriate
times. It can be changed if it ever becomes important. */
/* The compressed file starts with a dummy ECOFF file header. */
- if (bfd_seek (nbfd, FILHSZ, SEEK_SET) != 0)
+ if (bfd_seek (nbfd, (file_ptr) FILHSZ, SEEK_SET) != 0)
goto error_return;
/* The next eight bytes are the real file size. */
- if (bfd_read (ab, 1, 8, nbfd) != 8)
+ if (bfd_bread (ab, (bfd_size_type) 8, nbfd) != 8)
goto error_return;
- size = bfd_h_get_64 (nbfd, ab);
+ size = H_GET_64 (nbfd, ab);
if (size == 0)
buf = NULL;
@@ -2137,7 +2133,7 @@ alpha_ecoff_get_elt_at_filepos (archive, filepos)
left = size;
/* I don't know what the next eight bytes are for. */
- if (bfd_read (ab, 1, 8, nbfd) != 8)
+ if (bfd_bread (ab, (bfd_size_type) 8, nbfd) != 8)
goto error_return;
/* This is the uncompression algorithm. It's a simple
@@ -2148,7 +2144,7 @@ alpha_ecoff_get_elt_at_filepos (archive, filepos)
next eight bytes in the output stream. */
memset (dict, 0, sizeof dict);
h = 0;
- while (bfd_read (&b, 1, 1, nbfd) == 1)
+ while (bfd_bread (&b, (bfd_size_type) 1, nbfd) == 1)
{
unsigned int i;
@@ -2160,7 +2156,7 @@ alpha_ecoff_get_elt_at_filepos (archive, filepos)
n = dict[h];
else
{
- if (! bfd_read (&n, 1, 1, nbfd))
+ if (! bfd_bread (&n, (bfd_size_type) 1, nbfd))
goto error_return;
dict[h] = n;
}
@@ -2183,7 +2179,7 @@ alpha_ecoff_get_elt_at_filepos (archive, filepos)
/* Now the uncompressed file contents are in buf. */
bim = ((struct bfd_in_memory *)
- bfd_alloc (nbfd, sizeof (struct bfd_in_memory)));
+ bfd_alloc (nbfd, (bfd_size_type) sizeof (struct bfd_in_memory)));
if (bim == NULL)
goto error_return;
bim->size = size;
@@ -2359,6 +2355,7 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
/* Relaxing sections is generic. */
#define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section
#define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
+#define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections
const bfd_target ecoffalpha_little_vec =
{
diff --git a/contrib/binutils/bfd/coff-arm.c b/contrib/binutils/bfd/coff-arm.c
index 8bb4e6c..df2be76 100644
--- a/contrib/binutils/bfd/coff-arm.c
+++ b/contrib/binutils/bfd/coff-arm.c
@@ -36,18 +36,39 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Macros for manipulation the bits in the flags field of the coff data
structure. */
-#define APCS_26_FLAG( abfd ) (coff_data (abfd)->flags & F_APCS_26)
-#define APCS_FLOAT_FLAG( abfd ) (coff_data (abfd)->flags & F_APCS_FLOAT)
-#define PIC_FLAG( abfd ) (coff_data (abfd)->flags & F_PIC)
-#define APCS_SET( abfd ) (coff_data (abfd)->flags & F_APCS_SET)
-#define SET_APCS_FLAGS( abfd, flgs) (coff_data (abfd)->flags = \
- (coff_data (abfd)->flags & ~ (F_APCS_26 | F_APCS_FLOAT | F_PIC)) \
- | (flgs | F_APCS_SET))
-#define INTERWORK_FLAG( abfd ) (coff_data (abfd)->flags & F_INTERWORK)
-#define INTERWORK_SET( abfd ) (coff_data (abfd)->flags & F_INTERWORK_SET)
-#define SET_INTERWORK_FLAG( abfd, flg ) (coff_data (abfd)->flags = \
- (coff_data (abfd)->flags & ~ F_INTERWORK) \
- | (flg | F_INTERWORK_SET))
+#define APCS_26_FLAG(abfd) \
+ (coff_data (abfd)->flags & F_APCS_26)
+
+#define APCS_FLOAT_FLAG(abfd) \
+ (coff_data (abfd)->flags & F_APCS_FLOAT)
+
+#define PIC_FLAG(abfd) \
+ (coff_data (abfd)->flags & F_PIC)
+
+#define APCS_SET(abfd) \
+ (coff_data (abfd)->flags & F_APCS_SET)
+
+#define SET_APCS_FLAGS(abfd, flgs) \
+ do \
+ { \
+ coff_data (abfd)->flags &= ~(F_APCS_26 | F_APCS_FLOAT | F_PIC); \
+ coff_data (abfd)->flags |= (flgs) | F_APCS_SET; \
+ } \
+ while (0)
+
+#define INTERWORK_FLAG(abfd) \
+ (coff_data (abfd)->flags & F_INTERWORK)
+
+#define INTERWORK_SET(abfd) \
+ (coff_data (abfd)->flags & F_INTERWORK_SET)
+
+#define SET_INTERWORK_FLAG(abfd, flg) \
+ do \
+ { \
+ coff_data (abfd)->flags &= ~F_INTERWORK; \
+ coff_data (abfd)->flags |= (flg) | F_INTERWORK_SET; \
+ } \
+ while (0)
#ifndef NUM_ELEM
#define NUM_ELEM(a) ((sizeof (a)) / sizeof ((a)[0]))
@@ -79,20 +100,21 @@ static boolean coff_arm_adjust_symndx
asection *, struct internal_reloc *, boolean *));
static reloc_howto_type * coff_arm_rtype_to_howto
PARAMS ((bfd *, asection *, struct internal_reloc *,
- struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *));
+ struct coff_link_hash_entry *, struct internal_syment *,
+ bfd_vma *));
static bfd_reloc_status_type coff_thumb_pcrel_common
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **,
thumb_pcrel_branchtype));
-static CONST struct reloc_howto_struct * coff_arm_reloc_type_lookup
+static const struct reloc_howto_struct * coff_arm_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static struct bfd_link_hash_table * coff_arm_link_hash_table_create
PARAMS ((bfd *));
static insn32 insert_thumb_branch
PARAMS ((insn32, int));
static struct coff_link_hash_entry * find_thumb_glue
- PARAMS ((struct bfd_link_info *, CONST char *, bfd *));
+ PARAMS ((struct bfd_link_info *, const char *, bfd *));
static struct coff_link_hash_entry * find_arm_glue
- PARAMS ((struct bfd_link_info *, CONST char *, bfd *));
+ PARAMS ((struct bfd_link_info *, const char *, bfd *));
#ifndef COFF_IMAGE_WITH_PE
static void record_arm_to_thumb_glue
PARAMS ((struct bfd_link_info *, struct coff_link_hash_entry *));
@@ -113,12 +135,13 @@ static boolean coff_arm_link_output_has_begun
PARAMS ((bfd *, struct coff_final_link_info *));
static boolean coff_arm_final_link_postscript
PARAMS ((bfd *, struct coff_final_link_info *));
+static void arm_emit_base_file_entry
+ PARAMS ((struct bfd_link_info *, bfd *, asection *, bfd_vma));
/* The linker script knows the section names for placement.
The entry_names are used to do simple name mangling on the stubs.
Given a function name, and its type, the stub can be found. The
- name can be changed. The only requirement is the %s be present.
- */
+ name can be changed. The only requirement is the %s be present. */
#define THUMB2ARM_GLUE_SECTION_NAME ".glue_7t"
#define THUMB2ARM_GLUE_ENTRY_NAME "__%s_from_thumb"
@@ -127,6 +150,7 @@ static boolean coff_arm_final_link_postscript
#define ARM2THUMB_GLUE_ENTRY_NAME "__%s_from_arm"
/* Used by the assembler. */
+
static bfd_reloc_status_type
coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
error_message)
@@ -144,8 +168,9 @@ coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
diff = reloc_entry->addend;
-#define DOIT(x) \
- x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask))
+#define DOIT(x) \
+ x = ((x & ~howto->dst_mask) \
+ | (((x & howto->src_mask) + diff) & howto->dst_mask))
if (diff != 0)
{
@@ -166,7 +191,7 @@ coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
{
short x = bfd_get_16 (abfd, addr);
DOIT (x);
- bfd_put_16 (abfd, x, addr);
+ bfd_put_16 (abfd, (bfd_vma) x, addr);
}
break;
@@ -174,7 +199,7 @@ coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
{
long x = bfd_get_32 (abfd, addr);
DOIT (x);
- bfd_put_32 (abfd, x, addr);
+ bfd_put_32 (abfd, (bfd_vma) x, addr);
}
break;
@@ -233,300 +258,300 @@ coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
#endif
static reloc_howto_type aoutarm_std_reloc_howto[] =
-{
- /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */
+ {
#ifdef ARM_WINCE
- EMPTY_HOWTO (-1),
- HOWTO (ARM_32,
- 0,
- 2,
- 32,
- false,
- 0,
- complain_overflow_bitfield,
- coff_arm_reloc,
- "ARM_32",
- true,
- 0xffffffff,
- 0xffffffff,
- PCRELOFFSET),
- HOWTO (ARM_RVA32,
- 0,
- 2,
- 32,
- false,
- 0,
- complain_overflow_bitfield,
- coff_arm_reloc,
- "ARM_RVA32",
- true,
- 0xffffffff,
- 0xffffffff,
- PCRELOFFSET),
- HOWTO (ARM_26,
- 2,
- 2,
- 24,
- true,
- 0,
- complain_overflow_signed,
- aoutarm_fix_pcrel_26 ,
- "ARM_26",
- false,
- 0x00ffffff,
- 0x00ffffff,
- PCRELOFFSET),
- HOWTO (ARM_THUMB12,
- 1,
- 1,
- 11,
- true,
- 0,
- complain_overflow_signed,
- coff_thumb_pcrel_12 ,
- "ARM_THUMB12",
- false,
- 0x000007ff,
- 0x000007ff,
- PCRELOFFSET),
- HOWTO (ARM_26D,
- 2,
- 2,
- 24,
- false,
- 0,
- complain_overflow_dont,
- aoutarm_fix_pcrel_26_done,
- "ARM_26D",
- true,
- 0x00ffffff,
- 0x0,
- false),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- EMPTY_HOWTO (-1),
- HOWTO (ARM_SECTION,
- 0,
- 1,
- 16,
- false,
- 0,
- complain_overflow_bitfield,
- coff_arm_reloc,
- "ARM_16",
- true,
- 0x0000ffff,
- 0x0000ffff,
- PCRELOFFSET),
- HOWTO (ARM_SECREL,
- 0,
- 2,
- 32,
- false,
- 0,
- complain_overflow_bitfield,
- coff_arm_reloc,
- "ARM_32",
- true,
- 0xffffffff,
- 0xffffffff,
- PCRELOFFSET),
+ EMPTY_HOWTO (-1),
+ HOWTO (ARM_32,
+ 0,
+ 2,
+ 32,
+ false,
+ 0,
+ complain_overflow_bitfield,
+ coff_arm_reloc,
+ "ARM_32",
+ true,
+ 0xffffffff,
+ 0xffffffff,
+ PCRELOFFSET),
+ HOWTO (ARM_RVA32,
+ 0,
+ 2,
+ 32,
+ false,
+ 0,
+ complain_overflow_bitfield,
+ coff_arm_reloc,
+ "ARM_RVA32",
+ true,
+ 0xffffffff,
+ 0xffffffff,
+ PCRELOFFSET),
+ HOWTO (ARM_26,
+ 2,
+ 2,
+ 24,
+ true,
+ 0,
+ complain_overflow_signed,
+ aoutarm_fix_pcrel_26 ,
+ "ARM_26",
+ false,
+ 0x00ffffff,
+ 0x00ffffff,
+ PCRELOFFSET),
+ HOWTO (ARM_THUMB12,
+ 1,
+ 1,
+ 11,
+ true,
+ 0,
+ complain_overflow_signed,
+ coff_thumb_pcrel_12 ,
+ "ARM_THUMB12",
+ false,
+ 0x000007ff,
+ 0x000007ff,
+ PCRELOFFSET),
+ HOWTO (ARM_26D,
+ 2,
+ 2,
+ 24,
+ false,
+ 0,
+ complain_overflow_dont,
+ aoutarm_fix_pcrel_26_done,
+ "ARM_26D",
+ true,
+ 0x00ffffff,
+ 0x0,
+ false),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ EMPTY_HOWTO (-1),
+ HOWTO (ARM_SECTION,
+ 0,
+ 1,
+ 16,
+ false,
+ 0,
+ complain_overflow_bitfield,
+ coff_arm_reloc,
+ "ARM_16",
+ true,
+ 0x0000ffff,
+ 0x0000ffff,
+ PCRELOFFSET),
+ HOWTO (ARM_SECREL,
+ 0,
+ 2,
+ 32,
+ false,
+ 0,
+ complain_overflow_bitfield,
+ coff_arm_reloc,
+ "ARM_32",
+ true,
+ 0xffffffff,
+ 0xffffffff,
+ PCRELOFFSET),
#else /* not ARM_WINCE */
- HOWTO(ARM_8, /* type */
- 0, /* rightshift */
- 0, /* size */
- 8, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- coff_arm_reloc, /* special_function */
- "ARM_8", /* name */
- true, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
- PCRELOFFSET /* pcrel_offset */),
- HOWTO(ARM_16,
- 0,
- 1,
- 16,
- false,
- 0,
- complain_overflow_bitfield,
- coff_arm_reloc,
- "ARM_16",
- true,
- 0x0000ffff,
- 0x0000ffff,
- PCRELOFFSET),
- HOWTO(ARM_32,
- 0,
- 2,
- 32,
- false,
- 0,
- complain_overflow_bitfield,
- coff_arm_reloc,
- "ARM_32",
- true,
- 0xffffffff,
- 0xffffffff,
- PCRELOFFSET),
- HOWTO(ARM_26,
- 2,
- 2,
- 24,
- true,
- 0,
- complain_overflow_signed,
- aoutarm_fix_pcrel_26 ,
- "ARM_26",
- false,
- 0x00ffffff,
- 0x00ffffff,
- PCRELOFFSET),
- HOWTO(ARM_DISP8,
- 0,
- 0,
- 8,
- true,
- 0,
- complain_overflow_signed,
- coff_arm_reloc,
- "ARM_DISP8",
- true,
- 0x000000ff,
- 0x000000ff,
- true),
- HOWTO( ARM_DISP16,
- 0,
- 1,
- 16,
- true,
- 0,
- complain_overflow_signed,
- coff_arm_reloc,
- "ARM_DISP16",
- true,
- 0x0000ffff,
- 0x0000ffff,
- true),
- HOWTO( ARM_DISP32,
- 0,
- 2,
- 32,
- true,
- 0,
- complain_overflow_signed,
- coff_arm_reloc,
- "ARM_DISP32",
- true,
- 0xffffffff,
- 0xffffffff,
- true),
- HOWTO( ARM_26D,
- 2,
- 2,
- 24,
- false,
- 0,
- complain_overflow_dont,
- aoutarm_fix_pcrel_26_done,
- "ARM_26D",
- true,
- 0x00ffffff,
- 0x0,
- false),
- /* 8 is unused */
- EMPTY_HOWTO (-1),
- HOWTO( ARM_NEG16,
- 0,
- -1,
- 16,
- false,
- 0,
- complain_overflow_bitfield,
- coff_arm_reloc,
- "ARM_NEG16",
- true,
- 0x0000ffff,
- 0x0000ffff,
- false),
- HOWTO( ARM_NEG32,
- 0,
- -2,
- 32,
- false,
- 0,
- complain_overflow_bitfield,
- coff_arm_reloc,
- "ARM_NEG32",
- true,
- 0xffffffff,
- 0xffffffff,
- false),
- HOWTO( ARM_RVA32,
- 0,
- 2,
- 32,
- false,
- 0,
- complain_overflow_bitfield,
- coff_arm_reloc,
- "ARM_RVA32",
- true,
- 0xffffffff,
- 0xffffffff,
- PCRELOFFSET),
- HOWTO( ARM_THUMB9,
- 1,
- 1,
- 8,
- true,
- 0,
- complain_overflow_signed,
- coff_thumb_pcrel_9 ,
- "ARM_THUMB9",
- false,
- 0x000000ff,
- 0x000000ff,
- PCRELOFFSET),
- HOWTO( ARM_THUMB12,
- 1,
- 1,
- 11,
- true,
- 0,
- complain_overflow_signed,
- coff_thumb_pcrel_12 ,
- "ARM_THUMB12",
- false,
- 0x000007ff,
- 0x000007ff,
- PCRELOFFSET),
- HOWTO( ARM_THUMB23,
- 1,
- 2,
- 22,
- true,
- 0,
- complain_overflow_signed,
- coff_thumb_pcrel_23 ,
- "ARM_THUMB23",
- false,
- 0x07ff07ff,
- 0x07ff07ff,
- PCRELOFFSET)
+ HOWTO (ARM_8, /* type */
+ 0, /* rightshift */
+ 0, /* size */
+ 8, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_arm_reloc, /* special_function */
+ "ARM_8", /* name */
+ true, /* partial_inplace */
+ 0x000000ff, /* src_mask */
+ 0x000000ff, /* dst_mask */
+ PCRELOFFSET /* pcrel_offset */),
+ HOWTO (ARM_16,
+ 0,
+ 1,
+ 16,
+ false,
+ 0,
+ complain_overflow_bitfield,
+ coff_arm_reloc,
+ "ARM_16",
+ true,
+ 0x0000ffff,
+ 0x0000ffff,
+ PCRELOFFSET),
+ HOWTO (ARM_32,
+ 0,
+ 2,
+ 32,
+ false,
+ 0,
+ complain_overflow_bitfield,
+ coff_arm_reloc,
+ "ARM_32",
+ true,
+ 0xffffffff,
+ 0xffffffff,
+ PCRELOFFSET),
+ HOWTO (ARM_26,
+ 2,
+ 2,
+ 24,
+ true,
+ 0,
+ complain_overflow_signed,
+ aoutarm_fix_pcrel_26 ,
+ "ARM_26",
+ false,
+ 0x00ffffff,
+ 0x00ffffff,
+ PCRELOFFSET),
+ HOWTO (ARM_DISP8,
+ 0,
+ 0,
+ 8,
+ true,
+ 0,
+ complain_overflow_signed,
+ coff_arm_reloc,
+ "ARM_DISP8",
+ true,
+ 0x000000ff,
+ 0x000000ff,
+ true),
+ HOWTO (ARM_DISP16,
+ 0,
+ 1,
+ 16,
+ true,
+ 0,
+ complain_overflow_signed,
+ coff_arm_reloc,
+ "ARM_DISP16",
+ true,
+ 0x0000ffff,
+ 0x0000ffff,
+ true),
+ HOWTO (ARM_DISP32,
+ 0,
+ 2,
+ 32,
+ true,
+ 0,
+ complain_overflow_signed,
+ coff_arm_reloc,
+ "ARM_DISP32",
+ true,
+ 0xffffffff,
+ 0xffffffff,
+ true),
+ HOWTO (ARM_26D,
+ 2,
+ 2,
+ 24,
+ false,
+ 0,
+ complain_overflow_dont,
+ aoutarm_fix_pcrel_26_done,
+ "ARM_26D",
+ true,
+ 0x00ffffff,
+ 0x0,
+ false),
+ /* 8 is unused */
+ EMPTY_HOWTO (-1),
+ HOWTO (ARM_NEG16,
+ 0,
+ -1,
+ 16,
+ false,
+ 0,
+ complain_overflow_bitfield,
+ coff_arm_reloc,
+ "ARM_NEG16",
+ true,
+ 0x0000ffff,
+ 0x0000ffff,
+ false),
+ HOWTO (ARM_NEG32,
+ 0,
+ -2,
+ 32,
+ false,
+ 0,
+ complain_overflow_bitfield,
+ coff_arm_reloc,
+ "ARM_NEG32",
+ true,
+ 0xffffffff,
+ 0xffffffff,
+ false),
+ HOWTO (ARM_RVA32,
+ 0,
+ 2,
+ 32,
+ false,
+ 0,
+ complain_overflow_bitfield,
+ coff_arm_reloc,
+ "ARM_RVA32",
+ true,
+ 0xffffffff,
+ 0xffffffff,
+ PCRELOFFSET),
+ HOWTO (ARM_THUMB9,
+ 1,
+ 1,
+ 8,
+ true,
+ 0,
+ complain_overflow_signed,
+ coff_thumb_pcrel_9 ,
+ "ARM_THUMB9",
+ false,
+ 0x000000ff,
+ 0x000000ff,
+ PCRELOFFSET),
+ HOWTO (ARM_THUMB12,
+ 1,
+ 1,
+ 11,
+ true,
+ 0,
+ complain_overflow_signed,
+ coff_thumb_pcrel_12 ,
+ "ARM_THUMB12",
+ false,
+ 0x000007ff,
+ 0x000007ff,
+ PCRELOFFSET),
+ HOWTO (ARM_THUMB23,
+ 1,
+ 2,
+ 22,
+ true,
+ 0,
+ complain_overflow_signed,
+ coff_thumb_pcrel_23 ,
+ "ARM_THUMB23",
+ false,
+ 0x07ff07ff,
+ 0x07ff07ff,
+ PCRELOFFSET)
#endif /* not ARM_WINCE */
-};
+ };
#define NUM_RELOCS NUM_ELEM (aoutarm_std_reloc_howto)
#ifdef COFF_WITH_PE
+static boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
/* Return true if this relocation should
appear in the output .reloc section. */
@@ -568,6 +593,7 @@ coff_arm_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
return howto;
}
+
/* Used by the assembler. */
static bfd_reloc_status_type
@@ -603,7 +629,7 @@ aoutarm_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section,
long target = bfd_get_32 (abfd, (bfd_byte *) data + addr);
bfd_reloc_status_type flag = bfd_reloc_ok;
- /* If this is an undefined symbol, return error */
+ /* If this is an undefined symbol, return error. */
if (symbol->section == &bfd_und_section
&& (symbol->flags & BSF_WEAK) == 0)
return output_bfd ? bfd_reloc_continue : bfd_reloc_undefined;
@@ -615,7 +641,7 @@ aoutarm_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section,
return bfd_reloc_continue;
relocation = (target & 0x00ffffff) << 2;
- relocation = (relocation ^ 0x02000000) - 0x02000000; /* Sign extend */
+ relocation = (relocation ^ 0x02000000) - 0x02000000; /* Sign extend. */
relocation += symbol->value;
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
@@ -627,18 +653,18 @@ aoutarm_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section,
if (relocation & 3)
return bfd_reloc_overflow;
- /* Check for overflow */
+ /* Check for overflow. */
if (relocation & 0x02000000)
{
if ((relocation & ~ (bfd_vma) 0x03ffffff) != ~ (bfd_vma) 0x03ffffff)
flag = bfd_reloc_overflow;
}
- else if (relocation & ~0x03ffffff)
+ else if (relocation & ~(bfd_vma) 0x03ffffff)
flag = bfd_reloc_overflow;
target &= ~0x00ffffff;
target |= (relocation >> 2) & 0x00ffffff;
- bfd_put_32 (abfd, target, (bfd_byte *) data + addr);
+ bfd_put_32 (abfd, (bfd_vma) target, (bfd_byte *) data + addr);
/* Now the ARM magic... Change the reloc type so that it is marked as done.
Strictly this is only necessary if we are doing a partial relocation. */
@@ -694,7 +720,7 @@ coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section,
abort ();
}
- /* If this is an undefined symbol, return error */
+ /* If this is an undefined symbol, return error. */
if (symbol->section == &bfd_und_section
&& (symbol->flags & BSF_WEAK) == 0)
return output_bfd ? bfd_reloc_continue : bfd_reloc_undefined;
@@ -723,7 +749,7 @@ coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section,
abort ();
}
- relocation = (relocation ^ signbit) - signbit; /* Sign extend */
+ relocation = (relocation ^ signbit) - signbit; /* Sign extend. */
relocation += symbol->value;
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
@@ -735,7 +761,7 @@ coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section,
if (relocation & 1)
return bfd_reloc_overflow;
- /* Check for overflow */
+ /* Check for overflow. */
if (relocation & signbit)
{
if ((relocation & ~offmsk) != ~offmsk)
@@ -754,22 +780,24 @@ coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section,
case b23:
if (bfd_big_endian (abfd))
- target |= ((relocation & 0xfff) >> 1) | ((relocation << 4) & 0x07ff0000);
+ target |= (((relocation & 0xfff) >> 1)
+ | ((relocation << 4) & 0x07ff0000));
else
- target |= ((relocation & 0xffe) << 15) | ((relocation >> 12) & 0x7ff);
+ target |= (((relocation & 0xffe) << 15)
+ | ((relocation >> 12) & 0x7ff));
break;
default:
abort ();
}
- bfd_put_32 (abfd, target, (bfd_byte *) data + addr);
+ bfd_put_32 (abfd, (bfd_vma) target, (bfd_byte *) data + addr);
/* Now the ARM magic... Change the reloc type so that it is marked as done.
Strictly this is only necessary if we are doing a partial relocation. */
reloc_entry->howto = & aoutarm_std_reloc_howto [ARM_26D];
- /* TODO: We should possibly have DONE entries for the THUMB PCREL relocations */
+ /* TODO: We should possibly have DONE entries for the THUMB PCREL relocations. */
return flag;
}
@@ -785,7 +813,8 @@ coff_thumb_pcrel_23 (abfd, reloc_entry, symbol, data, input_section,
char **error_message;
{
return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message, b23);
+ input_section, output_bfd, error_message,
+ b23);
}
static bfd_reloc_status_type
@@ -800,7 +829,8 @@ coff_thumb_pcrel_12 (abfd, reloc_entry, symbol, data, input_section,
char **error_message;
{
return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message, b12);
+ input_section, output_bfd, error_message,
+ b12);
}
static bfd_reloc_status_type
@@ -815,10 +845,11 @@ coff_thumb_pcrel_9 (abfd, reloc_entry, symbol, data, input_section,
char **error_message;
{
return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data,
- input_section, output_bfd, error_message, b9);
+ input_section, output_bfd, error_message,
+ b9);
}
-static CONST struct reloc_howto_struct *
+static const struct reloc_howto_struct *
coff_arm_reloc_type_lookup (abfd, code)
bfd * abfd;
bfd_reloc_code_real_type code;
@@ -831,7 +862,8 @@ coff_arm_reloc_type_lookup (abfd, code)
case 32:
code = BFD_RELOC_32;
break;
- default: return (CONST struct reloc_howto_struct *) 0;
+ default:
+ return (const struct reloc_howto_struct *) 0;
}
switch (code)
@@ -856,7 +888,7 @@ coff_arm_reloc_type_lookup (abfd, code)
ASTD (BFD_RELOC_THUMB_PCREL_BRANCH23, ARM_THUMB23);
ASTD (BFD_RELOC_THUMB_PCREL_BLX, ARM_THUMB23);
#endif
- default: return (CONST struct reloc_howto_struct *) 0;
+ default: return (const struct reloc_howto_struct *) 0;
}
}
@@ -872,21 +904,21 @@ coff_arm_reloc_type_lookup (abfd, code)
This allows us to store global data here without actually creating any
global variables, which is a no-no in the BFD world. */
struct coff_arm_link_hash_table
-{
- /* The original coff_link_hash_table structure. MUST be first field. */
- struct coff_link_hash_table root;
+ {
+ /* The original coff_link_hash_table structure. MUST be first field. */
+ struct coff_link_hash_table root;
- /* The size in bytes of the section containg the Thumb-to-ARM glue. */
- long int thumb_glue_size;
+ /* The size in bytes of the section containg the Thumb-to-ARM glue. */
+ bfd_size_type thumb_glue_size;
- /* The size in bytes of the section containg the ARM-to-Thumb glue. */
- long int arm_glue_size;
+ /* The size in bytes of the section containg the ARM-to-Thumb glue. */
+ bfd_size_type arm_glue_size;
- /* An arbitary input BFD chosen to hold the glue sections. */
- bfd * bfd_of_glue_owner;
+ /* An arbitary input BFD chosen to hold the glue sections. */
+ bfd * bfd_of_glue_owner;
- /* Support interworking with old, non-interworking aware ARM code. */
- int support_old_code;
+ /* Support interworking with old, non-interworking aware ARM code. */
+ int support_old_code;
};
/* Get the ARM coff linker hash table from a link_info structure. */
@@ -900,9 +932,9 @@ coff_arm_link_hash_table_create (abfd)
bfd * abfd;
{
struct coff_arm_link_hash_table * ret;
+ bfd_size_type amt = sizeof (struct coff_arm_link_hash_table);
- ret = ((struct coff_arm_link_hash_table *)
- bfd_alloc (abfd, sizeof (struct coff_arm_link_hash_table)));
+ ret = (struct coff_arm_link_hash_table *) bfd_alloc (abfd, amt);
if (ret == (struct coff_arm_link_hash_table *) NULL)
return NULL;
@@ -932,9 +964,9 @@ arm_emit_base_file_entry (info, output_bfd, input_section, reloc_offset)
+ input_section->output_offset
+ input_section->output_section->vma;
- if (coff_data(output_bfd)->pe)
- addr -= pe_data(output_bfd)->pe_opthdr.ImageBase;
- fwrite (&addr, 1, sizeof (addr), (FILE *) info->base_file);
+ if (coff_data (output_bfd)->pe)
+ addr -= pe_data (output_bfd)->pe_opthdr.ImageBase;
+ fwrite (& addr, 1, sizeof (addr), (FILE *) info->base_file);
}
@@ -964,7 +996,7 @@ arm_emit_base_file_entry (info, output_bfd, input_section, reloc_offset)
moves the computed address into the PC, so it must be the second one
in the sequence. The problem, however is that whilst little endian code
stores the instructions in HI then LOW order, big endian code does the
- reverse. nickc@cygnus.com */
+ reverse. nickc@cygnus.com. */
#define LOW_HI_ORDER 0xF800F000
#define HI_LOW_ORDER 0xF000F800
@@ -988,24 +1020,24 @@ insert_thumb_branch (br_insn, rel_off)
else if ((br_insn & HI_LOW_ORDER) == HI_LOW_ORDER)
br_insn = HI_LOW_ORDER | (high_bits << 16) | low_bits;
else
- abort (); /* error - not a valid branch instruction form */
-
- /* FIXME: abort is probably not the right call. krk@cygnus.com */
+ /* FIXME: the BFD library should never abort except for internal errors
+ - it should return an error status. */
+ abort (); /* Error - not a valid branch instruction form. */
return br_insn;
}
static struct coff_link_hash_entry *
find_thumb_glue (info, name, input_bfd)
- struct bfd_link_info * info;
- CONST char * name;
- bfd * input_bfd;
+ struct bfd_link_info *info;
+ const char *name;
+ bfd *input_bfd;
{
- char * tmp_name;
- struct coff_link_hash_entry * myh;
+ char *tmp_name;
+ struct coff_link_hash_entry *myh;
+ bfd_size_type amt = strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1;
- tmp_name = ((char *)
- bfd_malloc (strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1));
+ tmp_name = (char *) bfd_malloc (amt);
BFD_ASSERT (tmp_name);
@@ -1017,7 +1049,7 @@ find_thumb_glue (info, name, input_bfd)
if (myh == NULL)
/* xgettext:c-format */
_bfd_error_handler (_("%s: unable to find THUMB glue '%s' for `%s'"),
- bfd_get_filename (input_bfd), tmp_name, name);
+ bfd_archive_filename (input_bfd), tmp_name, name);
free (tmp_name);
@@ -1026,15 +1058,15 @@ find_thumb_glue (info, name, input_bfd)
static struct coff_link_hash_entry *
find_arm_glue (info, name, input_bfd)
- struct bfd_link_info * info;
- CONST char * name;
- bfd * input_bfd;
+ struct bfd_link_info *info;
+ const char *name;
+ bfd *input_bfd;
{
- char * tmp_name;
+ char *tmp_name;
struct coff_link_hash_entry * myh;
+ bfd_size_type amt = strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1;
- tmp_name = ((char *)
- bfd_malloc (strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1));
+ tmp_name = (char *) bfd_malloc (amt);
BFD_ASSERT (tmp_name);
@@ -1046,7 +1078,7 @@ find_arm_glue (info, name, input_bfd)
if (myh == NULL)
/* xgettext:c-format */
_bfd_error_handler (_("%s: unable to find ARM glue '%s' for `%s'"),
- bfd_get_filename (input_bfd), tmp_name, name);
+ bfd_archive_filename (input_bfd), tmp_name, name);
free (tmp_name);
@@ -1208,7 +1240,8 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
&& info->relocateable
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
- && h->root.u.def.section->output_section == input_section->output_section)
+ && (h->root.u.def.section->output_section
+ == input_section->output_section))
{
static reloc_howto_type fake_arm26_reloc =
HOWTO (ARM_26,
@@ -1246,10 +1279,10 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
continue;
/* FIXME - it is not clear which targets need this next test
and which do not. It is known that it is needed for the
- VXworks target (hence the #ifdef), but it is also known
- that it was supressed for other (arm) targets. This ought
- to be sorted out one day. */
-#ifdef VXWORKS
+ VxWorks and EPOC-PE targets, but it is also known that it
+ was supressed for other ARM targets. This ought to be
+ sorted out one day. */
+#ifdef ARM_COFF_BUGFIX
/* We must not ignore the symbol value. If the symbol is
within the same section, the relocation should have already
been fixed, but if it is not, we'll be handed a reloc into
@@ -1306,9 +1339,9 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
if ( h->class == C_THUMBSTATFUNC
|| h->class == C_THUMBEXTFUNC)
{
- /* Arm code calling a Thumb function */
+ /* Arm code calling a Thumb function. */
unsigned long int tmp;
- long int my_offset;
+ bfd_vma my_offset;
asection * s;
long int ret_offset;
struct coff_link_hash_entry * myh;
@@ -1340,20 +1373,20 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
_bfd_error_handler
/* xgettext:c-format */
(_("%s(%s): warning: interworking not enabled."),
- bfd_get_filename (h_sec->owner), name);
+ bfd_archive_filename (h_sec->owner), name);
_bfd_error_handler
/* xgettext:c-format */
(_(" first occurrence: %s: arm call to thumb"),
- bfd_get_filename (input_bfd));
+ bfd_archive_filename (input_bfd));
}
--my_offset;
myh->root.u.def.value = my_offset;
- bfd_put_32 (output_bfd, a2t1_ldr_insn,
+ bfd_put_32 (output_bfd, (bfd_vma) a2t1_ldr_insn,
s->contents + my_offset);
- bfd_put_32 (output_bfd, a2t2_bx_r12_insn,
+ bfd_put_32 (output_bfd, (bfd_vma) a2t2_bx_r12_insn,
s->contents + my_offset + 4);
/* It's a thumb address. Add the low order bit. */
@@ -1362,7 +1395,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
if (info->base_file)
arm_emit_base_file_entry (info, output_bfd, s,
- my_offset + 8);
+ my_offset + 8);
}
@@ -1385,14 +1418,14 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
tmp = tmp | ((ret_offset >> 2) & 0x00FFFFFF);
- bfd_put_32 (output_bfd, tmp, contents + rel->r_vaddr
- - input_section->vma);
+ bfd_put_32 (output_bfd, (bfd_vma) tmp,
+ contents + rel->r_vaddr - input_section->vma);
done = 1;
}
}
#ifndef ARM_WINCE
- /* Note: We used to check for ARM_THUMB9 and ARM_THUMB12 */
+ /* Note: We used to check for ARM_THUMB9 and ARM_THUMB12. */
else if (howto->type == ARM_THUMB23)
{
if ( h->class == C_EXT
@@ -1401,7 +1434,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
{
/* Thumb code calling an ARM function */
asection * s = 0;
- long int my_offset;
+ bfd_vma my_offset;
unsigned long int tmp;
long int ret_offset;
struct coff_link_hash_entry * myh;
@@ -1435,11 +1468,11 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
_bfd_error_handler
/* xgettext:c-format */
(_("%s(%s): warning: interworking not enabled."),
- bfd_get_filename (h_sec->owner), name);
+ bfd_archive_filename (h_sec->owner), name);
_bfd_error_handler
/* xgettext:c-format */
(_(" first occurrence: %s: thumb call to arm"),
- bfd_get_filename (input_bfd));
+ bfd_archive_filename (input_bfd));
_bfd_error_handler
(_(" consider relinking with --support-old-code enabled"));
}
@@ -1449,22 +1482,22 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
if (globals->support_old_code)
{
- bfd_put_16 (output_bfd, t2a1_push_insn,
+ bfd_put_16 (output_bfd, (bfd_vma) t2a1_push_insn,
s->contents + my_offset);
- bfd_put_16 (output_bfd, t2a2_ldr_insn,
+ bfd_put_16 (output_bfd, (bfd_vma) t2a2_ldr_insn,
s->contents + my_offset + 2);
- bfd_put_16 (output_bfd, t2a3_mov_insn,
+ bfd_put_16 (output_bfd, (bfd_vma) t2a3_mov_insn,
s->contents + my_offset + 4);
- bfd_put_16 (output_bfd, t2a4_bx_insn,
+ bfd_put_16 (output_bfd, (bfd_vma) t2a4_bx_insn,
s->contents + my_offset + 6);
- bfd_put_32 (output_bfd, t2a5_pop_insn,
+ bfd_put_32 (output_bfd, (bfd_vma) t2a5_pop_insn,
s->contents + my_offset + 8);
- bfd_put_32 (output_bfd, t2a6_bx_insn,
+ bfd_put_32 (output_bfd, (bfd_vma) t2a6_bx_insn,
s->contents + my_offset + 12);
/* Store the address of the function in the last word of the stub. */
@@ -1472,18 +1505,19 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
s->contents + my_offset + 16);
if (info->base_file)
- arm_emit_base_file_entry (info, output_bfd, s, my_offset + 16);
+ arm_emit_base_file_entry (info, output_bfd, s,
+ my_offset + 16);
}
else
{
- bfd_put_16 (output_bfd, t2a1_bx_pc_insn,
+ bfd_put_16 (output_bfd, (bfd_vma) t2a1_bx_pc_insn,
s->contents + my_offset);
- bfd_put_16 (output_bfd, t2a2_noop_insn,
+ bfd_put_16 (output_bfd, (bfd_vma) t2a2_noop_insn,
s->contents + my_offset + 2);
ret_offset =
- ((bfd_signed_vma) h_val) /* Address of destination of the stub */
+ ((bfd_signed_vma) h_val) /* Address of destination of the stub. */
- ((bfd_signed_vma)
(s->output_offset /* Offset from the start of the current section to the start of the stubs. */
+ my_offset /* Offset of the start of this stub from the start of the stubs. */
@@ -1492,7 +1526,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
+ 8); /* ARM branches work from the pc of the instruction + 8. */
bfd_put_32 (output_bfd,
- t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF),
+ (bfd_vma) t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF),
s->contents + my_offset + 4);
}
@@ -1513,9 +1547,9 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
- input_section->vma);
bfd_put_32 (output_bfd,
- insert_thumb_branch (tmp, ret_offset),
- contents + rel->r_vaddr
- - input_section->vma);
+ (bfd_vma) insert_thumb_branch (tmp,
+ ret_offset),
+ contents + rel->r_vaddr - input_section->vma);
done = 1;
}
@@ -1555,7 +1589,8 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
{
/* Emit a reloc if the backend thinks it needs it. */
if (sym && pe_data(output_bfd)->in_reloc_p(output_bfd, howto))
- arm_emit_base_file_entry (info, output_bfd, input_section, rel->r_vaddr);
+ arm_emit_base_file_entry (info, output_bfd, input_section,
+ rel->r_vaddr);
}
#if 1 /* THUMBEXTENSION */
@@ -1730,7 +1765,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section,
case bfd_reloc_outofrange:
(*_bfd_error_handler)
(_("%s: bad reloc address 0x%lx in section `%s'"),
- bfd_get_filename (input_bfd),
+ bfd_archive_filename (input_bfd),
(unsigned long) rel->r_vaddr,
bfd_get_section_name (input_bfd, input_section));
return false;
@@ -1787,10 +1822,10 @@ bfd_arm_allocate_interworking_sections (info)
BFD_ASSERT (s != NULL);
- foo = (bfd_byte *) bfd_alloc
- (globals->bfd_of_glue_owner, globals->arm_glue_size);
+ foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner,
+ globals->arm_glue_size);
#if 0
- memset (foo, test_char, globals->arm_glue_size);
+ memset (foo, test_char, (size_t) globals->arm_glue_size);
#endif
s->_raw_size = s->_cooked_size = globals->arm_glue_size;
@@ -1806,10 +1841,10 @@ bfd_arm_allocate_interworking_sections (info)
BFD_ASSERT (s != NULL);
- foo = (bfd_byte *) bfd_alloc
- (globals->bfd_of_glue_owner, globals->thumb_glue_size);
+ foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner,
+ globals->thumb_glue_size);
#if 0
- memset (foo, test_char, globals->thumb_glue_size);
+ memset (foo, test_char, (size_t) globals->thumb_glue_size);
#endif
s->_raw_size = s->_cooked_size = globals->thumb_glue_size;
@@ -1829,6 +1864,8 @@ record_arm_to_thumb_glue (info, h)
char * tmp_name;
struct coff_link_hash_entry * myh;
struct coff_arm_link_hash_table * globals;
+ bfd_vma val;
+ bfd_size_type amt;
globals = coff_arm_hash_table (info);
@@ -1840,8 +1877,8 @@ record_arm_to_thumb_glue (info, h)
BFD_ASSERT (s != NULL);
- tmp_name = ((char *)
- bfd_malloc (strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1));
+ amt = strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1;
+ tmp_name = (char *) bfd_malloc (amt);
BFD_ASSERT (tmp_name);
@@ -1860,10 +1897,9 @@ record_arm_to_thumb_glue (info, h)
though the section isn't allocated yet, this is where we will be putting
it. */
+ val = globals->arm_glue_size + 1;
bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
- BSF_GLOBAL,
- s, globals->arm_glue_size + 1,
- NULL, true, false,
+ BSF_GLOBAL, s, val, NULL, true, false,
(struct bfd_link_hash_entry **) & myh);
free (tmp_name);
@@ -1883,6 +1919,8 @@ record_thumb_to_arm_glue (info, h)
char * tmp_name;
struct coff_link_hash_entry * myh;
struct coff_arm_link_hash_table * globals;
+ bfd_vma val;
+ bfd_size_type amt;
globals = coff_arm_hash_table (info);
@@ -1894,7 +1932,8 @@ record_thumb_to_arm_glue (info, h)
BFD_ASSERT (s != NULL);
- tmp_name = (char *) bfd_malloc (strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1);
+ amt = strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1;
+ tmp_name = (char *) bfd_malloc (amt);
BFD_ASSERT (tmp_name);
@@ -1909,10 +1948,10 @@ record_thumb_to_arm_glue (info, h)
return; /* we've already seen this guy */
}
+ val = globals->thumb_glue_size + 1;
bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
- BSF_GLOBAL, s, globals->thumb_glue_size + 1,
- NULL, true, false,
- (struct bfd_link_hash_entry **) & myh);
+ BSF_GLOBAL, s, val, NULL, true, false,
+ (struct bfd_link_hash_entry **) &myh);
/* If we mark it 'thumb', the disassembler will do a better job. */
myh->class = C_THUMBEXTFUNC;
@@ -1924,18 +1963,17 @@ record_thumb_to_arm_glue (info, h)
#define CHANGE_TO_ARM "__%s_change_to_arm"
#define BACK_FROM_ARM "__%s_back_from_arm"
- tmp_name = (char *) bfd_malloc (strlen (name) + strlen (CHANGE_TO_ARM) + 1);
+ amt = strlen (name) + strlen (CHANGE_TO_ARM) + 1;
+ tmp_name = (char *) bfd_malloc (amt);
BFD_ASSERT (tmp_name);
sprintf (tmp_name, globals->support_old_code ? BACK_FROM_ARM : CHANGE_TO_ARM, name);
myh = NULL;
-
+ val = globals->thumb_glue_size + (globals->support_old_code ? 8 : 4);
bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name,
- BSF_LOCAL, s, globals->thumb_glue_size
- + (globals->support_old_code ? 8 : 4),
- NULL, true, false,
+ BSF_LOCAL, s, val, NULL, true, false,
(struct bfd_link_hash_entry **) & myh);
free (tmp_name);
@@ -2067,7 +2105,7 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code)
if (symndx >= obj_conv_table_size (abfd))
{
_bfd_error_handler (_("%s: illegal symbol index in reloc: %d"),
- bfd_get_filename (abfd), symndx);
+ bfd_archive_filename (abfd), symndx);
continue;
}
@@ -2195,7 +2233,7 @@ coff_arm_merge_private_bfd_data (ibfd, obfd)
_bfd_error_handler
/* xgettext: c-format */
(_("%s: ERROR: compiled for APCS-%d whereas target %s uses APCS-%d"),
- bfd_get_filename (ibfd), APCS_26_FLAG (ibfd) ? 26 : 32,
+ bfd_archive_filename (ibfd), APCS_26_FLAG (ibfd) ? 26 : 32,
bfd_get_filename (obfd), APCS_26_FLAG (obfd) ? 26 : 32
);
@@ -2214,7 +2252,7 @@ coff_arm_merge_private_bfd_data (ibfd, obfd)
/* xgettext: c-format */
msg = _("%s: ERROR: passes floats in integer registers whereas target %s uses float registers");
- _bfd_error_handler (msg, bfd_get_filename (ibfd),
+ _bfd_error_handler (msg, bfd_archive_filename (ibfd),
bfd_get_filename (obfd));
bfd_set_error (bfd_error_wrong_format);
@@ -2231,7 +2269,7 @@ coff_arm_merge_private_bfd_data (ibfd, obfd)
else
/* xgettext: c-format */
msg = _("%s: ERROR: compiled as absolute position code, whereas target %s is position independent");
- _bfd_error_handler (msg, bfd_get_filename (ibfd),
+ _bfd_error_handler (msg, bfd_archive_filename (ibfd),
bfd_get_filename (obfd));
bfd_set_error (bfd_error_wrong_format);
@@ -2264,7 +2302,7 @@ coff_arm_merge_private_bfd_data (ibfd, obfd)
/* xgettext: c-format */
msg = _("Warning: input file %s does not support interworking, whereas %s does.");
- _bfd_error_handler (msg, bfd_get_filename (ibfd),
+ _bfd_error_handler (msg, bfd_archive_filename (ibfd),
bfd_get_filename (obfd));
}
}
@@ -2361,11 +2399,11 @@ _bfd_coff_arm_set_private_flags (abfd, flags)
if (flag)
/* xgettext: c-format */
_bfd_error_handler (_("Warning: Not setting interworking flag of %s, since it has already been specified as non-interworking"),
- bfd_get_filename (abfd));
+ bfd_archive_filename (abfd));
else
/* xgettext: c-format */
_bfd_error_handler (_("Warning: Clearing the interworking flag of %s due to outside request"),
- bfd_get_filename (abfd));
+ bfd_archive_filename (abfd));
flag = 0;
}
@@ -2425,7 +2463,7 @@ coff_arm_copy_private_bfd_data (src, dest)
/* xgettext:c-format */
_bfd_error_handler (("Warning: Clearing the interworking bit of %s, because the non-interworking code in %s has been copied into it"),
bfd_get_filename (dest),
- bfd_get_filename (src));
+ bfd_archive_filename (src));
}
SET_INTERWORK_FLAG (dest, 0);
@@ -2471,7 +2509,7 @@ coff_arm_is_local_label_name (abfd, name)
if (LOCAL_LABEL_PREFIX[0] != 0)
{
- int len = strlen (LOCAL_LABEL_PREFIX);
+ size_t len = strlen (LOCAL_LABEL_PREFIX);
if (strncmp (name, LOCAL_LABEL_PREFIX, len) != 0)
return false;
diff --git a/contrib/binutils/bfd/coff-i386.c b/contrib/binutils/bfd/coff-i386.c
index 7d4ab5a..72c58a4 100644
--- a/contrib/binutils/bfd/coff-i386.c
+++ b/contrib/binutils/bfd/coff-i386.c
@@ -157,7 +157,7 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
{
short x = bfd_get_16 (abfd, addr);
DOIT (x);
- bfd_put_16 (abfd, x, addr);
+ bfd_put_16 (abfd, (bfd_vma) x, addr);
}
break;
@@ -165,7 +165,7 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
{
long x = bfd_get_32 (abfd, addr);
DOIT (x);
- bfd_put_32 (abfd, x, addr);
+ bfd_put_32 (abfd, (bfd_vma) x, addr);
}
break;
diff --git a/contrib/binutils/bfd/coff-ia64.c b/contrib/binutils/bfd/coff-ia64.c
index 776d3fa..76d1bf6 100644
--- a/contrib/binutils/bfd/coff-ia64.c
+++ b/contrib/binutils/bfd/coff-ia64.c
@@ -52,6 +52,8 @@ static reloc_howto_type howto_table[] =
/* Return true if this relocation should
appear in the output .reloc section. */
+static boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
+
static boolean
in_reloc_p(abfd, howto)
bfd * abfd ATTRIBUTE_UNUSED;
@@ -63,6 +65,8 @@ in_reloc_p(abfd, howto)
#include "coffcode.h"
+static const bfd_target *ia64coff_object_p PARAMS ((bfd *));
+
static const bfd_target *
ia64coff_object_p (abfd)
bfd *abfd;
@@ -73,9 +77,9 @@ ia64coff_object_p (abfd)
struct external_PEI_IMAGE_hdr image_hdr;
file_ptr offset;
- if (bfd_seek (abfd, 0x00, SEEK_SET) != 0
- || bfd_read (&dos_hdr, 1, sizeof (dos_hdr), abfd)
- != sizeof (dos_hdr))
+ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
+ || (bfd_bread (&dos_hdr, (bfd_size_type) sizeof (dos_hdr), abfd)
+ != sizeof (dos_hdr)))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
@@ -92,23 +96,23 @@ ia64coff_object_p (abfd)
this routine can only be called correctly for a PEI file, check
the e_magic number here, and, if it doesn't match, clobber the
f_magic number so that we don't get a false match. */
- if (bfd_h_get_16 (abfd, (bfd_byte *) dos_hdr.e_magic) != DOSMAGIC)
+ if (H_GET_16 (abfd, dos_hdr.e_magic) != DOSMAGIC)
{
bfd_set_error (bfd_error_wrong_format);
return NULL;
}
- offset = bfd_h_get_32 (abfd, (bfd_byte *) dos_hdr.e_lfanew);
- if (bfd_seek (abfd, (file_ptr) offset, SEEK_SET) != 0
- || bfd_read (&image_hdr, 1, sizeof (image_hdr), abfd)
- != sizeof (image_hdr))
+ offset = H_GET_32 (abfd, dos_hdr.e_lfanew);
+ if (bfd_seek (abfd, offset, SEEK_SET) != 0
+ || (bfd_bread (&image_hdr, (bfd_size_type) sizeof (image_hdr), abfd)
+ != sizeof (image_hdr)))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return NULL;
}
- if (bfd_h_get_32 (abfd, (bfd_byte *) image_hdr.nt_signature)
+ if (H_GET_32 (abfd, image_hdr.nt_signature)
!= 0x4550)
{
bfd_set_error (bfd_error_wrong_format);
@@ -118,10 +122,7 @@ ia64coff_object_p (abfd)
/* Here is the hack. coff_object_p wants to read filhsz bytes to
pick up the COFF header for PE, see "struct external_PEI_filehdr"
in include/coff/pe.h. We adjust so that that will work. */
- if (bfd_seek (abfd,
- (file_ptr) (offset - sizeof (dos_hdr)),
- SEEK_SET)
- != 0)
+ if (bfd_seek (abfd, offset - sizeof (dos_hdr), SEEK_SET) != 0)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
diff --git a/contrib/binutils/bfd/coff-ppc.c b/contrib/binutils/bfd/coff-ppc.c
index 2bf296a..f2bdfe5 100644
--- a/contrib/binutils/bfd/coff-ppc.c
+++ b/contrib/binutils/bfd/coff-ppc.c
@@ -202,9 +202,9 @@ ppc_coff_link_hash_table_create (abfd)
bfd *abfd;
{
struct ppc_coff_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct ppc_coff_link_hash_table);
- ret = ((struct ppc_coff_link_hash_table *)
- bfd_alloc (abfd, sizeof (struct ppc_coff_link_hash_table)));
+ ret = (struct ppc_coff_link_hash_table *) bfd_alloc (abfd, amt);
if (ret == NULL)
return NULL;
if (! ppc_coff_link_hash_table_init (ret, abfd,
@@ -833,7 +833,7 @@ enum ref_category
{
priv,
pub,
- data
+ tocdata
};
struct list_ele
@@ -849,18 +849,19 @@ extern struct list_ele *head;
extern struct list_ele *tail;
static void record_toc
- PARAMS ((asection *, int, enum ref_category, const char *));
+ PARAMS ((asection *, bfd_signed_vma, enum ref_category, const char *));
static void
record_toc (toc_section, our_toc_offset, cat, name)
asection *toc_section;
- int our_toc_offset;
+ bfd_signed_vma our_toc_offset;
enum ref_category cat;
const char *name;
{
/* add this entry to our toc addr-offset-name list */
- struct list_ele *t;
- t = (struct list_ele *) bfd_malloc (sizeof (struct list_ele));
+ bfd_size_type amt = sizeof (struct list_ele);
+ struct list_ele *t = (struct list_ele *) bfd_malloc (amt);
+
if (t == NULL)
abort ();
t->next = 0;
@@ -916,16 +917,16 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
if (local_syms == 0)
{
unsigned int i;
+ bfd_size_type amt;
/* allocate a table */
- local_syms =
- (int *) bfd_zalloc (abfd,
- obj_raw_syment_count(abfd) * sizeof (int));
+ amt = (bfd_size_type) obj_raw_syment_count (abfd) * sizeof (int);
+ local_syms = (int *) bfd_zalloc (abfd, amt);
if (local_syms == 0)
return false;
- obj_coff_local_toc_table(abfd) = local_syms;
- for (i = 0; i < obj_raw_syment_count(abfd); ++i)
+ obj_coff_local_toc_table (abfd) = local_syms;
+ for (i = 0; i < obj_raw_syment_count (abfd); ++i)
{
- SET_UNALLOCATED(local_syms[i]);
+ SET_UNALLOCATED (local_syms[i]);
}
}
@@ -1194,12 +1195,12 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
default:
(*_bfd_error_handler)
(_("%s: unsupported relocation type 0x%02x"),
- bfd_get_filename (input_bfd), r_type);
+ bfd_archive_filename (input_bfd), r_type);
bfd_set_error (bfd_error_bad_value);
return false;
case IMAGE_REL_PPC_TOCREL16:
{
- bfd_vma our_toc_offset;
+ bfd_signed_vma our_toc_offset;
int fixit;
DUMP_RELOC2(howto->name, rel);
@@ -1246,13 +1247,10 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
/* write out the toc entry */
- record_toc(toc_section,
- our_toc_offset,
- priv,
- strdup(name));
+ record_toc (toc_section, our_toc_offset, priv,
+ strdup (name));
- bfd_put_32 (output_bfd,
- val,
+ bfd_put_32 (output_bfd, val,
toc_section->contents + our_toc_offset);
MARK_AS_WRITTEN(local_toc_table[symndx]);
@@ -1282,21 +1280,22 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
the IAT to be part of the toc, thus saving a load.
*/
- our_toc_offset = val -
- (toc_section->output_section->vma +
- toc_section->output_offset);
+ our_toc_offset = val - (toc_section->output_section->vma
+ + toc_section->output_offset);
/* The size must still fit in a 16bit displacment */
- if (our_toc_offset >= 65535)
+ if ((bfd_vma) our_toc_offset >= 65535)
{
(*_bfd_error_handler)
- (_("%s: Relocation for %s of %x exceeds Toc size limit"),
- bfd_get_filename (input_bfd), name, our_toc_offset);
+ (_("%s: Relocation for %s of %lx exceeds Toc size limit"),
+ bfd_archive_filename (input_bfd), name,
+ (unsigned long) our_toc_offset);
bfd_set_error (bfd_error_bad_value);
return false;
}
- record_toc(toc_section, our_toc_offset, pub, strdup(name));
+ record_toc (toc_section, our_toc_offset, pub,
+ strdup (name));
}
else if (IS_WRITTEN(our_toc_offset))
{
@@ -1308,11 +1307,11 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
}
else
{
- record_toc(toc_section, our_toc_offset, pub, strdup(name));
+ record_toc(toc_section, our_toc_offset, pub,
+ strdup (name));
/* write out the toc entry */
- bfd_put_32 (output_bfd,
- val,
+ bfd_put_32 (output_bfd, val,
toc_section->contents + our_toc_offset);
MARK_AS_WRITTEN(h->toc_offset);
@@ -1331,8 +1330,8 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
isn't absolute - we output the address here
to a file */
- bfd_vma addr = toc_section->output_section->vma
- + toc_section->output_offset + our_toc_offset;
+ bfd_vma addr = (toc_section->output_section->vma
+ + toc_section->output_offset + our_toc_offset);
if (coff_data(output_bfd)->pe)
addr -= pe_data(output_bfd)->pe_opthdr.ImageBase;
@@ -1341,23 +1340,20 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
}
/* FIXME: this test is conservative */
- if ( (r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN &&
- our_toc_offset > toc_section->_raw_size)
+ if ((r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN
+ && (bfd_vma) our_toc_offset > toc_section->_raw_size)
{
(*_bfd_error_handler)
- (_("%s: Relocation exceeds allocated TOC (%x)"),
- bfd_get_filename (input_bfd),
- toc_section->_raw_size);
+ (_("%s: Relocation exceeds allocated TOC (%lx)"),
+ bfd_archive_filename (input_bfd),
+ (unsigned long) toc_section->_raw_size);
bfd_set_error (bfd_error_bad_value);
return false;
}
/* Now we know the relocation for this toc reference */
relocation = our_toc_offset + TOC_LOAD_ADJUSTMENT;
- rstat = _bfd_relocate_contents (howto,
- input_bfd,
- relocation,
- loc);
+ rstat = _bfd_relocate_contents (howto, input_bfd, relocation, loc);
}
break;
case IMAGE_REL_PPC_IFGLUE:
@@ -1377,7 +1373,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
if (h->symbol_is_glue == 1)
{
x = bfd_get_32 (input_bfd, loc);
- bfd_put_32 (input_bfd, h->glue_insn, loc);
+ bfd_put_32 (input_bfd, (bfd_vma) h->glue_insn, loc);
}
}
}
@@ -1406,7 +1402,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
fprintf (stderr,
_("Warning: unsupported reloc %s <file %s, section %s>\n"),
howto->name,
- bfd_get_filename(input_bfd),
+ bfd_archive_filename(input_bfd),
input_section->name);
fprintf (stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n",
@@ -1425,14 +1421,13 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
(*_bfd_error_handler)
(_("%s: Out of order IMGLUE reloc for %s"),
- bfd_get_filename (input_bfd), my_name);
+ bfd_archive_filename (input_bfd), my_name);
bfd_set_error (bfd_error_bad_value);
return false;
}
case IMAGE_REL_PPC_ADDR32NB:
{
- struct coff_link_hash_entry *myh = 0;
const char *name = 0;
DUMP_RELOC2(howto->name, rel);
@@ -1440,7 +1435,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
{
/* set magic values */
int idata5offset;
- struct coff_link_hash_entry *myh = 0;
+ struct coff_link_hash_entry *myh;
myh = coff_link_hash_lookup (coff_hash_table (info),
"__idata5_magic__",
false, false, true);
@@ -1480,7 +1475,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
if (target != 0)
{
- myh = 0;
+ struct coff_link_hash_entry *myh;
myh = coff_link_hash_lookup (coff_hash_table (info),
target,
@@ -1654,7 +1649,7 @@ dump_toc (vfile)
cat = _("private ");
else if (t->cat == pub)
cat = _("public ");
- else if (t->cat == data)
+ else if (t->cat == tocdata)
cat = _("data-in-toc ");
if (t->offset > global_toc_size)
@@ -1665,7 +1660,8 @@ dump_toc (vfile)
{
fprintf (file,
_("**** global_toc_size %ld(%lx), thunk_size %ld(%lx)\n"),
- global_toc_size, global_toc_size, thunk_size, thunk_size);
+ global_toc_size, global_toc_size,
+ thunk_size, thunk_size);
cat = _("Out of bounds!");
}
}
@@ -1687,6 +1683,7 @@ ppc_allocate_toc_section (info)
{
asection *s;
bfd_byte *foo;
+ bfd_size_type amt;
static char test_char = '1';
if ( global_toc_size == 0 ) /* FIXME: does this get me in trouble? */
@@ -1705,8 +1702,9 @@ ppc_allocate_toc_section (info)
abort ();
}
- foo = (bfd_byte *) bfd_alloc(bfd_of_toc_owner, global_toc_size);
- memset(foo, test_char, global_toc_size);
+ amt = global_toc_size;
+ foo = (bfd_byte *) bfd_alloc (bfd_of_toc_owner, amt);
+ memset(foo, test_char, (size_t) global_toc_size);
s->_raw_size = s->_cooked_size = global_toc_size;
s->contents = foo;
@@ -2178,10 +2176,6 @@ ppc_coff_reloc_type_lookup (abfd, code)
#define RTYPE2HOWTO(cache_ptr, dst) ppc_coff_rtype2howto (cache_ptr, dst)
-#ifndef COFF_IMAGE_WITH_PE
-static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR));
-#endif
-
/* We use the special COFF backend linker, with our own special touch. */
#define coff_bfd_reloc_type_lookup ppc_coff_reloc_type_lookup
@@ -2191,8 +2185,10 @@ static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR));
#ifndef COFF_IMAGE_WITH_PE
/* FIXME: This no longer works. */
+#if 0
#define coff_swap_sym_in_hook ppc_coff_swap_sym_in_hook
#endif
+#endif
#define SELECT_RELOC(internal, howto) {internal.r_type=howto->type;}
@@ -2220,6 +2216,8 @@ static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR));
#include "coffcode.h"
#ifndef COFF_IMAGE_WITH_PE
+/* FIXME: This no longer works. */
+#if 0
/* FIXME:
What we're trying to do here is allocate a toc section (early), and attach
it to the last bfd to be processed. This avoids the problem of having a toc
@@ -2233,6 +2231,7 @@ static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR));
3. Doing it on a "swap in" hook depends on when the "swap in" is called,
and how often, etc. It's not clear to me that there isn't a hole here.
*/
+static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR));
static void
ppc_coff_swap_sym_in_hook (abfd, ext1, in1)
@@ -2275,6 +2274,7 @@ ppc_coff_swap_sym_in_hook (abfd, ext1, in1)
return;
}
#endif
+#endif
#ifndef COFF_IMAGE_WITH_PE
@@ -2321,11 +2321,11 @@ ppc_bfd_coff_final_link (abfd, info)
boolean debug_merge_allocated;
asection *o;
struct bfd_link_order *p;
- size_t max_sym_count;
- size_t max_lineno_count;
- size_t max_reloc_count;
- size_t max_output_reloc_count;
- size_t max_contents_size;
+ bfd_size_type max_sym_count;
+ bfd_size_type max_lineno_count;
+ bfd_size_type max_reloc_count;
+ bfd_size_type max_output_reloc_count;
+ bfd_size_type max_contents_size;
file_ptr rel_filepos;
unsigned int relsz;
file_ptr line_filepos;
@@ -2333,6 +2333,7 @@ ppc_bfd_coff_final_link (abfd, info)
bfd *sub;
bfd_byte *external_relocs = NULL;
char strbuf[STRING_SIZE_SIZE];
+ bfd_size_type amt;
symesz = bfd_coff_symesz (abfd);
@@ -2433,10 +2434,9 @@ ppc_bfd_coff_final_link (abfd, info)
/* We use section_count + 1, rather than section_count, because
the target_index fields are 1 based. */
- finfo.section_info =
- ((struct coff_link_section_info *)
- bfd_malloc ((abfd->section_count + 1)
- * sizeof (struct coff_link_section_info)));
+ amt = abfd->section_count + 1;
+ amt *= sizeof (struct coff_link_section_info);
+ finfo.section_info = (struct coff_link_section_info *) bfd_malloc (amt);
if (finfo.section_info == NULL)
goto error_return;
for (i = 0; i <= abfd->section_count; i++)
@@ -2477,13 +2477,14 @@ ppc_bfd_coff_final_link (abfd, info)
but only when doing a relocateable link, which is not the
common case. */
BFD_ASSERT (info->relocateable);
+ amt = o->reloc_count;
+ amt *= sizeof (struct internal_reloc);
finfo.section_info[o->target_index].relocs =
- ((struct internal_reloc *)
- bfd_malloc (o->reloc_count * sizeof (struct internal_reloc)));
+ (struct internal_reloc *) bfd_malloc (amt);
+ amt = o->reloc_count;
+ amt *= sizeof (struct coff_link_hash_entry *);
finfo.section_info[o->target_index].rel_hashes =
- ((struct coff_link_hash_entry **)
- bfd_malloc (o->reloc_count
- * sizeof (struct coff_link_hash_entry *)));
+ (struct coff_link_hash_entry **) bfd_malloc (amt);
if (finfo.section_info[o->target_index].relocs == NULL
|| finfo.section_info[o->target_index].rel_hashes == NULL)
goto error_return;
@@ -2506,7 +2507,7 @@ ppc_bfd_coff_final_link (abfd, info)
max_sym_count = 0;
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
{
- size_t sz;
+ bfd_size_type sz;
sub->output_has_begun = false;
sz = obj_raw_syment_count (sub);
@@ -2515,22 +2516,23 @@ ppc_bfd_coff_final_link (abfd, info)
}
/* Allocate some buffers used while linking. */
- finfo.internal_syms = ((struct internal_syment *)
- bfd_malloc (max_sym_count
- * sizeof (struct internal_syment)));
- finfo.sec_ptrs = (asection **) bfd_malloc (max_sym_count
- * sizeof (asection *));
- finfo.sym_indices = (long *) bfd_malloc (max_sym_count * sizeof (long));
- finfo.outsyms = ((bfd_byte *)
- bfd_malloc ((size_t) ((max_sym_count + 1) * symesz)));
- finfo.linenos = (bfd_byte *) bfd_malloc (max_lineno_count
- * bfd_coff_linesz (abfd));
+ amt = max_sym_count * sizeof (struct internal_syment);
+ finfo.internal_syms = (struct internal_syment *) bfd_malloc (amt);
+ amt = max_sym_count * sizeof (asection *);
+ finfo.sec_ptrs = (asection **) bfd_malloc (amt);
+ amt = max_sym_count * sizeof (long);
+ finfo.sym_indices = (long *) bfd_malloc (amt);
+ amt = (max_sym_count + 1) * symesz;
+ finfo.outsyms = (bfd_byte *) bfd_malloc (amt);
+ amt = max_lineno_count * bfd_coff_linesz (abfd);
+ finfo.linenos = (bfd_byte *) bfd_malloc (amt);
finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
finfo.external_relocs = (bfd_byte *) bfd_malloc (max_reloc_count * relsz);
if (! info->relocateable)
- finfo.internal_relocs = ((struct internal_reloc *)
- bfd_malloc (max_reloc_count
- * sizeof (struct internal_reloc)));
+ {
+ amt = max_reloc_count * sizeof (struct internal_reloc);
+ finfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt);
+ }
if ((finfo.internal_syms == NULL && max_sym_count > 0)
|| (finfo.sec_ptrs == NULL && max_sym_count > 0)
|| (finfo.sym_indices == NULL && max_sym_count > 0)
@@ -2649,14 +2651,14 @@ ppc_bfd_coff_final_link (abfd, info)
if (finfo.last_file_index != -1
&& (unsigned int) finfo.last_file.n_value != obj_raw_syment_count (abfd))
{
+ file_ptr pos;
+
finfo.last_file.n_value = obj_raw_syment_count (abfd);
bfd_coff_swap_sym_out (abfd, (PTR) &finfo.last_file,
(PTR) finfo.outsyms);
- if (bfd_seek (abfd,
- (obj_sym_filepos (abfd)
- + finfo.last_file_index * symesz),
- SEEK_SET) != 0
- || bfd_write (finfo.outsyms, symesz, 1, abfd) != symesz)
+ pos = obj_sym_filepos (abfd) + finfo.last_file_index * symesz;
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0
+ || bfd_bwrite (finfo.outsyms, symesz, abfd) != symesz)
return false;
}
@@ -2679,8 +2681,8 @@ ppc_bfd_coff_final_link (abfd, info)
/* Now that we have written out all the global symbols, we know
the symbol indices to use for relocs against them, and we can
finally write out the relocs. */
- external_relocs = ((bfd_byte *)
- bfd_malloc (max_output_reloc_count * relsz));
+ amt = max_output_reloc_count * relsz;
+ external_relocs = (bfd_byte *) bfd_malloc (amt);
if (external_relocs == NULL)
goto error_return;
@@ -2708,9 +2710,9 @@ ppc_bfd_coff_final_link (abfd, info)
bfd_coff_swap_reloc_out (abfd, (PTR) irel, (PTR) erel);
}
+ amt = relsz * o->reloc_count;
if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0
- || bfd_write ((PTR) external_relocs, relsz, o->reloc_count,
- abfd) != relsz * o->reloc_count)
+ || bfd_bwrite ((PTR) external_relocs, amt, abfd) != amt)
goto error_return;
}
@@ -2744,21 +2746,22 @@ ppc_bfd_coff_final_link (abfd, info)
/* Write out the string table. */
if (obj_raw_syment_count (abfd) != 0)
{
- if (bfd_seek (abfd,
- (obj_sym_filepos (abfd)
- + obj_raw_syment_count (abfd) * symesz),
- SEEK_SET) != 0)
+ file_ptr pos;
+
+ pos = obj_sym_filepos (abfd) + obj_raw_syment_count (abfd) * symesz;
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0)
return false;
#if STRING_SIZE_SIZE == 4
- bfd_h_put_32 (abfd,
- _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE,
- (bfd_byte *) strbuf);
+ H_PUT_32 (abfd,
+ _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE,
+ strbuf);
#else
- #error Change bfd_h_put_32
+ #error Change H_PUT_32 above
#endif
- if (bfd_write (strbuf, 1, STRING_SIZE_SIZE, abfd) != STRING_SIZE_SIZE)
+ if (bfd_bwrite (strbuf, (bfd_size_type) STRING_SIZE_SIZE, abfd)
+ != STRING_SIZE_SIZE)
return false;
if (! _bfd_stringtab_emit (abfd, finfo.strtab))
diff --git a/contrib/binutils/bfd/coff-rs6000.c b/contrib/binutils/bfd/coff-rs6000.c
index ed47000..2d6d6e9 100644
--- a/contrib/binutils/bfd/coff-rs6000.c
+++ b/contrib/binutils/bfd/coff-rs6000.c
@@ -29,17 +29,123 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
+#include "bfdlink.h"
#include "libbfd.h"
#include "coff/internal.h"
+#include "coff/xcoff.h"
#include "coff/rs6000.h"
#include "libcoff.h"
-#define TARGET_NAME "aixcoff-rs6000"
-#define TARGET_SYM rs6000coff_vec
-#include "xcoff-target.h"
+#include "libxcoff.h"
+
+extern boolean _bfd_xcoff_mkobject PARAMS ((bfd *));
+extern boolean _bfd_xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *));
+extern boolean _bfd_xcoff_is_local_label_name PARAMS ((bfd *, const char *));
+extern reloc_howto_type *_bfd_xcoff_reloc_type_lookup
+ PARAMS ((bfd *, bfd_reloc_code_real_type));
+extern boolean _bfd_xcoff_slurp_armap PARAMS ((bfd *));
+extern const bfd_target *_bfd_xcoff_archive_p PARAMS ((bfd *));
+extern PTR _bfd_xcoff_read_ar_hdr PARAMS ((bfd *));
+extern bfd *_bfd_xcoff_openr_next_archived_file PARAMS ((bfd *, bfd *));
+extern int _bfd_xcoff_generic_stat_arch_elt PARAMS ((bfd *, struct stat *));
+extern boolean _bfd_xcoff_write_armap
+ PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
+extern boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *));
+extern int _bfd_xcoff_sizeof_headers PARAMS ((bfd *, boolean));
+extern void _bfd_xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR));
+extern unsigned int _bfd_xcoff_swap_sym_out PARAMS ((bfd *, PTR, PTR));
+extern void _bfd_xcoff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
+extern unsigned int _bfd_xcoff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR));
+
+/* Forward declare _bfd_xcoff_rtype2howto for coffcode.h macro. */
+void _bfd_xcoff_rtype2howto PARAMS ((arelent *, struct internal_reloc *));
+
+/* coffcode.h needs these to be defined. */
+#define RS6000COFF_C 1
+
+#define SELECT_RELOC(internal, howto) \
+ { \
+ internal.r_type = howto->type; \
+ internal.r_size = \
+ ((howto->complain_on_overflow == complain_overflow_signed \
+ ? 0x80 \
+ : 0) \
+ | (howto->bitsize - 1)); \
+ }
+
+#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
+#define COFF_LONG_FILENAMES
+#define NO_COFF_SYMBOLS
+#define RTYPE2HOWTO(cache_ptr, dst) _bfd_xcoff_rtype2howto (cache_ptr, dst)
+#define coff_mkobject _bfd_xcoff_mkobject
+#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data
+#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
+#define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup
+#ifdef AIX_CORE
+extern const bfd_target * rs6000coff_core_p ();
+extern boolean rs6000coff_core_file_matches_executable_p ();
+extern char *rs6000coff_core_file_failing_command PARAMS ((bfd *abfd));
+extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd));
+#define CORE_FILE_P rs6000coff_core_p
+#define coff_core_file_failing_command \
+ rs6000coff_core_file_failing_command
+#define coff_core_file_failing_signal \
+ rs6000coff_core_file_failing_signal
+#define coff_core_file_matches_executable_p \
+ rs6000coff_core_file_matches_executable_p
+#else
+#define CORE_FILE_P _bfd_dummy_target
+#define coff_core_file_failing_command \
+ _bfd_nocore_core_file_failing_command
+#define coff_core_file_failing_signal \
+ _bfd_nocore_core_file_failing_signal
+#define coff_core_file_matches_executable_p \
+ _bfd_nocore_core_file_matches_executable_p
+#endif
+#define coff_SWAP_sym_in _bfd_xcoff_swap_sym_in
+#define coff_SWAP_sym_out _bfd_xcoff_swap_sym_out
+#define coff_SWAP_aux_in _bfd_xcoff_swap_aux_in
+#define coff_SWAP_aux_out _bfd_xcoff_swap_aux_out
+
+#include "coffcode.h"
/* The main body of code is in coffcode.h. */
static const char *normalize_filename PARAMS ((bfd *));
+static boolean xcoff_write_armap_old
+ PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
+static boolean xcoff_write_armap_big
+ PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
+static boolean xcoff_write_archive_contents_old PARAMS ((bfd *));
+static boolean xcoff_write_archive_contents_big PARAMS ((bfd *));
+static void xcoff_swap_ldhdr_in
+ PARAMS ((bfd *, const PTR, struct internal_ldhdr *));
+static void xcoff_swap_ldhdr_out
+ PARAMS ((bfd *, const struct internal_ldhdr *, PTR));
+static void xcoff_swap_ldsym_in
+ PARAMS ((bfd *, const PTR, struct internal_ldsym *));
+static void xcoff_swap_ldsym_out
+ PARAMS ((bfd *, const struct internal_ldsym *, PTR));
+static void xcoff_swap_ldrel_in
+ PARAMS ((bfd *, const PTR, struct internal_ldrel *));
+static void xcoff_swap_ldrel_out
+ PARAMS ((bfd *, const struct internal_ldrel *, PTR));
+static boolean xcoff_ppc_relocate_section
+ PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+ struct internal_reloc *, struct internal_syment *, asection **));
+static boolean _bfd_xcoff_put_ldsymbol_name
+ PARAMS ((bfd *, struct xcoff_loader_info *, struct internal_ldsym *,
+ const char *));
+static asection *xcoff_create_csect_from_smclas
+ PARAMS ((bfd *, union internal_auxent *, const char *));
+static boolean xcoff_is_lineno_count_overflow PARAMS ((bfd *, bfd_vma));
+static boolean xcoff_is_reloc_count_overflow PARAMS ((bfd *, bfd_vma));
+static bfd_vma xcoff_loader_symbol_offset
+ PARAMS ((bfd *, struct internal_ldhdr *));
+static bfd_vma xcoff_loader_reloc_offset
+ PARAMS ((bfd *, struct internal_ldhdr *));
+static boolean xcoff_generate_rtinit
+ PARAMS((bfd *, const char *, const char *));
+
/* We use our own tdata type. Its first field is the COFF tdata type,
so the COFF routines are compatible. */
@@ -49,10 +155,9 @@ _bfd_xcoff_mkobject (abfd)
bfd *abfd;
{
coff_data_type *coff;
+ bfd_size_type amt = sizeof (struct xcoff_tdata);
- abfd->tdata.xcoff_obj_data =
- ((struct xcoff_tdata *)
- bfd_zalloc (abfd, sizeof (struct xcoff_tdata)));
+ abfd->tdata.xcoff_obj_data = (struct xcoff_tdata *) bfd_zalloc (abfd, amt);
if (abfd->tdata.xcoff_obj_data == NULL)
return false;
coff = coff_data (abfd);
@@ -70,6 +175,9 @@ _bfd_xcoff_mkobject (abfd)
xcoff_data (abfd)->csects = NULL;
xcoff_data (abfd)->debug_indices = NULL;
+ /* text section alignment is different than the default */
+ /* xcoff_data (abfd)->text_align_power = 5; */
+
return true;
}
@@ -138,7 +246,7 @@ _bfd_xcoff_swap_sym_in (abfd, ext1, in1)
PTR in1;
{
SYMENT *ext = (SYMENT *)ext1;
- struct internal_syment *in = (struct internal_syment *)in1;
+ struct internal_syment * in = (struct internal_syment *)in1;
if (ext->e.e_name[0] != 0)
{
@@ -147,15 +255,14 @@ _bfd_xcoff_swap_sym_in (abfd, ext1, in1)
else
{
in->_n._n_n._n_zeroes = 0;
- in->_n._n_n._n_offset =
- bfd_h_get_32(abfd, (bfd_byte *) ext->e.e.e_offset);
+ in->_n._n_n._n_offset = H_GET_32 (abfd, ext->e.e.e_offset);
}
- in->n_value = bfd_h_get_32(abfd, (bfd_byte *) ext->e_value);
- in->n_scnum = bfd_h_get_16(abfd, (bfd_byte *) ext->e_scnum);
- in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type);
- in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass);
- in->n_numaux = bfd_h_get_8(abfd, ext->e_numaux);
+ in->n_value = H_GET_32 (abfd, ext->e_value);
+ in->n_scnum = H_GET_16 (abfd, ext->e_scnum);
+ in->n_type = H_GET_16 (abfd, ext->e_type);
+ in->n_sclass = H_GET_8 (abfd, ext->e_sclass);
+ in->n_numaux = H_GET_8 (abfd, ext->e_numaux);
}
unsigned int
@@ -173,26 +280,18 @@ _bfd_xcoff_swap_sym_out (abfd, inp, extp)
}
else
{
- bfd_h_put_32(abfd, 0, (bfd_byte *) ext->e.e.e_zeroes);
- bfd_h_put_32(abfd, in->_n._n_n._n_offset,
- (bfd_byte *) ext->e.e.e_offset);
+ H_PUT_32 (abfd, 0, ext->e.e.e_zeroes);
+ H_PUT_32 (abfd, in->_n._n_n._n_offset, ext->e.e.e_offset);
}
- bfd_h_put_32(abfd, in->n_value , (bfd_byte *) ext->e_value);
- bfd_h_put_16(abfd, in->n_scnum , (bfd_byte *) ext->e_scnum);
- bfd_h_put_16(abfd, in->n_type , (bfd_byte *) ext->e_type);
- bfd_h_put_8(abfd, in->n_sclass , ext->e_sclass);
- bfd_h_put_8(abfd, in->n_numaux , ext->e_numaux);
+ H_PUT_32 (abfd, in->n_value, ext->e_value);
+ H_PUT_16 (abfd, in->n_scnum, ext->e_scnum);
+ H_PUT_16 (abfd, in->n_type, ext->e_type);
+ H_PUT_8 (abfd, in->n_sclass, ext->e_sclass);
+ H_PUT_8 (abfd, in->n_numaux, ext->e_numaux);
return bfd_coff_symesz (abfd);
}
-#define PUTWORD bfd_h_put_32
-#define PUTHALF bfd_h_put_16
-#define PUTBYTE bfd_h_put_8
-#define GETWORD bfd_h_get_32
-#define GETHALF bfd_h_get_16
-#define GETBYTE bfd_h_get_8
-
void
_bfd_xcoff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
bfd *abfd;
@@ -203,27 +302,31 @@ _bfd_xcoff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
int numaux;
PTR in1;
{
- AUXENT *ext = (AUXENT *)ext1;
+ AUXENT * ext = (AUXENT *)ext1;
union internal_auxent *in = (union internal_auxent *)in1;
- switch (class) {
+ switch (class)
+ {
case C_FILE:
- if (ext->x_file.x_fname[0] == 0) {
+ if (ext->x_file.x_fname[0] == 0)
+ {
in->x_file.x_n.x_zeroes = 0;
in->x_file.x_n.x_offset =
- bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset);
- } else {
- if (numaux > 1)
- {
- if (indx == 0)
- memcpy (in->x_file.x_fname, ext->x_file.x_fname,
- numaux * sizeof (AUXENT));
- }
- else
- {
- memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
- }
- }
+ H_GET_32 (abfd, ext->x_file.x_n.x_offset);
+ }
+ else
+ {
+ if (numaux > 1)
+ {
+ if (indx == 0)
+ memcpy (in->x_file.x_fname, ext->x_file.x_fname,
+ numaux * sizeof (AUXENT));
+ }
+ else
+ {
+ memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
+ }
+ }
goto end;
/* RS/6000 "csect" auxents */
@@ -231,18 +334,16 @@ _bfd_xcoff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
case C_HIDEXT:
if (indx + 1 == numaux)
{
- in->x_csect.x_scnlen.l =
- bfd_h_get_32 (abfd, ext->x_csect.x_scnlen);
- in->x_csect.x_parmhash = bfd_h_get_32 (abfd,
- ext->x_csect.x_parmhash);
- in->x_csect.x_snhash = bfd_h_get_16 (abfd, ext->x_csect.x_snhash);
+ in->x_csect.x_scnlen.l = H_GET_32 (abfd, ext->x_csect.x_scnlen);
+ in->x_csect.x_parmhash = H_GET_32 (abfd, ext->x_csect.x_parmhash);
+ in->x_csect.x_snhash = H_GET_16 (abfd, ext->x_csect.x_snhash);
/* We don't have to hack bitfields in x_smtyp because it's
defined by shifts-and-ands, which are equivalent on all
byte orders. */
- in->x_csect.x_smtyp = bfd_h_get_8 (abfd, ext->x_csect.x_smtyp);
- in->x_csect.x_smclas = bfd_h_get_8 (abfd, ext->x_csect.x_smclas);
- in->x_csect.x_stab = bfd_h_get_32 (abfd, ext->x_csect.x_stab);
- in->x_csect.x_snstab = bfd_h_get_16 (abfd, ext->x_csect.x_snstab);
+ in->x_csect.x_smtyp = H_GET_8 (abfd, ext->x_csect.x_smtyp);
+ in->x_csect.x_smclas = H_GET_8 (abfd, ext->x_csect.x_smclas);
+ in->x_csect.x_stab = H_GET_32 (abfd, ext->x_csect.x_stab);
+ in->x_csect.x_snstab = H_GET_16 (abfd, ext->x_csect.x_snstab);
goto end;
}
break;
@@ -250,13 +351,11 @@ _bfd_xcoff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
case C_STAT:
case C_LEAFSTAT:
case C_HIDDEN:
- if (type == T_NULL) {
- in->x_scn.x_scnlen = bfd_h_get_32(abfd,
- (bfd_byte *) ext->x_scn.x_scnlen);
- in->x_scn.x_nreloc = bfd_h_get_16(abfd,
- (bfd_byte *) ext->x_scn.x_nreloc);
- in->x_scn.x_nlinno = bfd_h_get_16(abfd,
- (bfd_byte *) ext->x_scn.x_nlinno);
+ if (type == T_NULL)
+ {
+ in->x_scn.x_scnlen = H_GET_32 (abfd, ext->x_scn.x_scnlen);
+ in->x_scn.x_nreloc = H_GET_16 (abfd, ext->x_scn.x_nreloc);
+ in->x_scn.x_nlinno = H_GET_16 (abfd, ext->x_scn.x_nlinno);
/* PE defines some extra fields; we zero them out for
safety. */
in->x_scn.x_checksum = 0;
@@ -268,52 +367,57 @@ _bfd_xcoff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
break;
}
- in->x_sym.x_tagndx.l = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_tagndx);
- in->x_sym.x_tvndx = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_tvndx);
+ in->x_sym.x_tagndx.l = H_GET_32 (abfd, ext->x_sym.x_tagndx);
+ in->x_sym.x_tvndx = H_GET_16 (abfd, ext->x_sym.x_tvndx);
if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
{
- in->x_sym.x_fcnary.x_fcn.x_lnnoptr = bfd_h_get_32(abfd, (bfd_byte *)
- ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
- in->x_sym.x_fcnary.x_fcn.x_endndx.l = bfd_h_get_32(abfd, (bfd_byte *)
- ext->x_sym.x_fcnary.x_fcn.x_endndx);
+ in->x_sym.x_fcnary.x_fcn.x_lnnoptr =
+ H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
+ in->x_sym.x_fcnary.x_fcn.x_endndx.l =
+ H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx);
}
else
{
in->x_sym.x_fcnary.x_ary.x_dimen[0] =
- bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
+ H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
in->x_sym.x_fcnary.x_ary.x_dimen[1] =
- bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
+ H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
in->x_sym.x_fcnary.x_ary.x_dimen[2] =
- bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
+ H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
in->x_sym.x_fcnary.x_ary.x_dimen[3] =
- bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
+ H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
}
- if (ISFCN(type)) {
- in->x_sym.x_misc.x_fsize = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_fsize);
- }
- else {
- in->x_sym.x_misc.x_lnsz.x_lnno = bfd_h_get_16(abfd, (bfd_byte *)
- ext->x_sym.x_misc.x_lnsz.x_lnno);
- in->x_sym.x_misc.x_lnsz.x_size = bfd_h_get_16(abfd, (bfd_byte *)
- ext->x_sym.x_misc.x_lnsz.x_size);
- }
-end: ;
- /* the semicolon is because MSVC doesn't like labels at
- end of block. */
+ if (ISFCN (type))
+ {
+ in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize);
+ }
+ else
+ {
+ in->x_sym.x_misc.x_lnsz.x_lnno =
+ H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno);
+ in->x_sym.x_misc.x_lnsz.x_size =
+ H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size);
+ }
+ end: ;
+ /* The semicolon is because MSVC doesn't like labels at
+ end of block. */
}
+
+unsigned int _bfd_xcoff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR));
+
unsigned int
_bfd_xcoff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
- bfd *abfd;
- PTR inp;
+ bfd * abfd;
+ PTR inp;
int type;
int class;
int indx ATTRIBUTE_UNUSED;
int numaux ATTRIBUTE_UNUSED;
- PTR extp;
+ PTR extp;
{
union internal_auxent *in = (union internal_auxent *)inp;
AUXENT *ext = (AUXENT *)extp;
@@ -321,87 +425,87 @@ _bfd_xcoff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
memset((PTR)ext, 0, bfd_coff_auxesz (abfd));
switch (class)
{
- case C_FILE:
- if (in->x_file.x_fname[0] == 0)
- {
- PUTWORD(abfd, 0, (bfd_byte *) ext->x_file.x_n.x_zeroes);
- PUTWORD(abfd,
- in->x_file.x_n.x_offset,
- (bfd_byte *) ext->x_file.x_n.x_offset);
- }
- else
- {
- memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
- }
- goto end;
-
- /* RS/6000 "csect" auxents */
- case C_EXT:
- case C_HIDEXT:
- if (indx + 1 == numaux)
- {
- PUTWORD (abfd, in->x_csect.x_scnlen.l,ext->x_csect.x_scnlen);
- PUTWORD (abfd, in->x_csect.x_parmhash, ext->x_csect.x_parmhash);
- PUTHALF (abfd, in->x_csect.x_snhash, ext->x_csect.x_snhash);
- /* We don't have to hack bitfields in x_smtyp because it's
- defined by shifts-and-ands, which are equivalent on all
- byte orders. */
- PUTBYTE (abfd, in->x_csect.x_smtyp, ext->x_csect.x_smtyp);
- PUTBYTE (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas);
- PUTWORD (abfd, in->x_csect.x_stab, ext->x_csect.x_stab);
- PUTHALF (abfd, in->x_csect.x_snstab, ext->x_csect.x_snstab);
- goto end;
- }
- break;
-
- case C_STAT:
- case C_LEAFSTAT:
- case C_HIDDEN:
- if (type == T_NULL) {
- bfd_h_put_32(abfd, in->x_scn.x_scnlen, (bfd_byte *) ext->x_scn.x_scnlen);
- bfd_h_put_16(abfd, in->x_scn.x_nreloc, (bfd_byte *) ext->x_scn.x_nreloc);
- bfd_h_put_16(abfd, in->x_scn.x_nlinno, (bfd_byte *) ext->x_scn.x_nlinno);
+ case C_FILE:
+ if (in->x_file.x_fname[0] == 0)
+ {
+ H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes);
+ H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
+ }
+ else
+ {
+ memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
+ }
goto end;
+
+ /* RS/6000 "csect" auxents */
+ case C_EXT:
+ case C_HIDEXT:
+ if (indx + 1 == numaux)
+ {
+ H_PUT_32 (abfd, in->x_csect.x_scnlen.l, ext->x_csect.x_scnlen);
+ H_PUT_32 (abfd, in->x_csect.x_parmhash, ext->x_csect.x_parmhash);
+ H_PUT_16 (abfd, in->x_csect.x_snhash, ext->x_csect.x_snhash);
+ /* We don't have to hack bitfields in x_smtyp because it's
+ defined by shifts-and-ands, which are equivalent on all
+ byte orders. */
+ H_PUT_8 (abfd, in->x_csect.x_smtyp, ext->x_csect.x_smtyp);
+ H_PUT_8 (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas);
+ H_PUT_32 (abfd, in->x_csect.x_stab, ext->x_csect.x_stab);
+ H_PUT_16 (abfd, in->x_csect.x_snstab, ext->x_csect.x_snstab);
+ goto end;
+ }
+ break;
+
+ case C_STAT:
+ case C_LEAFSTAT:
+ case C_HIDDEN:
+ if (type == T_NULL)
+ {
+ H_PUT_32 (abfd, in->x_scn.x_scnlen, ext->x_scn.x_scnlen);
+ H_PUT_16 (abfd, in->x_scn.x_nreloc, ext->x_scn.x_nreloc);
+ H_PUT_16 (abfd, in->x_scn.x_nlinno, ext->x_scn.x_nlinno);
+ goto end;
+ }
+ break;
}
- break;
- }
- PUTWORD(abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx);
- bfd_h_put_16 (abfd, in->x_sym.x_tvndx , (bfd_byte *) ext->x_sym.x_tvndx);
+ H_PUT_32 (abfd, in->x_sym.x_tagndx.l, ext->x_sym.x_tagndx);
+ H_PUT_16 (abfd, in->x_sym.x_tvndx, ext->x_sym.x_tvndx);
if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
{
- bfd_h_put_32(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr,
- (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
- PUTWORD(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l,
- (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx);
+ H_PUT_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr,
+ ext->x_sym.x_fcnary.x_fcn.x_lnnoptr);
+ H_PUT_32 (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l,
+ ext->x_sym.x_fcnary.x_fcn.x_endndx);
}
else
{
- bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0],
- (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
- bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1],
- (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
- bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2],
- (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
- bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3],
- (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
+ H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0],
+ ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
+ H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1],
+ ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
+ H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2],
+ ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
+ H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3],
+ ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
}
if (ISFCN (type))
- PUTWORD (abfd, in->x_sym.x_misc.x_fsize,
- (bfd_byte *) ext->x_sym.x_misc.x_fsize);
+ H_PUT_32 (abfd, in->x_sym.x_misc.x_fsize, ext->x_sym.x_misc.x_fsize);
else
{
- bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_lnno,
- (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno);
- bfd_h_put_16(abfd, in->x_sym.x_misc.x_lnsz.x_size,
- (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_size);
+ H_PUT_16 (abfd, in->x_sym.x_misc.x_lnsz.x_lnno,
+ ext->x_sym.x_misc.x_lnsz.x_lnno);
+ H_PUT_16 (abfd, in->x_sym.x_misc.x_lnsz.x_size,
+ ext->x_sym.x_misc.x_lnsz.x_size);
}
end:
return bfd_coff_auxesz (abfd);
}
+
+
/* The XCOFF reloc table. Actually, XCOFF relocations specify the
bitsize and whether they are signed or not, along with a
@@ -409,9 +513,6 @@ end:
different algorithms for putting in the reloc. Many of these
relocs need special_function entries, which I have not written. */
-/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
- from smaller values. Start with zero, widen, *then* decrement. */
-#define MINUS_ONE (((bfd_vma)0) - 1)
reloc_howto_type xcoff_howto_table[] =
{
@@ -755,6 +856,7 @@ reloc_howto_type xcoff_howto_table[] =
0xffff, /* src_mask */
0xffff, /* dst_mask */
false), /* pcrel_offset */
+
HOWTO (0, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
@@ -771,55 +873,6 @@ reloc_howto_type xcoff_howto_table[] =
};
-/* These are the first two like the above but for 16-bit relocs. */
-static reloc_howto_type xcoff_howto_table_16[] =
-{
- /* Standard 16 bit relocation. */
- HOWTO (0, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_POS_16", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* 16 bit relocation, but store negative value. */
- HOWTO (1, /* type */
- 0, /* rightshift */
- -2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- 0, /* special_function */
- "R_NEG_16", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* 16 bit PC relative relocation. */
- HOWTO (2, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- 0, /* special_function */
- "R_REL_16", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- false) /* pcrel_offset */
- };
-
void
_bfd_xcoff_rtype2howto (relent, internal)
arelent *relent;
@@ -827,10 +880,12 @@ _bfd_xcoff_rtype2howto (relent, internal)
{
relent->howto = xcoff_howto_table + internal->r_type;
- if (relent->howto->bitsize != ((unsigned int) internal->r_size & 0x1f) + 1
- && (internal->r_type
- < sizeof (xcoff_howto_table_16)/sizeof (xcoff_howto_table_16[0])))
- relent->howto = xcoff_howto_table_16 + internal->r_type;
+ /* Check for relocs we don't know of. */
+ if (internal->r_type
+ >= sizeof (xcoff_howto_table) / sizeof (xcoff_howto_table[0]))
+ abort ();
+ if (internal->r_type != relent->howto->type)
+ abort ();
/* The r_size field of an XCOFF reloc encodes the bitsize of the
relocation, as well as indicating whether it is signed or not.
@@ -871,6 +926,7 @@ _bfd_xcoff_reloc_type_lookup (abfd, code)
return NULL;
}
}
+
/* XCOFF archive support. The original version of this code was by
Damon A. Permezel. It was enhanced to permit cross support, and
@@ -917,168 +973,7 @@ _bfd_xcoff_reloc_type_lookup (abfd, code)
/* XCOFF archives use this as a magic string. Note that both strings
have the same length. */
-#define XCOFFARMAG "<aiaff>\012"
-#define XCOFFARMAGBIG "<bigaf>\012"
-#define SXCOFFARMAG 8
-
-/* This terminates an XCOFF archive member name. */
-
-#define XCOFFARFMAG "`\012"
-#define SXCOFFARFMAG 2
-/* XCOFF archives start with this (printable) structure. */
-
-struct xcoff_ar_file_hdr
-{
- /* Magic string. */
- char magic[SXCOFFARMAG];
-
- /* Offset of the member table (decimal ASCII string). */
- char memoff[12];
-
- /* Offset of the global symbol table (decimal ASCII string). */
- char symoff[12];
-
- /* Offset of the first member in the archive (decimal ASCII string). */
- char firstmemoff[12];
-
- /* Offset of the last member in the archive (decimal ASCII string). */
- char lastmemoff[12];
-
- /* Offset of the first member on the free list (decimal ASCII
- string). */
- char freeoff[12];
-};
-
-#define SIZEOF_AR_FILE_HDR (5 * 12 + SXCOFFARMAG)
-
-/* This is the equivalent data structure for the big archive format. */
-
-struct xcoff_ar_file_hdr_big
-{
- /* Magic string. */
- char magic[SXCOFFARMAG];
-
- /* Offset of the member table (decimal ASCII string). */
- char memoff[20];
-
- /* Offset of the global symbol table for 32-bit objects (decimal ASCII
- string). */
- char symoff[20];
-
- /* Offset of the global symbol table for 64-bit objects (decimal ASCII
- string). */
- char symoff64[20];
-
- /* Offset of the first member in the archive (decimal ASCII string). */
- char firstmemoff[20];
-
- /* Offset of the last member in the archive (decimal ASCII string). */
- char lastmemoff[20];
-
- /* Offset of the first member on the free list (decimal ASCII
- string). */
- char freeoff[20];
-};
-
-#define SIZEOF_AR_FILE_HDR_BIG (6 * 20 + SXCOFFARMAG)
-
-/* Each XCOFF archive member starts with this (printable) structure. */
-
-struct xcoff_ar_hdr
-{
- /* File size not including the header (decimal ASCII string). */
- char size[12];
-
- /* File offset of next archive member (decimal ASCII string). */
- char nextoff[12];
-
- /* File offset of previous archive member (decimal ASCII string). */
- char prevoff[12];
-
- /* File mtime (decimal ASCII string). */
- char date[12];
-
- /* File UID (decimal ASCII string). */
- char uid[12];
-
- /* File GID (decimal ASCII string). */
- char gid[12];
-
- /* File mode (octal ASCII string). */
- char mode[12];
-
- /* Length of file name (decimal ASCII string). */
- char namlen[4];
-
- /* This structure is followed by the file name. The length of the
- name is given in the namlen field. If the length of the name is
- odd, the name is followed by a null byte. The name and optional
- null byte are followed by XCOFFARFMAG, which is not included in
- namlen. The contents of the archive member follow; the number of
- bytes is given in the size field. */
-};
-
-#define SIZEOF_AR_HDR (7 * 12 + 4)
-
-/* The equivalent for the big archive format. */
-
-struct xcoff_ar_hdr_big
-{
- /* File size not including the header (decimal ASCII string). */
- char size[20];
-
- /* File offset of next archive member (decimal ASCII string). */
- char nextoff[20];
-
- /* File offset of previous archive member (decimal ASCII string). */
- char prevoff[20];
-
- /* File mtime (decimal ASCII string). */
- char date[12];
-
- /* File UID (decimal ASCII string). */
- char uid[12];
-
- /* File GID (decimal ASCII string). */
- char gid[12];
-
- /* File mode (octal ASCII string). */
- char mode[12];
-
- /* Length of file name (decimal ASCII string). */
- char namlen[4];
-
- /* This structure is followed by the file name. The length of the
- name is given in the namlen field. If the length of the name is
- odd, the name is followed by a null byte. The name and optional
- null byte are followed by XCOFFARFMAG, which is not included in
- namlen. The contents of the archive member follow; the number of
- bytes is given in the size field. */
-};
-
-#define SIZEOF_AR_HDR_BIG (3 * 20 + 4 * 12 + 4)
-
-/* We often have to distinguish between the old and big file format.
- Make it a bit cleaner. We can use `xcoff_ardata' here because the
- `hdr' member has the same size and position in both formats. */
-#define xcoff_big_format_p(abfd) \
- (xcoff_ardata (abfd)->magic[1] == 'b')
-
-/* We store a copy of the xcoff_ar_file_hdr in the tdata field of the
- artdata structure. Similar for the big archive. */
-#define xcoff_ardata(abfd) \
- ((struct xcoff_ar_file_hdr *) bfd_ardata (abfd)->tdata)
-#define xcoff_ardata_big(abfd) \
- ((struct xcoff_ar_file_hdr_big *) bfd_ardata (abfd)->tdata)
-
-/* We store a copy of the xcoff_ar_hdr in the arelt_data field of an
- archive element. Similar for the big archive. */
-#define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data))
-#define arch_xhdr(bfd) \
- ((struct xcoff_ar_hdr *) arch_eltdata (bfd)->arch_header)
-#define arch_xhdr_big(bfd) \
- ((struct xcoff_ar_hdr_big *) arch_eltdata (bfd)->arch_header)
/* Read in the armap of an XCOFF archive. */
@@ -1116,12 +1011,14 @@ _bfd_xcoff_slurp_armap (abfd)
return false;
/* The symbol table starts with a normal archive header. */
- if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR, 1, abfd) != SIZEOF_AR_HDR)
+ if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd)
+ != SIZEOF_AR_HDR)
return false;
/* Skip the name (normally empty). */
namlen = strtol (hdr.namlen, (char **) NULL, 10);
- if (bfd_seek (abfd, ((namlen + 1) & ~1) + SXCOFFARFMAG, SEEK_CUR) != 0)
+ off = ((namlen + 1) & ~ (size_t) 1) + SXCOFFARFMAG;
+ if (bfd_seek (abfd, off, SEEK_CUR) != 0)
return false;
sz = strtol (hdr.size, (char **) NULL, 10);
@@ -1130,11 +1027,11 @@ _bfd_xcoff_slurp_armap (abfd)
contents = (bfd_byte *) bfd_alloc (abfd, sz);
if (contents == NULL)
return false;
- if (bfd_read ((PTR) contents, 1, sz, abfd) != sz)
+ if (bfd_bread ((PTR) contents, sz, abfd) != sz)
return false;
/* The symbol table starts with a four byte count. */
- c = bfd_h_get_32 (abfd, contents);
+ c = H_GET_32 (abfd, contents);
if (c * 4 >= sz)
{
@@ -1142,8 +1039,8 @@ _bfd_xcoff_slurp_armap (abfd)
return false;
}
- bfd_ardata (abfd)->symdefs = ((carsym *)
- bfd_alloc (abfd, c * sizeof (carsym)));
+ bfd_ardata (abfd)->symdefs =
+ ((carsym *) bfd_alloc (abfd, c * sizeof (carsym)));
if (bfd_ardata (abfd)->symdefs == NULL)
return false;
@@ -1151,7 +1048,7 @@ _bfd_xcoff_slurp_armap (abfd)
for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 4;
i < c;
++i, ++arsym, p += 4)
- arsym->file_offset = bfd_h_get_32 (abfd, p);
+ arsym->file_offset = H_GET_32 (abfd, p);
}
else
{
@@ -1169,13 +1066,14 @@ _bfd_xcoff_slurp_armap (abfd)
return false;
/* The symbol table starts with a normal archive header. */
- if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR_BIG, 1, abfd)
+ if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd)
!= SIZEOF_AR_HDR_BIG)
return false;
/* Skip the name (normally empty). */
namlen = strtol (hdr.namlen, (char **) NULL, 10);
- if (bfd_seek (abfd, ((namlen + 1) & ~1) + SXCOFFARFMAG, SEEK_CUR) != 0)
+ off = ((namlen + 1) & ~ (size_t) 1) + SXCOFFARFMAG;
+ if (bfd_seek (abfd, off, SEEK_CUR) != 0)
return false;
/* XXX This actually has to be a call to strtoll (at least on 32-bit
@@ -1187,11 +1085,11 @@ _bfd_xcoff_slurp_armap (abfd)
contents = (bfd_byte *) bfd_alloc (abfd, sz);
if (contents == NULL)
return false;
- if (bfd_read ((PTR) contents, 1, sz, abfd) != sz)
+ if (bfd_bread ((PTR) contents, sz, abfd) != sz)
return false;
/* The symbol table starts with an eight byte count. */
- c = bfd_h_get_64 (abfd, contents);
+ c = H_GET_64 (abfd, contents);
if (c * 8 >= sz)
{
@@ -1199,8 +1097,8 @@ _bfd_xcoff_slurp_armap (abfd)
return false;
}
- bfd_ardata (abfd)->symdefs = ((carsym *)
- bfd_alloc (abfd, c * sizeof (carsym)));
+ bfd_ardata (abfd)->symdefs =
+ ((carsym *) bfd_alloc (abfd, c * sizeof (carsym)));
if (bfd_ardata (abfd)->symdefs == NULL)
return false;
@@ -1208,7 +1106,7 @@ _bfd_xcoff_slurp_armap (abfd)
for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 8;
i < c;
++i, ++arsym, p += 8)
- arsym->file_offset = bfd_h_get_64 (abfd, p);
+ arsym->file_offset = H_GET_64 (abfd, p);
}
/* After the file offsets come null terminated symbol names. */
@@ -1238,8 +1136,9 @@ _bfd_xcoff_archive_p (abfd)
bfd *abfd;
{
char magic[SXCOFFARMAG];
+ bfd_size_type amt;
- if (bfd_read ((PTR) magic, SXCOFFARMAG, 1, abfd) != SXCOFFARMAG)
+ if (bfd_bread ((PTR) magic, (bfd_size_type) SXCOFFARMAG, abfd) != SXCOFFARMAG)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
@@ -1256,9 +1155,8 @@ _bfd_xcoff_archive_p (abfd)
/* We are setting bfd_ardata(abfd) here, but since bfd_ardata
involves a cast, we can't do it as the left operand of
assignment. */
- abfd->tdata.aout_ar_data =
- (struct artdata *) bfd_zalloc (abfd, sizeof (struct artdata));
-
+ amt = sizeof (struct artdata);
+ abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt);
if (bfd_ardata (abfd) == (struct artdata *) NULL)
return NULL;
@@ -1277,8 +1175,9 @@ _bfd_xcoff_archive_p (abfd)
memcpy (hdr.magic, magic, SXCOFFARMAG);
/* Now read the rest of the file header. */
- if (bfd_read ((PTR) &hdr.memoff, SIZEOF_AR_FILE_HDR - SXCOFFARMAG, 1,
- abfd) != SIZEOF_AR_FILE_HDR - SXCOFFARMAG)
+ if (bfd_bread ((PTR) &hdr.memoff,
+ (bfd_size_type) SIZEOF_AR_FILE_HDR - SXCOFFARMAG, abfd)
+ != SIZEOF_AR_FILE_HDR - SXCOFFARMAG)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
@@ -1288,7 +1187,8 @@ _bfd_xcoff_archive_p (abfd)
bfd_ardata (abfd)->first_file_filepos = strtol (hdr.firstmemoff,
(char **) NULL, 10);
- bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, SIZEOF_AR_FILE_HDR);
+ amt = SIZEOF_AR_FILE_HDR;
+ bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, amt);
if (bfd_ardata (abfd)->tdata == NULL)
return NULL;
@@ -1303,8 +1203,9 @@ _bfd_xcoff_archive_p (abfd)
memcpy (hdr.magic, magic, SXCOFFARMAG);
/* Now read the rest of the file header. */
- if (bfd_read ((PTR) &hdr.memoff, SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG, 1,
- abfd) != SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG)
+ if (bfd_bread ((PTR) &hdr.memoff,
+ (bfd_size_type) SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG, abfd)
+ != SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
@@ -1317,7 +1218,8 @@ _bfd_xcoff_archive_p (abfd)
bfd_ardata (abfd)->first_file_filepos = strtol (hdr.firstmemoff,
(char **) NULL, 10);
- bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, SIZEOF_AR_FILE_HDR_BIG);
+ amt = SIZEOF_AR_FILE_HDR_BIG;
+ bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, amt);
if (bfd_ardata (abfd)->tdata == NULL)
return NULL;
@@ -1340,10 +1242,11 @@ PTR
_bfd_xcoff_read_ar_hdr (abfd)
bfd *abfd;
{
- size_t namlen;
+ bfd_size_type namlen;
struct areltdata *ret;
+ bfd_size_type amt = sizeof (struct areltdata);
- ret = (struct areltdata *) bfd_alloc (abfd, sizeof (struct areltdata));
+ ret = (struct areltdata *) bfd_alloc (abfd, amt);
if (ret == NULL)
return NULL;
@@ -1352,22 +1255,23 @@ _bfd_xcoff_read_ar_hdr (abfd)
struct xcoff_ar_hdr hdr;
struct xcoff_ar_hdr *hdrp;
- if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR, 1, abfd) != SIZEOF_AR_HDR)
+ if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd)
+ != SIZEOF_AR_HDR)
{
free (ret);
return NULL;
}
namlen = strtol (hdr.namlen, (char **) NULL, 10);
- hdrp = (struct xcoff_ar_hdr *) bfd_alloc (abfd,
- SIZEOF_AR_HDR + namlen + 1);
+ amt = SIZEOF_AR_HDR + namlen + 1;
+ hdrp = (struct xcoff_ar_hdr *) bfd_alloc (abfd, amt);
if (hdrp == NULL)
{
free (ret);
return NULL;
}
memcpy (hdrp, &hdr, SIZEOF_AR_HDR);
- if (bfd_read ((char *) hdrp + SIZEOF_AR_HDR, 1, namlen, abfd) != namlen)
+ if (bfd_bread ((char *) hdrp + SIZEOF_AR_HDR, namlen, abfd) != namlen)
{
free (ret);
return NULL;
@@ -1383,7 +1287,7 @@ _bfd_xcoff_read_ar_hdr (abfd)
struct xcoff_ar_hdr_big hdr;
struct xcoff_ar_hdr_big *hdrp;
- if (bfd_read ((PTR) &hdr, SIZEOF_AR_HDR_BIG, 1, abfd)
+ if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd)
!= SIZEOF_AR_HDR_BIG)
{
free (ret);
@@ -1391,16 +1295,15 @@ _bfd_xcoff_read_ar_hdr (abfd)
}
namlen = strtol (hdr.namlen, (char **) NULL, 10);
- hdrp = (struct xcoff_ar_hdr_big *) bfd_alloc (abfd,
- SIZEOF_AR_HDR_BIG
- + namlen + 1);
+ amt = SIZEOF_AR_HDR_BIG + namlen + 1;
+ hdrp = (struct xcoff_ar_hdr_big *) bfd_alloc (abfd, amt);
if (hdrp == NULL)
{
free (ret);
return NULL;
}
memcpy (hdrp, &hdr, SIZEOF_AR_HDR_BIG);
- if (bfd_read ((char *) hdrp + SIZEOF_AR_HDR_BIG, 1, namlen, abfd) != namlen)
+ if (bfd_bread ((char *) hdrp + SIZEOF_AR_HDR_BIG, namlen, abfd) != namlen)
{
free (ret);
return NULL;
@@ -1416,7 +1319,7 @@ _bfd_xcoff_read_ar_hdr (abfd)
}
/* Skip over the XCOFFARFMAG at the end of the file name. */
- if (bfd_seek (abfd, (namlen & 1) + SXCOFFARFMAG, SEEK_CUR) != 0)
+ if (bfd_seek (abfd, (file_ptr) ((namlen & 1) + SXCOFFARFMAG), SEEK_CUR) != 0)
return NULL;
return (PTR) ret;
@@ -1540,6 +1443,7 @@ normalize_filename (abfd)
/* Write out an XCOFF armap. */
+/*ARGSUSED*/
static boolean
xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
bfd *abfd;
@@ -1558,7 +1462,7 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
memset (&hdr, 0, sizeof hdr);
sprintf (hdr.size, "%ld", (long) (4 + orl_count * 4 + stridx));
sprintf (hdr.nextoff, "%d", 0);
- memcpy (hdr.prevoff, xcoff_ardata (abfd)->memoff, 12);
+ memcpy (hdr.prevoff, xcoff_ardata (abfd)->memoff, XCOFFARMAG_ELEMENT_SIZE);
sprintf (hdr.date, "%d", 0);
sprintf (hdr.uid, "%d", 0);
sprintf (hdr.gid, "%d", 0);
@@ -1570,12 +1474,14 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
if (*p == '\0')
*p = ' ';
- if (bfd_write ((PTR) &hdr, SIZEOF_AR_HDR, 1, abfd) != SIZEOF_AR_HDR
- || bfd_write (XCOFFARFMAG, 1, SXCOFFARFMAG, abfd) != SXCOFFARFMAG)
+ if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd)
+ != SIZEOF_AR_HDR
+ || (bfd_bwrite (XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd)
+ != SXCOFFARFMAG))
return false;
- bfd_h_put_32 (abfd, orl_count, buf);
- if (bfd_write (buf, 1, 4, abfd) != 4)
+ H_PUT_32 (abfd, orl_count, buf);
+ if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4)
return false;
sub = abfd->archive_head;
@@ -1585,15 +1491,15 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
{
size_t namlen;
- while (((bfd *) (map[i]).pos) == sub)
+ while (map[i].u.abfd == sub)
{
- bfd_h_put_32 (abfd, fileoff, buf);
- if (bfd_write (buf, 1, 4, abfd) != 4)
+ H_PUT_32 (abfd, fileoff, buf);
+ if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4)
return false;
++i;
}
namlen = strlen (normalize_filename (sub));
- namlen = (namlen + 1) &~ 1;
+ namlen = (namlen + 1) &~ (size_t) 1;
fileoff += (SIZEOF_AR_HDR
+ namlen
+ SXCOFFARFMAG
@@ -1609,7 +1515,7 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
name = *map[i].name;
namlen = strlen (name);
- if (bfd_write (name, 1, namlen + 1, abfd) != namlen + 1)
+ if (bfd_bwrite (name, (bfd_size_type) (namlen + 1), abfd) != namlen + 1)
return false;
}
@@ -1618,183 +1524,321 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx)
char b;
b = '\0';
- if (bfd_write (&b, 1, 1, abfd) != 1)
+ if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
return false;
}
return true;
}
-/* Write a single armap in the big format. */
+static char buff20[XCOFFARMAGBIG_ELEMENT_SIZE + 1];
+#define FMT20 "%-20lld"
+#define FMT12 "%-12d"
+#define FMT12_OCTAL "%-12o"
+#define FMT4 "%-4d"
+#define PRINT20(d, v) \
+ sprintf (buff20, FMT20, (long long)(v)), \
+ memcpy ((void *) (d), buff20, 20)
+
+#define PRINT12(d, v) \
+ sprintf (buff20, FMT12, (int)(v)), \
+ memcpy ((void *) (d), buff20, 12)
+
+#define PRINT12_OCTAL(d, v) \
+ sprintf (buff20, FMT12_OCTAL, (unsigned int)(v)), \
+ memcpy ((void *) (d), buff20, 12)
+
+#define PRINT4(d, v) \
+ sprintf (buff20, FMT4, (int)(v)), \
+ memcpy ((void *) (d), buff20, 4)
+
+#define READ20(d, v) \
+ buff20[20] = 0, \
+ memcpy (buff20, (d), 20), \
+ (v) = bfd_scan_vma (buff20, (const char **) NULL, 10)
+
static boolean
-xcoff_write_one_armap_big (abfd, map, orl_count, orl_ccount, stridx, bits64,
- prevoff, nextoff)
+xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
bfd *abfd;
+ unsigned int elength ATTRIBUTE_UNUSED;
struct orl *map;
unsigned int orl_count;
- unsigned int orl_ccount;
- unsigned int stridx;
- int bits64;
- const char *prevoff;
- char *nextoff;
+ int stridx;
{
- struct xcoff_ar_hdr_big hdr;
- char *p;
- unsigned char buf[4];
+ struct xcoff_ar_file_hdr_big *fhdr;
+ bfd_vma i, sym_32, sym_64, str_32, str_64;
const bfd_arch_info_type *arch_info = NULL;
- bfd *sub;
- file_ptr fileoff;
- bfd *object_bfd;
- unsigned int i;
-
- memset (&hdr, 0, sizeof hdr);
- /* XXX This call actually should use %lld (at least on 32-bit
- machines) since the fields's width is 20 and there numbers with
- more than 32 bits can be represented. */
- sprintf (hdr.size, "%ld", (long) (4 + orl_ccount * 4 + stridx));
- if (bits64)
- sprintf (hdr.nextoff, "%d", 0);
- else
- sprintf (hdr.nextoff, "%ld", (strtol (prevoff, (char **) NULL, 10)
- + 4 + orl_ccount * 4 + stridx));
- memcpy (hdr.prevoff, prevoff, sizeof (hdr.prevoff));
- sprintf (hdr.date, "%d", 0);
- sprintf (hdr.uid, "%d", 0);
- sprintf (hdr.gid, "%d", 0);
- sprintf (hdr.mode, "%d", 0);
- sprintf (hdr.namlen, "%d", 0);
-
- /* We need spaces, not null bytes, in the header. */
- for (p = (char *) &hdr; p < (char *) &hdr + SIZEOF_AR_HDR_BIG; p++)
- if (*p == '\0')
- *p = ' ';
-
- memcpy (nextoff, hdr.nextoff, sizeof (hdr.nextoff));
-
- if (bfd_write ((PTR) &hdr, SIZEOF_AR_HDR_BIG, 1, abfd) != SIZEOF_AR_HDR_BIG
- || bfd_write (XCOFFARFMAG, 1, SXCOFFARFMAG, abfd) != SXCOFFARFMAG)
- return false;
-
- bfd_h_put_32 (abfd, orl_ccount, buf);
- if (bfd_write (buf, 1, 4, abfd) != 4)
- return false;
+ bfd *current_bfd;
+ size_t string_length;
+ ufile_ptr nextoff, prevoff;
+
+ /* First, we look through the symbols and work out which are
+ from 32-bit objects and which from 64-bit ones. */
+ sym_32 = sym_64 = str_32 = str_64 = 0;
- sub = abfd->archive_head;
- fileoff = SIZEOF_AR_FILE_HDR_BIG;
- i = 0;
- while (sub != NULL && i < orl_count)
+ current_bfd = abfd->archive_head;
+ if (current_bfd != NULL)
+ arch_info = bfd_get_arch_info (current_bfd);
+ i = 0;
+ while (current_bfd != NULL && i < orl_count)
{
- size_t namlen;
+ while (map[i].u.abfd == current_bfd)
+ {
+ string_length = strlen (*map[i].name) + 1;
- if ((bfd_arch_bits_per_address ((bfd *) map[i].pos) == 64) == bits64)
- while (((bfd *) (map[i]).pos) == sub)
- {
- bfd_h_put_32 (abfd, fileoff, buf);
- if (bfd_write (buf, 1, 4, abfd) != 4)
- return false;
- i++;
- }
- else
- while (((bfd *) (map[i]).pos) == sub)
+ if (arch_info->bits_per_address == 64)
+ {
+ sym_64++;
+ str_64 += string_length;
+ }
+ else
+ {
+ sym_32++;
+ str_32 += string_length;
+ }
i++;
-
- namlen = strlen (normalize_filename (sub));
- namlen = (namlen + 1) &~ 1;
- fileoff += (SIZEOF_AR_HDR_BIG
- + namlen
- + SXCOFFARFMAG
- + arelt_size (sub));
- fileoff = (fileoff + 1) &~ 1;
- sub = sub->next;
+ }
+ current_bfd = current_bfd->next;
+ if (current_bfd != NULL)
+ arch_info = bfd_get_arch_info (current_bfd);
}
- object_bfd = NULL;
- for (i = 0; i < orl_count; i++)
- {
- const char *name;
- size_t namlen;
- bfd *ob = (bfd *)map[i].pos;
+ /* A quick sanity check... */
+ BFD_ASSERT (sym_64 + sym_32 == orl_count);
+ /* Explicit cast to int for compiler. */
+ BFD_ASSERT ((int)(str_64 + str_32) == stridx);
- if (ob != object_bfd)
- arch_info = bfd_get_arch_info (ob);
+ fhdr = xcoff_ardata_big (abfd);
- if (arch_info && (arch_info->bits_per_address == 64) != bits64)
- continue;
+ /* xcoff_write_archive_contents_big passes nextoff in symoff. */
+ READ20 (fhdr->memoff, prevoff);
+ READ20 (fhdr->symoff, nextoff);
- name = *map[i].name;
- namlen = strlen (name);
- if (bfd_write (name, 1, namlen + 1, abfd) != namlen + 1)
- return false;
- }
+ BFD_ASSERT (nextoff == bfd_tell (abfd));
- if ((stridx & 1) != 0)
+ /* Write out the symbol table.
+ Layout :
+
+ standard big archive header
+ 0x0000 ar_size [0x14]
+ 0x0014 ar_nxtmem [0x14]
+ 0x0028 ar_prvmem [0x14]
+ 0x003C ar_date [0x0C]
+ 0x0048 ar_uid [0x0C]
+ 0x0054 ar_gid [0x0C]
+ 0x0060 ar_mod [0x0C]
+ 0x006C ar_namelen[0x04]
+ 0x0070 ar_fmag [SXCOFFARFMAG]
+
+ Symbol table
+ 0x0072 num_syms [0x08], binary
+ 0x0078 offsets [0x08 * num_syms], binary
+ 0x0086 + 0x08 * num_syms names [??]
+ ?? pad to even bytes.
+ */
+
+ if (sym_32)
{
- char b;
-
- b = '\0';
- if (bfd_write (&b, 1, 1, abfd) != 1)
+ struct xcoff_ar_hdr_big *hdr;
+ bfd_byte *symbol_table;
+ bfd_byte *st;
+ file_ptr fileoff;
+
+ bfd_vma symbol_table_size =
+ SIZEOF_AR_HDR_BIG
+ + SXCOFFARFMAG
+ + 8
+ + 8 * sym_32
+ + str_32 + (str_32 & 1);
+
+ symbol_table = NULL;
+ symbol_table = (bfd_byte *) bfd_malloc (symbol_table_size);
+ if (symbol_table == NULL)
return false;
- }
+ memset (symbol_table, 0, symbol_table_size);
+
+ hdr = (struct xcoff_ar_hdr_big *) symbol_table;
+
+ PRINT20 (hdr->size, 8 + 8 * sym_32 + str_32 + (str_32 & 1));
+
+ if (sym_64)
+ PRINT20 (hdr->nextoff, nextoff + symbol_table_size);
+ else
+ PRINT20 (hdr->nextoff, 0);
+
+ PRINT20 (hdr->prevoff, prevoff);
+ PRINT12 (hdr->date, 0);
+ PRINT12 (hdr->uid, 0);
+ PRINT12 (hdr->gid, 0);
+ PRINT12 (hdr->mode, 0);
+ PRINT4 (hdr->namlen, 0) ;
+
+ st = symbol_table + SIZEOF_AR_HDR_BIG;
+ memcpy (st, XCOFFARFMAG, SXCOFFARFMAG);
+ st += SXCOFFARFMAG;
+
+ bfd_h_put_64 (abfd, sym_32, st);
+ st += 8;
+
+ /* loop over the 32 bit offsets */
+ current_bfd = abfd->archive_head;
+ if (current_bfd != NULL)
+ arch_info = bfd_get_arch_info (current_bfd);
+ fileoff = SIZEOF_AR_FILE_HDR_BIG;
+ i = 0;
+ while (current_bfd != NULL && i < orl_count)
+ {
+ while (map[i].u.abfd == current_bfd)
+ {
+ if (arch_info->bits_per_address == 32)
+ {
+ bfd_h_put_64 (abfd, fileoff, st);
+ st += 8;
+ }
+ i++;
+ }
+ string_length = strlen (normalize_filename (current_bfd));
+ string_length += string_length & 1;
+ fileoff += (SIZEOF_AR_HDR_BIG
+ + string_length
+ + SXCOFFARFMAG
+ + arelt_size (current_bfd));
+ fileoff += fileoff & 1;
+ current_bfd = current_bfd->next;
+ if (current_bfd != NULL)
+ arch_info = bfd_get_arch_info (current_bfd);
+ }
- return true;
-}
+ /* loop over the 32 bit symbol names */
+ current_bfd = abfd->archive_head;
+ if (current_bfd != NULL)
+ arch_info = bfd_get_arch_info (current_bfd);
+ i = 0;
+ while (current_bfd != NULL && i < orl_count)
+ {
+ while (map[i].u.abfd == current_bfd)
+ {
+ if (arch_info->bits_per_address == 32)
+ {
+ string_length = sprintf (st, "%s", *map[i].name);
+ st += string_length + 1;
+ }
+ i++;
+ }
+ current_bfd = current_bfd->next;
+ if (current_bfd != NULL)
+ arch_info = bfd_get_arch_info (current_bfd);
+ }
-static boolean
-xcoff_write_armap_big (abfd, elength, map, orl_count, stridx)
- bfd *abfd;
- unsigned int elength ATTRIBUTE_UNUSED;
- struct orl *map;
- unsigned int orl_count;
- int stridx;
-{
- unsigned int i;
- unsigned int orl_count_32, orl_count_64;
- unsigned int stridx_32, stridx_64;
- const bfd_arch_info_type *arch_info = NULL;
- bfd *object_bfd;
+ bfd_bwrite (symbol_table, symbol_table_size, abfd);
- /* First, we look through the symbols and work out which are
- from 32-bit objects and which from 64-bit ones. */
- orl_count_32 = 0;
- orl_count_64 = 0;
- stridx_32 = 0;
- stridx_64 = 0;
- object_bfd = NULL;
- for (i = 0; i < orl_count; i++)
+ free (symbol_table);
+ symbol_table = NULL;
+
+ prevoff = nextoff;
+ nextoff = nextoff + symbol_table_size;
+ }
+ else
+ PRINT20 (fhdr->symoff, 0);
+
+ if (sym_64)
{
- bfd *ob = (bfd *)map[i].pos;
- unsigned int len;
- if (ob != object_bfd)
- arch_info = bfd_get_arch_info (ob);
- len = strlen (*map[i].name) + 1;
- if (arch_info && arch_info->bits_per_address == 64)
+ struct xcoff_ar_hdr_big *hdr;
+ bfd_byte *symbol_table;
+ bfd_byte *st;
+ file_ptr fileoff;
+
+ bfd_vma symbol_table_size =
+ SIZEOF_AR_HDR_BIG
+ + SXCOFFARFMAG
+ + 8
+ + 8 * sym_64
+ + str_64 + (str_64 & 1);
+
+ symbol_table = NULL;
+ symbol_table = (bfd_byte *) bfd_malloc (symbol_table_size);
+ if (symbol_table == NULL)
+ return false;
+ memset (symbol_table, 0, symbol_table_size);
+
+ hdr = (struct xcoff_ar_hdr_big *) symbol_table;
+
+ PRINT20 (hdr->size, 8 + 8 * sym_64 + str_64 + (str_64 & 1));
+ PRINT20 (hdr->nextoff, 0);
+ PRINT20 (hdr->prevoff, prevoff);
+ PRINT12 (hdr->date, 0);
+ PRINT12 (hdr->uid, 0);
+ PRINT12 (hdr->gid, 0);
+ PRINT12 (hdr->mode, 0);
+ PRINT4 (hdr->namlen, 0);
+
+ st = symbol_table + SIZEOF_AR_HDR_BIG;
+ memcpy (st, XCOFFARFMAG, SXCOFFARFMAG);
+ st += SXCOFFARFMAG;
+
+ bfd_h_put_64 (abfd, sym_64, st);
+ st += 8;
+
+ /* loop over the 64 bit offsets */
+ current_bfd = abfd->archive_head;
+ if (current_bfd != NULL)
+ arch_info = bfd_get_arch_info (current_bfd);
+ fileoff = SIZEOF_AR_FILE_HDR_BIG;
+ i = 0;
+ while (current_bfd != NULL && i < orl_count)
{
- orl_count_64++;
- stridx_64 += len;
+ while (map[i].u.abfd == current_bfd)
+ {
+ if (arch_info->bits_per_address == 64)
+ {
+ bfd_h_put_64 (abfd, fileoff, st);
+ st += 8;
+ }
+ i++;
+ }
+ string_length = strlen (normalize_filename (current_bfd));
+ string_length += string_length & 1;
+ fileoff += (SIZEOF_AR_HDR_BIG
+ + string_length
+ + SXCOFFARFMAG
+ + arelt_size (current_bfd));
+ fileoff += fileoff & 1;
+ current_bfd = current_bfd->next;
+ if (current_bfd != NULL)
+ arch_info = bfd_get_arch_info (current_bfd);
}
- else
+
+ /* loop over the 64 bit symbol names */
+ current_bfd = abfd->archive_head;
+ if (current_bfd != NULL)
+ arch_info = bfd_get_arch_info (current_bfd);
+ i = 0;
+ while (current_bfd != NULL && i < orl_count)
{
- orl_count_32++;
- stridx_32 += len;
+ while (map[i].u.abfd == current_bfd)
+ {
+ if (arch_info->bits_per_address == 64)
+ {
+ string_length = sprintf (st, "%s", *map[i].name);
+ st += string_length + 1;
+ }
+ i++;
+ }
+ current_bfd = current_bfd->next;
+ if (current_bfd != NULL)
+ arch_info = bfd_get_arch_info (current_bfd);
}
- object_bfd = ob;
- }
- /* A quick sanity check... */
- BFD_ASSERT (orl_count_64 + orl_count_32 == orl_count);
- BFD_ASSERT (stridx_64 + stridx_32 == stridx);
-
- /* Now write out each map. */
- if (! xcoff_write_one_armap_big (abfd, map, orl_count, orl_count_32,
- stridx_32, false,
- xcoff_ardata_big (abfd)->memoff,
- xcoff_ardata_big (abfd)->symoff))
- return false;
- if (! xcoff_write_one_armap_big (abfd, map, orl_count, orl_count_64,
- stridx_64, true,
- xcoff_ardata_big (abfd)->symoff,
- xcoff_ardata_big (abfd)->symoff64))
- return false;
+ bfd_bwrite (symbol_table, symbol_table_size, abfd);
+
+ free (symbol_table);
+ symbol_table = NULL;
+
+ PRINT20 (fhdr->symoff64, nextoff);
+ }
+ else
+ PRINT20 (fhdr->symoff64, 0);
+
return true;
}
@@ -1820,18 +1864,18 @@ xcoff_write_archive_contents_old (abfd)
bfd *abfd;
{
struct xcoff_ar_file_hdr fhdr;
- size_t count;
- size_t total_namlen;
+ bfd_size_type count;
+ bfd_size_type total_namlen;
file_ptr *offsets;
boolean makemap;
boolean hasobjects;
- file_ptr prevoff, nextoff;
+ ufile_ptr prevoff, nextoff;
bfd *sub;
- unsigned int i;
+ size_t i;
struct xcoff_ar_hdr ahdr;
bfd_size_type size;
char *p;
- char decbuf[13];
+ char decbuf[XCOFFARMAG_ELEMENT_SIZE + 1];
memset (&fhdr, 0, sizeof fhdr);
strncpy (fhdr.magic, XCOFFARMAG, SXCOFFARMAG);
@@ -1849,7 +1893,7 @@ xcoff_write_archive_contents_old (abfd)
if (offsets == NULL)
return false;
- if (bfd_seek (abfd, SIZEOF_AR_FILE_HDR, SEEK_SET) != 0)
+ if (bfd_seek (abfd, (file_ptr) SIZEOF_AR_FILE_HDR, SEEK_SET) != 0)
return false;
makemap = bfd_has_map (abfd);
@@ -1859,7 +1903,7 @@ xcoff_write_archive_contents_old (abfd)
for (sub = abfd->archive_head, i = 0; sub != NULL; sub = sub->next, i++)
{
const char *name;
- size_t namlen;
+ bfd_size_type namlen;
struct xcoff_ar_hdr *ahdrp;
bfd_size_type remaining;
@@ -1897,7 +1941,8 @@ xcoff_write_archive_contents_old (abfd)
if (sub->arelt_data == NULL)
{
- sub->arelt_data = bfd_alloc (sub, sizeof (struct areltdata));
+ size = sizeof (struct areltdata);
+ sub->arelt_data = bfd_alloc (sub, size);
if (sub->arelt_data == NULL)
return false;
}
@@ -1910,7 +1955,7 @@ xcoff_write_archive_contents_old (abfd)
/* If the length of the name is odd, we write out the null byte
after the name as well. */
- namlen = (namlen + 1) &~ 1;
+ namlen = (namlen + 1) &~ (bfd_size_type) 1;
remaining = arelt_size (sub);
size = (SIZEOF_AR_HDR
@@ -1932,9 +1977,10 @@ xcoff_write_archive_contents_old (abfd)
if (*p == '\0')
*p = ' ';
- if (bfd_write ((PTR) ahdrp, 1, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR
- || bfd_write ((PTR) name, 1, namlen, abfd) != namlen
- || (bfd_write ((PTR) XCOFFARFMAG, 1, SXCOFFARFMAG, abfd)
+ if ((bfd_bwrite ((PTR) ahdrp, (bfd_size_type) SIZEOF_AR_HDR, abfd)
+ != SIZEOF_AR_HDR)
+ || (bfd_bwrite ((PTR) name, namlen, abfd) != namlen)
+ || (bfd_bwrite ((PTR) XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd)
!= SXCOFFARFMAG))
return false;
@@ -1948,8 +1994,8 @@ xcoff_write_archive_contents_old (abfd)
amt = sizeof buffer;
if (amt > remaining)
amt = remaining;
- if (bfd_read (buffer, 1, amt, sub) != amt
- || bfd_write (buffer, 1, amt, abfd) != amt)
+ if (bfd_bread (buffer, amt, sub) != amt
+ || bfd_bwrite (buffer, amt, abfd) != amt)
return false;
remaining -= amt;
}
@@ -1959,7 +2005,7 @@ xcoff_write_archive_contents_old (abfd)
bfd_byte b;
b = '\0';
- if (bfd_write (&b, 1, 1, abfd) != 1)
+ if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
return false;
}
}
@@ -1972,7 +2018,9 @@ xcoff_write_archive_contents_old (abfd)
sprintf (fhdr.memoff, "%ld", (long) nextoff);
memset (&ahdr, 0, sizeof ahdr);
- sprintf (ahdr.size, "%ld", (long) (12 + count * 12 + total_namlen));
+ sprintf (ahdr.size, "%ld", (long) (XCOFFARMAG_ELEMENT_SIZE +
+ count * XCOFFARMAG_ELEMENT_SIZE +
+ total_namlen));
sprintf (ahdr.prevoff, "%ld", (long) prevoff);
sprintf (ahdr.date, "%d", 0);
sprintf (ahdr.uid, "%d", 0);
@@ -1981,8 +2029,8 @@ xcoff_write_archive_contents_old (abfd)
sprintf (ahdr.namlen, "%d", 0);
size = (SIZEOF_AR_HDR
- + 12
- + count * 12
+ + XCOFFARMAG_ELEMENT_SIZE
+ + count * XCOFFARMAG_ELEMENT_SIZE
+ total_namlen
+ SXCOFFARFMAG);
@@ -1999,28 +2047,31 @@ xcoff_write_archive_contents_old (abfd)
if (*p == '\0')
*p = ' ';
- if (bfd_write ((PTR) &ahdr, 1, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR
- || (bfd_write ((PTR) XCOFFARFMAG, 1, SXCOFFARFMAG, abfd)
+ if ((bfd_bwrite ((PTR) &ahdr, (bfd_size_type) SIZEOF_AR_HDR, abfd)
+ != SIZEOF_AR_HDR)
+ || (bfd_bwrite ((PTR) XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd)
!= SXCOFFARFMAG))
return false;
sprintf (decbuf, "%-12ld", (long) count);
- if (bfd_write ((PTR) decbuf, 1, 12, abfd) != 12)
+ if (bfd_bwrite ((PTR) decbuf, (bfd_size_type) XCOFFARMAG_ELEMENT_SIZE, abfd)
+ != XCOFFARMAG_ELEMENT_SIZE)
return false;
- for (i = 0; i < count; i++)
+ for (i = 0; i < (size_t) count; i++)
{
sprintf (decbuf, "%-12ld", (long) offsets[i]);
- if (bfd_write ((PTR) decbuf, 1, 12, abfd) != 12)
+ if (bfd_bwrite ((PTR) decbuf, (bfd_size_type) XCOFFARMAG_ELEMENT_SIZE,
+ abfd) != XCOFFARMAG_ELEMENT_SIZE)
return false;
}
for (sub = abfd->archive_head; sub != NULL; sub = sub->next)
{
const char *name;
- size_t namlen;
+ bfd_size_type namlen;
name = normalize_filename (sub);
namlen = strlen (name);
- if (bfd_write ((PTR) name, 1, namlen + 1, abfd) != namlen + 1)
+ if (bfd_bwrite ((PTR) name, namlen + 1, abfd) != namlen + 1)
return false;
}
if ((size & 1) != 0)
@@ -2028,12 +2079,11 @@ xcoff_write_archive_contents_old (abfd)
bfd_byte b;
b = '\0';
- if (bfd_write ((PTR) &b, 1, 1, abfd) != 1)
+ if (bfd_bwrite ((PTR) &b, (bfd_size_type) 1, abfd) != 1)
return false;
}
/* Write out the armap, if appropriate. */
-
if (! makemap || ! hasobjects)
sprintf (fhdr.symoff, "%d", 0);
else
@@ -2053,8 +2103,8 @@ xcoff_write_archive_contents_old (abfd)
*p = ' ';
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || (bfd_write ((PTR) &fhdr, SIZEOF_AR_FILE_HDR, 1, abfd) !=
- SIZEOF_AR_FILE_HDR))
+ || (bfd_bwrite ((PTR) &fhdr, (bfd_size_type) SIZEOF_AR_FILE_HDR, abfd)
+ != SIZEOF_AR_FILE_HDR))
return false;
return true;
@@ -2065,60 +2115,63 @@ xcoff_write_archive_contents_big (abfd)
bfd *abfd;
{
struct xcoff_ar_file_hdr_big fhdr;
- size_t count;
- size_t total_namlen;
+ bfd_size_type count;
+ bfd_size_type total_namlen;
file_ptr *offsets;
boolean makemap;
boolean hasobjects;
- file_ptr prevoff, nextoff;
- bfd *sub;
- unsigned int i;
- struct xcoff_ar_hdr_big ahdr;
+ ufile_ptr prevoff, nextoff;
+ bfd *current_bfd;
+ size_t i;
+ struct xcoff_ar_hdr_big *hdr, ahdr;
bfd_size_type size;
- char *p;
- char decbuf[13];
+ bfd_byte *member_table, *mt;
+ bfd_vma member_table_size;
- memset (&fhdr, 0, sizeof fhdr);
- strncpy (fhdr.magic, XCOFFARMAGBIG, SXCOFFARMAG);
- sprintf (fhdr.firstmemoff, "%d", SIZEOF_AR_FILE_HDR_BIG);
- sprintf (fhdr.freeoff, "%d", 0);
+ memcpy (fhdr.magic, XCOFFARMAGBIG, SXCOFFARMAG);
+ PRINT20 (fhdr.firstmemoff, SIZEOF_AR_FILE_HDR_BIG);
+ PRINT20 (fhdr.freeoff, 0);
- count = 0;
- total_namlen = 0;
- for (sub = abfd->archive_head; sub != NULL; sub = sub->next)
+ /* Calculate count and total_namlen */
+ for (current_bfd = abfd->archive_head, count = 0, total_namlen = 0;
+ current_bfd != NULL;
+ current_bfd = current_bfd->next, count++)
+ total_namlen += strlen (normalize_filename (current_bfd)) + 1;
+
+ offsets = NULL;
+ if (count)
{
- ++count;
- total_namlen += strlen (normalize_filename (sub)) + 1;
+ offsets = (file_ptr *) bfd_malloc (count * sizeof (file_ptr));
+ if (offsets == NULL)
+ return false;
}
- offsets = (file_ptr *) bfd_alloc (abfd, count * sizeof (file_ptr));
- if (offsets == NULL)
- return false;
-
- if (bfd_seek (abfd, SIZEOF_AR_FILE_HDR_BIG, SEEK_SET) != 0)
+ if (bfd_seek (abfd, (file_ptr) SIZEOF_AR_FILE_HDR_BIG, SEEK_SET) != 0)
return false;
makemap = bfd_has_map (abfd);
hasobjects = false;
prevoff = 0;
nextoff = SIZEOF_AR_FILE_HDR_BIG;
- for (sub = abfd->archive_head, i = 0; sub != NULL; sub = sub->next, i++)
+ for (current_bfd = abfd->archive_head, i = 0;
+ current_bfd != NULL;
+ current_bfd = current_bfd->next, i++)
{
const char *name;
- size_t namlen;
+ bfd_size_type namlen;
struct xcoff_ar_hdr_big *ahdrp;
bfd_size_type remaining;
if (makemap && ! hasobjects)
{
- if (bfd_check_format (sub, bfd_object))
+ if (bfd_check_format (current_bfd, bfd_object))
hasobjects = true;
}
- name = normalize_filename (sub);
+ name = normalize_filename (current_bfd);
namlen = strlen (name);
- if (sub->arelt_data != NULL)
- ahdrp = arch_xhdr_big (sub);
+ if (current_bfd->arelt_data != NULL)
+ ahdrp = arch_xhdr_big (current_bfd);
else
ahdrp = NULL;
@@ -2126,46 +2179,41 @@ xcoff_write_archive_contents_big (abfd)
{
struct stat s;
- memset (&ahdr, 0, sizeof ahdr);
ahdrp = &ahdr;
/* XXX This should actually be a call to stat64 (at least on
- 32-bit machines). */
- if (stat (bfd_get_filename (sub), &s) != 0)
+ 32-bit machines).
+ XXX This call will fail if the original object is not found. */
+ if (stat (bfd_get_filename (current_bfd), &s) != 0)
{
bfd_set_error (bfd_error_system_call);
return false;
}
- /* XXX This call actually should use %lld (at least on 32-bit
- machines) since the fields's width is 20 and there numbers with
- more than 32 bits can be represented. */
- sprintf (ahdrp->size, "%ld", (long) s.st_size);
- sprintf (ahdrp->date, "%ld", (long) s.st_mtime);
- sprintf (ahdrp->uid, "%ld", (long) s.st_uid);
- sprintf (ahdrp->gid, "%ld", (long) s.st_gid);
- sprintf (ahdrp->mode, "%o", (unsigned int) s.st_mode);
+ PRINT20 (ahdrp->size, s.st_size);
+ PRINT12 (ahdrp->date, s.st_mtime);
+ PRINT12 (ahdrp->uid, s.st_uid);
+ PRINT12 (ahdrp->gid, s.st_gid);
+ PRINT12_OCTAL (ahdrp->mode, s.st_mode);
- if (sub->arelt_data == NULL)
+ if (current_bfd->arelt_data == NULL)
{
- sub->arelt_data = bfd_alloc (sub, sizeof (struct areltdata));
- if (sub->arelt_data == NULL)
+ size = sizeof (struct areltdata);
+ current_bfd->arelt_data = bfd_alloc (current_bfd, size);
+ if (current_bfd->arelt_data == NULL)
return false;
}
- arch_eltdata (sub)->parsed_size = s.st_size;
+ arch_eltdata (current_bfd)->parsed_size = s.st_size;
}
- /* XXX These calls actually should use %lld (at least on 32-bit
- machines) since the fields's width is 20 and there numbers with
- more than 32 bits can be represented. */
- sprintf (ahdrp->prevoff, "%ld", (long) prevoff);
- sprintf (ahdrp->namlen, "%ld", (long) namlen);
+ PRINT20 (ahdrp->prevoff, prevoff);
+ PRINT4 (ahdrp->namlen, namlen);
/* If the length of the name is odd, we write out the null byte
after the name as well. */
- namlen = (namlen + 1) &~ 1;
+ namlen = (namlen + 1) &~ (bfd_size_type) 1;
- remaining = arelt_size (sub);
+ remaining = arelt_size (current_bfd);
size = (SIZEOF_AR_HDR_BIG
+ namlen
+ SXCOFFARFMAG
@@ -2178,21 +2226,16 @@ xcoff_write_archive_contents_big (abfd)
prevoff = nextoff;
nextoff += size + (size & 1);
- sprintf (ahdrp->nextoff, "%ld", (long) nextoff);
+ PRINT20 (ahdrp->nextoff, nextoff);
- /* We need spaces, not null bytes, in the header. */
- for (p = (char *) ahdrp; p < (char *) ahdrp + SIZEOF_AR_HDR_BIG; p++)
- if (*p == '\0')
- *p = ' ';
-
- if (bfd_write ((PTR) ahdrp, 1, SIZEOF_AR_HDR_BIG, abfd)
- != SIZEOF_AR_HDR_BIG
- || bfd_write ((PTR) name, 1, namlen, abfd) != namlen
- || (bfd_write ((PTR) XCOFFARFMAG, 1, SXCOFFARFMAG, abfd)
- != SXCOFFARFMAG))
+ if ((bfd_bwrite ((PTR) ahdrp, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd)
+ != SIZEOF_AR_HDR_BIG)
+ || bfd_bwrite ((PTR) name, (bfd_size_type) namlen, abfd) != namlen
+ || (bfd_bwrite ((PTR) XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG,
+ abfd) != SXCOFFARFMAG))
return false;
- if (bfd_seek (sub, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (current_bfd, (file_ptr) 0, SEEK_SET) != 0)
return false;
while (remaining != 0)
{
@@ -2202,8 +2245,8 @@ xcoff_write_archive_contents_big (abfd)
amt = sizeof buffer;
if (amt > remaining)
amt = remaining;
- if (bfd_read (buffer, 1, amt, sub) != amt
- || bfd_write (buffer, 1, amt, abfd) != amt)
+ if (bfd_bread (buffer, amt, current_bfd) != amt
+ || bfd_bwrite (buffer, amt, abfd) != amt)
return false;
remaining -= amt;
}
@@ -2213,101 +2256,116 @@ xcoff_write_archive_contents_big (abfd)
bfd_byte b;
b = '\0';
- if (bfd_write (&b, 1, 1, abfd) != 1)
+ if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
return false;
}
}
- /* XXX This call actually should use %lld (at least on 32-bit
- machines) since the fields's width is 20 and there numbers with
- more than 32 bits can be represented. */
- sprintf (fhdr.lastmemoff, "%ld", (long) prevoff);
-
- /* Write out the member table. */
+ PRINT20 (fhdr.lastmemoff, prevoff);
+
+ /* Write out the member table.
+ Layout :
+
+ standard big archive header
+ 0x0000 ar_size [0x14]
+ 0x0014 ar_nxtmem [0x14]
+ 0x0028 ar_prvmem [0x14]
+ 0x003C ar_date [0x0C]
+ 0x0048 ar_uid [0x0C]
+ 0x0054 ar_gid [0x0C]
+ 0x0060 ar_mod [0x0C]
+ 0x006C ar_namelen[0x04]
+ 0x0070 ar_fmag [0x02]
+
+ Member table
+ 0x0072 count [0x14]
+ 0x0086 offsets [0x14 * counts]
+ 0x0086 + 0x14 * counts names [??]
+ ?? pad to even bytes.
+ */
BFD_ASSERT (nextoff == bfd_tell (abfd));
- /* XXX This call actually should use %lld (at least on 32-bit
- machines) since the fields's width is 20 and there numbers with
- more than 32 bits can be represented. */
- sprintf (fhdr.memoff, "%ld", (long) nextoff);
- memset (&ahdr, 0, sizeof ahdr);
- /* XXX The next two calls actually should use %lld (at least on 32-bit
- machines) since the fields's width is 20 and there numbers with
- more than 32 bits can be represented. */
- sprintf (ahdr.size, "%ld", (long) (12 + count * 12 + total_namlen));
- sprintf (ahdr.prevoff, "%ld", (long) prevoff);
- sprintf (ahdr.date, "%d", 0);
- sprintf (ahdr.uid, "%d", 0);
- sprintf (ahdr.gid, "%d", 0);
- sprintf (ahdr.mode, "%d", 0);
- sprintf (ahdr.namlen, "%d", 0);
+ member_table_size = (SIZEOF_AR_HDR_BIG
+ + SXCOFFARFMAG
+ + XCOFFARMAGBIG_ELEMENT_SIZE
+ + count * XCOFFARMAGBIG_ELEMENT_SIZE
+ + total_namlen);
- size = (SIZEOF_AR_HDR_BIG
- + 12
- + count * 12
- + total_namlen
- + SXCOFFARFMAG);
+ member_table_size += member_table_size & 1;
+ member_table = NULL;
+ member_table = (bfd_byte *) bfd_malloc (member_table_size);
+ if (member_table == NULL)
+ return false;
+ memset (member_table, 0, member_table_size);
- prevoff = nextoff;
- nextoff += size + (size & 1);
+ hdr = (struct xcoff_ar_hdr_big *) member_table;
- if (makemap && hasobjects)
- /* XXX This call actually should use %lld (at least on 32-bit
- machines) since the fields's width is 20 and there numbers with
- more than 32 bits can be represented. */
- sprintf (ahdr.nextoff, "%ld", (long) nextoff);
+ PRINT20 (hdr->size, (XCOFFARMAGBIG_ELEMENT_SIZE +
+ count * XCOFFARMAGBIG_ELEMENT_SIZE +
+ total_namlen + (total_namlen & 1)));
+ if (makemap && hasobjects)
+ PRINT20 (hdr->nextoff, nextoff + member_table_size);
else
- sprintf (ahdr.nextoff, "%d", 0);
-
- /* We need spaces, not null bytes, in the header. */
- for (p = (char *) &ahdr; p < (char *) &ahdr + SIZEOF_AR_HDR_BIG; p++)
- if (*p == '\0')
- *p = ' ';
-
- if (bfd_write ((PTR) &ahdr, 1, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG
- || (bfd_write ((PTR) XCOFFARFMAG, 1, SXCOFFARFMAG, abfd)
- != SXCOFFARFMAG))
- return false;
+ PRINT20 (hdr->nextoff, 0);
+ PRINT20 (hdr->prevoff, prevoff);
+ PRINT12 (hdr->date, 0);
+ PRINT12 (hdr->uid, 0);
+ PRINT12 (hdr->gid, 0);
+ PRINT12 (hdr->mode, 0);
+ PRINT4 (hdr->namlen, 0);
+
+ mt = member_table + SIZEOF_AR_HDR_BIG;
+ memcpy (mt, XCOFFARFMAG, SXCOFFARFMAG);
+ mt += SXCOFFARFMAG;
+
+ PRINT20 (mt, count);
+ mt += XCOFFARMAGBIG_ELEMENT_SIZE;
+ for (i = 0; i < (size_t) count; i++)
+ {
+ PRINT20 (mt, offsets[i]);
+ mt += XCOFFARMAGBIG_ELEMENT_SIZE;
+ }
- sprintf (decbuf, "%-12ld", (long) count);
- if (bfd_write ((PTR) decbuf, 1, 12, abfd) != 12)
- return false;
- for (i = 0; i < count; i++)
+ if (count)
{
- sprintf (decbuf, "%-12ld", (long) offsets[i]);
- if (bfd_write ((PTR) decbuf, 1, 12, abfd) != 12)
- return false;
+ free (offsets);
+ offsets = NULL;
}
- for (sub = abfd->archive_head; sub != NULL; sub = sub->next)
+
+ for (current_bfd = abfd->archive_head; current_bfd != NULL;
+ current_bfd = current_bfd->next)
{
const char *name;
size_t namlen;
- name = normalize_filename (sub);
- namlen = strlen (name);
- if (bfd_write ((PTR) name, 1, namlen + 1, abfd) != namlen + 1)
- return false;
+ name = normalize_filename (current_bfd);
+ namlen = sprintf(mt, "%s", name);
+ mt += namlen + 1;
}
- if ((size & 1) != 0)
- {
- bfd_byte b;
+
+ if (bfd_bwrite (member_table, member_table_size, abfd) != member_table_size)
+ return false;
- b = '\0';
- if (bfd_write ((PTR) &b, 1, 1, abfd) != 1)
- return false;
- }
+ free (member_table);
+ member_table = NULL;
+
+ PRINT20 (fhdr.memoff, nextoff);
+
+ prevoff = nextoff;
+ nextoff += member_table_size;
/* Write out the armap, if appropriate. */
- if (! makemap || ! hasobjects)
- sprintf (fhdr.symoff, "%d", 0);
+ if (! makemap || ! hasobjects)
+ PRINT20 (fhdr.symoff, 0);
else
{
BFD_ASSERT (nextoff == bfd_tell (abfd));
- /* XXX This call actually should use %lld (at least on 32-bit
- machines) since the fields's width is 20 and there numbers with
- more than 32 bits can be represented. */
+
+ /* Save nextoff in fhdr.symoff so the armap routine can use it. */
+ PRINT20 (fhdr.symoff, nextoff);
+
bfd_ardata (abfd)->tdata = (PTR) &fhdr;
if (! _bfd_compute_and_write_armap (abfd, 0))
return false;
@@ -2315,16 +2373,11 @@ xcoff_write_archive_contents_big (abfd)
/* Write out the archive file header. */
- /* We need spaces, not null bytes, in the header. */
- for (p = (char *) &fhdr; p < (char *) &fhdr + SIZEOF_AR_FILE_HDR_BIG; p++)
- if (*p == '\0')
- *p = ' ';
-
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || (bfd_write ((PTR) &fhdr, SIZEOF_AR_FILE_HDR_BIG, 1, abfd) !=
- SIZEOF_AR_FILE_HDR_BIG))
+ || (bfd_bwrite ((PTR) &fhdr, (bfd_size_type) SIZEOF_AR_FILE_HDR_BIG,
+ abfd) != SIZEOF_AR_FILE_HDR_BIG))
return false;
-
+
return true;
}
@@ -2356,3 +2409,1443 @@ _bfd_xcoff_sizeof_headers (abfd, reloc)
size += abfd->section_count * SCNHSZ;
return size;
}
+
+/* Routines to swap information in the XCOFF .loader section. If we
+ ever need to write an XCOFF loader, this stuff will need to be
+ moved to another file shared by the linker (which XCOFF calls the
+ ``binder'') and the loader. */
+
+/* Swap in the ldhdr structure. */
+
+static void
+xcoff_swap_ldhdr_in (abfd, s, dst)
+ bfd *abfd;
+ const PTR s;
+ struct internal_ldhdr *dst;
+{
+ const struct external_ldhdr *src = (const struct external_ldhdr *) s;
+
+ dst->l_version = bfd_get_32 (abfd, src->l_version);
+ dst->l_nsyms = bfd_get_32 (abfd, src->l_nsyms);
+ dst->l_nreloc = bfd_get_32 (abfd, src->l_nreloc);
+ dst->l_istlen = bfd_get_32 (abfd, src->l_istlen);
+ dst->l_nimpid = bfd_get_32 (abfd, src->l_nimpid);
+ dst->l_impoff = bfd_get_32 (abfd, src->l_impoff);
+ dst->l_stlen = bfd_get_32 (abfd, src->l_stlen);
+ dst->l_stoff = bfd_get_32 (abfd, src->l_stoff);
+}
+
+/* Swap out the ldhdr structure. */
+
+static void
+xcoff_swap_ldhdr_out (abfd, src, d)
+ bfd *abfd;
+ const struct internal_ldhdr *src;
+ PTR d;
+{
+ struct external_ldhdr *dst = (struct external_ldhdr *) d;
+
+ bfd_put_32 (abfd, (bfd_vma) src->l_version, dst->l_version);
+ bfd_put_32 (abfd, src->l_nsyms, dst->l_nsyms);
+ bfd_put_32 (abfd, src->l_nreloc, dst->l_nreloc);
+ bfd_put_32 (abfd, src->l_istlen, dst->l_istlen);
+ bfd_put_32 (abfd, src->l_nimpid, dst->l_nimpid);
+ bfd_put_32 (abfd, src->l_impoff, dst->l_impoff);
+ bfd_put_32 (abfd, src->l_stlen, dst->l_stlen);
+ bfd_put_32 (abfd, src->l_stoff, dst->l_stoff);
+}
+
+/* Swap in the ldsym structure. */
+
+static void
+xcoff_swap_ldsym_in (abfd, s, dst)
+ bfd *abfd;
+ const PTR s;
+ struct internal_ldsym *dst;
+{
+ const struct external_ldsym *src = (const struct external_ldsym *) s;
+
+ if (bfd_get_32 (abfd, src->_l._l_l._l_zeroes) != 0) {
+ memcpy (dst->_l._l_name, src->_l._l_name, SYMNMLEN);
+ } else {
+ dst->_l._l_l._l_zeroes = 0;
+ dst->_l._l_l._l_offset = bfd_get_32 (abfd, src->_l._l_l._l_offset);
+ }
+ dst->l_value = bfd_get_32 (abfd, src->l_value);
+ dst->l_scnum = bfd_get_16 (abfd, src->l_scnum);
+ dst->l_smtype = bfd_get_8 (abfd, src->l_smtype);
+ dst->l_smclas = bfd_get_8 (abfd, src->l_smclas);
+ dst->l_ifile = bfd_get_32 (abfd, src->l_ifile);
+ dst->l_parm = bfd_get_32 (abfd, src->l_parm);
+}
+
+/* Swap out the ldsym structure. */
+
+static void
+xcoff_swap_ldsym_out (abfd, src, d)
+ bfd *abfd;
+ const struct internal_ldsym *src;
+ PTR d;
+{
+ struct external_ldsym *dst = (struct external_ldsym *) d;
+
+ if (src->_l._l_l._l_zeroes != 0)
+ memcpy (dst->_l._l_name, src->_l._l_name, SYMNMLEN);
+ else
+ {
+ bfd_put_32 (abfd, (bfd_vma) 0, dst->_l._l_l._l_zeroes);
+ bfd_put_32 (abfd, (bfd_vma) src->_l._l_l._l_offset,
+ dst->_l._l_l._l_offset);
+ }
+ bfd_put_32 (abfd, src->l_value, dst->l_value);
+ bfd_put_16 (abfd, (bfd_vma) src->l_scnum, dst->l_scnum);
+ bfd_put_8 (abfd, src->l_smtype, dst->l_smtype);
+ bfd_put_8 (abfd, src->l_smclas, dst->l_smclas);
+ bfd_put_32 (abfd, src->l_ifile, dst->l_ifile);
+ bfd_put_32 (abfd, src->l_parm, dst->l_parm);
+}
+
+/* Swap in the ldrel structure. */
+
+static void
+xcoff_swap_ldrel_in (abfd, s, dst)
+ bfd *abfd;
+ const PTR s;
+ struct internal_ldrel *dst;
+{
+ const struct external_ldrel *src = (const struct external_ldrel *) s;
+
+ dst->l_vaddr = bfd_get_32 (abfd, src->l_vaddr);
+ dst->l_symndx = bfd_get_32 (abfd, src->l_symndx);
+ dst->l_rtype = bfd_get_16 (abfd, src->l_rtype);
+ dst->l_rsecnm = bfd_get_16 (abfd, src->l_rsecnm);
+}
+
+/* Swap out the ldrel structure. */
+
+static void
+xcoff_swap_ldrel_out (abfd, src, d)
+ bfd *abfd;
+ const struct internal_ldrel *src;
+ PTR d;
+{
+ struct external_ldrel *dst = (struct external_ldrel *) d;
+
+ bfd_put_32 (abfd, src->l_vaddr, dst->l_vaddr);
+ bfd_put_32 (abfd, src->l_symndx, dst->l_symndx);
+ bfd_put_16 (abfd, (bfd_vma) src->l_rtype, dst->l_rtype);
+ bfd_put_16 (abfd, (bfd_vma) src->l_rsecnm, dst->l_rsecnm);
+}
+
+
+
+/* This is the relocation function for the RS/6000/POWER/PowerPC.
+ This is currently the only processor which uses XCOFF; I hope that
+ will never change. */
+
+static boolean
+xcoff_ppc_relocate_section (output_bfd, info, input_bfd,
+ input_section, contents, relocs, syms,
+ sections)
+ bfd *output_bfd;
+ struct bfd_link_info *info;
+ bfd *input_bfd;
+ asection *input_section;
+ bfd_byte *contents;
+ struct internal_reloc *relocs;
+ struct internal_syment *syms;
+ asection **sections;
+{
+ struct internal_reloc *rel;
+ struct internal_reloc *relend;
+
+ rel = relocs;
+ relend = rel + input_section->reloc_count;
+
+ for (; rel < relend; rel++)
+ {
+ long symndx;
+ struct xcoff_link_hash_entry *h;
+ struct internal_syment *sym;
+ bfd_vma addend;
+ bfd_vma val;
+ struct reloc_howto_struct howto;
+ bfd_reloc_status_type rstat;
+
+ /* Relocation type R_REF is a special relocation type which is
+ merely used to prevent garbage collection from occurring for
+ the csect including the symbol which it references. */
+ if (rel->r_type == R_REF)
+ continue;
+
+ symndx = rel->r_symndx;
+
+ if (symndx == -1)
+ {
+ h = NULL;
+ sym = NULL;
+ addend = 0;
+ }
+ else
+ {
+ h = obj_xcoff_sym_hashes (input_bfd)[symndx];
+ sym = syms + symndx;
+ addend = - sym->n_value;
+
+ }
+
+ /* We build the howto information on the fly. */
+
+ howto.type = rel->r_type;
+ howto.rightshift = 0;
+ howto.size = 2;
+ howto.bitsize = (rel->r_size & 0x1f) + 1;
+ howto.pc_relative = false;
+ howto.bitpos = 0;
+ if ((rel->r_size & 0x80) != 0)
+ howto.complain_on_overflow = complain_overflow_signed;
+ else
+ howto.complain_on_overflow = complain_overflow_bitfield;
+ howto.special_function = NULL;
+ howto.name = "internal";
+ howto.partial_inplace = true;
+ if (howto.bitsize == 32)
+ howto.src_mask = howto.dst_mask = 0xffffffff;
+ else
+ {
+ howto.src_mask = howto.dst_mask = (1 << howto.bitsize) - 1;
+ if (howto.bitsize == 16)
+ howto.size = 1;
+ }
+ howto.pcrel_offset = false;
+
+ val = 0;
+
+ if (h == NULL)
+ {
+ asection *sec;
+
+ if (symndx == -1)
+ {
+ sec = bfd_abs_section_ptr;
+ val = 0;
+ }
+ else
+ {
+ sec = sections[symndx];
+ /* Hack to make sure we use the right TOC anchor value
+ if this reloc is against the TOC anchor. */
+
+ if (sec->name[3] == '0'
+ && strcmp (sec->name, ".tc0") == 0)
+ {
+ val = xcoff_data (output_bfd)->toc;
+ }
+ else
+ {
+ val = (sec->output_section->vma
+ + sec->output_offset
+ + sym->n_value
+ - sec->vma);
+ }
+ }
+ }
+ else
+ {
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ {
+ asection *sec;
+
+ sec = h->root.u.def.section;
+ val = (h->root.u.def.value
+ + sec->output_section->vma
+ + sec->output_offset);
+ }
+ else if (h->root.type == bfd_link_hash_common)
+ {
+ asection *sec;
+
+ sec = h->root.u.c.p->section;
+ val = (sec->output_section->vma
+ + sec->output_offset);
+ }
+ else if ((h->flags & XCOFF_DEF_DYNAMIC) != 0
+ || (h->flags & XCOFF_IMPORT) != 0)
+ {
+ /* Every symbol in a shared object is defined somewhere. */
+ val = 0;
+ }
+ else if (! info->relocateable)
+ {
+ if (! ((*info->callbacks->undefined_symbol)
+ (info, h->root.root.string, input_bfd, input_section,
+ rel->r_vaddr - input_section->vma, true)))
+ return false;
+
+ /* Don't try to process the reloc. It can't help, and
+ it may generate another error. */
+ continue;
+ }
+ }
+
+ /* I took the relocation type definitions from two documents:
+ the PowerPC AIX Version 4 Application Binary Interface, First
+ Edition (April 1992), and the PowerOpen ABI, Big-Endian
+ 32-Bit Hardware Implementation (June 30, 1994). Differences
+ between the documents are noted below. */
+
+ switch (rel->r_type)
+ {
+ case R_RTB:
+ case R_RRTBI:
+ case R_RRTBA:
+ /* These relocs are defined by the PowerPC ABI to be
+ relative branches which use half of the difference
+ between the symbol and the program counter. I can't
+ quite figure out when this is useful. These relocs are
+ not defined by the PowerOpen ABI. */
+ default:
+ (*_bfd_error_handler)
+ (_("%s: unsupported relocation type 0x%02x"),
+ bfd_archive_filename (input_bfd), (unsigned int) rel->r_type);
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ case R_POS:
+ /* Simple positive relocation. */
+ break;
+ case R_NEG:
+ /* Simple negative relocation. */
+ val = - val;
+ break;
+ case R_REL:
+ /* Simple PC relative relocation. */
+ howto.pc_relative = true;
+ break;
+ case R_TOC:
+ /* TOC relative relocation. The value in the instruction in
+ the input file is the offset from the input file TOC to
+ the desired location. We want the offset from the final
+ TOC to the desired location. We have:
+ isym = iTOC + in
+ iinsn = in + o
+ osym = oTOC + on
+ oinsn = on + o
+ so we must change insn by on - in.
+ */
+ case R_GL:
+ /* Global linkage relocation. The value of this relocation
+ is the address of the entry in the TOC section. */
+ case R_TCL:
+ /* Local object TOC address. I can't figure out the
+ difference between this and case R_GL. */
+ case R_TRL:
+ /* TOC relative relocation. A TOC relative load instruction
+ which may be changed to a load address instruction.
+ FIXME: We don't currently implement this optimization. */
+ case R_TRLA:
+ /* TOC relative relocation. This is a TOC relative load
+ address instruction which may be changed to a load
+ instruction. FIXME: I don't know if this is the correct
+ implementation. */
+ if (h != NULL && h->smclas != XMC_TD)
+ {
+ if (h->toc_section == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry"),
+ bfd_archive_filename (input_bfd), rel->r_vaddr,
+ h->root.root.string);
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
+
+ BFD_ASSERT ((h->flags & XCOFF_SET_TOC) == 0);
+ val = (h->toc_section->output_section->vma
+ + h->toc_section->output_offset);
+ }
+
+ val = ((val - xcoff_data (output_bfd)->toc)
+ - (sym->n_value - xcoff_data (input_bfd)->toc));
+ addend = 0;
+ break;
+ case R_BA:
+ /* Absolute branch. We don't want to mess with the lower
+ two bits of the instruction. */
+ case R_CAI:
+ /* The PowerPC ABI defines this as an absolute call which
+ may be modified to become a relative call. The PowerOpen
+ ABI does not define this relocation type. */
+ case R_RBA:
+ /* Absolute branch which may be modified to become a
+ relative branch. */
+ case R_RBAC:
+ /* The PowerPC ABI defines this as an absolute branch to a
+ fixed address which may be modified to an absolute branch
+ to a symbol. The PowerOpen ABI does not define this
+ relocation type. */
+ case R_RBRC:
+ /* The PowerPC ABI defines this as an absolute branch to a
+ fixed address which may be modified to a relative branch.
+ The PowerOpen ABI does not define this relocation type. */
+ howto.src_mask &= ~3;
+ howto.dst_mask = howto.src_mask;
+ break;
+ case R_BR:
+ /* Relative branch. We don't want to mess with the lower
+ two bits of the instruction. */
+ case R_CREL:
+ /* The PowerPC ABI defines this as a relative call which may
+ be modified to become an absolute call. The PowerOpen
+ ABI does not define this relocation type. */
+ case R_RBR:
+ /* A relative branch which may be modified to become an
+ absolute branch. FIXME: We don't implement this,
+ although we should for symbols of storage mapping class
+ XMC_XO. */
+ howto.pc_relative = true;
+ howto.src_mask &= ~3;
+ howto.dst_mask = howto.src_mask;
+ break;
+ case R_RL:
+ /* The PowerPC AIX ABI describes this as a load which may be
+ changed to a load address. The PowerOpen ABI says this
+ is the same as case R_POS. */
+ break;
+ case R_RLA:
+ /* The PowerPC AIX ABI describes this as a load address
+ which may be changed to a load. The PowerOpen ABI says
+ this is the same as R_POS. */
+ break;
+ }
+
+ /* If we see an R_BR or R_RBR reloc which is jumping to global
+ linkage code, and it is followed by an appropriate cror nop
+ instruction, we replace the cror with lwz r2,20(r1). This
+ restores the TOC after the glink code. Contrariwise, if the
+ call is followed by a lwz r2,20(r1), but the call is not
+ going to global linkage code, we can replace the load with a
+ cror. */
+ if ((rel->r_type == R_BR || rel->r_type == R_RBR)
+ && h != NULL
+ && h->root.type == bfd_link_hash_defined
+ && (rel->r_vaddr - input_section->vma + 8
+ <= input_section->_cooked_size))
+ {
+ bfd_byte *pnext;
+ unsigned long next;
+
+ pnext = contents + (rel->r_vaddr - input_section->vma) + 4;
+ next = bfd_get_32 (input_bfd, pnext);
+
+ /* The _ptrgl function is magic. It is used by the AIX
+ compiler to call a function through a pointer. */
+ if (h->smclas == XMC_GL
+ || strcmp (h->root.root.string, "._ptrgl") == 0)
+ {
+ if (next == 0x4def7b82 /* cror 15,15,15 */
+ || next == 0x4ffffb82 /* cror 31,31,31 */
+ || next == 0x60000000) /* ori r0,r0,0 */
+ bfd_put_32 (input_bfd,
+ (bfd_vma) 0x80410014, /* lwz r1,20(r1) */
+ pnext);
+ }
+ else
+ {
+ if (next == 0x80410014) /* lwz r1,20(r1) */
+ bfd_put_32 (input_bfd,
+ (bfd_vma) 0x60000000, /* ori r0,r0,0 */
+ pnext);
+ }
+ }
+
+ /* A PC relative reloc includes the section address. */
+ if (howto.pc_relative)
+ addend += input_section->vma;
+
+ rstat = _bfd_final_link_relocate (&howto, input_bfd, input_section,
+ contents,
+ rel->r_vaddr - input_section->vma,
+ val, addend);
+
+ switch (rstat)
+ {
+ default:
+ abort ();
+ case bfd_reloc_ok:
+ break;
+ case bfd_reloc_overflow:
+ {
+ const char *name;
+ char buf[SYMNMLEN + 1];
+ char howto_name[10];
+
+ if (symndx == -1)
+ name = "*ABS*";
+ else if (h != NULL)
+ name = h->root.root.string;
+ else
+ {
+ name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
+
+ if (name == NULL)
+ return false;
+ }
+ sprintf (howto_name, "0x%02x", rel->r_type);
+
+ if (! ((*info->callbacks->reloc_overflow)
+ (info, name, howto_name, (bfd_vma) 0, input_bfd,
+ input_section, rel->r_vaddr - input_section->vma)))
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+static boolean
+_bfd_xcoff_put_ldsymbol_name (abfd, ldinfo, ldsym, name)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ struct xcoff_loader_info *ldinfo;
+ struct internal_ldsym *ldsym;
+ const char *name;
+{
+ size_t len;
+ len = strlen (name);
+
+ if (len <= SYMNMLEN)
+ strncpy (ldsym->_l._l_name, name, SYMNMLEN);
+ else
+ {
+ if (ldinfo->string_size + len + 3 > ldinfo->string_alc)
+ {
+ bfd_size_type newalc;
+ bfd_byte *newstrings;
+
+ newalc = ldinfo->string_alc * 2;
+ if (newalc == 0)
+ newalc = 32;
+ while (ldinfo->string_size + len + 3 > newalc)
+ newalc *= 2;
+
+ newstrings = ((bfd_byte *)
+ bfd_realloc ((PTR) ldinfo->strings, newalc));
+ if (newstrings == NULL)
+ {
+ ldinfo->failed = true;
+ return false;
+ }
+ ldinfo->string_alc = newalc;
+ ldinfo->strings = newstrings;
+ }
+
+ bfd_put_16 (ldinfo->output_bfd, (bfd_vma) (len + 1),
+ ldinfo->strings + ldinfo->string_size);
+ strcpy (ldinfo->strings + ldinfo->string_size + 2, name);
+ ldsym->_l._l_l._l_zeroes = 0;
+ ldsym->_l._l_l._l_offset = ldinfo->string_size + 2;
+ ldinfo->string_size += len + 3;
+ }
+
+ return true;
+}
+
+static boolean
+_bfd_xcoff_put_symbol_name (bfd *abfd, struct bfd_strtab_hash *strtab,
+ struct internal_syment *sym,
+ const char *name)
+{
+ if (strlen (name) <= SYMNMLEN)
+ {
+ strncpy (sym->_n._n_name, name, SYMNMLEN);
+ }
+ else
+ {
+ boolean hash;
+ bfd_size_type indx;
+
+ hash = true;
+ if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
+ hash = false;
+ indx = _bfd_stringtab_add (strtab, name, hash, false);
+ if (indx == (bfd_size_type) -1)
+ return false;
+ sym->_n._n_n._n_zeroes = 0;
+ sym->_n._n_n._n_offset = STRING_SIZE_SIZE + indx;
+ }
+ return true;
+}
+
+static asection *
+xcoff_create_csect_from_smclas (abfd, aux, symbol_name)
+ bfd *abfd;
+ union internal_auxent *aux;
+ const char *symbol_name;
+{
+ asection *return_value = NULL;
+
+ /* .sv64 = x_smclas == 17
+ This is an invalid csect for 32 bit apps. */
+ static const char *names[19] =
+ {
+ ".pr", ".ro", ".db", ".tc", ".ua", ".rw", ".gl", ".xo",
+ ".sv", ".bs", ".ds", ".uc", ".ti", ".tb", NULL, ".tc0",
+ ".td", NULL, ".sv3264"
+ };
+
+ if ((19 >= aux->x_csect.x_smclas) &&
+ (NULL != names[aux->x_csect.x_smclas]))
+ {
+ return_value = bfd_make_section_anyway
+ (abfd, names[aux->x_csect.x_smclas]);
+ }
+ else
+ {
+ (*_bfd_error_handler)
+ (_("%s: symbol `%s' has unrecognized smclas %d"),
+ bfd_archive_filename (abfd), symbol_name, aux->x_csect.x_smclas);
+ bfd_set_error (bfd_error_bad_value);
+ }
+
+ return return_value;
+}
+
+static boolean
+xcoff_is_lineno_count_overflow (abfd, value)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ bfd_vma value;
+{
+ if (0xffff <= value)
+ return true;
+
+ return false;
+}
+
+static boolean
+xcoff_is_reloc_count_overflow (abfd, value)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ bfd_vma value;
+{
+ if (0xffff <= value)
+ return true;
+
+ return false;
+}
+
+static bfd_vma
+xcoff_loader_symbol_offset (abfd, ldhdr)
+ bfd *abfd;
+ struct internal_ldhdr *ldhdr ATTRIBUTE_UNUSED;
+{
+ return bfd_xcoff_ldhdrsz(abfd);
+}
+
+static bfd_vma
+xcoff_loader_reloc_offset (abfd, ldhdr)
+ bfd *abfd;
+ struct internal_ldhdr *ldhdr;
+{
+ return bfd_xcoff_ldhdrsz(abfd) +
+ (ldhdr->l_nsyms * bfd_xcoff_ldsymsz(abfd));
+}
+
+static boolean
+xcoff_generate_rtinit (abfd, init, fini)
+ bfd *abfd;
+ const char *init;
+ const char *fini;
+{
+ bfd_byte filehdr_ext[FILHSZ];
+ bfd_byte scnhdr_ext[SCNHSZ];
+ bfd_byte syment_ext[SYMESZ * 8];
+ bfd_byte reloc_ext[RELSZ * 2];
+ bfd_byte *data_buffer;
+ bfd_size_type data_buffer_size;
+ bfd_byte *string_table, *st_tmp;
+ bfd_size_type string_table_size;
+ bfd_vma val;
+ size_t initsz, finisz;
+ struct internal_filehdr filehdr;
+ struct internal_scnhdr scnhdr;
+ struct internal_syment syment;
+ union internal_auxent auxent;
+ struct internal_reloc reloc;
+
+ char *data_name = ".data";
+ char *rtinit_name = "__rtinit";
+
+ if (! bfd_xcoff_rtinit_size (abfd)
+ || (init == NULL && fini == NULL))
+ return false;
+
+ initsz = (init == NULL ? 0 : 1 + strlen (init));
+ finisz = (fini == NULL ? 0 : 1 + strlen (fini));
+
+ /* file header */
+ memset (filehdr_ext, 0, FILHSZ);
+ memset (&filehdr, 0, sizeof (struct internal_filehdr));
+ filehdr.f_magic = bfd_xcoff_magic_number (abfd);
+ filehdr.f_nscns = 1;
+ filehdr.f_timdat = 0;
+ filehdr.f_nsyms = 0; /* at least 6, no more than 8 */
+ filehdr.f_symptr = 0; /* set below */
+ filehdr.f_opthdr = 0;
+ filehdr.f_flags = 0;
+
+ /* section header */
+ memset (scnhdr_ext, 0, SCNHSZ);
+ memset (&scnhdr, 0, sizeof (struct internal_scnhdr));
+ memcpy (scnhdr.s_name, data_name, strlen (data_name));
+ scnhdr.s_paddr = 0;
+ scnhdr.s_vaddr = 0;
+ scnhdr.s_size = 0; /* set below */
+ scnhdr.s_scnptr = FILHSZ + SCNHSZ;
+ scnhdr.s_relptr = 0; /* set below */
+ scnhdr.s_lnnoptr = 0;
+ scnhdr.s_nreloc = 0; /* either 1 or 2 */
+ scnhdr.s_nlnno = 0;
+ scnhdr.s_flags = STYP_DATA;
+
+ /* .data
+ 0x0000 0x00000000 : rtl
+ 0x0004 0x00000010 : offset to init, or 0
+ 0x0008 0x00000028 : offset to fini, or 0
+ 0x000C 0x0000000C : size of descriptor
+ 0x0010 0x00000000 : init, needs a reloc
+ 0x0014 0x00000040 : offset to init name
+ 0x0018 0x00000000 : flags, padded to a word
+ 0x001C 0x00000000 : empty init
+ 0x0020 0x00000000 :
+ 0x0024 0x00000000 :
+ 0x0028 0x00000000 : fini, needs a reloc
+ 0x002C 0x00000??? : offset to fini name
+ 0x0030 0x00000000 : flags, padded to a word
+ 0x0034 0x00000000 : empty fini
+ 0x0038 0x00000000 :
+ 0x003C 0x00000000 :
+ 0x0040 init name
+ 0x0040 + initsz fini name */
+
+ data_buffer_size = 0x0040 + initsz + finisz;
+ data_buffer_size += (data_buffer_size & 7) ? 8 - (data_buffer_size & 7) : 0;
+ data_buffer = NULL;
+ data_buffer = (bfd_byte *) bfd_malloc (data_buffer_size);
+ if (data_buffer == NULL)
+ return false;
+
+ memset (data_buffer, 0, data_buffer_size);
+
+ if (initsz)
+ {
+ val = 0x10;
+ bfd_h_put_32 (abfd, val, &data_buffer[0x04]);
+ val = 0x40;
+ bfd_h_put_32 (abfd, val, &data_buffer[0x14]);
+ memcpy (&data_buffer[val], init, initsz);
+ }
+
+ if (finisz)
+ {
+ val = 0x28;
+ bfd_h_put_32 (abfd, val, &data_buffer[0x08]);
+ val = 0x40 + initsz;
+ bfd_h_put_32 (abfd, val, &data_buffer[0x2C]);
+ memcpy (&data_buffer[val], fini, finisz);
+ }
+
+ val = 0x0C;
+ bfd_h_put_32 (abfd, val, &data_buffer[0x0C]);
+
+ scnhdr.s_size = data_buffer_size;
+
+ /* string table */
+ string_table_size = 0;
+ if (initsz > 9)
+ string_table_size += initsz;
+ if (finisz > 9)
+ string_table_size += finisz;
+ if (string_table_size)
+ {
+ string_table_size += 4;
+ string_table = (bfd_byte *)bfd_malloc (string_table_size);
+ memset (string_table, 0, string_table_size);
+ val = string_table_size;
+ bfd_h_put_32 (abfd, val, &string_table[0]);
+ st_tmp = string_table + 4;
+ }
+
+ /* symbols
+ 0. .data csect
+ 2. __rtinit
+ 4. init function
+ 6. fini function */
+ memset (syment_ext, 0, 8 * SYMESZ);
+ memset (reloc_ext, 0, 2 * RELSZ);
+
+ /* .data csect */
+ memset (&syment, 0, sizeof (struct internal_syment));
+ memset (&auxent, 0, sizeof (union internal_auxent));
+ memcpy (syment._n._n_name, data_name, strlen (data_name));
+ syment.n_scnum = 1;
+ syment.n_sclass = C_HIDEXT;
+ syment.n_numaux = 1;
+ auxent.x_csect.x_scnlen.l = data_buffer_size;
+ auxent.x_csect.x_smtyp = 3 << 3 | XTY_SD;
+ auxent.x_csect.x_smclas = XMC_RW;
+ bfd_coff_swap_sym_out (abfd, &syment,
+ &syment_ext[filehdr.f_nsyms * SYMESZ]);
+ bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
+ syment.n_numaux,
+ &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
+ filehdr.f_nsyms += 2;
+
+ /* __rtinit */
+ memset (&syment, 0, sizeof (struct internal_syment));
+ memset (&auxent, 0, sizeof (union internal_auxent));
+ memcpy (syment._n._n_name, rtinit_name, strlen (rtinit_name));
+ syment.n_scnum = 1;
+ syment.n_sclass = C_EXT;
+ syment.n_numaux = 1;
+ auxent.x_csect.x_smtyp = XTY_LD;
+ auxent.x_csect.x_smclas = XMC_RW;
+ bfd_coff_swap_sym_out (abfd, &syment,
+ &syment_ext[filehdr.f_nsyms * SYMESZ]);
+ bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
+ syment.n_numaux,
+ &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
+ filehdr.f_nsyms += 2;
+
+ /* init */
+ if (initsz)
+ {
+ memset (&syment, 0, sizeof (struct internal_syment));
+ memset (&auxent, 0, sizeof (union internal_auxent));
+
+ if (initsz > 9)
+ {
+ syment._n._n_n._n_offset = st_tmp - string_table;
+ memcpy (st_tmp, init, initsz);
+ st_tmp += initsz;
+ }
+ else
+ memcpy (syment._n._n_name, init, initsz - 1);
+
+ syment.n_sclass = C_EXT;
+ syment.n_numaux = 1;
+ bfd_coff_swap_sym_out (abfd, &syment,
+ &syment_ext[filehdr.f_nsyms * SYMESZ]);
+ bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
+ syment.n_numaux,
+ &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
+
+ /* reloc */
+ memset (&reloc, 0, sizeof (struct internal_reloc));
+ reloc.r_vaddr = 0x0010;
+ reloc.r_symndx = filehdr.f_nsyms;
+ reloc.r_type = R_POS;
+ reloc.r_size = 31;
+ bfd_coff_swap_reloc_out (abfd, &reloc, &reloc_ext[0]);
+
+ filehdr.f_nsyms += 2;
+ scnhdr.s_nreloc += 1;
+ }
+
+ /* fini */
+ if (finisz)
+ {
+ memset (&syment, 0, sizeof (struct internal_syment));
+ memset (&auxent, 0, sizeof (union internal_auxent));
+
+ if (finisz > 9)
+ {
+ syment._n._n_n._n_offset = st_tmp - string_table;
+ memcpy (st_tmp, fini, finisz);
+ st_tmp += finisz;
+ }
+ else
+ memcpy (syment._n._n_name, fini, finisz - 1);
+
+ syment.n_sclass = C_EXT;
+ syment.n_numaux = 1;
+ bfd_coff_swap_sym_out (abfd, &syment,
+ &syment_ext[filehdr.f_nsyms * SYMESZ]);
+ bfd_coff_swap_aux_out (abfd, &auxent, syment.n_type, syment.n_sclass, 0,
+ syment.n_numaux,
+ &syment_ext[(filehdr.f_nsyms + 1) * SYMESZ]);
+
+ /* reloc */
+ memset (&reloc, 0, sizeof (struct internal_reloc));
+ reloc.r_vaddr = 0x0028;
+ reloc.r_symndx = filehdr.f_nsyms;
+ reloc.r_type = R_POS;
+ reloc.r_size = 31;
+ bfd_coff_swap_reloc_out (abfd, &reloc,
+ &reloc_ext[scnhdr.s_nreloc * RELSZ]);
+
+ filehdr.f_nsyms += 2;
+ scnhdr.s_nreloc += 1;
+ }
+
+ scnhdr.s_relptr = scnhdr.s_scnptr + data_buffer_size;
+ filehdr.f_symptr = scnhdr.s_relptr + scnhdr.s_nreloc * RELSZ;
+
+ bfd_coff_swap_filehdr_out (abfd, &filehdr, filehdr_ext);
+ bfd_bwrite (filehdr_ext, FILHSZ, abfd);
+ bfd_coff_swap_scnhdr_out (abfd, &scnhdr, scnhdr_ext);
+ bfd_bwrite (scnhdr_ext, SCNHSZ, abfd);
+ bfd_bwrite (data_buffer, data_buffer_size, abfd);
+ bfd_bwrite (reloc_ext, scnhdr.s_nreloc * RELSZ, abfd);
+ bfd_bwrite (syment_ext, filehdr.f_nsyms * SYMESZ, abfd);
+ bfd_bwrite (string_table, string_table_size, abfd);
+
+ free (data_buffer);
+ data_buffer = NULL;
+
+ return true;
+}
+
+
+static reloc_howto_type xcoff_dynamic_reloc =
+HOWTO (0, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ 0, /* special_function */
+ "R_POS", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false); /* pcrel_offset */
+
+/* glink
+
+ The first word of global linkage code must be modified by filling in
+ the correct TOC offset. */
+
+static unsigned long xcoff_glink_code[9] =
+ {
+ 0x81820000, /* lwz r12,0(r2) */
+ 0x90410014, /* stw r2,20(r1) */
+ 0x800c0000, /* lwz r0,0(r12) */
+ 0x804c0004, /* lwz r2,4(r12) */
+ 0x7c0903a6, /* mtctr r0 */
+ 0x4e800420, /* bctr */
+ 0x00000000, /* start of traceback table */
+ 0x000c8000, /* traceback table */
+ 0x00000000, /* traceback table */
+ };
+
+
+static const struct xcoff_backend_data_rec bfd_xcoff_backend_data =
+ {
+ { /* COFF backend, defined in libcoff.h. */
+ _bfd_xcoff_swap_aux_in, /* _bfd_coff_swap_aux_in */
+ _bfd_xcoff_swap_sym_in, /* _bfd_coff_swap_sym_in */
+ coff_swap_lineno_in, /* _bfd_coff_swap_lineno_in */
+ _bfd_xcoff_swap_aux_out, /* _bfd_swap_aux_out */
+ _bfd_xcoff_swap_sym_out, /* _bfd_swap_sym_out */
+ coff_swap_lineno_out, /* _bfd_swap_lineno_out */
+ coff_swap_reloc_out, /* _bfd_swap_reloc_out */
+ coff_swap_filehdr_out, /* _bfd_swap_filehdr_out */
+ coff_swap_aouthdr_out, /* _bfd_swap_aouthdr_out */
+ coff_swap_scnhdr_out, /* _bfd_swap_scnhdr_out */
+ FILHSZ, /* _bfd_filhsz */
+ AOUTSZ, /* _bfd_aoutsz */
+ SCNHSZ, /* _bfd_scnhsz */
+ SYMESZ, /* _bfd_symesz */
+ AUXESZ, /* _bfd_auxesz */
+ RELSZ, /* _bfd_relsz */
+ LINESZ, /* _bfd_linesz */
+ FILNMLEN, /* _bfd_filnmlen */
+ true, /* _bfd_coff_long_filenames */
+ false, /* _bfd_coff_long_section_names */
+ (3), /* _bfd_coff_default_section_alignment_power */
+ false, /* _bfd_coff_force_symnames_in_strings */
+ 2, /* _bfd_coff_debug_string_prefix_length */
+ coff_swap_filehdr_in, /* _bfd_coff_swap_filehdr_in */
+ coff_swap_aouthdr_in, /* _bfd_swap_aouthdr_in */
+ coff_swap_scnhdr_in, /* _bfd_swap_scnhdr_in */
+ coff_swap_reloc_in, /* _bfd_reloc_in */
+ coff_bad_format_hook, /* _bfd_bad_format_hook */
+ coff_set_arch_mach_hook, /* _bfd_set_arch_mach_hook */
+ coff_mkobject_hook, /* _bfd_mkobject_hook */
+ styp_to_sec_flags, /* _bfd_syp_to_sec_flags */
+ coff_set_alignment_hook, /* _bfd_set_alignment_hook */
+ coff_slurp_symbol_table, /* _bfd_coff_slurp_symbol_table */
+ symname_in_debug_hook, /* _coff_symname_in_debug_hook */
+ coff_pointerize_aux_hook, /* _bfd_coff_pointerize_aux_hook */
+ coff_print_aux, /* bfd_coff_print_aux */
+ dummy_reloc16_extra_cases, /* _bfd_coff_reloc16_extra_cases */
+ dummy_reloc16_estimate, /* _bfd_coff_reloc16_estimate */
+ NULL, /* bfd_coff_sym_is_global */
+ coff_compute_section_file_positions, /* _bfd_coff_compute_section_file_positions */
+ NULL, /* _bfd_coff_start_final_link */
+ xcoff_ppc_relocate_section, /* _bfd_coff_relocate_section */
+ coff_rtype_to_howto, /* _bfd_coff_rtype_to_howto */
+ NULL, /* _bfd_coff_addust_symndx */
+ _bfd_generic_link_add_one_symbol, /* _bfd_coff_add_one_symbol */
+ coff_link_output_has_begun, /* _bfd_coff_link_output_has_begun */
+ coff_final_link_postscript /* _bfd_coff_final_link_postscript */
+ },
+
+ 0x01DF, /* magic number */
+ bfd_arch_rs6000, /* architecture */
+ bfd_mach_rs6k, /* machine */
+
+ /* Function pointers to xcoff specific swap routines. */
+ xcoff_swap_ldhdr_in, /* _xcoff_swap_ldhdr_in */
+ xcoff_swap_ldhdr_out, /* _xcoff_swap_ldhdr_out */
+ xcoff_swap_ldsym_in, /* _xcoff_swap_ldsym_in */
+ xcoff_swap_ldsym_out, /* _xcoff_swap_ldsym_out */
+ xcoff_swap_ldrel_in, /* _xcoff_swap_ldrel_in */
+ xcoff_swap_ldrel_out, /* _xcoff_swap_ldrel_out */
+
+ /* Sizes. */
+ LDHDRSZ, /* _xcoff_ldhdrsz */
+ LDSYMSZ, /* _xcoff_ldsymsz */
+ LDRELSZ, /* _xcoff_ldrelsz */
+ 12, /* _xcoff_function_descriptor_size */
+ SMALL_AOUTSZ, /* _xcoff_small_aout_header_size */
+
+ /* Versions. */
+ 1, /* _xcoff_ldhdr_version */
+
+ /* Xcoff vs xcoff64 putting symbol names. */
+ _bfd_xcoff_put_symbol_name, /* _xcoff_put_symbol_name */
+ _bfd_xcoff_put_ldsymbol_name, /* _xcoff_put_ldsymbol_name */
+
+ & xcoff_dynamic_reloc, /* dynamic reloc howto */
+
+ xcoff_create_csect_from_smclas, /* _xcoff_create_csect_from_smclas */
+
+ /* Lineno and reloc count overflow. */
+ xcoff_is_lineno_count_overflow,
+ xcoff_is_reloc_count_overflow,
+
+ xcoff_loader_symbol_offset,
+ xcoff_loader_reloc_offset,
+
+ /* glink. */
+ & xcoff_glink_code[0],
+ (36), /* _xcoff_glink_size */
+
+ /* rtinit */
+ 64, /* _xcoff_rtinit_size */
+ xcoff_generate_rtinit, /* _xcoff_generate_rtinit */
+};
+
+/* The transfer vector that leads the outside world to all of the above. */
+const bfd_target rs6000coff_vec =
+{
+ "aixcoff-rs6000",
+ bfd_target_xcoff_flavour,
+ BFD_ENDIAN_BIG, /* data byte order is big */
+ BFD_ENDIAN_BIG, /* header byte order is big */
+
+ (HAS_RELOC | EXEC_P | /* object flags */
+ HAS_LINENO | HAS_DEBUG | DYNAMIC |
+ HAS_SYMS | HAS_LOCALS | WP_TEXT),
+
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
+ 0, /* leading char */
+ '/', /* ar_pad_char */
+ 15, /* ar_max_namelen??? FIXMEmgo */
+
+ /* data */
+ bfd_getb64, /* bfd_getx64 */
+ bfd_getb_signed_64, /* bfd_getx_signed_64 */
+ bfd_putb64, /* bfd_putx64 */
+ bfd_getb32, /* bfd_getx32 */
+ bfd_getb_signed_32, /* bfd_getx_signed_32 */
+ bfd_putb32, /* bfd_putx32 */
+ bfd_getb16, /* bfd_getx16 */
+ bfd_getb_signed_16, /* bfd_getx_signed_16 */
+ bfd_putb16, /* bfd_putx16 */
+
+ /* hdrs */
+ bfd_getb64, /* bfd_h_getx64 */
+ bfd_getb_signed_64, /* bfd_h_getx_signed_64 */
+ bfd_putb64, /* bfd_h_putx64 */
+ bfd_getb32, /* bfd_h_getx32 */
+ bfd_getb_signed_32, /* bfd_h_getx_signed_32 */
+ bfd_putb32, /* bfd_h_putx32 */
+ bfd_getb16, /* bfd_h_getx16 */
+ bfd_getb_signed_16, /* bfd_h_getx_signed_16 */
+ bfd_putb16, /* bfd_h_putx16 */
+
+ { /* bfd_check_format */
+ _bfd_dummy_target,
+ coff_object_p,
+ _bfd_xcoff_archive_p,
+ CORE_FILE_P
+ },
+
+ { /* bfd_set_format */
+ bfd_false,
+ coff_mkobject,
+ _bfd_generic_mkarchive,
+ bfd_false
+ },
+
+ {/* bfd_write_contents */
+ bfd_false,
+ coff_write_object_contents,
+ _bfd_xcoff_write_archive_contents,
+ bfd_false
+ },
+
+ /* Generic */
+ bfd_true, /* _close_and_cleanup */
+ bfd_true, /* _bfd_free_cached_info */
+ coff_new_section_hook, /* _new_section_hook */
+ _bfd_generic_get_section_contents, /* _bfd_get_section_contents */
+ /* _bfd_get_section_contents_in_window */
+ _bfd_generic_get_section_contents_in_window,
+
+ /* Copy */
+ _bfd_xcoff_copy_private_bfd_data, /* _bfd_copy_private_bfd */
+ /* _bfd_merge_private_bfd_data */
+ ((boolean (*) (bfd *, bfd *)) bfd_true),
+ /* _bfd_copy_pivate_section_data */
+ ((boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
+ /* _bfd_copy_private_symbol_data */
+ ((boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
+ ((boolean (*) (bfd *, flagword)) bfd_true), /* _bfd_set_private_flags */
+ ((boolean (*) (bfd *, void * )) bfd_true), /* _bfd_print_private_bfd_data */
+
+ /* Core */
+ coff_core_file_failing_command, /* _core_file_failing_command */
+ coff_core_file_failing_signal, /* _core_file_failing_signal */
+ /* _core_file_matches_executable_p */
+ coff_core_file_matches_executable_p,
+
+ /* Archive */
+ _bfd_xcoff_slurp_armap, /* _slurp_armap */
+ /* XCOFF archives do not have
+ anything which corresponds to
+ an extended name table. */
+ bfd_false, /* _slurp_extended_name_table */
+ /* _construct_extended_name_table */
+ ((boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false),
+ bfd_dont_truncate_arname, /* _truncate_arname */
+ _bfd_xcoff_write_armap, /* _write_armap */
+ _bfd_xcoff_read_ar_hdr, /* _read_ar_hdr */
+ _bfd_xcoff_openr_next_archived_file, /* _openr_next_archived_file */
+ _bfd_generic_get_elt_at_index, /* _get_elt_at_index */
+ _bfd_xcoff_generic_stat_arch_elt, /* _generic_dtat_arch_elt */
+ /* XCOFF archives do not have
+ a timestamp. */
+ bfd_true, /* _update_armap_timestamp */
+
+ /* Symbols */
+ coff_get_symtab_upper_bound, /* _get_symtab_upper_bound */
+ coff_get_symtab, /* _get_symtab */
+ coff_make_empty_symbol, /* _make_empty_symbol */
+ coff_print_symbol, /* _print_symbol */
+ coff_get_symbol_info, /* _get_symbol_info */
+ _bfd_xcoff_is_local_label_name, /* _bfd_is_local_label_name */
+ coff_get_lineno, /* _get_lineno */
+ coff_find_nearest_line, /* _find_nearest_line */
+ coff_bfd_make_debug_symbol, /* _bfd_make_debug_symbol */
+ _bfd_generic_read_minisymbols, /* _read_minisymbols */
+ _bfd_generic_minisymbol_to_symbol, /* _minsymbol_to_symbol */
+
+ /* Reloc */
+ coff_get_reloc_upper_bound, /* _get_reloc_upper_bound */
+ coff_canonicalize_reloc, /* _cononicalize_reloc */
+ _bfd_xcoff_reloc_type_lookup, /* _bfd_reloc_type_lookup */
+
+ /* Write */
+ coff_set_arch_mach, /* _set_arch_mach */
+ coff_set_section_contents, /* _set_section_contents */
+
+ /* Link */
+ _bfd_xcoff_sizeof_headers, /* _sizeof_headers */
+ /* _bfd_get_relocated_section_contents */
+ bfd_generic_get_relocated_section_contents,
+ bfd_generic_relax_section, /* _bfd_relax_section */
+ _bfd_xcoff_bfd_link_hash_table_create, /* _bfd_link_hash_table_create */
+ _bfd_xcoff_bfd_link_add_symbols, /* _bfd_link_add_symbols */
+ _bfd_xcoff_bfd_final_link, /* _bfd_filnal_link */
+ _bfd_generic_link_split_section, /* _bfd_link_split_section */
+ bfd_generic_gc_sections, /* _bfd_gc_sections */
+ bfd_generic_merge_sections, /* _bfd_merge_sections */
+
+ /* Dynamic */
+ /* _get_dynamic_symtab_upper_bound */
+ _bfd_xcoff_get_dynamic_symtab_upper_bound,
+ _bfd_xcoff_canonicalize_dynamic_symtab, /* _cononicalize_dynamic_symtab */
+ _bfd_xcoff_get_dynamic_reloc_upper_bound,/* _get_dynamic_reloc_upper_bound */
+ _bfd_xcoff_canonicalize_dynamic_reloc, /* _cononicalize_dynamic_reloc */
+
+ /* Opposite endian version, none exists */
+ NULL,
+
+ /* back end data */
+ (void *) &bfd_xcoff_backend_data,
+};
+
+/*
+ * xcoff-powermac target
+ * Old target.
+ * Only difference between this target and the rs6000 target is the
+ * the default architecture and machine type used in coffcode.h
+ *
+ * PowerPC Macs use the same magic numbers as RS/6000
+ * (because that's how they were bootstrapped originally),
+ * but they are always PowerPC architecture.
+ */
+static const struct xcoff_backend_data_rec bfd_pmac_xcoff_backend_data =
+{
+ { /* COFF backend, defined in libcoff.h */
+ _bfd_xcoff_swap_aux_in, /* _bfd_coff_swap_aux_in */
+ _bfd_xcoff_swap_sym_in, /* _bfd_coff_swap_sym_in */
+ coff_swap_lineno_in, /* _bfd_coff_swap_lineno_in */
+ _bfd_xcoff_swap_aux_out, /* _bfd_swap_aux_out */
+ _bfd_xcoff_swap_sym_out, /* _bfd_swap_sym_out */
+ coff_swap_lineno_out, /* _bfd_swap_lineno_out */
+ coff_swap_reloc_out, /* _bfd_swap_reloc_out */
+ coff_swap_filehdr_out, /* _bfd_swap_filehdr_out */
+ coff_swap_aouthdr_out, /* _bfd_swap_aouthdr_out */
+ coff_swap_scnhdr_out, /* _bfd_swap_scnhdr_out */
+ FILHSZ, /* _bfd_filhsz */
+ AOUTSZ, /* _bfd_aoutsz */
+ SCNHSZ, /* _bfd_scnhsz */
+ SYMESZ, /* _bfd_symesz */
+ AUXESZ, /* _bfd_auxesz */
+ RELSZ, /* _bfd_relsz */
+ LINESZ, /* _bfd_linesz */
+ FILNMLEN, /* _bfd_filnmlen */
+ true, /* _bfd_coff_long_filenames */
+ false, /* _bfd_coff_long_section_names */
+ (3), /* _bfd_coff_default_section_alignment_power */
+ false, /* _bfd_coff_force_symnames_in_strings */
+ 2, /* _bfd_coff_debug_string_prefix_length */
+ coff_swap_filehdr_in, /* _bfd_coff_swap_filehdr_in */
+ coff_swap_aouthdr_in, /* _bfd_swap_aouthdr_in */
+ coff_swap_scnhdr_in, /* _bfd_swap_scnhdr_in */
+ coff_swap_reloc_in, /* _bfd_reloc_in */
+ coff_bad_format_hook, /* _bfd_bad_format_hook */
+ coff_set_arch_mach_hook, /* _bfd_set_arch_mach_hook */
+ coff_mkobject_hook, /* _bfd_mkobject_hook */
+ styp_to_sec_flags, /* _bfd_syp_to_sec_flags */
+ coff_set_alignment_hook, /* _bfd_set_alignment_hook */
+ coff_slurp_symbol_table, /* _bfd_coff_slurp_symbol_table */
+ symname_in_debug_hook, /* _coff_symname_in_debug_hook */
+ coff_pointerize_aux_hook, /* _bfd_coff_pointerize_aux_hook */
+ coff_print_aux, /* bfd_coff_print_aux */
+ dummy_reloc16_extra_cases, /* _bfd_coff_reloc16_extra_cases */
+ dummy_reloc16_estimate, /* _bfd_coff_reloc16_estimate */
+ NULL, /* bfd_coff_sym_is_global */
+ /* _bfd_coff_compute_section_file_positions */
+ coff_compute_section_file_positions,
+ NULL, /* _bfd_coff_start_final_link */
+ xcoff_ppc_relocate_section, /* _bfd_coff_relocate_section */
+ coff_rtype_to_howto, /* _bfd_coff_rtype_to_howto */
+ NULL, /* _bfd_coff_addust_symndx */
+ _bfd_generic_link_add_one_symbol, /* _bfd_coff_add_one_symbol */
+ coff_link_output_has_begun, /* _bfd_coff_link_output_has_begun */
+ coff_final_link_postscript /* _bfd_coff_final_link_postscript */
+ },
+
+ 0x01DF, /* magic number */
+ bfd_arch_powerpc, /* architecture */
+ bfd_mach_ppc, /* machine */
+
+ /* function pointers to xcoff specific swap routines */
+ xcoff_swap_ldhdr_in, /* _xcoff_swap_ldhdr_in */
+ xcoff_swap_ldhdr_out, /* _xcoff_swap_ldhdr_out */
+ xcoff_swap_ldsym_in, /* _xcoff_swap_ldsym_in */
+ xcoff_swap_ldsym_out, /* _xcoff_swap_ldsym_out */
+ xcoff_swap_ldrel_in, /* _xcoff_swap_ldrel_in */
+ xcoff_swap_ldrel_out, /* _xcoff_swap_ldrel_out */
+
+ /* sizes */
+ LDHDRSZ, /* _xcoff_ldhdrsz */
+ LDSYMSZ, /* _xcoff_ldsymsz */
+ LDRELSZ, /* _xcoff_ldrelsz */
+ 12, /* _xcoff_function_descriptor_size */
+ SMALL_AOUTSZ, /* _xcoff_small_aout_header_size */
+
+ /* versions */
+ 1, /* _xcoff_ldhdr_version */
+
+ /* xcoff vs xcoff64 putting symbol names */
+ _bfd_xcoff_put_symbol_name, /* _xcoff_put_symbol_name */
+ _bfd_xcoff_put_ldsymbol_name, /* _xcoff_put_ldsymbol_name */
+
+ &xcoff_dynamic_reloc, /* dynamic reloc howto */
+
+ xcoff_create_csect_from_smclas, /* _xcoff_create_csect_from_smclas */
+
+ /* lineno and reloc count overflow */
+ xcoff_is_lineno_count_overflow,
+ xcoff_is_reloc_count_overflow,
+
+ xcoff_loader_symbol_offset,
+ xcoff_loader_reloc_offset,
+
+ /* glink */
+ &xcoff_glink_code[0],
+ (36), /* _xcoff_glink_size */
+
+ /* rtinit */
+ 0, /* _xcoff_rtinit_size */
+ xcoff_generate_rtinit, /* _xcoff_generate_rtinit */
+
+};
+
+/* The transfer vector that leads the outside world to all of the above. */
+const bfd_target pmac_xcoff_vec =
+{
+ "xcoff-powermac",
+ bfd_target_xcoff_flavour,
+ BFD_ENDIAN_BIG, /* data byte order is big */
+ BFD_ENDIAN_BIG, /* header byte order is big */
+
+ (HAS_RELOC | EXEC_P | /* object flags */
+ HAS_LINENO | HAS_DEBUG | DYNAMIC |
+ HAS_SYMS | HAS_LOCALS | WP_TEXT),
+
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
+ 0, /* leading char */
+ '/', /* ar_pad_char */
+ 15, /* ar_max_namelen??? FIXMEmgo */
+
+ /* data */
+ bfd_getb64, /* bfd_getx64 */
+ bfd_getb_signed_64, /* bfd_getx_signed_64 */
+ bfd_putb64, /* bfd_putx64 */
+ bfd_getb32, /* bfd_getx32 */
+ bfd_getb_signed_32, /* bfd_getx_signed_32 */
+ bfd_putb32, /* bfd_putx32 */
+ bfd_getb16, /* bfd_getx16 */
+ bfd_getb_signed_16, /* bfd_getx_signed_16 */
+ bfd_putb16, /* bfd_putx16 */
+
+ /* hdrs */
+ bfd_getb64, /* bfd_h_getx64 */
+ bfd_getb_signed_64, /* bfd_h_getx_signed_64 */
+ bfd_putb64, /* bfd_h_putx64 */
+ bfd_getb32, /* bfd_h_getx32 */
+ bfd_getb_signed_32, /* bfd_h_getx_signed_32 */
+ bfd_putb32, /* bfd_h_putx32 */
+ bfd_getb16, /* bfd_h_getx16 */
+ bfd_getb_signed_16, /* bfd_h_getx_signed_16 */
+ bfd_putb16, /* bfd_h_putx16 */
+
+ { /* bfd_check_format */
+ _bfd_dummy_target,
+ coff_object_p,
+ _bfd_xcoff_archive_p,
+ CORE_FILE_P
+ },
+
+ { /* bfd_set_format */
+ bfd_false,
+ coff_mkobject,
+ _bfd_generic_mkarchive,
+ bfd_false
+ },
+
+ {/* bfd_write_contents */
+ bfd_false,
+ coff_write_object_contents,
+ _bfd_xcoff_write_archive_contents,
+ bfd_false
+ },
+
+ /* Generic */
+ bfd_true, /* _close_and_cleanup */
+ bfd_true, /* _bfd_free_cached_info */
+ coff_new_section_hook, /* _new_section_hook */
+ _bfd_generic_get_section_contents, /* _bfd_get_section_contents */
+ /* _bfd_get_section_contents_in_window */
+ _bfd_generic_get_section_contents_in_window,
+
+ /* Copy */
+ _bfd_xcoff_copy_private_bfd_data, /* _bfd_copy_private_bfd */
+ /* _bfd_merge_private_bfd_data */
+ ((boolean (*) (bfd *, bfd *)) bfd_true),
+ /* _bfd_copy_pivate_section_data */
+ ((boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
+ /* _bfd_copy_private_symbol_data */
+ ((boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
+ ((boolean (*) (bfd *, flagword)) bfd_true), /* _bfd_set_private_flags */
+ ((boolean (*) (bfd *, void * )) bfd_true), /* _bfd_print_private_bfd_data */
+
+ /* Core */
+ coff_core_file_failing_command, /* _core_file_failing_command */
+ coff_core_file_failing_signal, /* _core_file_failing_signal */
+ /* _core_file_matches_executable_p */
+ coff_core_file_matches_executable_p,
+
+ /* Archive */
+ _bfd_xcoff_slurp_armap, /* _slurp_armap */
+ /* XCOFF archives do not have
+ anything which corresponds to
+ an extended name table. */
+ bfd_false, /* _slurp_extended_name_table */
+ /* _construct_extended_name_table */
+ ((boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false),
+ bfd_dont_truncate_arname, /* _truncate_arname */
+ _bfd_xcoff_write_armap, /* _write_armap */
+ _bfd_xcoff_read_ar_hdr, /* _read_ar_hdr */
+ _bfd_xcoff_openr_next_archived_file, /* _openr_next_archived_file */
+ _bfd_generic_get_elt_at_index, /* _get_elt_at_index */
+ _bfd_xcoff_generic_stat_arch_elt, /* _generic_dtat_arch_elt */
+ /* XCOFF archives do not have
+ a timestamp. */
+ bfd_true, /* _update_armap_timestamp */
+
+ /* Symbols */
+ coff_get_symtab_upper_bound, /* _get_symtab_upper_bound */
+ coff_get_symtab, /* _get_symtab */
+ coff_make_empty_symbol, /* _make_empty_symbol */
+ coff_print_symbol, /* _print_symbol */
+ coff_get_symbol_info, /* _get_symbol_info */
+ _bfd_xcoff_is_local_label_name, /* _bfd_is_local_label_name */
+ coff_get_lineno, /* _get_lineno */
+ coff_find_nearest_line, /* _find_nearest_line */
+ coff_bfd_make_debug_symbol, /* _bfd_make_debug_symbol */
+ _bfd_generic_read_minisymbols, /* _read_minisymbols */
+ _bfd_generic_minisymbol_to_symbol, /* _minsymbol_to_symbol */
+
+ /* Reloc */
+ coff_get_reloc_upper_bound, /* _get_reloc_upper_bound */
+ coff_canonicalize_reloc, /* _cononicalize_reloc */
+ _bfd_xcoff_reloc_type_lookup, /* _bfd_reloc_type_lookup */
+
+ /* Write */
+ coff_set_arch_mach, /* _set_arch_mach */
+ coff_set_section_contents, /* _set_section_contents */
+
+ /* Link */
+ _bfd_xcoff_sizeof_headers, /* _sizeof_headers */
+ /* _bfd_get_relocated_section_contents */
+ bfd_generic_get_relocated_section_contents,
+ bfd_generic_relax_section, /* _bfd_relax_section */
+ _bfd_xcoff_bfd_link_hash_table_create, /* _bfd_link_hash_table_create */
+ _bfd_xcoff_bfd_link_add_symbols, /* _bfd_link_add_symbols */
+ _bfd_xcoff_bfd_final_link, /* _bfd_filnal_link */
+ _bfd_generic_link_split_section, /* _bfd_link_split_section */
+ bfd_generic_gc_sections, /* _bfd_gc_sections */
+ bfd_generic_merge_sections, /* _bfd_merge_sections */
+
+ /* Dynamic */
+ /* _get_dynamic_symtab_upper_bound */
+ _bfd_xcoff_get_dynamic_symtab_upper_bound,
+ _bfd_xcoff_canonicalize_dynamic_symtab, /* _cononicalize_dynamic_symtab */
+ _bfd_xcoff_get_dynamic_reloc_upper_bound,/* _get_dynamic_reloc_upper_bound */
+ _bfd_xcoff_canonicalize_dynamic_reloc, /* _cononicalize_dynamic_reloc */
+
+ /* Opposite endian version, none exists */
+ NULL,
+
+ /* back end data */
+ (void *) &bfd_pmac_xcoff_backend_data,
+};
diff --git a/contrib/binutils/bfd/coff-sparc.c b/contrib/binutils/bfd/coff-sparc.c
index 0f592de..35c23df 100644
--- a/contrib/binutils/bfd/coff-sparc.c
+++ b/contrib/binutils/bfd/coff-sparc.c
@@ -1,5 +1,5 @@
/* BFD back-end for Sparc COFF files.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -33,6 +33,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* The page size is a guess based on ELF. */
#define COFF_PAGE_SIZE 0x10000
+
+static reloc_howto_type *coff_sparc_reloc_type_lookup
+ PARAMS ((bfd *, bfd_reloc_code_real_type));
+static void rtype2howto PARAMS ((arelent *, struct internal_reloc *));
+
enum reloc_type
{
R_SPARC_NONE = 0,
@@ -52,7 +57,7 @@ enum reloc_type
};
#if 0
-static CONST char *CONST reloc_type_names[] =
+static const char *const reloc_type_names[] =
{
"R_SPARC_NONE",
"R_SPARC_8", "R_SPARC_16", "R_SPARC_32",
@@ -129,7 +134,7 @@ struct coff_reloc_map {
unsigned char coff_reloc_val;
};
-static CONST struct coff_reloc_map sparc_reloc_map[] =
+static const struct coff_reloc_map sparc_reloc_map[] =
{
{ BFD_RELOC_NONE, R_SPARC_NONE, },
{ BFD_RELOC_16, R_SPARC_16, },
@@ -183,8 +188,8 @@ rtype2howto (cache_ptr, dst)
#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
-#define SWAP_IN_RELOC_OFFSET bfd_h_get_32
-#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
+#define SWAP_IN_RELOC_OFFSET H_GET_32
+#define SWAP_OUT_RELOC_OFFSET H_PUT_32
#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
cache_ptr->addend = reloc.r_offset;
diff --git a/contrib/binutils/bfd/coffcode.h b/contrib/binutils/bfd/coffcode.h
index 2cdc137..0b185a5 100644
--- a/contrib/binutils/bfd/coffcode.h
+++ b/contrib/binutils/bfd/coffcode.h
@@ -1,6 +1,6 @@
/* Support for the generic parts of most COFF variants, for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001
+ 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -248,39 +248,37 @@ CODE_FRAGMENT
.
.typedef struct coff_ptr_struct
.{
+. {* Remembers the offset from the first symbol in the file for
+. this symbol. Generated by coff_renumber_symbols. *}
+. unsigned int offset;
.
-. {* Remembers the offset from the first symbol in the file for
-. this symbol. Generated by coff_renumber_symbols. *}
-.unsigned int offset;
+. {* Should the value of this symbol be renumbered. Used for
+. XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. *}
+. unsigned int fix_value : 1;
.
-. {* Should the value of this symbol be renumbered. Used for
-. XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. *}
-.unsigned int fix_value : 1;
+. {* Should the tag field of this symbol be renumbered.
+. Created by coff_pointerize_aux. *}
+. unsigned int fix_tag : 1;
.
-. {* Should the tag field of this symbol be renumbered.
-. Created by coff_pointerize_aux. *}
-.unsigned int fix_tag : 1;
+. {* Should the endidx field of this symbol be renumbered.
+. Created by coff_pointerize_aux. *}
+. unsigned int fix_end : 1;
.
-. {* Should the endidx field of this symbol be renumbered.
-. Created by coff_pointerize_aux. *}
-.unsigned int fix_end : 1;
+. {* Should the x_csect.x_scnlen field be renumbered.
+. Created by coff_pointerize_aux. *}
+. unsigned int fix_scnlen : 1;
.
-. {* Should the x_csect.x_scnlen field be renumbered.
-. Created by coff_pointerize_aux. *}
-.unsigned int fix_scnlen : 1;
+. {* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the
+. index into the line number entries. Set by coff_slurp_symbol_table. *}
+. unsigned int fix_line : 1;
.
-. {* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the
-. index into the line number entries. Set by
-. coff_slurp_symbol_table. *}
-.unsigned int fix_line : 1;
-.
-. {* The container for the symbol structure as read and translated
-. from the file. *}
-.
-.union {
-. union internal_auxent auxent;
-. struct internal_syment syment;
-. } u;
+. {* The container for the symbol structure as read and translated
+. from the file. *}
+. union
+. {
+. union internal_auxent auxent;
+. struct internal_syment syment;
+. } u;
.} combined_entry_type;
.
.
@@ -288,17 +286,17 @@ CODE_FRAGMENT
.
.typedef struct coff_symbol_struct
.{
-. {* The actual symbol which the rest of BFD works with *}
-.asymbol symbol;
+. {* The actual symbol which the rest of BFD works with *}
+. asymbol symbol;
.
-. {* A pointer to the hidden information for this symbol *}
-.combined_entry_type *native;
+. {* A pointer to the hidden information for this symbol *}
+. combined_entry_type *native;
.
-. {* A pointer to the linenumber information for this symbol *}
-.struct lineno_cache_entry *lineno;
+. {* A pointer to the linenumber information for this symbol *}
+. struct lineno_cache_entry *lineno;
.
-. {* Have the line numbers been relocated yet ? *}
-.boolean done_lineno;
+. {* Have the line numbers been relocated yet ? *}
+. boolean done_lineno;
.} coff_symbol_type;
*/
@@ -312,8 +310,8 @@ CODE_FRAGMENT
#define STRING_SIZE_SIZE (4)
static long sec_to_styp_flags PARAMS ((const char *, flagword));
-static flagword styp_to_sec_flags
- PARAMS ((bfd *, PTR, const char *, asection *));
+static boolean styp_to_sec_flags
+ PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
static boolean coff_bad_format_hook PARAMS ((bfd *, PTR));
static void coff_set_custom_section_alignment
PARAMS ((bfd *, asection *, const struct coff_section_alignment_entry *,
@@ -324,12 +322,12 @@ static boolean coff_write_relocs PARAMS ((bfd *, int));
static boolean coff_set_flags
PARAMS ((bfd *, unsigned int *, unsigned short *));
static boolean coff_set_arch_mach
- PARAMS ((bfd *, enum bfd_architecture, unsigned long));
+ PARAMS ((bfd *, enum bfd_architecture, unsigned long)) ATTRIBUTE_UNUSED;
static boolean coff_compute_section_file_positions PARAMS ((bfd *));
-static boolean coff_write_object_contents PARAMS ((bfd *));
+static boolean coff_write_object_contents PARAMS ((bfd *)) ATTRIBUTE_UNUSED;
static boolean coff_set_section_contents
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
-static PTR buy_and_read PARAMS ((bfd *, file_ptr, int, size_t));
+static PTR buy_and_read PARAMS ((bfd *, file_ptr, bfd_size_type));
static boolean coff_slurp_line_table PARAMS ((bfd *, asection *));
static boolean coff_slurp_symbol_table PARAMS ((bfd *));
static enum coff_symbol_classification coff_classify_symbol
@@ -368,7 +366,7 @@ static flagword handle_COMDAT PARAMS ((bfd *, flagword, PTR, const char *, asect
static long
sec_to_styp_flags (sec_name, sec_flags)
- CONST char *sec_name;
+ const char *sec_name;
flagword sec_flags;
{
long styp_flags = 0;
@@ -430,6 +428,14 @@ sec_to_styp_flags (sec_name, sec_flags)
{
styp_flags = STYP_LOADER;
}
+ else if (!strcmp (sec_name, _EXCEPT))
+ {
+ styp_flags = STYP_EXCEPT;
+ }
+ else if (!strcmp (sec_name, _TYPCHK))
+ {
+ styp_flags = STYP_TYPCHK;
+ }
#endif
/* Try and figure out what it should be */
else if (sec_flags & SEC_CODE)
@@ -508,7 +514,7 @@ sec_to_styp_flags (sec_name, sec_flags)
if ((sec_flags & SEC_ALLOC) != 0 && (sec_flags & SEC_LOAD) == 0)
styp_flags |= IMAGE_SCN_CNT_UNINITIALIZED_DATA; /* ==STYP_BSS */
/* skip ROM */
- /* skip CONSTRUCTOR */
+ /* skip constRUCTOR */
/* skip CONTENTS */
#ifdef STYP_NOLOAD
if ((sec_flags & (SEC_NEVER_LOAD | SEC_COFF_SHARED_LIBRARY)) != 0)
@@ -553,12 +559,13 @@ sec_to_styp_flags (sec_name, sec_flags)
#ifndef COFF_WITH_PE
-static flagword
-styp_to_sec_flags (abfd, hdr, name, section)
+static boolean
+styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
bfd *abfd ATTRIBUTE_UNUSED;
PTR hdr;
const char *name;
asection *section ATTRIBUTE_UNUSED;
+ flagword *flags_ptr;
{
struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
long styp_flags = internal_s->s_flags;
@@ -566,19 +573,17 @@ styp_to_sec_flags (abfd, hdr, name, section)
#ifdef STYP_BLOCK
if (styp_flags & STYP_BLOCK)
- sec_flags |= SEC_BLOCK;
+ sec_flags |= SEC_BLOCK;
#endif
#ifdef STYP_CLINK
if (styp_flags & STYP_CLINK)
- sec_flags |= SEC_CLINK;
+ sec_flags |= SEC_CLINK;
#endif
#ifdef STYP_NOLOAD
if (styp_flags & STYP_NOLOAD)
- {
- sec_flags |= SEC_NEVER_LOAD;
- }
+ sec_flags |= SEC_NEVER_LOAD;
#endif /* STYP_NOLOAD */
/* For 386 COFF, at least, an unloadable text or data section is
@@ -619,9 +624,7 @@ styp_to_sec_flags (abfd, hdr, name, section)
#endif
}
else if (styp_flags & STYP_PAD)
- {
- sec_flags = 0;
- }
+ sec_flags = 0;
else if (strcmp (name, _TEXT) == 0)
{
if (sec_flags & SEC_NEVER_LOAD)
@@ -664,26 +667,19 @@ styp_to_sec_flags (abfd, hdr, name, section)
#endif
#ifdef _LIT
else if (strcmp (name, _LIT) == 0)
- {
- sec_flags = SEC_LOAD | SEC_ALLOC | SEC_READONLY;
- }
+ sec_flags = SEC_LOAD | SEC_ALLOC | SEC_READONLY;
#endif
else
- {
- sec_flags |= SEC_ALLOC | SEC_LOAD;
- }
+ sec_flags |= SEC_ALLOC | SEC_LOAD;
#ifdef STYP_LIT /* A29k readonly text/data section type */
if ((styp_flags & STYP_LIT) == STYP_LIT)
- {
- sec_flags = (SEC_LOAD | SEC_ALLOC | SEC_READONLY);
- }
+ sec_flags = (SEC_LOAD | SEC_ALLOC | SEC_READONLY);
#endif /* STYP_LIT */
+
#ifdef STYP_OTHER_LOAD /* Other loaded sections */
if (styp_flags & STYP_OTHER_LOAD)
- {
- sec_flags = (SEC_LOAD | SEC_ALLOC);
- }
+ sec_flags = (SEC_LOAD | SEC_ALLOC);
#endif /* STYP_SDATA */
#if defined (COFF_LONG_SECTION_NAMES) && defined (COFF_SUPPORT_GNU_LINKONCE)
@@ -697,7 +693,11 @@ styp_to_sec_flags (abfd, hdr, name, section)
sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
#endif
- return sec_flags;
+ if (flags_ptr == NULL)
+ return false;
+
+ * flags_ptr = sec_flags;
+ return true;
}
#else /* COFF_WITH_PE */
@@ -736,7 +736,7 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section)
if (! _bfd_coff_get_external_symbols (abfd))
return sec_flags;
-
+
esymstart = esym = (bfd_byte *) obj_coff_external_syms (abfd);
esymend = esym + obj_raw_syment_count (abfd) * bfd_coff_symesz (abfd);
@@ -923,21 +923,23 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section)
drop through from the above). */
{
char *newname;
+ bfd_size_type amt;
- /* This must the the second symbol with the
+ /* This must the second symbol with the
section #. It is the actual symbol name.
Intel puts the two adjacent, but Alpha (at
least) spreads them out. */
- section->comdat =
- bfd_alloc (abfd, sizeof (struct bfd_comdat_info));
+ amt = sizeof (struct bfd_comdat_info);
+ section->comdat = bfd_alloc (abfd, amt);
if (section->comdat == NULL)
abort ();
section->comdat->symbol =
(esym - esymstart) / bfd_coff_symesz (abfd);
- newname = bfd_alloc (abfd, strlen (symname) + 1);
+ amt = strlen (symname) + 1;
+ newname = bfd_alloc (abfd, amt);
if (newname == NULL)
abort ();
@@ -966,16 +968,18 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section)
required information. FIXME: Is the COMDAT symbol index used for
any purpose other than objdump? */
-static flagword
-styp_to_sec_flags (abfd, hdr, name, section)
+static boolean
+styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
bfd *abfd;
PTR hdr;
const char *name;
asection *section;
+ flagword *flags_ptr;
{
struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
long styp_flags = internal_s->s_flags;
flagword sec_flags;
+ boolean result = true;
/* Assume read only unless IMAGE_SCN_MEM_WRITE is specified. */
sec_flags = SEC_READONLY;
@@ -985,7 +989,7 @@ styp_to_sec_flags (abfd, hdr, name, section)
{
long flag = styp_flags & - styp_flags;
char * unhandled = NULL;
-
+
styp_flags &= ~ flag;
/* We infer from the distinct read/write/execute bits the settings
@@ -1010,7 +1014,7 @@ styp_to_sec_flags (abfd, hdr, name, section)
case STYP_NOLOAD:
sec_flags |= SEC_NEVER_LOAD;
break;
-#endif
+#endif
case IMAGE_SCN_MEM_READ:
/* Ignored, assume it always to be true. */
break;
@@ -1067,17 +1071,17 @@ styp_to_sec_flags (abfd, hdr, name, section)
break;
default:
/* Silently ignore for now. */
- break;
+ break;
}
- /* If the section flag was not handled, report it here. This will allow
- users of the BFD library to report a problem but continue executing.
- Tools which need to be aware of these problems (such as the linker)
- can override the default bfd_error_handler to intercept these reports. */
+ /* If the section flag was not handled, report it here. */
if (unhandled != NULL)
- (*_bfd_error_handler)
- (_("%s (%s): Section flag %s (0x%x) ignored"),
- bfd_get_filename (abfd), name, unhandled, flag);
+ {
+ (*_bfd_error_handler)
+ (_("%s (%s): Section flag %s (0x%x) ignored"),
+ bfd_archive_filename (abfd), name, unhandled, flag);
+ result = false;
+ }
}
#if defined (COFF_LONG_SECTION_NAMES) && defined (COFF_SUPPORT_GNU_LINKONCE)
@@ -1091,7 +1095,10 @@ styp_to_sec_flags (abfd, hdr, name, section)
sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
#endif
- return sec_flags;
+ if (flags_ptr)
+ * flags_ptr = sec_flags;
+
+ return result;
}
#endif /* COFF_WITH_PE */
@@ -1123,234 +1130,166 @@ CODE_FRAGMENT
Special entry points for gdb to swap in coff symbol table parts:
.typedef struct
.{
-. void (*_bfd_coff_swap_aux_in) PARAMS ((
-. bfd *abfd,
-. PTR ext,
-. int type,
-. int class,
-. int indaux,
-. int numaux,
-. PTR in));
+. void (*_bfd_coff_swap_aux_in)
+. PARAMS ((bfd *, PTR, int, int, int, int, PTR));
.
-. void (*_bfd_coff_swap_sym_in) PARAMS ((
-. bfd *abfd ,
-. PTR ext,
-. PTR in));
+. void (*_bfd_coff_swap_sym_in)
+. PARAMS ((bfd *, PTR, PTR));
.
-. void (*_bfd_coff_swap_lineno_in) PARAMS ((
-. bfd *abfd,
-. PTR ext,
-. PTR in));
+. void (*_bfd_coff_swap_lineno_in)
+. PARAMS ((bfd *, PTR, PTR));
.
-
-Special entry points for gas to swap out coff parts:
-
-. unsigned int (*_bfd_coff_swap_aux_out) PARAMS ((
-. bfd *abfd,
-. PTR in,
-. int type,
-. int class,
-. int indaux,
-. int numaux,
-. PTR ext));
+. unsigned int (*_bfd_coff_swap_aux_out)
+. PARAMS ((bfd *, PTR, int, int, int, int, PTR));
.
-. unsigned int (*_bfd_coff_swap_sym_out) PARAMS ((
-. bfd *abfd,
-. PTR in,
-. PTR ext));
+. unsigned int (*_bfd_coff_swap_sym_out)
+. PARAMS ((bfd *, PTR, PTR));
.
-. unsigned int (*_bfd_coff_swap_lineno_out) PARAMS ((
-. bfd *abfd,
-. PTR in,
-. PTR ext));
+. unsigned int (*_bfd_coff_swap_lineno_out)
+. PARAMS ((bfd *, PTR, PTR));
.
-. unsigned int (*_bfd_coff_swap_reloc_out) PARAMS ((
-. bfd *abfd,
-. PTR src,
-. PTR dst));
+. unsigned int (*_bfd_coff_swap_reloc_out)
+. PARAMS ((bfd *, PTR, PTR));
.
-. unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS ((
-. bfd *abfd,
-. PTR in,
-. PTR out));
+. unsigned int (*_bfd_coff_swap_filehdr_out)
+. PARAMS ((bfd *, PTR, PTR));
.
-. unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS ((
-. bfd *abfd,
-. PTR in,
-. PTR out));
+. unsigned int (*_bfd_coff_swap_aouthdr_out)
+. PARAMS ((bfd *, PTR, PTR));
.
-. unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS ((
-. bfd *abfd,
-. PTR in,
-. PTR out));
+. unsigned int (*_bfd_coff_swap_scnhdr_out)
+. PARAMS ((bfd *, PTR, PTR));
.
-
-Special entry points for generic COFF routines to call target
-dependent COFF routines:
-
-. unsigned int _bfd_filhsz;
-. unsigned int _bfd_aoutsz;
-. unsigned int _bfd_scnhsz;
-. unsigned int _bfd_symesz;
-. unsigned int _bfd_auxesz;
-. unsigned int _bfd_relsz;
-. unsigned int _bfd_linesz;
-. unsigned int _bfd_filnmlen;
-. boolean _bfd_coff_long_filenames;
-. boolean _bfd_coff_long_section_names;
-. unsigned int _bfd_coff_default_section_alignment_power;
-. boolean _bfd_coff_force_symnames_in_strings;
-. unsigned int _bfd_coff_debug_string_prefix_length;
-. void (*_bfd_coff_swap_filehdr_in) PARAMS ((
-. bfd *abfd,
-. PTR ext,
-. PTR in));
-. void (*_bfd_coff_swap_aouthdr_in) PARAMS ((
-. bfd *abfd,
-. PTR ext,
-. PTR in));
-. void (*_bfd_coff_swap_scnhdr_in) PARAMS ((
-. bfd *abfd,
-. PTR ext,
-. PTR in));
-. void (*_bfd_coff_swap_reloc_in) PARAMS ((
-. bfd *abfd,
-. PTR ext,
-. PTR in));
-. boolean (*_bfd_coff_bad_format_hook) PARAMS ((
-. bfd *abfd,
-. PTR internal_filehdr));
-. boolean (*_bfd_coff_set_arch_mach_hook) PARAMS ((
-. bfd *abfd,
-. PTR internal_filehdr));
-. PTR (*_bfd_coff_mkobject_hook) PARAMS ((
-. bfd *abfd,
-. PTR internal_filehdr,
-. PTR internal_aouthdr));
-. flagword (*_bfd_styp_to_sec_flags_hook) PARAMS ((
-. bfd *abfd,
-. PTR internal_scnhdr,
-. const char *name,
-. asection *section));
-. void (*_bfd_set_alignment_hook) PARAMS ((
-. bfd *abfd,
-. asection *sec,
-. PTR internal_scnhdr));
-. boolean (*_bfd_coff_slurp_symbol_table) PARAMS ((
-. bfd *abfd));
-. boolean (*_bfd_coff_symname_in_debug) PARAMS ((
-. bfd *abfd,
-. struct internal_syment *sym));
-. boolean (*_bfd_coff_pointerize_aux_hook) PARAMS ((
-. bfd *abfd,
-. combined_entry_type *table_base,
-. combined_entry_type *symbol,
-. unsigned int indaux,
-. combined_entry_type *aux));
-. boolean (*_bfd_coff_print_aux) PARAMS ((
-. bfd *abfd,
-. FILE *file,
-. combined_entry_type *table_base,
-. combined_entry_type *symbol,
-. combined_entry_type *aux,
-. unsigned int indaux));
-. void (*_bfd_coff_reloc16_extra_cases) PARAMS ((
-. bfd *abfd,
-. struct bfd_link_info *link_info,
-. struct bfd_link_order *link_order,
-. arelent *reloc,
-. bfd_byte *data,
-. unsigned int *src_ptr,
-. unsigned int *dst_ptr));
-. int (*_bfd_coff_reloc16_estimate) PARAMS ((
-. bfd *abfd,
-. asection *input_section,
-. arelent *r,
-. unsigned int shrink,
-. struct bfd_link_info *link_info));
-. enum coff_symbol_classification (*_bfd_coff_classify_symbol) PARAMS ((
-. bfd *abfd,
-. struct internal_syment *));
-. boolean (*_bfd_coff_compute_section_file_positions) PARAMS ((
-. bfd *abfd));
-. boolean (*_bfd_coff_start_final_link) PARAMS ((
-. bfd *output_bfd,
-. struct bfd_link_info *info));
-. boolean (*_bfd_coff_relocate_section) PARAMS ((
-. bfd *output_bfd,
-. struct bfd_link_info *info,
-. bfd *input_bfd,
-. asection *input_section,
-. bfd_byte *contents,
-. struct internal_reloc *relocs,
-. struct internal_syment *syms,
-. asection **sections));
-. reloc_howto_type *(*_bfd_coff_rtype_to_howto) PARAMS ((
-. bfd *abfd,
-. asection *sec,
-. struct internal_reloc *rel,
-. struct coff_link_hash_entry *h,
-. struct internal_syment *sym,
-. bfd_vma *addendp));
-. boolean (*_bfd_coff_adjust_symndx) PARAMS ((
-. bfd *obfd,
-. struct bfd_link_info *info,
-. bfd *ibfd,
-. asection *sec,
-. struct internal_reloc *reloc,
-. boolean *adjustedp));
-. boolean (*_bfd_coff_link_add_one_symbol) PARAMS ((
-. struct bfd_link_info *info,
-. bfd *abfd,
-. const char *name,
-. flagword flags,
-. asection *section,
-. bfd_vma value,
-. const char *string,
-. boolean copy,
-. boolean collect,
-. struct bfd_link_hash_entry **hashp));
+. unsigned int _bfd_filhsz;
+. unsigned int _bfd_aoutsz;
+. unsigned int _bfd_scnhsz;
+. unsigned int _bfd_symesz;
+. unsigned int _bfd_auxesz;
+. unsigned int _bfd_relsz;
+. unsigned int _bfd_linesz;
+. unsigned int _bfd_filnmlen;
+. boolean _bfd_coff_long_filenames;
+. boolean _bfd_coff_long_section_names;
+. unsigned int _bfd_coff_default_section_alignment_power;
+. boolean _bfd_coff_force_symnames_in_strings;
+. unsigned int _bfd_coff_debug_string_prefix_length;
+.
+. void (*_bfd_coff_swap_filehdr_in)
+. PARAMS ((bfd *, PTR, PTR));
+.
+. void (*_bfd_coff_swap_aouthdr_in)
+. PARAMS ((bfd *, PTR, PTR));
+.
+. void (*_bfd_coff_swap_scnhdr_in)
+. PARAMS ((bfd *, PTR, PTR));
+.
+. void (*_bfd_coff_swap_reloc_in)
+. PARAMS ((bfd *abfd, PTR, PTR));
+.
+. boolean (*_bfd_coff_bad_format_hook)
+. PARAMS ((bfd *, PTR));
+.
+. boolean (*_bfd_coff_set_arch_mach_hook)
+. PARAMS ((bfd *, PTR));
+.
+. PTR (*_bfd_coff_mkobject_hook)
+. PARAMS ((bfd *, PTR, PTR));
+.
+. boolean (*_bfd_styp_to_sec_flags_hook)
+. PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
+.
+. void (*_bfd_set_alignment_hook)
+. PARAMS ((bfd *, asection *, PTR));
+.
+. boolean (*_bfd_coff_slurp_symbol_table)
+. PARAMS ((bfd *));
+.
+. boolean (*_bfd_coff_symname_in_debug)
+. PARAMS ((bfd *, struct internal_syment *));
+.
+. boolean (*_bfd_coff_pointerize_aux_hook)
+. PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
+. unsigned int, combined_entry_type *));
+.
+. boolean (*_bfd_coff_print_aux)
+. PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *,
+. combined_entry_type *, unsigned int));
+.
+. void (*_bfd_coff_reloc16_extra_cases)
+. PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
+. bfd_byte *, unsigned int *, unsigned int *));
+.
+. int (*_bfd_coff_reloc16_estimate)
+. PARAMS ((bfd *, asection *, arelent *, unsigned int,
+. struct bfd_link_info *));
+.
+. enum coff_symbol_classification (*_bfd_coff_classify_symbol)
+. PARAMS ((bfd *, struct internal_syment *));
+.
+. boolean (*_bfd_coff_compute_section_file_positions)
+. PARAMS ((bfd *));
+.
+. boolean (*_bfd_coff_start_final_link)
+. PARAMS ((bfd *, struct bfd_link_info *));
.
-. boolean (*_bfd_coff_link_output_has_begun) PARAMS ((
-. bfd * abfd,
-. struct coff_final_link_info * pfinfo));
-. boolean (*_bfd_coff_final_link_postscript) PARAMS ((
-. bfd * abfd,
-. struct coff_final_link_info * pfinfo));
+. boolean (*_bfd_coff_relocate_section)
+. PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+. struct internal_reloc *, struct internal_syment *, asection **));
+.
+. reloc_howto_type *(*_bfd_coff_rtype_to_howto)
+. PARAMS ((bfd *, asection *, struct internal_reloc *,
+. struct coff_link_hash_entry *, struct internal_syment *,
+. bfd_vma *));
+.
+. boolean (*_bfd_coff_adjust_symndx)\
+. PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
+. struct internal_reloc *, boolean *));
+.
+. boolean (*_bfd_coff_link_add_one_symbol)
+. PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
+. asection *, bfd_vma, const char *, boolean, boolean,
+. struct bfd_link_hash_entry **));
+.
+. boolean (*_bfd_coff_link_output_has_begun)
+. PARAMS ((bfd *, struct coff_final_link_info *));
+.
+. boolean (*_bfd_coff_final_link_postscript)
+. PARAMS ((bfd *, struct coff_final_link_info *));
.
.} bfd_coff_backend_data;
.
-.#define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
+.#define coff_backend_info(abfd) \
+. ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
.
.#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \
-. ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
+. ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
.
.#define bfd_coff_swap_sym_in(a,e,i) \
-. ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i))
+. ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i))
.
.#define bfd_coff_swap_lineno_in(a,e,i) \
-. ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i))
+. ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i))
.
.#define bfd_coff_swap_reloc_out(abfd, i, o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o))
+. ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o))
.
.#define bfd_coff_swap_lineno_out(abfd, i, o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o))
+. ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o))
.
.#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \
-. ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o))
+. ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o))
.
.#define bfd_coff_swap_sym_out(abfd, i,o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o))
+. ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o))
.
.#define bfd_coff_swap_scnhdr_out(abfd, i,o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o))
+. ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o))
.
.#define bfd_coff_swap_filehdr_out(abfd, i,o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o))
+. ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o))
.
.#define bfd_coff_swap_aouthdr_out(abfd, i,o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o))
+. ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o))
.
.#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz)
.#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz)
@@ -1360,90 +1299,91 @@ dependent COFF routines:
.#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz)
.#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
.#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen)
-.#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames)
+.#define bfd_coff_long_filenames(abfd) \
+. (coff_backend_info (abfd)->_bfd_coff_long_filenames)
.#define bfd_coff_long_section_names(abfd) \
-. (coff_backend_info (abfd)->_bfd_coff_long_section_names)
+. (coff_backend_info (abfd)->_bfd_coff_long_section_names)
.#define bfd_coff_default_section_alignment_power(abfd) \
-. (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power)
+. (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power)
.#define bfd_coff_swap_filehdr_in(abfd, i,o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
+. ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
.
.#define bfd_coff_swap_aouthdr_in(abfd, i,o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o))
+. ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o))
.
.#define bfd_coff_swap_scnhdr_in(abfd, i,o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
+. ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
.
.#define bfd_coff_swap_reloc_in(abfd, i, o) \
-. ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))
+. ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))
.
.#define bfd_coff_bad_format_hook(abfd, filehdr) \
-. ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
+. ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
.
.#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
-. ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
+. ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
.#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
-. ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
+. ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
.
-.#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section)\
-. ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
-. (abfd, scnhdr, name, section))
+.#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\
+. ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
+. (abfd, scnhdr, name, section, flags_ptr))
.
.#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
-. ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
+. ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
.
.#define bfd_coff_slurp_symbol_table(abfd)\
-. ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd))
+. ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd))
.
.#define bfd_coff_symname_in_debug(abfd, sym)\
-. ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))
+. ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))
.
.#define bfd_coff_force_symnames_in_strings(abfd)\
-. (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings)
+. (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings)
.
.#define bfd_coff_debug_string_prefix_length(abfd)\
-. (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length)
+. (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length)
.
.#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\
-. ((coff_backend_info (abfd)->_bfd_coff_print_aux)\
-. (abfd, file, base, symbol, aux, indaux))
+. ((coff_backend_info (abfd)->_bfd_coff_print_aux)\
+. (abfd, file, base, symbol, aux, indaux))
.
.#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)\
-. ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
-. (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
+. ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
+. (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
.
.#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\
-. ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
-. (abfd, section, reloc, shrink, link_info))
+. ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
+. (abfd, section, reloc, shrink, link_info))
.
.#define bfd_coff_classify_symbol(abfd, sym)\
-. ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\
-. (abfd, sym))
+. ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\
+. (abfd, sym))
.
.#define bfd_coff_compute_section_file_positions(abfd)\
-. ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\
-. (abfd))
+. ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\
+. (abfd))
.
.#define bfd_coff_start_final_link(obfd, info)\
-. ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\
-. (obfd, info))
+. ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\
+. (obfd, info))
.#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\
-. ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\
-. (obfd, info, ibfd, o, con, rel, isyms, secs))
+. ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\
+. (obfd, info, ibfd, o, con, rel, isyms, secs))
.#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\
-. ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\
-. (abfd, sec, rel, h, sym, addendp))
+. ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\
+. (abfd, sec, rel, h, sym, addendp))
.#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
-. ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
-. (obfd, info, ibfd, sec, rel, adjustedp))
+. ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
+. (obfd, info, ibfd, sec, rel, adjustedp))
.#define bfd_coff_link_add_one_symbol(info,abfd,name,flags,section,value,string,cp,coll,hashp)\
-. ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
-. (info, abfd, name, flags, section, value, string, cp, coll, hashp))
+. ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
+. (info, abfd, name, flags, section, value, string, cp, coll, hashp))
.
.#define bfd_coff_link_output_has_begun(a,p) \
-. ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p))
+. ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p))
.#define bfd_coff_final_link_postscript(a,p) \
-. ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p))
+. ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p))
.
*/
@@ -1506,7 +1446,10 @@ coff_set_custom_section_alignment (abfd, section, alignment_table, table_size)
return;
if (alignment_table[i].default_alignment_max != COFF_ALIGNMENT_FIELD_EMPTY
- && default_alignment > alignment_table[i].default_alignment_max)
+#if COFF_DEFAULT_SECTION_ALIGNMENT_POWER != 0
+ && default_alignment > alignment_table[i].default_alignment_max
+#endif
+ )
return;
section->alignment_power = alignment_table[i].alignment_power;
@@ -1545,6 +1488,7 @@ coff_new_section_hook (abfd, section)
asection * section;
{
combined_entry_type *native;
+ bfd_size_type amt;
section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER;
@@ -1562,8 +1506,8 @@ coff_new_section_hook (abfd, section)
@@ The 10 is a guess at a plausible maximum number of aux entries
(but shouldn't be a constant). */
- native = ((combined_entry_type *)
- bfd_zalloc (abfd, sizeof (combined_entry_type) * 10));
+ amt = sizeof (combined_entry_type) * 10;
+ native = (combined_entry_type *) bfd_zalloc (abfd, amt);
if (native == NULL)
return false;
@@ -1645,6 +1589,7 @@ coff_set_alignment_hook (abfd, section, scnhdr)
PTR scnhdr;
{
struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr;
+ bfd_size_type amt;
ALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_64BYTES, 6)
ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_32BYTES, 5)
@@ -1660,8 +1605,8 @@ coff_set_alignment_hook (abfd, section, scnhdr)
mapped onto a generic BFD section bit. */
if (coff_section_data (abfd, section) == NULL)
{
- section->used_by_bfd =
- (PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata));
+ amt = sizeof (struct coff_section_tdata);
+ section->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
if (section->used_by_bfd == NULL)
{
/* FIXME: Return error. */
@@ -1670,8 +1615,8 @@ coff_set_alignment_hook (abfd, section, scnhdr)
}
if (pei_section_data (abfd, section) == NULL)
{
- coff_section_data (abfd, section)->tdata =
- (PTR) bfd_zalloc (abfd, sizeof (struct pei_section_tdata));
+ amt = sizeof (struct pei_section_tdata);
+ coff_section_data (abfd, section)->tdata = (PTR) bfd_zalloc (abfd, amt);
if (coff_section_data (abfd, section)->tdata == NULL)
{
/* FIXME: Return error. */
@@ -1688,16 +1633,15 @@ coff_set_alignment_hook (abfd, section, scnhdr)
{
struct external_reloc dst;
struct internal_reloc n;
- int oldpos = bfd_tell (abfd);
- bfd_seek (abfd, hdr->s_relptr, 0);
- if (bfd_read ((PTR) & dst, 1, bfd_coff_relsz (abfd), abfd)
+ file_ptr oldpos = bfd_tell (abfd);
+ bfd_seek (abfd, (file_ptr) hdr->s_relptr, 0);
+ if (bfd_bread ((PTR) &dst, (bfd_size_type) bfd_coff_relsz (abfd), abfd)
!= bfd_coff_relsz (abfd))
return;
coff_swap_reloc_in (abfd, &dst, &n);
bfd_seek (abfd, oldpos, 0);
- section->reloc_count =
- hdr->s_nreloc = n.r_vaddr;
+ section->reloc_count = hdr->s_nreloc = n.r_vaddr;
}
}
#undef ALIGN_SET
@@ -1725,7 +1669,7 @@ coff_set_alignment_hook (abfd, section, scnhdr)
if ((hdr->s_flags & STYP_OVRFLO) == 0)
return;
- real_sec = coff_section_from_bfd_index (abfd, hdr->s_nreloc);
+ real_sec = coff_section_from_bfd_index (abfd, (int) hdr->s_nreloc);
if (real_sec == NULL)
return;
@@ -1736,7 +1680,7 @@ coff_set_alignment_hook (abfd, section, scnhdr)
{
if (*ps == section)
{
- *ps = (*ps)->next;
+ bfd_section_list_remove (abfd, ps);
--abfd->section_count;
break;
}
@@ -1761,8 +1705,9 @@ coff_mkobject (abfd)
bfd * abfd;
{
coff_data_type *coff;
+ bfd_size_type amt = sizeof (coff_data_type);
- abfd->tdata.coff_obj_data = (struct coff_tdata *) bfd_zalloc (abfd, sizeof (coff_data_type));
+ abfd->tdata.coff_obj_data = (struct coff_tdata *) bfd_zalloc (abfd, amt);
if (abfd->tdata.coff_obj_data == 0)
return false;
coff = coff_data (abfd);
@@ -1870,7 +1815,7 @@ coff_set_arch_mach_hook (abfd, filehdr)
bfd *abfd;
PTR filehdr;
{
- long machine;
+ unsigned long machine;
enum bfd_architecture arch;
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
@@ -2030,11 +1975,11 @@ coff_set_arch_mach_hook (abfd, filehdr)
{
bfd_byte *buf;
struct internal_syment sym;
+ bfd_size_type amt = bfd_coff_symesz (abfd);
- buf = (bfd_byte *) bfd_malloc (bfd_coff_symesz (abfd));
+ buf = (bfd_byte *) bfd_malloc (amt);
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
- || (bfd_read (buf, 1, bfd_coff_symesz (abfd), abfd)
- != bfd_coff_symesz (abfd)))
+ || bfd_bread (buf, amt, abfd) != amt)
{
free (buf);
return false;
@@ -2053,21 +1998,8 @@ coff_set_arch_mach_hook (abfd, filehdr)
{
default:
case 0:
-#ifdef POWERMAC
- /* PowerPC Macs use the same magic numbers as RS/6000
- (because that's how they were bootstrapped originally),
- but they are always PowerPC architecture. */
- arch = bfd_arch_powerpc;
- machine = bfd_mach_ppc;
-#else
-#ifdef XCOFF64
- arch = bfd_arch_powerpc;
- machine = bfd_mach_ppc_620;
-#else
- arch = bfd_arch_rs6000;
- machine = bfd_mach_rs6k;
-#endif
-#endif /* POWERMAC */
+ arch = bfd_xcoff_architecture (abfd);
+ machine = bfd_xcoff_machine (abfd);
break;
case 1:
@@ -2338,13 +2270,21 @@ coff_print_aux (abfd, file, table_base, symbol, aux, indaux)
if (SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp) != XTY_LD)
{
BFD_ASSERT (! aux->fix_scnlen);
- fprintf (file, "val %5ld", aux->u.auxent.x_csect.x_scnlen.l);
+#ifdef XCOFF64
+ fprintf (file, "val %5lld", aux->u.auxent.x_csect.x_scnlen.l);
+#else
+ fprintf (file, "val %5ld", (long) aux->u.auxent.x_csect.x_scnlen.l);
+#endif
}
else
{
fprintf (file, "indx ");
if (! aux->fix_scnlen)
- fprintf (file, "%4ld", aux->u.auxent.x_csect.x_scnlen.l);
+#ifdef XCOFF64
+ fprintf (file, "%4lld", aux->u.auxent.x_csect.x_scnlen.l);
+#else
+ fprintf (file, "%4ld", (long) aux->u.auxent.x_csect.x_scnlen.l);
+#endif
else
fprintf (file, "%4ld",
(long) (aux->u.auxent.x_csect.x_scnlen.p - table_base));
@@ -2418,12 +2358,18 @@ coff_write_relocs (abfd, first_undef)
#ifndef TARG_AUX
p = s->orelocation;
#else
- /* sort relocations before we write them out */
- p = (arelent **) bfd_malloc (s->reloc_count * sizeof (arelent *));
- if (p == NULL && s->reloc_count > 0)
- return false;
- memcpy (p, s->orelocation, s->reloc_count * sizeof (arelent *));
- qsort (p, s->reloc_count, sizeof (arelent *), compare_arelent_ptr);
+ {
+ /* sort relocations before we write them out */
+ bfd_size_type amt;
+
+ amt = s->reloc_count;
+ amt *= sizeof (arelent *);
+ p = (arelent **) bfd_malloc (amt);
+ if (p == NULL && s->reloc_count > 0)
+ return false;
+ memcpy (p, s->orelocation, (size_t) amt);
+ qsort (p, s->reloc_count, sizeof (arelent *), compare_arelent_ptr);
+ }
#endif
if (bfd_seek (abfd, s->rel_filepos, SEEK_SET) != 0)
@@ -2438,8 +2384,8 @@ coff_write_relocs (abfd, first_undef)
/* add one to count *this* reloc (grr) */
n.r_vaddr = s->reloc_count + 1;
coff_swap_reloc_out (abfd, &n, &dst);
- if (bfd_write ((PTR) & dst, 1, bfd_coff_relsz (abfd), abfd)
- != bfd_coff_relsz (abfd))
+ if (bfd_bwrite ((PTR) & dst, (bfd_size_type) bfd_coff_relsz (abfd),
+ abfd) != bfd_coff_relsz (abfd))
return false;
}
#endif
@@ -2462,15 +2408,15 @@ coff_write_relocs (abfd, first_undef)
if (q->sym_ptr_ptr[0]->the_bfd != abfd)
{
- int i;
+ int j;
const char *sname = q->sym_ptr_ptr[0]->name;
asymbol **outsyms = abfd->outsymbols;
- for (i = first_undef; outsyms[i]; i++)
+ for (j = first_undef; outsyms[j]; j++)
{
- const char *intable = outsyms[i]->name;
+ const char *intable = outsyms[j]->name;
if (strcmp (intable, sname) == 0) {
/* got a hit, so repoint the reloc */
- q->sym_ptr_ptr = outsyms + i;
+ q->sym_ptr_ptr = outsyms + j;
break;
}
}
@@ -2517,8 +2463,8 @@ coff_write_relocs (abfd, first_undef)
n.r_type = q->howto->type;
#endif
coff_swap_reloc_out (abfd, &n, &dst);
- if (bfd_write ((PTR) & dst, 1, bfd_coff_relsz (abfd), abfd)
- != bfd_coff_relsz (abfd))
+ if (bfd_bwrite ((PTR) & dst, (bfd_size_type) bfd_coff_relsz (abfd),
+ abfd) != bfd_coff_relsz (abfd))
return false;
}
@@ -2994,17 +2940,19 @@ coff_compute_section_file_positions (abfd)
right order in the image file itself, but we do need to get the
target_index values right. */
- int count;
+ unsigned int count;
asection **section_list;
- int i;
+ unsigned int i;
int target_index;
+ bfd_size_type amt;
count = 0;
for (current = abfd->sections; current != NULL; current = current->next)
++count;
/* We allocate an extra cell to simplify the final loop. */
- section_list = bfd_malloc (sizeof (struct asection *) * (count + 1));
+ amt = sizeof (struct asection *) * (count + 1);
+ section_list = bfd_malloc (amt);
if (section_list == NULL)
return false;
@@ -3068,15 +3016,16 @@ coff_compute_section_file_positions (abfd)
page size too, and remember both sizes. */
if (coff_section_data (abfd, current) == NULL)
{
- current->used_by_bfd =
- (PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata));
+ bfd_size_type amt = sizeof (struct coff_section_tdata);
+ current->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
if (current->used_by_bfd == NULL)
return false;
}
if (pei_section_data (abfd, current) == NULL)
{
- coff_section_data (abfd, current)->tdata =
- (PTR) bfd_zalloc (abfd, sizeof (struct pei_section_tdata));
+ bfd_size_type amt = sizeof (struct pei_section_tdata);
+ coff_section_data (abfd, current)->tdata
+ = (PTR) bfd_zalloc (abfd, amt);
if (coff_section_data (abfd, current)->tdata == NULL)
return false;
}
@@ -3105,7 +3054,36 @@ coff_compute_section_file_positions (abfd)
padding the previous section up if necessary */
old_sofar = sofar;
- sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
+#ifdef RS6000COFF_C
+ /* AIX loader checks the text section alignment of (vma - filepos)
+ So even though the filepos may be aligned wrt the o_algntext, for
+ AIX executables, this check fails. This shows up when an native
+ AIX executable is stripped with gnu strip because the default vma
+ of native is 0x10000150 but default for gnu is 0x10000140. Gnu
+ stripped gnu excutable passes this check because the filepos is
+ 0x0140. */
+ if (!strcmp (current->name, _TEXT))
+ {
+ bfd_vma pad;
+ bfd_vma align;
+
+ sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
+
+ align = 1 << current->alignment_power;
+ pad = abs (current->vma - sofar) % align;
+
+ if (pad)
+ {
+ pad = align - pad;
+ sofar += pad;
+ }
+ }
+ else
+#else
+ {
+ sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
+ }
+#endif
if (previous != (asection *) NULL)
{
previous->_raw_size += sofar - old_sofar;
@@ -3181,7 +3159,7 @@ coff_compute_section_file_positions (abfd)
b = 0;
if (bfd_seek (abfd, sofar - 1, SEEK_SET) != 0
- || bfd_write (&b, 1, 1, abfd) != 1)
+ || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
return false;
}
@@ -3214,11 +3192,12 @@ coff_add_missing_symbols (abfd)
asymbol **sympp2;
unsigned int i;
int need_text = 1, need_data = 1, need_bss = 1, need_file = 1;
+ bfd_size_type amt;
for (i = 0; i < nsyms; i++)
{
coff_symbol_type *csym = coff_symbol_from (abfd, sympp[i]);
- CONST char *name;
+ const char *name;
if (csym)
{
/* only do this if there is a coff representation of the input
@@ -3250,7 +3229,9 @@ coff_add_missing_symbols (abfd)
if (!need_text && !need_data && !need_bss && !need_file)
return true;
nsyms += need_text + need_data + need_bss + need_file;
- sympp2 = (asymbol **) bfd_alloc (abfd, nsyms * sizeof (asymbol *));
+ amt = nsyms;
+ amt *= sizeof (asymbol *);
+ sympp2 = (asymbol **) bfd_alloc (abfd, amt);
if (!sympp2)
return false;
memcpy (sympp2, sympp, i * sizeof (asymbol *));
@@ -3370,11 +3351,13 @@ coff_write_object_contents (abfd)
{
scn_base = bfd_coff_filhsz (abfd);
#ifdef RS6000COFF_C
+#ifndef XCOFF64
if (xcoff_data (abfd)->full_aouthdr)
scn_base += bfd_coff_aoutsz (abfd);
else
scn_base += SMALL_AOUTSZ;
#endif
+#endif
}
if (bfd_seek (abfd, scn_base, SEEK_SET) != 0)
@@ -3523,9 +3506,10 @@ coff_write_object_contents (abfd)
#endif
{
SCNHDR buff;
+ bfd_size_type amt = bfd_coff_scnhsz (abfd);
+
if (coff_swap_scnhdr_out (abfd, &section, &buff) == 0
- || bfd_write ((PTR) (&buff), 1, bfd_coff_scnhsz (abfd), abfd)
- != bfd_coff_scnhsz (abfd))
+ || bfd_bwrite ((PTR) &buff, amt, abfd) != amt)
return false;
}
@@ -3625,6 +3609,7 @@ coff_write_object_contents (abfd)
}
#ifdef RS6000COFF_C
+#ifndef XCOFF64
/* XCOFF handles overflows in the reloc and line number count fields
by creating a new section header to hold the correct values. */
for (current = abfd->sections; current != NULL; current = current->next)
@@ -3633,6 +3618,7 @@ coff_write_object_contents (abfd)
{
struct internal_scnhdr scnhdr;
SCNHDR buff;
+ bfd_size_type amt;
internal_f.f_nscns++;
strncpy (&(scnhdr.s_name[0]), current->name, 8);
@@ -3645,13 +3631,14 @@ coff_write_object_contents (abfd)
scnhdr.s_nreloc = current->target_index;
scnhdr.s_nlnno = current->target_index;
scnhdr.s_flags = STYP_OVRFLO;
+ amt = bfd_coff_scnhsz (abfd);
if (coff_swap_scnhdr_out (abfd, &scnhdr, &buff) == 0
- || bfd_write ((PTR) &buff, 1, bfd_coff_scnhsz (abfd), abfd)
- != bfd_coff_scnhsz (abfd))
+ || bfd_bwrite ((PTR) &buff, amt, abfd) != amt)
return false;
}
}
#endif
+#endif
/* OK, now set up the filehdr... */
@@ -3673,11 +3660,13 @@ coff_write_object_contents (abfd)
{
internal_f.f_opthdr = 0;
#ifdef RS6000COFF_C
+#ifndef XCOFF64
if (xcoff_data (abfd)->full_aouthdr)
internal_f.f_opthdr = bfd_coff_aoutsz (abfd);
else
internal_f.f_opthdr = SMALL_AOUTSZ;
#endif
+#endif
}
if (!hasrelocs)
@@ -3890,9 +3879,9 @@ coff_write_object_contents (abfd)
rounded up to the page size. */
b = 0;
if (bfd_seek (abfd,
- BFD_ALIGN (sym_base, COFF_PAGE_SIZE) - 1,
+ (file_ptr) BFD_ALIGN (sym_base, COFF_PAGE_SIZE) - 1,
SEEK_SET) != 0
- || bfd_write (&b, 1, 1, abfd) != 1)
+ || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
return false;
}
#endif
@@ -4016,14 +4005,14 @@ coff_write_object_contents (abfd)
{
char * buff;
- bfd_size_type amount;
+ bfd_size_type amount = bfd_coff_filhsz (abfd);
- buff = bfd_malloc (bfd_coff_filhsz (abfd));
+ buff = bfd_malloc (amount);
if (buff == NULL)
return false;
- bfd_coff_swap_filehdr_out (abfd, (PTR) & internal_f, (PTR) buff);
- amount = bfd_write ((PTR) buff, 1, bfd_coff_filhsz (abfd), abfd);
+ bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, (PTR) buff);
+ amount = bfd_bwrite ((PTR) buff, amount, abfd);
free (buff);
@@ -4036,14 +4025,14 @@ coff_write_object_contents (abfd)
/* Note that peicode.h fills in a PEAOUTHDR, not an AOUTHDR.
include/coff/pe.h sets AOUTSZ == sizeof (PEAOUTHDR)) */
char * buff;
- bfd_size_type amount;
+ bfd_size_type amount = bfd_coff_aoutsz (abfd);
- buff = bfd_malloc (bfd_coff_aoutsz (abfd));
+ buff = bfd_malloc (amount);
if (buff == NULL)
return false;
- coff_swap_aouthdr_out (abfd, (PTR) & internal_a, (PTR) buff);
- amount = bfd_write ((PTR) buff, 1, bfd_coff_aoutsz (abfd), abfd);
+ coff_swap_aouthdr_out (abfd, (PTR) &internal_a, (PTR) buff);
+ amount = bfd_bwrite ((PTR) buff, amount, abfd);
free (buff);
@@ -4062,7 +4051,7 @@ coff_write_object_contents (abfd)
size = bfd_coff_aoutsz (abfd);
else
size = SMALL_AOUTSZ;
- if (bfd_write ((PTR) &buff, 1, size, abfd) != size)
+ if (bfd_bwrite ((PTR) &buff, (bfd_size_type) size, abfd) != size)
return false;
}
#endif
@@ -4129,14 +4118,13 @@ coff_set_section_contents (abfd, section, location, offset, count)
if (section->filepos == 0)
return true;
- if (bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0)
+ if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0)
return false;
- if (count != 0)
- {
- return (bfd_write (location, 1, count, abfd) == count) ? true : false;
- }
- return true;
+ if (count == 0)
+ return true;
+
+ return bfd_bwrite (location, count, abfd) == count;
}
#if 0
static boolean
@@ -4166,17 +4154,16 @@ coff_close_and_cleanup (abfd)
#endif
static PTR
-buy_and_read (abfd, where, seek_direction, size)
+buy_and_read (abfd, where, size)
bfd *abfd;
file_ptr where;
- int seek_direction;
- size_t size;
+ bfd_size_type size;
{
PTR area = (PTR) bfd_alloc (abfd, size);
if (!area)
return (NULL);
- if (bfd_seek (abfd, where, seek_direction) != 0
- || bfd_read (area, 1, size, abfd) != size)
+ if (bfd_seek (abfd, where, SEEK_SET) != 0
+ || bfd_bread (area, size, abfd) != size)
return (NULL);
return (area);
} /* buy_and_read() */
@@ -4212,16 +4199,14 @@ coff_slurp_line_table (abfd, asect)
{
LINENO *native_lineno;
alent *lineno_cache;
+ bfd_size_type amt;
BFD_ASSERT (asect->lineno == (alent *) NULL);
- native_lineno = (LINENO *) buy_and_read (abfd,
- asect->line_filepos,
- SEEK_SET,
- (size_t) (bfd_coff_linesz (abfd) *
- asect->lineno_count));
- lineno_cache =
- (alent *) bfd_alloc (abfd, (size_t) ((asect->lineno_count + 1) * sizeof (alent)));
+ amt = (bfd_size_type) bfd_coff_linesz (abfd) * asect->lineno_count;
+ native_lineno = (LINENO *) buy_and_read (abfd, asect->line_filepos, amt);
+ amt = ((bfd_size_type) asect->lineno_count + 1) * sizeof (alent);
+ lineno_cache = (alent *) bfd_alloc (abfd, amt);
if (lineno_cache == NULL)
return false;
else
@@ -4239,17 +4224,17 @@ coff_slurp_line_table (abfd, asect)
if (cache_ptr->line_number == 0)
{
boolean warned;
- long symndx;
+ bfd_signed_vma symndx;
coff_symbol_type *sym;
warned = false;
symndx = dst.l_addr.l_symndx;
if (symndx < 0
- || (unsigned long) symndx >= obj_raw_syment_count (abfd))
+ || (bfd_vma) symndx >= obj_raw_syment_count (abfd))
{
(*_bfd_error_handler)
(_("%s: warning: illegal symbol index %ld in line numbers"),
- bfd_get_filename (abfd), dst.l_addr.l_symndx);
+ bfd_archive_filename (abfd), dst.l_addr.l_symndx);
symndx = 0;
warned = true;
}
@@ -4263,7 +4248,7 @@ coff_slurp_line_table (abfd, asect)
{
(*_bfd_error_handler)
(_("%s: warning: duplicate line number information for `%s'"),
- bfd_get_filename (abfd),
+ bfd_archive_filename (abfd),
bfd_asymbol_name (&sym->symbol));
}
sym->lineno = cache_ptr;
@@ -4297,6 +4282,7 @@ coff_slurp_symbol_table (abfd)
combined_entry_type *native_symbols;
coff_symbol_type *cached_area;
unsigned int *table_ptr;
+ bfd_size_type amt;
unsigned int number_of_symbols = 0;
@@ -4310,17 +4296,15 @@ coff_slurp_symbol_table (abfd)
} /* on error */
/* Allocate enough room for all the symbols in cached form */
- cached_area = ((coff_symbol_type *)
- bfd_alloc (abfd,
- (obj_raw_syment_count (abfd)
- * sizeof (coff_symbol_type))));
-
+ amt = obj_raw_syment_count (abfd);
+ amt *= sizeof (coff_symbol_type);
+ cached_area = (coff_symbol_type *) bfd_alloc (abfd, amt);
if (cached_area == NULL)
return false;
- table_ptr = ((unsigned int *)
- bfd_alloc (abfd,
- (obj_raw_syment_count (abfd)
- * sizeof (unsigned int))));
+
+ amt = obj_raw_syment_count (abfd);
+ amt *= sizeof (unsigned int);
+ table_ptr = (unsigned int *) bfd_alloc (abfd, amt);
if (table_ptr == NULL)
return false;
@@ -4623,7 +4607,7 @@ coff_slurp_symbol_table (abfd)
default:
(*_bfd_error_handler)
(_("%s: Unrecognized storage class %d for %s symbol `%s'"),
- bfd_get_filename (abfd), src->u.syment.n_sclass,
+ bfd_archive_filename (abfd), src->u.syment.n_sclass,
dst->symbol.section->name, dst->symbol.name);
dst->symbol.flags = BSF_DEBUGGING;
dst->symbol.value = (src->u.syment.n_value);
@@ -4754,7 +4738,7 @@ coff_classify_symbol (abfd, syment)
(*_bfd_error_handler)
(_("warning: %s: local symbol `%s' has no section"),
- bfd_get_filename (abfd),
+ bfd_archive_filename (abfd),
_bfd_coff_internal_syment_name (abfd, syment, buf));
}
@@ -4818,8 +4802,8 @@ coff_slurp_reloc_table (abfd, asect, symbols)
RELOC *native_relocs;
arelent *reloc_cache;
arelent *cache_ptr;
-
unsigned int idx;
+ bfd_size_type amt;
if (asect->relocation)
return true;
@@ -4829,14 +4813,10 @@ coff_slurp_reloc_table (abfd, asect, symbols)
return true;
if (!coff_slurp_symbol_table (abfd))
return false;
- native_relocs =
- (RELOC *) buy_and_read (abfd,
- asect->rel_filepos,
- SEEK_SET,
- (size_t) (bfd_coff_relsz (abfd) *
- asect->reloc_count));
- reloc_cache = (arelent *)
- bfd_alloc (abfd, (size_t) (asect->reloc_count * sizeof (arelent)));
+ amt = (bfd_size_type) bfd_coff_relsz (abfd) * asect->reloc_count;
+ native_relocs = (RELOC *) buy_and_read (abfd, asect->rel_filepos, amt);
+ amt = (bfd_size_type) asect->reloc_count * sizeof (arelent);
+ reloc_cache = (arelent *) bfd_alloc (abfd, amt);
if (reloc_cache == NULL)
return false;
@@ -4865,7 +4845,7 @@ coff_slurp_reloc_table (abfd, asect, symbols)
{
(*_bfd_error_handler)
(_("%s: warning: illegal symbol index %ld in relocs"),
- bfd_get_filename (abfd), dst.r_symndx);
+ bfd_archive_filename (abfd), dst.r_symndx);
cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
ptr = NULL;
}
@@ -4903,7 +4883,7 @@ coff_slurp_reloc_table (abfd, asect, symbols)
{
(*_bfd_error_handler)
(_("%s: illegal relocation type %d at address 0x%lx"),
- bfd_get_filename (abfd), dst.r_type, (long) dst.r_vaddr);
+ bfd_archive_filename (abfd), dst.r_type, (long) dst.r_vaddr);
bfd_set_error (bfd_error_bad_value);
return false;
}
@@ -5258,6 +5238,10 @@ static const bfd_coff_backend_data bfd_coff_std_swap_table =
#define coff_bfd_gc_sections bfd_generic_gc_sections
#endif
+#ifndef coff_bfd_merge_sections
+#define coff_bfd_merge_sections bfd_generic_merge_sections
+#endif
+
#define CREATE_BIG_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE) \
const bfd_target VAR = \
{ \
diff --git a/contrib/binutils/bfd/coffgen.c b/contrib/binutils/bfd/coffgen.c
index 82bfdc8..88591f1 100644
--- a/contrib/binutils/bfd/coffgen.c
+++ b/contrib/binutils/bfd/coffgen.c
@@ -47,13 +47,13 @@ static void coff_fix_symbol_name
PARAMS ((bfd *, asymbol *, combined_entry_type *, bfd_size_type *,
asection **, bfd_size_type *));
static boolean coff_write_symbol
- PARAMS ((bfd *, asymbol *, combined_entry_type *, unsigned int *,
+ PARAMS ((bfd *, asymbol *, combined_entry_type *, bfd_vma *,
bfd_size_type *, asection **, bfd_size_type *));
static boolean coff_write_alien_symbol
- PARAMS ((bfd *, asymbol *, unsigned int *, bfd_size_type *,
+ PARAMS ((bfd *, asymbol *, bfd_vma *, bfd_size_type *,
asection **, bfd_size_type *));
static boolean coff_write_native_symbol
- PARAMS ((bfd *, coff_symbol_type *, unsigned int *, bfd_size_type *,
+ PARAMS ((bfd *, coff_symbol_type *, bfd_vma *, bfd_size_type *,
asection **, bfd_size_type *));
static void coff_pointerize_aux
PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
@@ -68,7 +68,7 @@ static void fixup_symbol_value
static char *build_debug_section
PARAMS ((bfd *));
static char *copy_name
- PARAMS ((bfd *, char *, int));
+ PARAMS ((bfd *, char *, size_t));
#define STRING_SIZE_SIZE (4)
@@ -82,6 +82,8 @@ make_a_section_from_file (abfd, hdr, target_index)
{
asection *return_section;
char *name;
+ boolean result = true;
+ flagword flags;
name = NULL;
@@ -106,7 +108,7 @@ make_a_section_from_file (abfd, hdr, target_index)
strindex does not run us past the end, but right now we
don't know the length of the string table. */
strings += strindex;
- name = bfd_alloc (abfd, strlen (strings) + 1);
+ name = bfd_alloc (abfd, (bfd_size_type) strlen (strings) + 1);
if (name == NULL)
return false;
strcpy (name, strings);
@@ -116,7 +118,7 @@ make_a_section_from_file (abfd, hdr, target_index)
if (name == NULL)
{
/* Assorted wastage to null-terminate the name, thanks AT&T! */
- name = bfd_alloc (abfd, sizeof (hdr->s_name) + 1);
+ name = bfd_alloc (abfd, (bfd_size_type) sizeof (hdr->s_name) + 1);
if (name == NULL)
return false;
strncpy (name, (char *) &hdr->s_name[0], sizeof (hdr->s_name));
@@ -142,8 +144,12 @@ make_a_section_from_file (abfd, hdr, target_index)
return_section->userdata = NULL;
return_section->next = (asection *) NULL;
return_section->target_index = target_index;
- return_section->flags = bfd_coff_styp_to_sec_flags_hook (abfd, hdr, name,
- return_section);
+
+ if (! bfd_coff_styp_to_sec_flags_hook (abfd, hdr, name, return_section,
+ & flags))
+ result = false;
+
+ return_section->flags = flags;
/* At least on i386-coff, the line number count for a shared library
section must be ignored. */
@@ -155,7 +161,8 @@ make_a_section_from_file (abfd, hdr, target_index)
/* FIXME: should this check 'hdr->s_size > 0' */
if (hdr->s_scnptr != 0)
return_section->flags |= SEC_HAS_CONTENTS;
- return true;
+
+ return result;
}
/* Read in a COFF object and make it into a BFD. This is used by
@@ -171,7 +178,7 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
flagword oflags = abfd->flags;
bfd_vma ostart = bfd_get_start_address (abfd);
PTR tdata;
- size_t readsize; /* length of file_info */
+ bfd_size_type readsize; /* length of file_info */
unsigned int scnhsz;
char *external_sections;
@@ -204,12 +211,12 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
return 0;
scnhsz = bfd_coff_scnhsz (abfd);
- readsize = nscns * scnhsz;
+ readsize = (bfd_size_type) nscns * scnhsz;
external_sections = (char *) bfd_alloc (abfd, readsize);
if (!external_sections)
goto fail;
- if (bfd_read ((PTR) external_sections, 1, readsize, abfd) != readsize)
+ if (bfd_bread ((PTR) external_sections, readsize, abfd) != readsize)
goto fail;
/* Set the arch/mach *before* swapping in sections; section header swapping
@@ -250,9 +257,9 @@ const bfd_target *
coff_object_p (abfd)
bfd *abfd;
{
- unsigned int filhsz;
- unsigned int aoutsz;
- int nscns;
+ bfd_size_type filhsz;
+ bfd_size_type aoutsz;
+ unsigned int nscns;
PTR filehdr;
struct internal_filehdr internal_f;
struct internal_aouthdr internal_a;
@@ -264,7 +271,7 @@ coff_object_p (abfd)
filehdr = bfd_alloc (abfd, filhsz);
if (filehdr == NULL)
return 0;
- if (bfd_read (filehdr, 1, filhsz, abfd) != filhsz)
+ if (bfd_bread (filehdr, filhsz, abfd) != filhsz)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
@@ -273,7 +280,16 @@ coff_object_p (abfd)
bfd_coff_swap_filehdr_in (abfd, filehdr, &internal_f);
bfd_release (abfd, filehdr);
- if (bfd_coff_bad_format_hook (abfd, &internal_f) == false)
+ /* The XCOFF format has two sizes for the f_opthdr. SMALL_AOUTSZ
+ (less than aoutsz) used in object files and AOUTSZ (equal to
+ aoutsz) in executables. The bfd_coff_swap_aouthdr_in function
+ expects this header to be aoutsz bytes in length, so we use that
+ value in the call to bfd_alloc below. But we must be careful to
+ only read in f_opthdr bytes in the call to bfd_bread. We should
+ also attempt to catch corrupt or non-COFF binaries with a strange
+ value for f_opthdr. */
+ if (bfd_coff_bad_format_hook (abfd, &internal_f) == false
+ || internal_f.f_opthdr > aoutsz)
{
bfd_set_error (bfd_error_wrong_format);
return 0;
@@ -286,8 +302,8 @@ coff_object_p (abfd)
opthdr = bfd_alloc (abfd, aoutsz);
if (opthdr == NULL)
- return 0;;
- if (bfd_read (opthdr, 1, internal_f.f_opthdr, abfd)
+ return 0;
+ if (bfd_bread (opthdr, (bfd_size_type) internal_f.f_opthdr, abfd)
!= internal_f.f_opthdr)
{
return 0;
@@ -424,6 +440,7 @@ _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs,
bfd_byte *erel;
bfd_byte *erel_end;
struct internal_reloc *irel;
+ bfd_size_type amt;
if (coff_section_data (abfd, sec) != NULL
&& coff_section_data (abfd, sec)->relocs != NULL)
@@ -437,24 +454,24 @@ _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs,
relsz = bfd_coff_relsz (abfd);
+ amt = sec->reloc_count * relsz;
if (external_relocs == NULL)
{
- free_external = (bfd_byte *) bfd_malloc (sec->reloc_count * relsz);
+ free_external = (bfd_byte *) bfd_malloc (amt);
if (free_external == NULL && sec->reloc_count > 0)
goto error_return;
external_relocs = free_external;
}
if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0
- || (bfd_read (external_relocs, relsz, sec->reloc_count, abfd)
- != relsz * sec->reloc_count))
+ || bfd_bread (external_relocs, amt, abfd) != amt)
goto error_return;
if (internal_relocs == NULL)
{
- free_internal = ((struct internal_reloc *)
- bfd_malloc (sec->reloc_count
- * sizeof (struct internal_reloc)));
+ amt = sec->reloc_count;
+ amt *= sizeof (struct internal_reloc);
+ free_internal = (struct internal_reloc *) bfd_malloc (amt);
if (free_internal == NULL && sec->reloc_count > 0)
goto error_return;
internal_relocs = free_internal;
@@ -477,9 +494,8 @@ _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs,
{
if (coff_section_data (abfd, sec) == NULL)
{
- sec->used_by_bfd =
- (PTR) bfd_zalloc (abfd,
- sizeof (struct coff_section_tdata));
+ amt = sizeof (struct coff_section_tdata);
+ sec->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
if (sec->used_by_bfd == NULL)
goto error_return;
coff_section_data (abfd, sec)->contents = NULL;
@@ -539,15 +555,18 @@ coff_count_linenumbers (abfd)
section's linenumber count. */
alent *l = q->lineno;
- ++q->symbol.section->output_section->lineno_count;
- ++total;
- ++l;
- while (l->line_number != 0)
+ do
{
+ asection * sec = q->symbol.section->output_section;
+
+ /* Do not try to update fields in read-only sections. */
+ if (! bfd_is_const_section (sec))
+ sec->lineno_count ++;
+
++total;
- ++q->symbol.section->output_section->lineno_count;
++l;
}
+ while (l->line_number != 0);
}
}
}
@@ -654,9 +673,10 @@ coff_renumber_symbols (bfd_ptr, first_undef)
{
asymbol **newsyms;
unsigned int i;
+ bfd_size_type amt;
- newsyms = (asymbol **) bfd_alloc (bfd_ptr,
- sizeof (asymbol *) * (symbol_count + 1));
+ amt = sizeof (asymbol *) * ((bfd_size_type) symbol_count + 1);
+ newsyms = (asymbol **) bfd_alloc (bfd_ptr, amt);
if (!newsyms)
return false;
bfd_ptr->outsymbols = newsyms;
@@ -750,7 +770,8 @@ coff_mangle_symbols (bfd_ptr)
{
/* FIXME: We should use a union here. */
s->u.syment.n_value =
- ((combined_entry_type *) s->u.syment.n_value)->offset;
+ (bfd_vma)((combined_entry_type *)
+ ((unsigned long) s->u.syment.n_value))->offset;
s->fix_value = 0;
}
if (s->fix_line)
@@ -868,7 +889,7 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
}
else
{
- long filepos;
+ file_ptr filepos;
bfd_byte buf[4];
int prefix_len = bfd_coff_debug_string_prefix_length (abfd);
@@ -881,9 +902,9 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
*debug_string_section_p = bfd_get_section_by_name (abfd, ".debug");
filepos = bfd_tell (abfd);
if (prefix_len == 4)
- bfd_put_32 (abfd, name_length + 1, buf);
+ bfd_put_32 (abfd, (bfd_vma) (name_length + 1), buf);
else
- bfd_put_16 (abfd, name_length + 1, buf);
+ bfd_put_16 (abfd, (bfd_vma) (name_length + 1), buf);
if (!bfd_set_section_contents (abfd,
*debug_string_section_p,
@@ -893,8 +914,8 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
|| !bfd_set_section_contents (abfd,
*debug_string_section_p,
(PTR) symbol->name,
- ((file_ptr) *debug_string_size_p
- + prefix_len),
+ (file_ptr) (*debug_string_size_p
+ + prefix_len),
(bfd_size_type) name_length + 1))
abort ();
if (bfd_seek (abfd, filepos, SEEK_SET) != 0)
@@ -921,7 +942,7 @@ coff_write_symbol (abfd, symbol, native, written, string_size_p,
bfd *abfd;
asymbol *symbol;
combined_entry_type *native;
- unsigned int *written;
+ bfd_vma *written;
bfd_size_type *string_size_p;
asection **debug_string_section_p;
bfd_size_type *debug_string_size_p;
@@ -962,7 +983,7 @@ coff_write_symbol (abfd, symbol, native, written, string_size_p,
if (!buf)
return false;
bfd_coff_swap_sym_out (abfd, &native->u.syment, buf);
- if (bfd_write (buf, 1, symesz, abfd) != symesz)
+ if (bfd_bwrite (buf, symesz, abfd) != symesz)
return false;
bfd_release (abfd, buf);
@@ -981,10 +1002,10 @@ coff_write_symbol (abfd, symbol, native, written, string_size_p,
&((native + j + 1)->u.auxent),
type,
class,
- j,
+ (int) j,
native->u.syment.n_numaux,
buf);
- if (bfd_write (buf, 1, auxesz, abfd) != auxesz)
+ if (bfd_bwrite (buf, auxesz, abfd) != auxesz)
return false;
}
bfd_release (abfd, buf);
@@ -1006,7 +1027,7 @@ coff_write_alien_symbol (abfd, symbol, written, string_size_p,
debug_string_section_p, debug_string_size_p)
bfd *abfd;
asymbol *symbol;
- unsigned int *written;
+ bfd_vma *written;
bfd_size_type *string_size_p;
asection **debug_string_section_p;
bfd_size_type *debug_string_size_p;
@@ -1045,7 +1066,7 @@ coff_write_alien_symbol (abfd, symbol, written, string_size_p,
if (! obj_pe (abfd))
native->u.syment.n_value += symbol->section->output_section->vma;
- /* Copy the any flags from the the file header into the symbol.
+ /* Copy the any flags from the file header into the symbol.
FIXME: Why? */
{
coff_symbol_type *c = coff_symbol_from (abfd, symbol);
@@ -1074,7 +1095,7 @@ coff_write_native_symbol (abfd, symbol, written, string_size_p,
debug_string_section_p, debug_string_size_p)
bfd *abfd;
coff_symbol_type *symbol;
- unsigned int *written;
+ bfd_vma *written;
bfd_size_type *string_size_p;
asection **debug_string_section_p;
bfd_size_type *debug_string_size_p;
@@ -1127,8 +1148,9 @@ coff_write_native_symbol (abfd, symbol, written, string_size_p,
}
symbol->done_lineno = true;
- symbol->symbol.section->output_section->moving_line_filepos +=
- count * bfd_coff_linesz (abfd);
+ if (! bfd_is_const_section (symbol->symbol.section->output_section))
+ symbol->symbol.section->output_section->moving_line_filepos +=
+ count * bfd_coff_linesz (abfd);
}
return coff_write_symbol (abfd, &(symbol->symbol), native, written,
@@ -1147,7 +1169,7 @@ coff_write_symbols (abfd)
bfd_size_type debug_string_size;
unsigned int i;
unsigned int limit = bfd_get_symcount (abfd);
- unsigned int written = 0;
+ bfd_signed_vma written = 0;
asymbol **p;
string_size = 0;
@@ -1211,11 +1233,12 @@ coff_write_symbols (abfd)
bfd_byte buffer[STRING_SIZE_SIZE];
#if STRING_SIZE_SIZE == 4
- bfd_h_put_32 (abfd, size, buffer);
+ H_PUT_32 (abfd, size, buffer);
#else
- #error Change bfd_h_put_32
+ #error Change H_PUT_32
#endif
- if (bfd_write ((PTR) buffer, 1, sizeof (buffer), abfd) != sizeof (buffer))
+ if (bfd_bwrite ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd)
+ != sizeof (buffer))
return false;
/* Handle long section names. This code must handle section
@@ -1231,7 +1254,8 @@ coff_write_symbols (abfd)
len = strlen (o->name);
if (len > SCNNMLEN)
{
- if (bfd_write (o->name, 1, len + 1, abfd) != len + 1)
+ if (bfd_bwrite (o->name, (bfd_size_type) (len + 1), abfd)
+ != len + 1)
return false;
}
}
@@ -1271,7 +1295,10 @@ coff_write_symbols (abfd)
&& c_symbol->native->u.syment.n_numaux > 0)
{
if (bfd_coff_force_symnames_in_strings (abfd))
- bfd_write (".file", 1, 6, abfd);
+ {
+ if (bfd_bwrite (".file", (bfd_size_type) 6, abfd) != 6)
+ return false;
+ }
maxlen = bfd_coff_filnmlen (abfd);
}
else
@@ -1279,8 +1306,8 @@ coff_write_symbols (abfd)
if (name_length > maxlen)
{
- if (bfd_write ((PTR) (q->name), 1, name_length + 1, abfd)
- != name_length + 1)
+ if (bfd_bwrite ((PTR) (q->name), (bfd_size_type) name_length + 1,
+ abfd) != name_length + 1)
return false;
}
}
@@ -1294,11 +1321,11 @@ coff_write_symbols (abfd)
bfd_byte buffer[STRING_SIZE_SIZE];
#if STRING_SIZE_SIZE == 4
- bfd_h_put_32 (abfd, size, buffer);
+ H_PUT_32 (abfd, size, buffer);
#else
- #error Change bfd_h_put_32
+ #error Change H_PUT_32
#endif
- if (bfd_write ((PTR) buffer, 1, STRING_SIZE_SIZE, abfd)
+ if (bfd_bwrite ((PTR) buffer, (bfd_size_type) STRING_SIZE_SIZE, abfd)
!= STRING_SIZE_SIZE)
return false;
}
@@ -1353,7 +1380,8 @@ coff_write_linenumbers (abfd)
out.l_lnno = 0;
out.l_addr.l_symndx = l->u.offset;
bfd_coff_swap_lineno_out (abfd, &out, buff);
- if (bfd_write (buff, 1, linesz, abfd) != linesz)
+ if (bfd_bwrite (buff, (bfd_size_type) linesz, abfd)
+ != linesz)
return false;
l++;
while (l->line_number)
@@ -1361,7 +1389,8 @@ coff_write_linenumbers (abfd)
out.l_lnno = l->line_number;
out.l_addr.l_symndx = l->u.offset;
bfd_coff_swap_lineno_out (abfd, &out, buff);
- if (bfd_write (buff, 1, linesz, abfd) != linesz)
+ if (bfd_bwrite (buff, (bfd_size_type) linesz, abfd)
+ != linesz)
return false;
l++;
}
@@ -1409,7 +1438,7 @@ coff_section_symbol (abfd, name)
combined_entry_type e[10];
};
struct foo *f;
- f = (struct foo *) bfd_alloc (abfd, sizeof (*f));
+ f = (struct foo *) bfd_alloc (abfd, (bfd_size_type) sizeof (*f));
if (!f)
{
bfd_set_error (bfd_error_no_error);
@@ -1492,7 +1521,8 @@ build_debug_section (abfd)
bfd *abfd;
{
char *debug_section;
- long position;
+ file_ptr position;
+ bfd_size_type sec_size;
asection *sect = bfd_get_section_by_name (abfd, ".debug");
@@ -1502,8 +1532,8 @@ build_debug_section (abfd)
return NULL;
}
- debug_section = (PTR) bfd_alloc (abfd,
- bfd_get_section_size_before_reloc (sect));
+ sec_size = bfd_get_section_size_before_reloc (sect);
+ debug_section = (PTR) bfd_alloc (abfd, sec_size);
if (debug_section == NULL)
return NULL;
@@ -1513,9 +1543,7 @@ build_debug_section (abfd)
position = bfd_tell (abfd);
if (bfd_seek (abfd, sect->filepos, SEEK_SET) != 0
- || (bfd_read (debug_section,
- bfd_get_section_size_before_reloc (sect), 1, abfd)
- != bfd_get_section_size_before_reloc (sect))
+ || bfd_bread (debug_section, sec_size, abfd) != sec_size
|| bfd_seek (abfd, position, SEEK_SET) != 0)
return NULL;
return debug_section;
@@ -1528,9 +1556,9 @@ static char *
copy_name (abfd, name, maxlen)
bfd *abfd;
char *name;
- int maxlen;
+ size_t maxlen;
{
- int len;
+ size_t len;
char *newname;
for (len = 0; len < maxlen; ++len)
@@ -1541,7 +1569,7 @@ copy_name (abfd, name, maxlen)
}
}
- if ((newname = (PTR) bfd_alloc (abfd, len + 1)) == NULL)
+ if ((newname = (PTR) bfd_alloc (abfd, (bfd_size_type) len + 1)) == NULL)
return (NULL);
strncpy (newname, name, len);
newname[len] = '\0';
@@ -1555,7 +1583,7 @@ _bfd_coff_get_external_symbols (abfd)
bfd *abfd;
{
bfd_size_type symesz;
- size_t size;
+ bfd_size_type size;
PTR syms;
if (obj_coff_external_syms (abfd) != NULL)
@@ -1570,7 +1598,7 @@ _bfd_coff_get_external_symbols (abfd)
return false;
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
- || bfd_read (syms, size, 1, abfd) != size)
+ || bfd_bread (syms, size, abfd) != size)
{
if (syms != NULL)
free (syms);
@@ -1591,8 +1619,9 @@ _bfd_coff_read_string_table (abfd)
bfd *abfd;
{
char extstrsize[STRING_SIZE_SIZE];
- size_t strsize;
+ bfd_size_type strsize;
char *strings;
+ file_ptr pos;
if (obj_coff_strings (abfd) != NULL)
return obj_coff_strings (abfd);
@@ -1603,13 +1632,13 @@ _bfd_coff_read_string_table (abfd)
return NULL;
}
- if (bfd_seek (abfd,
- (obj_sym_filepos (abfd)
- + obj_raw_syment_count (abfd) * bfd_coff_symesz (abfd)),
- SEEK_SET) != 0)
+ pos = obj_sym_filepos (abfd);
+ pos += obj_raw_syment_count (abfd) * bfd_coff_symesz (abfd);
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0)
return NULL;
- if (bfd_read (extstrsize, sizeof extstrsize, 1, abfd) != sizeof extstrsize)
+ if (bfd_bread (extstrsize, (bfd_size_type) sizeof extstrsize, abfd)
+ != sizeof extstrsize)
{
if (bfd_get_error () != bfd_error_file_truncated)
return NULL;
@@ -1620,16 +1649,16 @@ _bfd_coff_read_string_table (abfd)
else
{
#if STRING_SIZE_SIZE == 4
- strsize = bfd_h_get_32 (abfd, (bfd_byte *) extstrsize);
+ strsize = H_GET_32 (abfd, extstrsize);
#else
- #error Change bfd_h_get_32
+ #error Change H_GET_32
#endif
}
if (strsize < STRING_SIZE_SIZE)
{
(*_bfd_error_handler)
- (_("%s: bad string table size %lu"), bfd_get_filename (abfd),
+ (_("%s: bad string table size %lu"), bfd_archive_filename (abfd),
(unsigned long) strsize);
bfd_set_error (bfd_error_bad_value);
return NULL;
@@ -1639,8 +1668,7 @@ _bfd_coff_read_string_table (abfd)
if (strings == NULL)
return NULL;
- if (bfd_read (strings + STRING_SIZE_SIZE,
- strsize - STRING_SIZE_SIZE, 1, abfd)
+ if (bfd_bread (strings + STRING_SIZE_SIZE, strsize - STRING_SIZE_SIZE, abfd)
!= strsize - STRING_SIZE_SIZE)
{
free (strings);
@@ -1686,12 +1714,12 @@ coff_get_normalized_symtab (abfd)
combined_entry_type *internal_ptr;
combined_entry_type *symbol_ptr;
combined_entry_type *internal_end;
- bfd_size_type symesz;
+ size_t symesz;
char *raw_src;
char *raw_end;
const char *string_table = NULL;
char *debug_section = NULL;
- unsigned long size;
+ bfd_size_type size;
if (obj_raw_syments (abfd) != NULL)
return obj_raw_syments (abfd);
@@ -1734,7 +1762,7 @@ coff_get_normalized_symtab (abfd)
bfd_coff_swap_aux_in (abfd, (PTR) raw_src,
symbol_ptr->u.syment.n_type,
symbol_ptr->u.syment.n_sclass,
- i, symbol_ptr->u.syment.n_numaux,
+ (int) i, symbol_ptr->u.syment.n_numaux,
&(internal_ptr->u.auxent));
coff_pointerize_aux (abfd, internal, symbol_ptr, i,
internal_ptr);
@@ -1789,7 +1817,7 @@ coff_get_normalized_symtab (abfd)
((long)
copy_name (abfd,
(internal_ptr + 1)->u.auxent.x_file.x_fname,
- bfd_coff_filnmlen (abfd)));
+ (size_t) bfd_coff_filnmlen (abfd)));
}
}
}
@@ -1798,23 +1826,20 @@ coff_get_normalized_symtab (abfd)
if (internal_ptr->u.syment._n._n_n._n_zeroes != 0)
{
/* This is a "short" name. Make it long. */
- unsigned long i = 0;
- char *newstring = NULL;
+ size_t i;
+ char *newstring;
/* find the length of this string without walking into memory
that isn't ours. */
for (i = 0; i < 8; ++i)
- {
- if (internal_ptr->u.syment._n._n_name[i] == '\0')
- {
- break;
- } /* if end of string */
- } /* possible lengths of this string. */
+ if (internal_ptr->u.syment._n._n_name[i] == '\0')
+ break;
- if ((newstring = (PTR) bfd_alloc (abfd, ++i)) == NULL)
+ newstring = (PTR) bfd_alloc (abfd, (bfd_size_type) (i + 1));
+ if (newstring == NULL)
return (NULL);
- memset (newstring, 0, i);
- strncpy (newstring, internal_ptr->u.syment._n._n_name, i - 1);
+ memset (newstring, 0, i + 1);
+ strncpy (newstring, internal_ptr->u.syment._n._n_name, i);
internal_ptr->u.syment._n._n_n._n_offset = (long int) newstring;
internal_ptr->u.syment._n._n_n._n_zeroes = 0;
}
@@ -1871,7 +1896,8 @@ asymbol *
coff_make_empty_symbol (abfd)
bfd *abfd;
{
- coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, sizeof (coff_symbol_type));
+ bfd_size_type amt = sizeof (coff_symbol_type);
+ coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, amt);
if (new == NULL)
return (NULL);
memset (new, 0, sizeof *new);
@@ -1891,12 +1917,14 @@ coff_bfd_make_debug_symbol (abfd, ptr, sz)
PTR ptr ATTRIBUTE_UNUSED;
unsigned long sz ATTRIBUTE_UNUSED;
{
- coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, sizeof (coff_symbol_type));
+ bfd_size_type amt = sizeof (coff_symbol_type);
+ coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, amt);
if (new == NULL)
return (NULL);
/* @@ The 10 is a guess at a plausible maximum number of aux entries
(but shouldn't be a constant). */
- new->native = (combined_entry_type *) bfd_zalloc (abfd, sizeof (combined_entry_type) * 10);
+ amt = sizeof (combined_entry_type) * 10;
+ new->native = (combined_entry_type *) bfd_zalloc (abfd, amt);
if (!new->native)
return (NULL);
new->symbol.section = bfd_abs_section_ptr;
@@ -1917,11 +1945,8 @@ coff_get_symbol_info (abfd, symbol, ret)
if (coffsymbol (symbol)->native != NULL
&& coffsymbol (symbol)->native->fix_value)
{
- combined_entry_type *psym;
-
- psym = ((combined_entry_type *)
- coffsymbol (symbol)->native->u.syment.n_value);
- ret->value = (bfd_vma) (psym - obj_raw_syments (abfd));
+ ret->value = coffsymbol (symbol)->native->u.syment.n_value -
+ (unsigned long) obj_raw_syments (abfd);
}
}
@@ -1945,8 +1970,8 @@ bfd_coff_get_syment (abfd, symbol, psyment)
*psyment = csym->native->u.syment;
if (csym->native->fix_value)
- psyment->n_value = ((combined_entry_type *) psyment->n_value
- - obj_raw_syments (abfd));
+ psyment->n_value = psyment->n_value -
+ (unsigned long) obj_raw_syments (abfd);
/* FIXME: We should handle fix_line here. */
@@ -2023,7 +2048,7 @@ coff_print_symbol (abfd, filep, symbol, how)
case bfd_print_symbol_all:
if (coffsymbol (symbol)->native)
{
- unsigned long val;
+ bfd_vma val;
unsigned int aux;
combined_entry_type *combined = coffsymbol (symbol)->native;
combined_entry_type *root = obj_raw_syments (abfd);
@@ -2032,12 +2057,11 @@ coff_print_symbol (abfd, filep, symbol, how)
fprintf (file, "[%3ld]", (long) (combined - root));
if (! combined->fix_value)
- val = (unsigned long) combined->u.syment.n_value;
+ val = (bfd_vma) combined->u.syment.n_value;
else
- val = ((unsigned long)
- ((combined_entry_type *) combined->u.syment.n_value
- - root));
+ val = combined->u.syment.n_value - (unsigned long) root;
+#ifndef XCOFF64
fprintf (file,
"(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d) 0x%08lx %s",
combined->u.syment.n_scnum,
@@ -2045,8 +2069,20 @@ coff_print_symbol (abfd, filep, symbol, how)
combined->u.syment.n_type,
combined->u.syment.n_sclass,
combined->u.syment.n_numaux,
+ (unsigned long) val,
+ symbol->name);
+#else
+ /* Print out the wide, 64 bit, symbol value */
+ fprintf (file,
+ "(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d) 0x%016llx %s",
+ combined->u.syment.n_scnum,
+ combined->u.syment.n_flags,
+ combined->u.syment.n_type,
+ combined->u.syment.n_sclass,
+ combined->u.syment.n_numaux,
val,
symbol->name);
+#endif
for (aux = 0; aux < combined->u.syment.n_numaux; aux++)
{
@@ -2090,16 +2126,18 @@ coff_print_symbol (abfd, filep, symbol, how)
case C_EXT:
if (ISFCN (combined->u.syment.n_type))
{
+ long next, llnos;
+
+ if (auxp->fix_end)
+ next = (auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p
+ - root);
+ else
+ next = auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l;
+ llnos = auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_lnnoptr;
fprintf (file,
- _("AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld"),
- tagndx,
- auxp->u.auxent.x_sym.x_misc.x_fsize,
- auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_lnnoptr,
- (auxp->fix_end
- ? ((long)
- (auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p
- - root))
- : auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l));
+ "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld",
+ tagndx, auxp->u.auxent.x_sym.x_misc.x_fsize,
+ llnos, next);
break;
}
/* else fall through */
@@ -2133,7 +2171,7 @@ coff_print_symbol (abfd, filep, symbol, how)
}
else
{
- bfd_print_symbol_vandf ((PTR) file, symbol);
+ bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
fprintf (file, " %-5s %s %s %s",
symbol->section->name,
coffsymbol (symbol)->native ? "n" : "g",
@@ -2167,8 +2205,8 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
asection *section;
asymbol **symbols;
bfd_vma offset;
- CONST char **filename_ptr;
- CONST char **functionname_ptr;
+ const char **filename_ptr;
+ const char **functionname_ptr;
unsigned int *line_ptr;
{
boolean found;
@@ -2180,6 +2218,7 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
combined_entry_type *pend;
alent *l;
struct coff_section_tdata *sec_data;
+ bfd_size_type amt;
/* Before looking through the symbol table, try to use a .stab
section to find the information. */
@@ -2264,7 +2303,7 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
/* Avoid endless loops on erroneous files by ensuring that
we always move forward in the file. */
- if (p - cof->raw_syments >= p->u.syment.n_value)
+ if (p >= cof->raw_syments + p->u.syment.n_value)
break;
p = cof->raw_syments + p->u.syment.n_value;
@@ -2354,9 +2393,8 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
/* Cache the results for the next call. */
if (sec_data == NULL && section->owner == abfd)
{
- section->used_by_bfd =
- ((PTR) bfd_zalloc (abfd,
- sizeof (struct coff_section_tdata)));
+ amt = sizeof (struct coff_section_tdata);
+ section->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
sec_data = (struct coff_section_tdata *) section->used_by_bfd;
}
if (sec_data != NULL)
@@ -2413,8 +2451,9 @@ bfd_coff_set_symbol_class (abfd, symbol, class)
coff_write_alien_symbol(). */
combined_entry_type * native;
+ bfd_size_type amt = sizeof (* native);
- native = (combined_entry_type *) bfd_alloc (abfd, sizeof (* native));
+ native = (combined_entry_type *) bfd_alloc (abfd, amt);
if (native == NULL)
return false;
@@ -2442,7 +2481,7 @@ bfd_coff_set_symbol_class (abfd, symbol, class)
if (! obj_pe (abfd))
native->u.syment.n_value += symbol->section->output_section->vma;
- /* Copy the any flags from the the file header into the symbol.
+ /* Copy the any flags from the file header into the symbol.
FIXME: Why? */
native->u.syment.n_flags = bfd_asymbol_bfd (& csym->symbol)->flags;
}
diff --git a/contrib/binutils/bfd/cofflink.c b/contrib/binutils/bfd/cofflink.c
index 96b005b..00a5289 100644
--- a/contrib/binutils/bfd/cofflink.c
+++ b/contrib/binutils/bfd/cofflink.c
@@ -117,9 +117,9 @@ _bfd_coff_link_hash_table_create (abfd)
bfd *abfd;
{
struct coff_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct coff_link_hash_table);
- ret = ((struct coff_link_hash_table *)
- bfd_alloc (abfd, sizeof (struct coff_link_hash_table)));
+ ret = (struct coff_link_hash_table *) bfd_alloc (abfd, amt);
if (ret == NULL)
return NULL;
if (! _bfd_coff_link_hash_table_init (ret, abfd,
@@ -277,6 +277,16 @@ coff_link_check_ar_symbols (abfd, info, pneeded)
return false;
h = bfd_link_hash_lookup (info->hash, name, false, false, true);
+ /* auto import */
+ if (!h && info->pei386_auto_import)
+ {
+ if (!strncmp (name,"__imp_", 6))
+ {
+ h =
+ bfd_link_hash_lookup (info->hash, name + 6, false, false,
+ true);
+ }
+ }
/* We are only interested in symbols that are currently
undefined. If a symbol is currently known to be common,
COFF linkers do not bring in an object file which defines
@@ -315,6 +325,7 @@ coff_link_add_symbols (abfd, info)
bfd_size_type symesz;
bfd_byte *esym;
bfd_byte *esym_end;
+ bfd_size_type amt;
/* Keep the symbols during this function, in case the linker needs
to read the generic symbols in order to report an error message. */
@@ -330,10 +341,8 @@ coff_link_add_symbols (abfd, info)
/* We keep a list of the linker hash table entries that correspond
to particular symbols. */
- sym_hash = ((struct coff_link_hash_entry **)
- bfd_alloc (abfd,
- ((size_t) symcount
- * sizeof (struct coff_link_hash_entry *))));
+ amt = symcount * sizeof (struct coff_link_hash_entry *);
+ sym_hash = (struct coff_link_hash_entry **) bfd_alloc (abfd, amt);
if (sym_hash == NULL && symcount != 0)
goto error_return;
obj_coff_sym_hashes (abfd) = sym_hash;
@@ -433,7 +442,7 @@ coff_link_add_symbols (abfd, info)
/* The Microsoft Visual C compiler does string pooling by
hashing the constants to an internal symbol name, and
- relying on the the linker comdat support to discard
+ relying on the linker comdat support to discard
duplicate names. However, if one string is a literal and
one is a data initializer, one will end up in the .data
section and one will end up in the .rdata section. The
@@ -526,7 +535,7 @@ coff_link_add_symbols (abfd, info)
(*_bfd_error_handler)
(_("Warning: type of symbol `%s' changed from %d to %d in %s"),
name, (*sym_hash)->type, sym.n_type,
- bfd_get_filename (abfd));
+ bfd_archive_filename (abfd));
/* We don't want to change from a meaningful
base type to a null one, but if we know
@@ -554,8 +563,8 @@ coff_link_add_symbols (abfd, info)
i < sym.n_numaux;
i++, eaux += symesz, iaux++)
bfd_coff_swap_aux_in (abfd, (PTR) eaux, sym.n_type,
- sym.n_sclass, i, sym.n_numaux,
- (PTR) iaux);
+ sym.n_sclass, (int) i,
+ sym.n_numaux, (PTR) iaux);
(*sym_hash)->aux = alloc;
}
}
@@ -608,9 +617,8 @@ coff_link_add_symbols (abfd, info)
secdata = coff_section_data (abfd, stab);
if (secdata == NULL)
{
- stab->used_by_bfd =
- (PTR) bfd_zalloc (abfd,
- sizeof (struct coff_section_tdata));
+ amt = sizeof (struct coff_section_tdata);
+ stab->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
if (stab->used_by_bfd == NULL)
goto error_return;
secdata = coff_section_data (abfd, stab);
@@ -648,11 +656,11 @@ _bfd_coff_final_link (abfd, info)
boolean long_section_names;
asection *o;
struct bfd_link_order *p;
- size_t max_sym_count;
- size_t max_lineno_count;
- size_t max_reloc_count;
- size_t max_output_reloc_count;
- size_t max_contents_size;
+ bfd_size_type max_sym_count;
+ bfd_size_type max_lineno_count;
+ bfd_size_type max_reloc_count;
+ bfd_size_type max_output_reloc_count;
+ bfd_size_type max_contents_size;
file_ptr rel_filepos;
unsigned int relsz;
file_ptr line_filepos;
@@ -660,6 +668,7 @@ _bfd_coff_final_link (abfd, info)
bfd *sub;
bfd_byte *external_relocs = NULL;
char strbuf[STRING_SIZE_SIZE];
+ bfd_size_type amt;
symesz = bfd_coff_symesz (abfd);
@@ -775,10 +784,9 @@ _bfd_coff_final_link (abfd, info)
/* We use section_count + 1, rather than section_count, because
the target_index fields are 1 based. */
- finfo.section_info =
- ((struct coff_link_section_info *)
- bfd_malloc ((abfd->section_count + 1)
- * sizeof (struct coff_link_section_info)));
+ amt = abfd->section_count + 1;
+ amt *= sizeof (struct coff_link_section_info);
+ finfo.section_info = (struct coff_link_section_info *) bfd_malloc (amt);
if (finfo.section_info == NULL)
goto error_return;
for (i = 0; i <= abfd->section_count; i++)
@@ -819,13 +827,14 @@ _bfd_coff_final_link (abfd, info)
but only when doing a relocateable link, which is not the
common case. */
BFD_ASSERT (info->relocateable);
+ amt = o->reloc_count;
+ amt *= sizeof (struct internal_reloc);
finfo.section_info[o->target_index].relocs =
- ((struct internal_reloc *)
- bfd_malloc (o->reloc_count * sizeof (struct internal_reloc)));
+ (struct internal_reloc *) bfd_malloc (amt);
+ amt = o->reloc_count;
+ amt *= sizeof (struct coff_link_hash_entry *);
finfo.section_info[o->target_index].rel_hashes =
- ((struct coff_link_hash_entry **)
- bfd_malloc (o->reloc_count
- * sizeof (struct coff_link_hash_entry *)));
+ (struct coff_link_hash_entry **) bfd_malloc (amt);
if (finfo.section_info[o->target_index].relocs == NULL
|| finfo.section_info[o->target_index].rel_hashes == NULL)
goto error_return;
@@ -857,22 +866,23 @@ _bfd_coff_final_link (abfd, info)
}
/* Allocate some buffers used while linking. */
- finfo.internal_syms = ((struct internal_syment *)
- bfd_malloc (max_sym_count
- * sizeof (struct internal_syment)));
- finfo.sec_ptrs = (asection **) bfd_malloc (max_sym_count
- * sizeof (asection *));
- finfo.sym_indices = (long *) bfd_malloc (max_sym_count * sizeof (long));
- finfo.outsyms = ((bfd_byte *)
- bfd_malloc ((size_t) ((max_sym_count + 1) * symesz)));
- finfo.linenos = (bfd_byte *) bfd_malloc (max_lineno_count
- * bfd_coff_linesz (abfd));
+ amt = max_sym_count * sizeof (struct internal_syment);
+ finfo.internal_syms = (struct internal_syment *) bfd_malloc (amt);
+ amt = max_sym_count * sizeof (asection *);
+ finfo.sec_ptrs = (asection **) bfd_malloc (amt);
+ amt = max_sym_count * sizeof (long);
+ finfo.sym_indices = (long *) bfd_malloc (amt);
+ finfo.outsyms = (bfd_byte *) bfd_malloc ((max_sym_count + 1) * symesz);
+ amt = max_lineno_count * bfd_coff_linesz (abfd);
+ finfo.linenos = (bfd_byte *) bfd_malloc (amt);
finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
- finfo.external_relocs = (bfd_byte *) bfd_malloc (max_reloc_count * relsz);
+ amt = max_reloc_count * relsz;
+ finfo.external_relocs = (bfd_byte *) bfd_malloc (amt);
if (! info->relocateable)
- finfo.internal_relocs = ((struct internal_reloc *)
- bfd_malloc (max_reloc_count
- * sizeof (struct internal_reloc)));
+ {
+ amt = max_reloc_count * sizeof (struct internal_reloc);
+ finfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt);
+ }
if ((finfo.internal_syms == NULL && max_sym_count > 0)
|| (finfo.sec_ptrs == NULL && max_sym_count > 0)
|| (finfo.sym_indices == NULL && max_sym_count > 0)
@@ -977,14 +987,15 @@ _bfd_coff_final_link (abfd, info)
if (finfo.last_file_index != -1
&& (unsigned int) finfo.last_file.n_value != obj_raw_syment_count (abfd))
{
+ file_ptr pos;
+
finfo.last_file.n_value = obj_raw_syment_count (abfd);
bfd_coff_swap_sym_out (abfd, (PTR) &finfo.last_file,
(PTR) finfo.outsyms);
- if (bfd_seek (abfd,
- (obj_sym_filepos (abfd)
- + finfo.last_file_index * symesz),
- SEEK_SET) != 0
- || bfd_write (finfo.outsyms, symesz, 1, abfd) != symesz)
+
+ pos = obj_sym_filepos (abfd) + finfo.last_file_index * symesz;
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0
+ || bfd_bwrite (finfo.outsyms, symesz, abfd) != symesz)
return false;
}
@@ -1019,8 +1030,8 @@ _bfd_coff_final_link (abfd, info)
/* Now that we have written out all the global symbols, we know
the symbol indices to use for relocs against them, and we can
finally write out the relocs. */
- external_relocs = ((bfd_byte *)
- bfd_malloc (max_output_reloc_count * relsz));
+ amt = max_output_reloc_count * relsz;
+ external_relocs = (bfd_byte *) bfd_malloc (amt);
if (external_relocs == NULL)
goto error_return;
@@ -1049,8 +1060,9 @@ _bfd_coff_final_link (abfd, info)
}
if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0
- || bfd_write ((PTR) external_relocs, relsz, o->reloc_count,
- abfd) != relsz * o->reloc_count)
+ || (bfd_bwrite ((PTR) external_relocs,
+ (bfd_size_type) relsz * o->reloc_count, abfd)
+ != (bfd_size_type) relsz * o->reloc_count))
goto error_return;
}
@@ -1084,21 +1096,22 @@ _bfd_coff_final_link (abfd, info)
/* Write out the string table. */
if (obj_raw_syment_count (abfd) != 0 || long_section_names)
{
- if (bfd_seek (abfd,
- (obj_sym_filepos (abfd)
- + obj_raw_syment_count (abfd) * symesz),
- SEEK_SET) != 0)
+ file_ptr pos;
+
+ pos = obj_sym_filepos (abfd) + obj_raw_syment_count (abfd) * symesz;
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0)
return false;
#if STRING_SIZE_SIZE == 4
- bfd_h_put_32 (abfd,
- _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE,
- (bfd_byte *) strbuf);
+ H_PUT_32 (abfd,
+ _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE,
+ strbuf);
#else
- #error Change bfd_h_put_32
+ #error Change H_PUT_32 above
#endif
- if (bfd_write (strbuf, 1, STRING_SIZE_SIZE, abfd) != STRING_SIZE_SIZE)
+ if (bfd_bwrite (strbuf, (bfd_size_type) STRING_SIZE_SIZE, abfd)
+ != STRING_SIZE_SIZE)
return false;
if (! _bfd_stringtab_emit (abfd, finfo.strtab))
@@ -1166,17 +1179,17 @@ dores_com (ptr, output_bfd, heap)
{
int val = strtoul (ptr, &ptr, 0);
if (heap)
- pe_data(output_bfd)->pe_opthdr.SizeOfHeapReserve =val;
+ pe_data(output_bfd)->pe_opthdr.SizeOfHeapReserve = val;
else
- pe_data(output_bfd)->pe_opthdr.SizeOfStackReserve =val;
+ pe_data(output_bfd)->pe_opthdr.SizeOfStackReserve = val;
if (ptr[0] == ',')
{
- int val = strtoul (ptr+1, &ptr, 0);
+ val = strtoul (ptr+1, &ptr, 0);
if (heap)
- pe_data(output_bfd)->pe_opthdr.SizeOfHeapCommit =val;
+ pe_data(output_bfd)->pe_opthdr.SizeOfHeapCommit = val;
else
- pe_data(output_bfd)->pe_opthdr.SizeOfStackCommit =val;
+ pe_data(output_bfd)->pe_opthdr.SizeOfStackCommit = val;
}
}
return ptr;
@@ -1210,10 +1223,10 @@ process_embedded_commands (output_bfd, info, abfd)
if (!sec)
return 1;
- copy = bfd_malloc ((size_t) sec->_raw_size);
+ copy = bfd_malloc (sec->_raw_size);
if (!copy)
return 0;
- if (! bfd_get_section_contents(abfd, sec, copy, 0, sec->_raw_size))
+ if (! bfd_get_section_contents(abfd, sec, copy, (bfd_vma) 0, sec->_raw_size))
{
free (copy);
return 0;
@@ -1501,6 +1514,19 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
}
}
+#ifndef COFF_WITH_PE
+ /* Skip section symbols for sections which are not going to be
+ emitted. */
+ if (!skip
+ && isym.n_sclass == C_STAT
+ && isym.n_type == T_NULL
+ && isym.n_numaux > 0)
+ {
+ if ((*secpp)->output_section == bfd_abs_section_ptr)
+ skip = true;
+ }
+#endif
+
/* If we stripping debugging symbols, and this is a debugging
symbol, then skip it. FIXME: gas sets the section to N_ABS
for some types of debugging symbols; I don't know if this is
@@ -1561,6 +1587,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
struct coff_debug_merge_element **epp;
bfd_byte *esl, *eslend;
struct internal_syment *islp;
+ bfd_size_type amt;
name = _bfd_coff_internal_syment_name (input_bfd, &isym, buf);
if (name == NULL)
@@ -1581,9 +1608,8 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
/* Allocate memory to hold type information. If this turns
out to be a duplicate, we pass this address to
bfd_release. */
- mt = ((struct coff_debug_merge_type *)
- bfd_alloc (input_bfd,
- sizeof (struct coff_debug_merge_type)));
+ amt = sizeof (struct coff_debug_merge_type);
+ mt = (struct coff_debug_merge_type *) bfd_alloc (input_bfd, amt);
if (mt == NULL)
return false;
mt->class = isym.n_sclass;
@@ -1609,9 +1635,9 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
bfd_coff_swap_sym_in (input_bfd, (PTR) esl, (PTR) islp);
+ amt = sizeof (struct coff_debug_merge_element);
*epp = ((struct coff_debug_merge_element *)
- bfd_alloc (input_bfd,
- sizeof (struct coff_debug_merge_element)));
+ bfd_alloc (input_bfd, amt));
if (*epp == NULL)
return false;
@@ -1620,8 +1646,8 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
if (elename == NULL)
return false;
- name_copy = (char *) bfd_alloc (input_bfd,
- strlen (elename) + 1);
+ amt = strlen (elename) + 1;
+ name_copy = (char *) bfd_alloc (input_bfd, amt);
if (name_copy == NULL)
return false;
strcpy (name_copy, elename);
@@ -1804,7 +1830,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
have to write the symbol out twice. */
if (finfo->last_file_index != -1
- && finfo->last_file.n_value != (long) output_index)
+ && finfo->last_file.n_value != (bfd_vma) output_index)
{
/* We must correct the value of the last C_FILE
entry. */
@@ -1821,18 +1847,18 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
}
else
{
+ file_ptr pos;
+
/* We have already written out the last C_FILE
symbol. We need to write it out again. We
borrow *outsym temporarily. */
bfd_coff_swap_sym_out (output_bfd,
(PTR) &finfo->last_file,
(PTR) outsym);
- if (bfd_seek (output_bfd,
- (obj_sym_filepos (output_bfd)
- + finfo->last_file_index * osymesz),
- SEEK_SET) != 0
- || (bfd_write (outsym, osymesz, 1, output_bfd)
- != osymesz))
+ pos = obj_sym_filepos (output_bfd);
+ pos += finfo->last_file_index * osymesz;
+ if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
+ || bfd_bwrite (outsym, osymesz, output_bfd) != osymesz)
return false;
}
}
@@ -2054,6 +2080,8 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
}
else
{
+ file_ptr pos;
+
/* We have already written out the last
.bf aux entry. We need to write it
out again. We borrow *outsym
@@ -2065,12 +2093,11 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
isymp->n_sclass,
0, isymp->n_numaux,
(PTR) outsym);
- if (bfd_seek (output_bfd,
- (obj_sym_filepos (output_bfd)
- + finfo->last_bf_index * osymesz),
- SEEK_SET) != 0
- || bfd_write (outsym, osymesz, 1,
- output_bfd) != osymesz)
+ pos = obj_sym_filepos (output_bfd);
+ pos += finfo->last_bf_index * osymesz;
+ if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
+ || (bfd_bwrite (outsym, osymesz, output_bfd)
+ != osymesz))
return false;
}
}
@@ -2118,6 +2145,8 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
bfd_byte *elineend;
bfd_byte *oeline;
boolean skipping;
+ file_ptr pos;
+ bfd_size_type amt;
/* FIXME: If SEC_HAS_CONTENTS is not for the section, then
build_link_order in ldwrite.c will not have created a
@@ -2133,7 +2162,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
continue;
if (bfd_seek (input_bfd, o->line_filepos, SEEK_SET) != 0
- || bfd_read (finfo->linenos, linesz, o->lineno_count,
+ || bfd_bread (finfo->linenos, linesz * o->lineno_count,
input_bfd) != linesz * o->lineno_count)
return false;
@@ -2221,17 +2250,14 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
}
}
- if (bfd_seek (output_bfd,
- (o->output_section->line_filepos
- + o->output_section->lineno_count * linesz),
- SEEK_SET) != 0
- || (bfd_write (finfo->linenos, 1, oeline - finfo->linenos,
- output_bfd)
- != (bfd_size_type) (oeline - finfo->linenos)))
+ pos = o->output_section->line_filepos;
+ pos += o->output_section->lineno_count * linesz;
+ amt = oeline - finfo->linenos;
+ if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
+ || bfd_bwrite (finfo->linenos, amt, output_bfd) != amt)
return false;
- o->output_section->lineno_count +=
- (oeline - finfo->linenos) / linesz;
+ o->output_section->lineno_count += amt / linesz;
}
}
@@ -2252,12 +2278,13 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
/* Write the modified symbols to the output file. */
if (outsym > finfo->outsyms)
{
- if (bfd_seek (output_bfd,
- obj_sym_filepos (output_bfd) + syment_base * osymesz,
- SEEK_SET) != 0
- || (bfd_write (finfo->outsyms, outsym - finfo->outsyms, 1,
- output_bfd)
- != (bfd_size_type) (outsym - finfo->outsyms)))
+ file_ptr pos;
+ bfd_size_type amt;
+
+ pos = obj_sym_filepos (output_bfd) + syment_base * osymesz;
+ amt = outsym - finfo->outsyms;
+ if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
+ || bfd_bwrite (finfo->outsyms, amt, output_bfd) != amt)
return false;
BFD_ASSERT ((obj_raw_syment_count (output_bfd)
@@ -2288,7 +2315,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
{
((*_bfd_error_handler)
(_("%s: relocs in section `%s', but it has no contents"),
- bfd_get_filename (input_bfd),
+ bfd_archive_filename (input_bfd),
bfd_get_section_name (input_bfd, o)));
bfd_set_error (bfd_error_no_contents);
return false;
@@ -2429,14 +2456,11 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
/* Write out the modified section contents. */
if (secdata == NULL || secdata->stab_info == NULL)
{
+ file_ptr loc = o->output_offset * bfd_octets_per_byte (output_bfd);
+ bfd_size_type amt = (o->_cooked_size != 0
+ ? o->_cooked_size : o->_raw_size);
if (! bfd_set_section_contents (output_bfd, o->output_section,
- contents,
- (file_ptr)
- (o->output_offset *
- bfd_octets_per_byte (output_bfd)),
- (o->_cooked_size != 0
- ? o->_cooked_size
- : o->_raw_size)))
+ contents, loc, amt))
return false;
}
else
@@ -2469,6 +2493,7 @@ _bfd_coff_write_global_sym (h, data)
struct internal_syment isym;
bfd_size_type symesz;
unsigned int i;
+ file_ptr pos;
output_bfd = finfo->output_bfd;
@@ -2577,11 +2602,10 @@ _bfd_coff_write_global_sym (h, data)
symesz = bfd_coff_symesz (output_bfd);
- if (bfd_seek (output_bfd,
- (obj_sym_filepos (output_bfd)
- + obj_raw_syment_count (output_bfd) * symesz),
- SEEK_SET) != 0
- || bfd_write (finfo->outsyms, symesz, 1, output_bfd) != symesz)
+ pos = obj_sym_filepos (output_bfd);
+ pos += obj_raw_syment_count (output_bfd) * symesz;
+ if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
+ || bfd_bwrite (finfo->outsyms, symesz, output_bfd) != symesz)
{
finfo->failed = true;
return false;
@@ -2649,9 +2673,9 @@ _bfd_coff_write_global_sym (h, data)
}
bfd_coff_swap_aux_out (output_bfd, (PTR) auxp, isym.n_type,
- isym.n_sclass, i, isym.n_numaux,
+ isym.n_sclass, (int) i, isym.n_numaux,
(PTR) finfo->outsyms);
- if (bfd_write (finfo->outsyms, symesz, 1, output_bfd) != symesz)
+ if (bfd_bwrite (finfo->outsyms, symesz, output_bfd) != symesz)
{
finfo->failed = true;
return false;
@@ -2719,6 +2743,7 @@ _bfd_coff_reloc_link_order (output_bfd, finfo, output_section, link_order)
bfd_byte *buf;
bfd_reloc_status_type rstat;
boolean ok;
+ file_ptr loc;
size = bfd_get_reloc_size (howto);
buf = (bfd_byte *) bfd_zmalloc (size);
@@ -2726,7 +2751,8 @@ _bfd_coff_reloc_link_order (output_bfd, finfo, output_section, link_order)
return false;
rstat = _bfd_relocate_contents (howto, output_bfd,
- link_order->u.reloc.p->addend, buf);
+ (bfd_vma) link_order->u.reloc.p->addend,\
+ buf);
switch (rstat)
{
case bfd_reloc_ok:
@@ -2749,10 +2775,9 @@ _bfd_coff_reloc_link_order (output_bfd, finfo, output_section, link_order)
}
break;
}
+ loc = link_order->offset * bfd_octets_per_byte (output_bfd);
ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf,
- (file_ptr)
- (link_order->offset *
- bfd_octets_per_byte (output_bfd)), size);
+ loc, size);
free (buf);
if (! ok)
return false;
@@ -2868,7 +2893,7 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
{
(*_bfd_error_handler)
("%s: illegal symbol index %ld in relocs",
- bfd_get_filename (input_bfd), symndx);
+ bfd_archive_filename (input_bfd), symndx);
return false;
}
else
@@ -2990,7 +3015,7 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
case bfd_reloc_outofrange:
(*_bfd_error_handler)
(_("%s: bad reloc address 0x%lx in section `%s'"),
- bfd_get_filename (input_bfd),
+ bfd_archive_filename (input_bfd),
(unsigned long) rel->r_vaddr,
bfd_get_section_name (input_bfd, input_section));
return false;
diff --git a/contrib/binutils/bfd/coffswap.h b/contrib/binutils/bfd/coffswap.h
index 2ff0a32..454e686 100644
--- a/contrib/binutils/bfd/coffswap.h
+++ b/contrib/binutils/bfd/coffswap.h
@@ -1,5 +1,6 @@
/* Generic COFF swapping routines, for BFD.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000,
+ 2001
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -27,174 +28,186 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Any file which uses this must first include "coff/internal.h" and
"coff/CPU.h". The functions will then be correct for that CPU. */
-#define PUTWORD bfd_h_put_32
-#define PUTHALF bfd_h_put_16
-#define PUTBYTE bfd_h_put_8
-
#ifndef GET_FCN_LNNOPTR
-#define GET_FCN_LNNOPTR(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
+#define GET_FCN_LNNOPTR(abfd, ext) \
+ H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
#endif
#ifndef GET_FCN_ENDNDX
-#define GET_FCN_ENDNDX(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
+#define GET_FCN_ENDNDX(abfd, ext) \
+ H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx)
#endif
#ifndef PUT_FCN_LNNOPTR
-#define PUT_FCN_LNNOPTR(abfd, in, ext) PUTWORD(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
+#define PUT_FCN_LNNOPTR(abfd, in, ext) \
+ H_PUT_32 (abfd, in, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
#endif
#ifndef PUT_FCN_ENDNDX
-#define PUT_FCN_ENDNDX(abfd, in, ext) PUTWORD(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
+#define PUT_FCN_ENDNDX(abfd, in, ext) \
+ H_PUT_32 (abfd, in, ext->x_sym.x_fcnary.x_fcn.x_endndx)
#endif
#ifndef GET_LNSZ_LNNO
-#define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno)
+#define GET_LNSZ_LNNO(abfd, ext) \
+ H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno)
#endif
#ifndef GET_LNSZ_SIZE
-#define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size)
+#define GET_LNSZ_SIZE(abfd, ext) \
+ H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size)
#endif
#ifndef PUT_LNSZ_LNNO
-#define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno)
+#define PUT_LNSZ_LNNO(abfd, in, ext) \
+ H_PUT_16 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno)
#endif
#ifndef PUT_LNSZ_SIZE
-#define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte*) ext->x_sym.x_misc.x_lnsz.x_size)
+#define PUT_LNSZ_SIZE(abfd, in, ext) \
+ H_PUT_16 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_size)
#endif
#ifndef GET_SCN_SCNLEN
-#define GET_SCN_SCNLEN(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen)
+#define GET_SCN_SCNLEN(abfd, ext) \
+ H_GET_32 (abfd, ext->x_scn.x_scnlen)
#endif
#ifndef GET_SCN_NRELOC
-#define GET_SCN_NRELOC(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nreloc)
+#define GET_SCN_NRELOC(abfd, ext) \
+ H_GET_16 (abfd, ext->x_scn.x_nreloc)
#endif
#ifndef GET_SCN_NLINNO
-#define GET_SCN_NLINNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nlinno)
+#define GET_SCN_NLINNO(abfd, ext) \
+ H_GET_16 (abfd, ext->x_scn.x_nlinno)
#endif
#ifndef PUT_SCN_SCNLEN
-#define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen)
+#define PUT_SCN_SCNLEN(abfd, in, ext) \
+ H_PUT_32 (abfd, in, ext->x_scn.x_scnlen)
#endif
#ifndef PUT_SCN_NRELOC
-#define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc)
+#define PUT_SCN_NRELOC(abfd, in, ext) \
+ H_PUT_16 (abfd, in, ext->x_scn.x_nreloc)
#endif
#ifndef PUT_SCN_NLINNO
-#define PUT_SCN_NLINNO(abfd,in, ext) bfd_h_put_16(abfd,in, (bfd_byte *) ext->x_scn.x_nlinno)
+#define PUT_SCN_NLINNO(abfd, in, ext) \
+ H_PUT_16 (abfd, in, ext->x_scn.x_nlinno)
#endif
#ifndef GET_LINENO_LNNO
-#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno));
+#define GET_LINENO_LNNO(abfd, ext) \
+ H_GET_16 (abfd, ext->l_lnno);
#endif
#ifndef PUT_LINENO_LNNO
-#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val, (bfd_byte *) (ext->l_lnno));
+#define PUT_LINENO_LNNO(abfd, val, ext) \
+ H_PUT_16 (abfd, val, ext->l_lnno);
#endif
/* The f_symptr field in the filehdr is sometimes 64 bits. */
#ifndef GET_FILEHDR_SYMPTR
-#define GET_FILEHDR_SYMPTR bfd_h_get_32
+#define GET_FILEHDR_SYMPTR H_GET_32
#endif
#ifndef PUT_FILEHDR_SYMPTR
-#define PUT_FILEHDR_SYMPTR bfd_h_put_32
+#define PUT_FILEHDR_SYMPTR H_PUT_32
#endif
/* Some fields in the aouthdr are sometimes 64 bits. */
#ifndef GET_AOUTHDR_TSIZE
-#define GET_AOUTHDR_TSIZE bfd_h_get_32
+#define GET_AOUTHDR_TSIZE H_GET_32
#endif
#ifndef PUT_AOUTHDR_TSIZE
-#define PUT_AOUTHDR_TSIZE bfd_h_put_32
+#define PUT_AOUTHDR_TSIZE H_PUT_32
#endif
#ifndef GET_AOUTHDR_DSIZE
-#define GET_AOUTHDR_DSIZE bfd_h_get_32
+#define GET_AOUTHDR_DSIZE H_GET_32
#endif
#ifndef PUT_AOUTHDR_DSIZE
-#define PUT_AOUTHDR_DSIZE bfd_h_put_32
+#define PUT_AOUTHDR_DSIZE H_PUT_32
#endif
#ifndef GET_AOUTHDR_BSIZE
-#define GET_AOUTHDR_BSIZE bfd_h_get_32
+#define GET_AOUTHDR_BSIZE H_GET_32
#endif
#ifndef PUT_AOUTHDR_BSIZE
-#define PUT_AOUTHDR_BSIZE bfd_h_put_32
+#define PUT_AOUTHDR_BSIZE H_PUT_32
#endif
#ifndef GET_AOUTHDR_ENTRY
-#define GET_AOUTHDR_ENTRY bfd_h_get_32
+#define GET_AOUTHDR_ENTRY H_GET_32
#endif
#ifndef PUT_AOUTHDR_ENTRY
-#define PUT_AOUTHDR_ENTRY bfd_h_put_32
+#define PUT_AOUTHDR_ENTRY H_PUT_32
#endif
#ifndef GET_AOUTHDR_TEXT_START
-#define GET_AOUTHDR_TEXT_START bfd_h_get_32
+#define GET_AOUTHDR_TEXT_START H_GET_32
#endif
#ifndef PUT_AOUTHDR_TEXT_START
-#define PUT_AOUTHDR_TEXT_START bfd_h_put_32
+#define PUT_AOUTHDR_TEXT_START H_PUT_32
#endif
#ifndef GET_AOUTHDR_DATA_START
-#define GET_AOUTHDR_DATA_START bfd_h_get_32
+#define GET_AOUTHDR_DATA_START H_GET_32
#endif
#ifndef PUT_AOUTHDR_DATA_START
-#define PUT_AOUTHDR_DATA_START bfd_h_put_32
+#define PUT_AOUTHDR_DATA_START H_PUT_32
#endif
/* Some fields in the scnhdr are sometimes 64 bits. */
#ifndef GET_SCNHDR_PADDR
-#define GET_SCNHDR_PADDR bfd_h_get_32
+#define GET_SCNHDR_PADDR H_GET_32
#endif
#ifndef PUT_SCNHDR_PADDR
-#define PUT_SCNHDR_PADDR bfd_h_put_32
+#define PUT_SCNHDR_PADDR H_PUT_32
#endif
#ifndef GET_SCNHDR_VADDR
-#define GET_SCNHDR_VADDR bfd_h_get_32
+#define GET_SCNHDR_VADDR H_GET_32
#endif
#ifndef PUT_SCNHDR_VADDR
-#define PUT_SCNHDR_VADDR bfd_h_put_32
+#define PUT_SCNHDR_VADDR H_PUT_32
#endif
#ifndef GET_SCNHDR_SIZE
-#define GET_SCNHDR_SIZE bfd_h_get_32
+#define GET_SCNHDR_SIZE H_GET_32
#endif
#ifndef PUT_SCNHDR_SIZE
-#define PUT_SCNHDR_SIZE bfd_h_put_32
+#define PUT_SCNHDR_SIZE H_PUT_32
#endif
#ifndef GET_SCNHDR_SCNPTR
-#define GET_SCNHDR_SCNPTR bfd_h_get_32
+#define GET_SCNHDR_SCNPTR H_GET_32
#endif
#ifndef PUT_SCNHDR_SCNPTR
-#define PUT_SCNHDR_SCNPTR bfd_h_put_32
+#define PUT_SCNHDR_SCNPTR H_PUT_32
#endif
#ifndef GET_SCNHDR_RELPTR
-#define GET_SCNHDR_RELPTR bfd_h_get_32
+#define GET_SCNHDR_RELPTR H_GET_32
#endif
#ifndef PUT_SCNHDR_RELPTR
-#define PUT_SCNHDR_RELPTR bfd_h_put_32
+#define PUT_SCNHDR_RELPTR H_PUT_32
#endif
#ifndef GET_SCNHDR_LNNOPTR
-#define GET_SCNHDR_LNNOPTR bfd_h_get_32
+#define GET_SCNHDR_LNNOPTR H_GET_32
#endif
#ifndef PUT_SCNHDR_LNNOPTR
-#define PUT_SCNHDR_LNNOPTR bfd_h_put_32
+#define PUT_SCNHDR_LNNOPTR H_PUT_32
#endif
#ifndef GET_SCNHDR_NRELOC
-#define GET_SCNHDR_NRELOC bfd_h_get_16
+#define GET_SCNHDR_NRELOC H_GET_16
#endif
#ifndef MAX_SCNHDR_NRELOC
#define MAX_SCNHDR_NRELOC 0xffff
#endif
#ifndef PUT_SCNHDR_NRELOC
-#define PUT_SCNHDR_NRELOC bfd_h_put_16
+#define PUT_SCNHDR_NRELOC H_PUT_16
#endif
#ifndef GET_SCNHDR_NLNNO
-#define GET_SCNHDR_NLNNO bfd_h_get_16
+#define GET_SCNHDR_NLNNO H_GET_16
#endif
#ifndef MAX_SCNHDR_NLNNO
#define MAX_SCNHDR_NLNNO 0xffff
#endif
#ifndef PUT_SCNHDR_NLNNO
-#define PUT_SCNHDR_NLNNO bfd_h_put_16
+#define PUT_SCNHDR_NLNNO H_PUT_16
#endif
#ifndef GET_SCNHDR_FLAGS
-#define GET_SCNHDR_FLAGS bfd_h_get_32
+#define GET_SCNHDR_FLAGS H_GET_32
#endif
#ifndef PUT_SCNHDR_FLAGS
-#define PUT_SCNHDR_FLAGS bfd_h_put_32
+#define PUT_SCNHDR_FLAGS H_PUT_32
#endif
#ifndef GET_RELOC_VADDR
-#define GET_RELOC_VADDR bfd_h_get_32
+#define GET_RELOC_VADDR H_GET_32
#endif
#ifndef PUT_RELOC_VADDR
-#define PUT_RELOC_VADDR bfd_h_put_32
+#define PUT_RELOC_VADDR H_PUT_32
#endif
static void coff_swap_aouthdr_in PARAMS ((bfd *, PTR, PTR));
@@ -229,48 +242,44 @@ coff_swap_reloc_in (abfd, src, dst)
RELOC *reloc_src = (RELOC *) src;
struct internal_reloc *reloc_dst = (struct internal_reloc *) dst;
- reloc_dst->r_vaddr = GET_RELOC_VADDR (abfd, (bfd_byte *)reloc_src->r_vaddr);
- reloc_dst->r_symndx = bfd_h_get_signed_32(abfd, (bfd_byte *) reloc_src->r_symndx);
+ reloc_dst->r_vaddr = GET_RELOC_VADDR (abfd, reloc_src->r_vaddr);
+ reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx);
#ifdef RS6000COFF_C
- reloc_dst->r_type = bfd_h_get_8(abfd, reloc_src->r_type);
- reloc_dst->r_size = bfd_h_get_8(abfd, reloc_src->r_size);
+ reloc_dst->r_type = H_GET_8 (abfd, reloc_src->r_type);
+ reloc_dst->r_size = H_GET_8 (abfd, reloc_src->r_size);
#else
- reloc_dst->r_type = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_type);
+ reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type);
#endif
#ifdef SWAP_IN_RELOC_OFFSET
- reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET(abfd,
- (bfd_byte *) reloc_src->r_offset);
+ reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET (abfd, reloc_src->r_offset);
#endif
}
static unsigned int
coff_swap_reloc_out (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
+ bfd *abfd;
+ PTR src;
+ PTR dst;
{
- struct internal_reloc *reloc_src = (struct internal_reloc *)src;
- struct external_reloc *reloc_dst = (struct external_reloc *)dst;
- PUT_RELOC_VADDR (abfd, reloc_src->r_vaddr, (bfd_byte *) reloc_dst->r_vaddr);
- bfd_h_put_32(abfd, reloc_src->r_symndx, (bfd_byte *) reloc_dst->r_symndx);
+ struct internal_reloc *reloc_src = (struct internal_reloc *) src;
+ struct external_reloc *reloc_dst = (struct external_reloc *) dst;
+ PUT_RELOC_VADDR (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
+ H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
#ifdef RS6000COFF_C
- bfd_h_put_8 (abfd, reloc_src->r_type, (bfd_byte *) reloc_dst->r_type);
- bfd_h_put_8 (abfd, reloc_src->r_size, (bfd_byte *) reloc_dst->r_size);
+ H_PUT_8 (abfd, reloc_src->r_type, reloc_dst->r_type);
+ H_PUT_8 (abfd, reloc_src->r_size, reloc_dst->r_size);
#else
- bfd_h_put_16(abfd, reloc_src->r_type, (bfd_byte *)
- reloc_dst->r_type);
+ H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type);
#endif
#ifdef SWAP_OUT_RELOC_OFFSET
- SWAP_OUT_RELOC_OFFSET(abfd,
- reloc_src->r_offset,
- (bfd_byte *) reloc_dst->r_offset);
+ SWAP_OUT_RELOC_OFFSET (abfd, reloc_src->r_offset, reloc_dst->r_offset);
#endif
#ifdef SWAP_OUT_RELOC_EXTRA
- SWAP_OUT_RELOC_EXTRA(abfd,reloc_src, reloc_dst);
+ SWAP_OUT_RELOC_EXTRA (abfd, reloc_src, reloc_dst);
#endif
return bfd_coff_relsz (abfd);
@@ -280,9 +289,9 @@ coff_swap_reloc_out (abfd, src, dst)
static void
coff_swap_filehdr_in (abfd, src, dst)
- bfd *abfd;
- PTR src;
- PTR dst;
+ bfd *abfd;
+ PTR src;
+ PTR dst;
{
FILHDR *filehdr_src = (FILHDR *) src;
struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst;
@@ -290,16 +299,15 @@ coff_swap_filehdr_in (abfd, src, dst)
#ifdef COFF_ADJUST_FILEHDR_IN_PRE
COFF_ADJUST_FILEHDR_IN_PRE (abfd, src, dst);
#endif
- filehdr_dst->f_magic = bfd_h_get_16(abfd, (bfd_byte *) filehdr_src->f_magic);
- filehdr_dst->f_nscns = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_nscns);
- filehdr_dst->f_timdat = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_timdat);
- filehdr_dst->f_symptr =
- GET_FILEHDR_SYMPTR (abfd, (bfd_byte *) filehdr_src->f_symptr);
- filehdr_dst->f_nsyms = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_nsyms);
- filehdr_dst->f_opthdr = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_opthdr);
- filehdr_dst->f_flags = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_flags);
+ filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->f_magic);
+ filehdr_dst->f_nscns = H_GET_16 (abfd, filehdr_src->f_nscns);
+ filehdr_dst->f_timdat = H_GET_32 (abfd, filehdr_src->f_timdat);
+ filehdr_dst->f_symptr = GET_FILEHDR_SYMPTR (abfd, filehdr_src->f_symptr);
+ filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src->f_nsyms);
+ filehdr_dst->f_opthdr = H_GET_16 (abfd, filehdr_src->f_opthdr);
+ filehdr_dst->f_flags = H_GET_16 (abfd, filehdr_src->f_flags);
#ifdef TIC80_TARGET_ID
- filehdr_dst->f_target_id = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_target_id);
+ filehdr_dst->f_target_id = H_GET_16 (abfd, filehdr_src->f_target_id);
#endif
#ifdef COFF_ADJUST_FILEHDR_IN_POST
@@ -309,26 +317,25 @@ coff_swap_filehdr_in (abfd, src, dst)
static unsigned int
coff_swap_filehdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
+ bfd *abfd;
+ PTR in;
+ PTR out;
{
- struct internal_filehdr *filehdr_in = (struct internal_filehdr *)in;
- FILHDR *filehdr_out = (FILHDR *)out;
+ struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
+ FILHDR *filehdr_out = (FILHDR *) out;
#ifdef COFF_ADJUST_FILEHDR_OUT_PRE
COFF_ADJUST_FILEHDR_OUT_PRE (abfd, in, out);
#endif
- bfd_h_put_16(abfd, filehdr_in->f_magic, (bfd_byte *) filehdr_out->f_magic);
- bfd_h_put_16(abfd, filehdr_in->f_nscns, (bfd_byte *) filehdr_out->f_nscns);
- bfd_h_put_32(abfd, filehdr_in->f_timdat, (bfd_byte *) filehdr_out->f_timdat);
- PUT_FILEHDR_SYMPTR (abfd, (bfd_vma) filehdr_in->f_symptr,
- (bfd_byte *) filehdr_out->f_symptr);
- bfd_h_put_32(abfd, filehdr_in->f_nsyms, (bfd_byte *) filehdr_out->f_nsyms);
- bfd_h_put_16(abfd, filehdr_in->f_opthdr, (bfd_byte *) filehdr_out->f_opthdr);
- bfd_h_put_16(abfd, filehdr_in->f_flags, (bfd_byte *) filehdr_out->f_flags);
+ H_PUT_16 (abfd, filehdr_in->f_magic, filehdr_out->f_magic);
+ H_PUT_16 (abfd, filehdr_in->f_nscns, filehdr_out->f_nscns);
+ H_PUT_32 (abfd, filehdr_in->f_timdat, filehdr_out->f_timdat);
+ PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr, filehdr_out->f_symptr);
+ H_PUT_32 (abfd, filehdr_in->f_nsyms, filehdr_out->f_nsyms);
+ H_PUT_16 (abfd, filehdr_in->f_opthdr, filehdr_out->f_opthdr);
+ H_PUT_16 (abfd, filehdr_in->f_flags, filehdr_out->f_flags);
#ifdef TIC80_TARGET_ID
- bfd_h_put_16(abfd, filehdr_in->f_target_id, (bfd_byte *) filehdr_out->f_target_id);
+ H_PUT_16 (abfd, filehdr_in->f_target_id, filehdr_out->f_target_id);
#endif
#ifdef COFF_ADJUST_FILEHDR_OUT_POST
@@ -341,34 +348,38 @@ coff_swap_filehdr_out (abfd, in, out)
static void
coff_swap_sym_in (abfd, ext1, in1)
- bfd *abfd;
+ bfd *abfd;
PTR ext1;
PTR in1;
{
- SYMENT *ext = (SYMENT *)ext1;
- struct internal_syment *in = (struct internal_syment *)in1;
-
- if( ext->e.e_name[0] == 0) {
- in->_n._n_n._n_zeroes = 0;
- in->_n._n_n._n_offset = bfd_h_get_32(abfd, (bfd_byte *) ext->e.e.e_offset);
- }
- else {
+ SYMENT *ext = (SYMENT *) ext1;
+ struct internal_syment *in = (struct internal_syment *) in1;
+
+ if (ext->e.e_name[0] == 0)
+ {
+ in->_n._n_n._n_zeroes = 0;
+ in->_n._n_n._n_offset = H_GET_32 (abfd, ext->e.e.e_offset);
+ }
+ else
+ {
#if SYMNMLEN != E_SYMNMLEN
- -> Error, we need to cope with truncating or extending SYMNMLEN!;
+ -> Error, we need to cope with truncating or extending SYMNMLEN!;
#else
- memcpy(in->_n._n_name, ext->e.e_name, SYMNMLEN);
-#endif
- }
- in->n_value = bfd_h_get_32(abfd, (bfd_byte *) ext->e_value);
- in->n_scnum = bfd_h_get_16(abfd, (bfd_byte *) ext->e_scnum);
- if (sizeof (ext->e_type) == 2){
- in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type);
- }
- else {
- in->n_type = bfd_h_get_32(abfd, (bfd_byte *) ext->e_type);
- }
- in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass);
- in->n_numaux = bfd_h_get_8(abfd, ext->e_numaux);
+ memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN);
+#endif
+ }
+ in->n_value = H_GET_32 (abfd, ext->e_value);
+ in->n_scnum = H_GET_16 (abfd, ext->e_scnum);
+ if (sizeof (ext->e_type) == 2)
+ {
+ in->n_type = H_GET_16 (abfd, ext->e_type);
+ }
+ else
+ {
+ in->n_type = H_GET_32 (abfd, ext->e_type);
+ }
+ in->n_sclass = H_GET_8 (abfd, ext->e_sclass);
+ in->n_numaux = H_GET_8 (abfd, ext->e_numaux);
#ifdef COFF_ADJUST_SYM_IN_POST
COFF_ADJUST_SYM_IN_POST (abfd, ext1, in1);
#endif
@@ -376,35 +387,37 @@ coff_swap_sym_in (abfd, ext1, in1)
static unsigned int
coff_swap_sym_out (abfd, inp, extp)
- bfd *abfd;
- PTR inp;
- PTR extp;
+ bfd *abfd;
+ PTR inp;
+ PTR extp;
{
- struct internal_syment *in = (struct internal_syment *)inp;
- SYMENT *ext =(SYMENT *)extp;
- if(in->_n._n_name[0] == 0) {
- bfd_h_put_32(abfd, 0, (bfd_byte *) ext->e.e.e_zeroes);
- bfd_h_put_32(abfd, in->_n._n_n._n_offset, (bfd_byte *) ext->e.e.e_offset);
- }
- else {
+ struct internal_syment *in = (struct internal_syment *) inp;
+ SYMENT *ext =(SYMENT *) extp;
+ if(in->_n._n_name[0] == 0)
+ {
+ H_PUT_32 (abfd, 0, ext->e.e.e_zeroes);
+ H_PUT_32 (abfd, in->_n._n_n._n_offset, ext->e.e.e_offset);
+ }
+ else
+ {
#if SYMNMLEN != E_SYMNMLEN
- -> Error, we need to cope with truncating or extending SYMNMLEN!;
+ -> Error, we need to cope with truncating or extending SYMNMLEN!;
#else
- memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN);
+ memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN);
#endif
- }
- bfd_h_put_32(abfd, in->n_value , (bfd_byte *) ext->e_value);
- bfd_h_put_16(abfd, in->n_scnum , (bfd_byte *) ext->e_scnum);
+ }
+ H_PUT_32 (abfd, in->n_value, ext->e_value);
+ H_PUT_16 (abfd, in->n_scnum, ext->e_scnum);
if (sizeof (ext->e_type) == 2)
- {
- bfd_h_put_16(abfd, in->n_type , (bfd_byte *) ext->e_type);
- }
+ {
+ H_PUT_16 (abfd, in->n_type, ext->e_type);
+ }
else
- {
- bfd_h_put_32(abfd, in->n_type , (bfd_byte *) ext->e_type);
- }
- bfd_h_put_8(abfd, in->n_sclass , ext->e_sclass);
- bfd_h_put_8(abfd, in->n_numaux , ext->e_numaux);
+ {
+ H_PUT_32 (abfd, in->n_type, ext->e_type);
+ }
+ H_PUT_8 (abfd, in->n_sclass, ext->e_sclass);
+ H_PUT_8 (abfd, in->n_numaux, ext->e_numaux);
#ifdef COFF_ADJUST_SYM_OUT_POST
COFF_ADJUST_SYM_OUT_POST (abfd, inp, extp);
#endif
@@ -413,42 +426,45 @@ coff_swap_sym_out (abfd, inp, extp)
static void
coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
- bfd *abfd;
- PTR ext1;
- int type;
- int class;
- int indx;
- int numaux;
- PTR in1;
+ bfd *abfd;
+ PTR ext1;
+ int type;
+ int class;
+ int indx;
+ int numaux;
+ PTR in1;
{
- AUXENT *ext = (AUXENT *)ext1;
- union internal_auxent *in = (union internal_auxent *)in1;
+ AUXENT *ext = (AUXENT *) ext1;
+ union internal_auxent *in = (union internal_auxent *) in1;
#ifdef COFF_ADJUST_AUX_IN_PRE
COFF_ADJUST_AUX_IN_PRE (abfd, ext1, type, class, indx, numaux, in1);
#endif
- switch (class) {
+ switch (class)
+ {
case C_FILE:
- if (ext->x_file.x_fname[0] == 0) {
+ if (ext->x_file.x_fname[0] == 0)
+ {
in->x_file.x_n.x_zeroes = 0;
- in->x_file.x_n.x_offset =
- bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset);
- } else {
+ in->x_file.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset);
+ }
+ else
+ {
#if FILNMLEN != E_FILNMLEN
- -> Error, we need to cope with truncating or extending FILNMLEN!;
+ -> Error, we need to cope with truncating or extending FILNMLEN!;
#else
- if (numaux > 1)
- {
- if (indx == 0)
- memcpy (in->x_file.x_fname, ext->x_file.x_fname,
- numaux * sizeof (AUXENT));
- }
- else
- {
- memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
- }
-#endif
- }
+ if (numaux > 1)
+ {
+ if (indx == 0)
+ memcpy (in->x_file.x_fname, ext->x_file.x_fname,
+ numaux * sizeof (AUXENT));
+ }
+ else
+ {
+ memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
+ }
+#endif
+ }
goto end;
case C_STAT:
@@ -456,10 +472,11 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
case C_LEAFSTAT:
#endif
case C_HIDDEN:
- if (type == T_NULL) {
- in->x_scn.x_scnlen = GET_SCN_SCNLEN(abfd, ext);
- in->x_scn.x_nreloc = GET_SCN_NRELOC(abfd, ext);
- in->x_scn.x_nlinno = GET_SCN_NLINNO(abfd, ext);
+ if (type == T_NULL)
+ {
+ in->x_scn.x_scnlen = GET_SCN_SCNLEN (abfd, ext);
+ in->x_scn.x_nreloc = GET_SCN_NRELOC (abfd, ext);
+ in->x_scn.x_nlinno = GET_SCN_NLINNO (abfd, ext);
/* PE defines some extra fields; we zero them out for
safety. */
@@ -472,9 +489,9 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
break;
}
- in->x_sym.x_tagndx.l = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_tagndx);
+ in->x_sym.x_tagndx.l = H_GET_32 (abfd, ext->x_sym.x_tagndx);
#ifndef NO_TVNDX
- in->x_sym.x_tvndx = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_tvndx);
+ in->x_sym.x_tvndx = H_GET_16 (abfd, ext->x_sym.x_tvndx);
#endif
if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
@@ -485,29 +502,29 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
else
{
#if DIMNUM != E_DIMNUM
- #error we need to cope with truncating or extending DIMNUM
+#error we need to cope with truncating or extending DIMNUM
#endif
in->x_sym.x_fcnary.x_ary.x_dimen[0] =
- bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
+ H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
in->x_sym.x_fcnary.x_ary.x_dimen[1] =
- bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
+ H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
in->x_sym.x_fcnary.x_ary.x_dimen[2] =
- bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
+ H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
in->x_sym.x_fcnary.x_ary.x_dimen[3] =
- bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
+ H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
}
- if (ISFCN(type)) {
- in->x_sym.x_misc.x_fsize = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_fsize);
- }
- else {
- in->x_sym.x_misc.x_lnsz.x_lnno = GET_LNSZ_LNNO(abfd, ext);
- in->x_sym.x_misc.x_lnsz.x_size = GET_LNSZ_SIZE(abfd, ext);
- }
+ if (ISFCN(type))
+ {
+ in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize);
+ }
+ else
+ {
+ in->x_sym.x_misc.x_lnsz.x_lnno = GET_LNSZ_LNNO (abfd, ext);
+ in->x_sym.x_misc.x_lnsz.x_size = GET_LNSZ_SIZE (abfd, ext);
+ }
-end: ;
- /* the semicolon is because MSVC doesn't like labels at
- end of block. */
+ end: ;
#ifdef COFF_ADJUST_AUX_IN_POST
COFF_ADJUST_AUX_IN_POST (abfd, ext1, type, class, indx, numaux, in1);
@@ -516,87 +533,88 @@ end: ;
static unsigned int
coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
- bfd *abfd;
- PTR inp;
- int type;
- int class;
- int indx ATTRIBUTE_UNUSED;
- int numaux ATTRIBUTE_UNUSED;
- PTR extp;
+ bfd *abfd;
+ PTR inp;
+ int type;
+ int class;
+ int indx ATTRIBUTE_UNUSED;
+ int numaux ATTRIBUTE_UNUSED;
+ PTR extp;
{
- union internal_auxent *in = (union internal_auxent *)inp;
- AUXENT *ext = (AUXENT *)extp;
+ union internal_auxent *in = (union internal_auxent *) inp;
+ AUXENT *ext = (AUXENT *) extp;
#ifdef COFF_ADJUST_AUX_OUT_PRE
COFF_ADJUST_AUX_OUT_PRE (abfd, inp, type, class, indx, numaux, extp);
#endif
memset((PTR)ext, 0, AUXESZ);
- switch (class) {
- case C_FILE:
- if (in->x_file.x_fname[0] == 0) {
- PUTWORD(abfd, 0, (bfd_byte *) ext->x_file.x_n.x_zeroes);
- PUTWORD(abfd,
- in->x_file.x_n.x_offset,
- (bfd_byte *) ext->x_file.x_n.x_offset);
- }
- else {
+ switch (class)
+ {
+ case C_FILE:
+ if (in->x_file.x_fname[0] == 0)
+ {
+ H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes);
+ H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
+ }
+ else
+ {
#if FILNMLEN != E_FILNMLEN
- -> Error, we need to cope with truncating or extending FILNMLEN!;
+ -> Error, we need to cope with truncating or extending FILNMLEN!;
#else
- memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
+ memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
#endif
- }
- goto end;
+ }
+ goto end;
- case C_STAT:
+ case C_STAT:
#ifdef C_LEAFSTAT
- case C_LEAFSTAT:
+ case C_LEAFSTAT:
#endif
- case C_HIDDEN:
- if (type == T_NULL) {
- PUT_SCN_SCNLEN(abfd, in->x_scn.x_scnlen, ext);
- PUT_SCN_NRELOC(abfd, in->x_scn.x_nreloc, ext);
- PUT_SCN_NLINNO(abfd, in->x_scn.x_nlinno, ext);
- goto end;
+ case C_HIDDEN:
+ if (type == T_NULL)
+ {
+ PUT_SCN_SCNLEN (abfd, in->x_scn.x_scnlen, ext);
+ PUT_SCN_NRELOC (abfd, in->x_scn.x_nreloc, ext);
+ PUT_SCN_NLINNO (abfd, in->x_scn.x_nlinno, ext);
+ goto end;
+ }
+ break;
}
- break;
- }
- PUTWORD(abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx);
+ H_PUT_32 (abfd, in->x_sym.x_tagndx.l, ext->x_sym.x_tagndx);
#ifndef NO_TVNDX
- bfd_h_put_16(abfd, in->x_sym.x_tvndx , (bfd_byte *) ext->x_sym.x_tvndx);
+ H_PUT_16 (abfd, in->x_sym.x_tvndx, ext->x_sym.x_tvndx);
#endif
if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
{
- PUT_FCN_LNNOPTR(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext);
- PUT_FCN_ENDNDX(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, ext);
+ PUT_FCN_LNNOPTR (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext);
+ PUT_FCN_ENDNDX (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, ext);
}
else
{
#if DIMNUM != E_DIMNUM
- #error we need to cope with truncating or extending DIMNUM
-#endif
- bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0],
- (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
- bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1],
- (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
- bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2],
- (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
- bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3],
- (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
+#error we need to cope with truncating or extending DIMNUM
+#endif
+ H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0],
+ ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
+ H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1],
+ ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
+ H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2],
+ ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
+ H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3],
+ ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
}
if (ISFCN (type))
- PUTWORD (abfd, in->x_sym.x_misc.x_fsize,
- (bfd_byte *) ext->x_sym.x_misc.x_fsize);
+ H_PUT_32 (abfd, in->x_sym.x_misc.x_fsize, ext->x_sym.x_misc.x_fsize);
else
{
PUT_LNSZ_LNNO (abfd, in->x_sym.x_misc.x_lnsz.x_lnno, ext);
PUT_LNSZ_SIZE (abfd, in->x_sym.x_misc.x_lnsz.x_size, ext);
}
-end:
+ end:
#ifdef COFF_ADJUST_AUX_OUT_POST
COFF_ADJUST_AUX_OUT_POST (abfd, inp, type, class, indx, numaux, extp);
#endif
@@ -609,27 +627,26 @@ end:
static void
coff_swap_lineno_in (abfd, ext1, in1)
- bfd *abfd;
+ bfd *abfd;
PTR ext1;
PTR in1;
{
- LINENO *ext = (LINENO *)ext1;
- struct internal_lineno *in = (struct internal_lineno *)in1;
+ LINENO *ext = (LINENO *) ext1;
+ struct internal_lineno *in = (struct internal_lineno *) in1;
- in->l_addr.l_symndx = bfd_h_get_32(abfd, (bfd_byte *) ext->l_addr.l_symndx);
- in->l_lnno = GET_LINENO_LNNO(abfd, ext);
+ in->l_addr.l_symndx = H_GET_32 (abfd, ext->l_addr.l_symndx);
+ in->l_lnno = GET_LINENO_LNNO (abfd, ext);
}
static unsigned int
coff_swap_lineno_out (abfd, inp, outp)
- bfd *abfd;
- PTR inp;
- PTR outp;
+ bfd *abfd;
+ PTR inp;
+ PTR outp;
{
- struct internal_lineno *in = (struct internal_lineno *)inp;
- struct external_lineno *ext = (struct external_lineno *)outp;
- PUTWORD(abfd, in->l_addr.l_symndx, (bfd_byte *)
- ext->l_addr.l_symndx);
+ struct internal_lineno *in = (struct internal_lineno *) inp;
+ struct external_lineno *ext = (struct external_lineno *) outp;
+ H_PUT_32 (abfd, in->l_addr.l_symndx, ext->l_addr.l_symndx);
PUT_LINENO_LNNO (abfd, in->l_lnno, ext);
return LINESZ;
@@ -639,128 +656,126 @@ coff_swap_lineno_out (abfd, inp, outp)
static void
coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
- bfd *abfd;
+ bfd *abfd;
PTR aouthdr_ext1;
PTR aouthdr_int1;
{
- AOUTHDR *aouthdr_ext = (AOUTHDR *) aouthdr_ext1;
- struct internal_aouthdr *aouthdr_int = (struct internal_aouthdr *)aouthdr_int1;
-
- aouthdr_int->magic = bfd_h_get_16(abfd, (bfd_byte *) aouthdr_ext->magic);
- aouthdr_int->vstamp = bfd_h_get_16(abfd, (bfd_byte *) aouthdr_ext->vstamp);
- aouthdr_int->tsize =
- GET_AOUTHDR_TSIZE (abfd, (bfd_byte *) aouthdr_ext->tsize);
- aouthdr_int->dsize =
- GET_AOUTHDR_DSIZE (abfd, (bfd_byte *) aouthdr_ext->dsize);
- aouthdr_int->bsize =
- GET_AOUTHDR_BSIZE (abfd, (bfd_byte *) aouthdr_ext->bsize);
- aouthdr_int->entry =
- GET_AOUTHDR_ENTRY (abfd, (bfd_byte *) aouthdr_ext->entry);
+ AOUTHDR *aouthdr_ext;
+ struct internal_aouthdr *aouthdr_int;
+
+ aouthdr_ext = (AOUTHDR *) aouthdr_ext1;
+ aouthdr_int = (struct internal_aouthdr *) aouthdr_int1;
+ aouthdr_int->magic = H_GET_16 (abfd, aouthdr_ext->magic);
+ aouthdr_int->vstamp = H_GET_16 (abfd, aouthdr_ext->vstamp);
+ aouthdr_int->tsize = GET_AOUTHDR_TSIZE (abfd, aouthdr_ext->tsize);
+ aouthdr_int->dsize = GET_AOUTHDR_DSIZE (abfd, aouthdr_ext->dsize);
+ aouthdr_int->bsize = GET_AOUTHDR_BSIZE (abfd, aouthdr_ext->bsize);
+ aouthdr_int->entry = GET_AOUTHDR_ENTRY (abfd, aouthdr_ext->entry);
aouthdr_int->text_start =
- GET_AOUTHDR_TEXT_START (abfd, (bfd_byte *) aouthdr_ext->text_start);
+ GET_AOUTHDR_TEXT_START (abfd, aouthdr_ext->text_start);
aouthdr_int->data_start =
- GET_AOUTHDR_DATA_START (abfd, (bfd_byte *) aouthdr_ext->data_start);
+ GET_AOUTHDR_DATA_START (abfd, aouthdr_ext->data_start);
#ifdef I960
- aouthdr_int->tagentries = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->tagentries);
+ aouthdr_int->tagentries = H_GET_32 (abfd, aouthdr_ext->tagentries);
#endif
#ifdef APOLLO_M68
- bfd_h_put_32(abfd, aouthdr_int->o_inlib, (bfd_byte *) aouthdr_ext->o_inlib);
- bfd_h_put_32(abfd, aouthdr_int->o_sri, (bfd_byte *) aouthdr_ext->o_sri);
- bfd_h_put_32(abfd, aouthdr_int->vid[0], (bfd_byte *) aouthdr_ext->vid);
- bfd_h_put_32(abfd, aouthdr_int->vid[1], (bfd_byte *) aouthdr_ext->vid + 4);
+ H_PUT_32 (abfd, aouthdr_int->o_inlib, aouthdr_ext->o_inlib);
+ H_PUT_32 (abfd, aouthdr_int->o_sri, aouthdr_ext->o_sri);
+ H_PUT_32 (abfd, aouthdr_int->vid[0], aouthdr_ext->vid);
+ H_PUT_32 (abfd, aouthdr_int->vid[1], aouthdr_ext->vid + 4);
#endif
#ifdef RS6000COFF_C
#ifdef XCOFF64
- aouthdr_int->o_toc = bfd_h_get_64(abfd, aouthdr_ext->o_toc);
+ aouthdr_int->o_toc = H_GET_64 (abfd, aouthdr_ext->o_toc);
#else
- aouthdr_int->o_toc = bfd_h_get_32(abfd, aouthdr_ext->o_toc);
-#endif
- aouthdr_int->o_snentry = bfd_h_get_16(abfd, aouthdr_ext->o_snentry);
- aouthdr_int->o_sntext = bfd_h_get_16(abfd, aouthdr_ext->o_sntext);
- aouthdr_int->o_sndata = bfd_h_get_16(abfd, aouthdr_ext->o_sndata);
- aouthdr_int->o_sntoc = bfd_h_get_16(abfd, aouthdr_ext->o_sntoc);
- aouthdr_int->o_snloader = bfd_h_get_16(abfd, aouthdr_ext->o_snloader);
- aouthdr_int->o_snbss = bfd_h_get_16(abfd, aouthdr_ext->o_snbss);
- aouthdr_int->o_algntext = bfd_h_get_16(abfd, aouthdr_ext->o_algntext);
- aouthdr_int->o_algndata = bfd_h_get_16(abfd, aouthdr_ext->o_algndata);
- aouthdr_int->o_modtype = bfd_h_get_16(abfd, aouthdr_ext->o_modtype);
- aouthdr_int->o_cputype = bfd_h_get_16(abfd, aouthdr_ext->o_cputype);
+ aouthdr_int->o_toc = H_GET_32 (abfd, aouthdr_ext->o_toc);
+#endif
+ aouthdr_int->o_snentry = H_GET_16 (abfd, aouthdr_ext->o_snentry);
+ aouthdr_int->o_sntext = H_GET_16 (abfd, aouthdr_ext->o_sntext);
+ aouthdr_int->o_sndata = H_GET_16 (abfd, aouthdr_ext->o_sndata);
+ aouthdr_int->o_sntoc = H_GET_16 (abfd, aouthdr_ext->o_sntoc);
+ aouthdr_int->o_snloader = H_GET_16 (abfd, aouthdr_ext->o_snloader);
+ aouthdr_int->o_snbss = H_GET_16 (abfd, aouthdr_ext->o_snbss);
+ aouthdr_int->o_algntext = H_GET_16 (abfd, aouthdr_ext->o_algntext);
+ aouthdr_int->o_algndata = H_GET_16 (abfd, aouthdr_ext->o_algndata);
+ aouthdr_int->o_modtype = H_GET_16 (abfd, aouthdr_ext->o_modtype);
+ aouthdr_int->o_cputype = H_GET_16 (abfd, aouthdr_ext->o_cputype);
#ifdef XCOFF64
- aouthdr_int->o_maxstack = bfd_h_get_64(abfd, aouthdr_ext->o_maxstack);
- aouthdr_int->o_maxdata = bfd_h_get_64(abfd, aouthdr_ext->o_maxdata);
+ aouthdr_int->o_maxstack = H_GET_64 (abfd, aouthdr_ext->o_maxstack);
+ aouthdr_int->o_maxdata = H_GET_64 (abfd, aouthdr_ext->o_maxdata);
#else
- aouthdr_int->o_maxstack = bfd_h_get_32(abfd, aouthdr_ext->o_maxstack);
- aouthdr_int->o_maxdata = bfd_h_get_32(abfd, aouthdr_ext->o_maxdata);
+ aouthdr_int->o_maxstack = H_GET_32 (abfd, aouthdr_ext->o_maxstack);
+ aouthdr_int->o_maxdata = H_GET_32 (abfd, aouthdr_ext->o_maxdata);
#endif
#endif
#ifdef MIPSECOFF
- aouthdr_int->bss_start = bfd_h_get_32(abfd, aouthdr_ext->bss_start);
- aouthdr_int->gp_value = bfd_h_get_32(abfd, aouthdr_ext->gp_value);
- aouthdr_int->gprmask = bfd_h_get_32(abfd, aouthdr_ext->gprmask);
- aouthdr_int->cprmask[0] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[0]);
- aouthdr_int->cprmask[1] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[1]);
- aouthdr_int->cprmask[2] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[2]);
- aouthdr_int->cprmask[3] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[3]);
+ aouthdr_int->bss_start = H_GET_32 (abfd, aouthdr_ext->bss_start);
+ aouthdr_int->gp_value = H_GET_32 (abfd, aouthdr_ext->gp_value);
+ aouthdr_int->gprmask = H_GET_32 (abfd, aouthdr_ext->gprmask);
+ aouthdr_int->cprmask[0] = H_GET_32 (abfd, aouthdr_ext->cprmask[0]);
+ aouthdr_int->cprmask[1] = H_GET_32 (abfd, aouthdr_ext->cprmask[1]);
+ aouthdr_int->cprmask[2] = H_GET_32 (abfd, aouthdr_ext->cprmask[2]);
+ aouthdr_int->cprmask[3] = H_GET_32 (abfd, aouthdr_ext->cprmask[3]);
#endif
#ifdef ALPHAECOFF
- aouthdr_int->bss_start = bfd_h_get_64(abfd, aouthdr_ext->bss_start);
- aouthdr_int->gp_value = bfd_h_get_64(abfd, aouthdr_ext->gp_value);
- aouthdr_int->gprmask = bfd_h_get_32(abfd, aouthdr_ext->gprmask);
- aouthdr_int->fprmask = bfd_h_get_32(abfd, aouthdr_ext->fprmask);
+ aouthdr_int->bss_start = H_GET_64 (abfd, aouthdr_ext->bss_start);
+ aouthdr_int->gp_value = H_GET_64 (abfd, aouthdr_ext->gp_value);
+ aouthdr_int->gprmask = H_GET_32 (abfd, aouthdr_ext->gprmask);
+ aouthdr_int->fprmask = H_GET_32 (abfd, aouthdr_ext->fprmask);
#endif
}
static unsigned int
coff_swap_aouthdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
+ bfd *abfd;
+ PTR in;
+ PTR out;
{
- struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *)in;
- AOUTHDR *aouthdr_out = (AOUTHDR *)out;
-
- bfd_h_put_16(abfd, aouthdr_in->magic, (bfd_byte *) aouthdr_out->magic);
- bfd_h_put_16(abfd, aouthdr_in->vstamp, (bfd_byte *) aouthdr_out->vstamp);
- PUT_AOUTHDR_TSIZE (abfd, aouthdr_in->tsize, (bfd_byte *) aouthdr_out->tsize);
- PUT_AOUTHDR_DSIZE (abfd, aouthdr_in->dsize, (bfd_byte *) aouthdr_out->dsize);
- PUT_AOUTHDR_BSIZE (abfd, aouthdr_in->bsize, (bfd_byte *) aouthdr_out->bsize);
- PUT_AOUTHDR_ENTRY (abfd, aouthdr_in->entry, (bfd_byte *) aouthdr_out->entry);
+ struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *) in;
+ AOUTHDR *aouthdr_out = (AOUTHDR *) out;
+
+ H_PUT_16 (abfd, aouthdr_in->magic, aouthdr_out->magic);
+ H_PUT_16 (abfd, aouthdr_in->vstamp, aouthdr_out->vstamp);
+ PUT_AOUTHDR_TSIZE (abfd, aouthdr_in->tsize, aouthdr_out->tsize);
+ PUT_AOUTHDR_DSIZE (abfd, aouthdr_in->dsize, aouthdr_out->dsize);
+ PUT_AOUTHDR_BSIZE (abfd, aouthdr_in->bsize, aouthdr_out->bsize);
+ PUT_AOUTHDR_ENTRY (abfd, aouthdr_in->entry, aouthdr_out->entry);
PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start,
- (bfd_byte *) aouthdr_out->text_start);
+ aouthdr_out->text_start);
PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start,
- (bfd_byte *) aouthdr_out->data_start);
+ aouthdr_out->data_start);
#ifdef I960
- bfd_h_put_32(abfd, aouthdr_in->tagentries, (bfd_byte *) aouthdr_out->tagentries);
+ H_PUT_32 (abfd, aouthdr_in->tagentries, aouthdr_out->tagentries);
#endif
#ifdef RS6000COFF_C
#ifdef XCOFF64
- bfd_h_put_64 (abfd, aouthdr_in->o_toc, aouthdr_out->o_toc);
+ H_PUT_64 (abfd, aouthdr_in->o_toc, aouthdr_out->o_toc);
#else
- bfd_h_put_32 (abfd, aouthdr_in->o_toc, aouthdr_out->o_toc);
-#endif
- bfd_h_put_16 (abfd, aouthdr_in->o_snentry, aouthdr_out->o_snentry);
- bfd_h_put_16 (abfd, aouthdr_in->o_sntext, aouthdr_out->o_sntext);
- bfd_h_put_16 (abfd, aouthdr_in->o_sndata, aouthdr_out->o_sndata);
- bfd_h_put_16 (abfd, aouthdr_in->o_sntoc, aouthdr_out->o_sntoc);
- bfd_h_put_16 (abfd, aouthdr_in->o_snloader, aouthdr_out->o_snloader);
- bfd_h_put_16 (abfd, aouthdr_in->o_snbss, aouthdr_out->o_snbss);
- bfd_h_put_16 (abfd, aouthdr_in->o_algntext, aouthdr_out->o_algntext);
- bfd_h_put_16 (abfd, aouthdr_in->o_algndata, aouthdr_out->o_algndata);
- bfd_h_put_16 (abfd, aouthdr_in->o_modtype, aouthdr_out->o_modtype);
- bfd_h_put_16 (abfd, aouthdr_in->o_cputype, aouthdr_out->o_cputype);
+ H_PUT_32 (abfd, aouthdr_in->o_toc, aouthdr_out->o_toc);
+#endif
+ H_PUT_16 (abfd, aouthdr_in->o_snentry, aouthdr_out->o_snentry);
+ H_PUT_16 (abfd, aouthdr_in->o_sntext, aouthdr_out->o_sntext);
+ H_PUT_16 (abfd, aouthdr_in->o_sndata, aouthdr_out->o_sndata);
+ H_PUT_16 (abfd, aouthdr_in->o_sntoc, aouthdr_out->o_sntoc);
+ H_PUT_16 (abfd, aouthdr_in->o_snloader, aouthdr_out->o_snloader);
+ H_PUT_16 (abfd, aouthdr_in->o_snbss, aouthdr_out->o_snbss);
+ H_PUT_16 (abfd, aouthdr_in->o_algntext, aouthdr_out->o_algntext);
+ H_PUT_16 (abfd, aouthdr_in->o_algndata, aouthdr_out->o_algndata);
+ H_PUT_16 (abfd, aouthdr_in->o_modtype, aouthdr_out->o_modtype);
+ H_PUT_16 (abfd, aouthdr_in->o_cputype, aouthdr_out->o_cputype);
#ifdef XCOFF64
- bfd_h_put_64 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack);
- bfd_h_put_64 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata);
+ H_PUT_64 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack);
+ H_PUT_64 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata);
#else
- bfd_h_put_32 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack);
- bfd_h_put_32 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata);
+ H_PUT_32 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack);
+ H_PUT_32 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata);
#endif
memset (aouthdr_out->o_resv2, 0, sizeof aouthdr_out->o_resv2);
#ifdef XCOFF64
@@ -770,23 +785,23 @@ coff_swap_aouthdr_out (abfd, in, out)
#endif
#ifdef MIPSECOFF
- bfd_h_put_32(abfd, aouthdr_in->bss_start, (bfd_byte *) aouthdr_out->bss_start);
- bfd_h_put_32(abfd, aouthdr_in->gp_value, (bfd_byte *) aouthdr_out->gp_value);
- bfd_h_put_32(abfd, aouthdr_in->gprmask, (bfd_byte *) aouthdr_out->gprmask);
- bfd_h_put_32(abfd, aouthdr_in->cprmask[0], (bfd_byte *) aouthdr_out->cprmask[0]);
- bfd_h_put_32(abfd, aouthdr_in->cprmask[1], (bfd_byte *) aouthdr_out->cprmask[1]);
- bfd_h_put_32(abfd, aouthdr_in->cprmask[2], (bfd_byte *) aouthdr_out->cprmask[2]);
- bfd_h_put_32(abfd, aouthdr_in->cprmask[3], (bfd_byte *) aouthdr_out->cprmask[3]);
+ H_PUT_32 (abfd, aouthdr_in->bss_start, aouthdr_out->bss_start);
+ H_PUT_32 (abfd, aouthdr_in->gp_value, aouthdr_out->gp_value);
+ H_PUT_32 (abfd, aouthdr_in->gprmask, aouthdr_out->gprmask);
+ H_PUT_32 (abfd, aouthdr_in->cprmask[0], aouthdr_out->cprmask[0]);
+ H_PUT_32 (abfd, aouthdr_in->cprmask[1], aouthdr_out->cprmask[1]);
+ H_PUT_32 (abfd, aouthdr_in->cprmask[2], aouthdr_out->cprmask[2]);
+ H_PUT_32 (abfd, aouthdr_in->cprmask[3], aouthdr_out->cprmask[3]);
#endif
#ifdef ALPHAECOFF
/* FIXME: What does bldrev mean? */
- bfd_h_put_16(abfd, (bfd_vma) 2, (bfd_byte *) aouthdr_out->bldrev);
- bfd_h_put_16(abfd, (bfd_vma) 0, (bfd_byte *) aouthdr_out->padding);
- bfd_h_put_64(abfd, aouthdr_in->bss_start, (bfd_byte *) aouthdr_out->bss_start);
- bfd_h_put_64(abfd, aouthdr_in->gp_value, (bfd_byte *) aouthdr_out->gp_value);
- bfd_h_put_32(abfd, aouthdr_in->gprmask, (bfd_byte *) aouthdr_out->gprmask);
- bfd_h_put_32(abfd, aouthdr_in->fprmask, (bfd_byte *) aouthdr_out->fprmask);
+ H_PUT_16 (abfd, 2, aouthdr_out->bldrev);
+ H_PUT_16 (abfd, 0, aouthdr_out->padding);
+ H_PUT_64 (abfd, aouthdr_in->bss_start, aouthdr_out->bss_start);
+ H_PUT_64 (abfd, aouthdr_in->gp_value, aouthdr_out->gp_value);
+ H_PUT_32 (abfd, aouthdr_in->gprmask, aouthdr_out->gprmask);
+ H_PUT_32 (abfd, aouthdr_in->fprmask, aouthdr_out->fprmask);
#endif
return AOUTSZ;
@@ -794,9 +809,9 @@ coff_swap_aouthdr_out (abfd, in, out)
static void
coff_swap_scnhdr_in (abfd, ext, in)
- bfd *abfd;
- PTR ext;
- PTR in;
+ bfd *abfd;
+ PTR ext;
+ PTR in;
{
SCNHDR *scnhdr_ext = (SCNHDR *) ext;
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
@@ -805,28 +820,18 @@ coff_swap_scnhdr_in (abfd, ext, in)
COFF_ADJUST_SCNHDR_IN_PRE (abfd, ext, in);
#endif
memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof (scnhdr_int->s_name));
- scnhdr_int->s_vaddr =
- GET_SCNHDR_VADDR (abfd, (bfd_byte *) scnhdr_ext->s_vaddr);
- scnhdr_int->s_paddr =
- GET_SCNHDR_PADDR (abfd, (bfd_byte *) scnhdr_ext->s_paddr);
- scnhdr_int->s_size =
- GET_SCNHDR_SIZE (abfd, (bfd_byte *) scnhdr_ext->s_size);
-
- scnhdr_int->s_scnptr =
- GET_SCNHDR_SCNPTR (abfd, (bfd_byte *) scnhdr_ext->s_scnptr);
- scnhdr_int->s_relptr =
- GET_SCNHDR_RELPTR (abfd, (bfd_byte *) scnhdr_ext->s_relptr);
- scnhdr_int->s_lnnoptr =
- GET_SCNHDR_LNNOPTR (abfd, (bfd_byte *) scnhdr_ext->s_lnnoptr);
- scnhdr_int->s_flags =
- GET_SCNHDR_FLAGS (abfd, (bfd_byte *) scnhdr_ext->s_flags);
- scnhdr_int->s_nreloc =
- GET_SCNHDR_NRELOC (abfd, (bfd_byte *) scnhdr_ext->s_nreloc);
- scnhdr_int->s_nlnno =
- GET_SCNHDR_NLNNO (abfd, (bfd_byte *) scnhdr_ext->s_nlnno);
+ scnhdr_int->s_vaddr = GET_SCNHDR_VADDR (abfd, scnhdr_ext->s_vaddr);
+ scnhdr_int->s_paddr = GET_SCNHDR_PADDR (abfd, scnhdr_ext->s_paddr);
+ scnhdr_int->s_size = GET_SCNHDR_SIZE (abfd, scnhdr_ext->s_size);
+
+ scnhdr_int->s_scnptr = GET_SCNHDR_SCNPTR (abfd, scnhdr_ext->s_scnptr);
+ scnhdr_int->s_relptr = GET_SCNHDR_RELPTR (abfd, scnhdr_ext->s_relptr);
+ scnhdr_int->s_lnnoptr = GET_SCNHDR_LNNOPTR (abfd, scnhdr_ext->s_lnnoptr);
+ scnhdr_int->s_flags = GET_SCNHDR_FLAGS (abfd, scnhdr_ext->s_flags);
+ scnhdr_int->s_nreloc = GET_SCNHDR_NRELOC (abfd, scnhdr_ext->s_nreloc);
+ scnhdr_int->s_nlnno = GET_SCNHDR_NLNNO (abfd, scnhdr_ext->s_nlnno);
#ifdef I960
- scnhdr_int->s_align =
- GET_SCNHDR_ALIGN (abfd, (bfd_byte *) scnhdr_ext->s_align);
+ scnhdr_int->s_align = GET_SCNHDR_ALIGN (abfd, scnhdr_ext->s_align);
#endif
#ifdef COFF_ADJUST_SCNHDR_IN_POST
COFF_ADJUST_SCNHDR_IN_POST (abfd, ext, in);
@@ -835,42 +840,32 @@ coff_swap_scnhdr_in (abfd, ext, in)
static unsigned int
coff_swap_scnhdr_out (abfd, in, out)
- bfd *abfd;
- PTR in;
- PTR out;
+ bfd *abfd;
+ PTR in;
+ PTR out;
{
- struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *)in;
- SCNHDR *scnhdr_ext = (SCNHDR *)out;
+ struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
+ SCNHDR *scnhdr_ext = (SCNHDR *) out;
unsigned int ret = bfd_coff_scnhsz (abfd);
#ifdef COFF_ADJUST_SCNHDR_OUT_PRE
COFF_ADJUST_SCNHDR_OUT_PRE (abfd, in, out);
#endif
- memcpy(scnhdr_ext->s_name, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
-
- PUT_SCNHDR_VADDR (abfd, scnhdr_int->s_vaddr,
- (bfd_byte *) scnhdr_ext->s_vaddr);
-
- PUT_SCNHDR_PADDR (abfd, scnhdr_int->s_paddr,
- (bfd_byte *) scnhdr_ext->s_paddr);
- PUT_SCNHDR_SIZE (abfd, scnhdr_int->s_size,
- (bfd_byte *) scnhdr_ext->s_size);
+ memcpy (scnhdr_ext->s_name, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
- PUT_SCNHDR_SCNPTR (abfd, scnhdr_int->s_scnptr,
- (bfd_byte *) scnhdr_ext->s_scnptr);
- PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr,
- (bfd_byte *) scnhdr_ext->s_relptr);
- PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr,
- (bfd_byte *) scnhdr_ext->s_lnnoptr);
- PUT_SCNHDR_FLAGS (abfd, scnhdr_int->s_flags,
- (bfd_byte *) scnhdr_ext->s_flags);
+ PUT_SCNHDR_VADDR (abfd, scnhdr_int->s_vaddr, scnhdr_ext->s_vaddr);
+ PUT_SCNHDR_PADDR (abfd, scnhdr_int->s_paddr, scnhdr_ext->s_paddr);
+ PUT_SCNHDR_SIZE (abfd, scnhdr_int->s_size, scnhdr_ext->s_size);
+ PUT_SCNHDR_SCNPTR (abfd, scnhdr_int->s_scnptr, scnhdr_ext->s_scnptr);
+ PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr, scnhdr_ext->s_relptr);
+ PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr, scnhdr_ext->s_lnnoptr);
+ PUT_SCNHDR_FLAGS (abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags);
#if defined(M88)
- PUTWORD(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno);
- PUTWORD(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc);
+ H_PUT_32 (abfd, scnhdr_int->s_nlnno, scnhdr_ext->s_nlnno);
+ H_PUT_32 (abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc);
#else
if (scnhdr_int->s_nlnno <= MAX_SCNHDR_NLNNO)
- PUT_SCNHDR_NLNNO(abfd, scnhdr_int->s_nlnno,
- (bfd_byte *) scnhdr_ext->s_nlnno);
+ PUT_SCNHDR_NLNNO (abfd, scnhdr_int->s_nlnno, scnhdr_ext->s_nlnno);
else
{
char buf[sizeof (scnhdr_int->s_name) + 1];
@@ -881,11 +876,10 @@ coff_swap_scnhdr_out (abfd, in, out)
(_("%s: warning: %s: line number overflow: 0x%lx > 0xffff"),
bfd_get_filename (abfd),
buf, scnhdr_int->s_nlnno);
- PUT_SCNHDR_NLNNO(abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nlnno);
+ PUT_SCNHDR_NLNNO (abfd, 0xffff, scnhdr_ext->s_nlnno);
}
if (scnhdr_int->s_nreloc <= MAX_SCNHDR_NRELOC)
- PUT_SCNHDR_NRELOC(abfd, scnhdr_int->s_nreloc,
- (bfd_byte *) scnhdr_ext->s_nreloc);
+ PUT_SCNHDR_NRELOC (abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc);
else
{
char buf[sizeof (scnhdr_int->s_name) + 1];
@@ -896,13 +890,13 @@ coff_swap_scnhdr_out (abfd, in, out)
bfd_get_filename (abfd),
buf, scnhdr_int->s_nreloc);
bfd_set_error (bfd_error_file_truncated);
- PUT_SCNHDR_NRELOC(abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nreloc);
+ PUT_SCNHDR_NRELOC (abfd, 0xffff, scnhdr_ext->s_nreloc);
ret = 0;
}
#endif
#ifdef I960
- PUT_SCNHDR_ALIGN (abfd, scnhdr_int->s_align, (bfd_byte *) scnhdr_ext->s_align);
+ PUT_SCNHDR_ALIGN (abfd, scnhdr_int->s_align, scnhdr_ext->s_align);
#endif
#ifdef COFF_ADJUST_SCNHDR_OUT_POST
COFF_ADJUST_SCNHDR_OUT_POST (abfd, in, out);
diff --git a/contrib/binutils/bfd/config.bfd b/contrib/binutils/bfd/config.bfd
index 56025ac..0fe7464 100755
--- a/contrib/binutils/bfd/config.bfd
+++ b/contrib/binutils/bfd/config.bfd
@@ -5,6 +5,8 @@
# Sets the following shell variables:
# targ_defvec Default vector for this target
# targ_selvecs Vectors to build for this target
+# targ64_selvecs Vectors to build if --enable-64-bit-bfd is given
+# or if host is 64 bit.
# targ_archs Architectures for this target
# targ_cflags $(CFLAGS) for this target (FIXME: pretty bogus)
# targ_underscore Whether underscores are used: yes or no
@@ -23,34 +25,38 @@
targ_defvec=
targ_selvecs=
+targ64_selvecs=
targ_cflags=
targ_underscore=no
targ_cpu=`echo $targ | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
case "${targ_cpu}" in
-alpha*) targ_archs=bfd_alpha_arch ;;
-arm*) targ_archs=bfd_arm_arch ;;
-strongarm*) targ_archs=bfd_arm_arch ;;
-thumb*) targ_archs=bfd_arm_arch ;;
-xscale*) targ_archs=bfd_arm_arch ;;
-c30*) targ_archs=bfd_tic30_arch ;;
-c54x*) targ_archs=bfd_tic54x_arch ;;
-hppa*) targ_archs=bfd_hppa_arch ;;
-x86_64) targ_archs=bfd_i386_arch ;;
-i[3456]86) targ_archs=bfd_i386_arch ;;
-i370) targ_archs=bfd_i370_arch ;;
+alpha*) targ_archs=bfd_alpha_arch ;;
+arm*) targ_archs=bfd_arm_arch ;;
+c30*) targ_archs=bfd_tic30_arch ;;
+c54x*) targ_archs=bfd_tic54x_arch ;;
+hppa*) targ_archs=bfd_hppa_arch ;;
+i[3456]86) targ_archs=bfd_i386_arch ;;
+i370) targ_archs=bfd_i370_arch ;;
m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch" ;;
m6812*|m68hc12*) targ_archs="bfd_m68hc12_arch bfd_m68hc11_arch" ;;
-m68*) targ_archs=bfd_m68k_arch ;;
-m88*) targ_archs=bfd_m88k_arch ;;
-mips*) targ_archs=bfd_mips_arch ;;
-pj*) targ_archs="bfd_pj_arch bfd_i386_arch";;
-powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
-rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
-sparc*) targ_archs=bfd_sparc_arch ;;
-v850*) targ_archs=bfd_v850_arch ;;
-z8k*) targ_archs=bfd_z8k_arch ;;
-*) targ_archs=bfd_${targ_cpu}_arch ;;
+m68*) targ_archs=bfd_m68k_arch ;;
+m88*) targ_archs=bfd_m88k_arch ;;
+mips*) targ_archs=bfd_mips_arch ;;
+pdp11*) targ_archs=bfd_pdp11_arch ;;
+pj*) targ_archs="bfd_pj_arch bfd_i386_arch";;
+powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
+rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
+s390*) targ_archs=bfd_s390_arch ;;
+sh*) targ_archs=bfd_sh_arch ;;
+sparc*) targ_archs=bfd_sparc_arch ;;
+strongarm*) targ_archs=bfd_arm_arch ;;
+thumb*) targ_archs=bfd_arm_arch ;;
+v850*) targ_archs=bfd_v850_arch ;;
+x86_64) targ_archs=bfd_i386_arch ;;
+xscale*) targ_archs=bfd_arm_arch ;;
+z8k*) targ_archs=bfd_z8k_arch ;;
+*) targ_archs=bfd_${targ_cpu}_arch ;;
esac
@@ -84,13 +90,17 @@ case "${targ}" in
alpha*-*-*)
targ_defvec=ecoffalpha_little_vec
;;
- ia64*-*-freebsd* | ia64*-*-linux-gnu* | ia64*-*-elf*)
+ ia64*-*-aix*)
+ targ_defvec=bfd_elf64_ia64_aix_little_vec
+ targ_selvecs="bfd_elf64_ia64_aix_big_vec bfd_efi_app_ia64_vec"
+ ;;
+ ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf*)
targ_defvec=bfd_elf64_ia64_little_vec
targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec"
;;
ia64*-*-hpux*)
- targ_defvec=bfd_elf64_ia64_big_vec
- targ_selvecs="bfd_elf32_ia64_big_vec"
+ targ_defvec=bfd_elf32_ia64_hpux_big_vec
+ targ_selvecs="bfd_elf64_ia64_hpux_big_vec"
;;
sparc64-*-freebsd* | sparc64-*-netbsd*)
targ_defvec=bfd_elf64_sparc_vec
@@ -103,7 +113,11 @@ case "${targ}" in
targ_selvecs=bfd_elf32_bigarc_vec
;;
- arm-*-netbsd*)
+ arm-*-netbsdelf*)
+ targ_defvec=bfd_elf32_littlearm_vec
+ targ_selvecs="bfd_elf32_bigarm_vec armnetbsd_vec"
+ ;;
+ arm-*-netbsd* | arm-*-openbsd*)
targ_defvec=armnetbsd_vec
targ_underscore=yes
;;
@@ -114,6 +128,7 @@ case "${targ}" in
targ_defvec=arm_epoc_pe_little_vec
targ_selvecs="arm_epoc_pe_little_vec arm_epoc_pe_big_vec arm_epoc_pei_little_vec arm_epoc_pei_big_vec"
targ_underscore=no
+ targ_cflags=-DARM_COFF_BUGFIX
;;
arm-wince-pe | arm-*-wince)
targ_defvec=armpe_little_vec
@@ -134,16 +149,16 @@ case "${targ}" in
targ_defvec=aout_arm_big_vec
targ_selvecs=aout_arm_little_vec
;;
- arm-*-coff)
+ arm-*-vxworks*)
targ_defvec=armcoff_little_vec
targ_selvecs=armcoff_big_vec
targ_underscore=yes
+ targ_cflags=-DARM_COFF_BUGFIX
;;
- arm-*-vxworks*)
+ arm-*-coff)
targ_defvec=armcoff_little_vec
targ_selvecs=armcoff_big_vec
targ_underscore=yes
- targ_cflags=-DVXWORKS
;;
arm-*-rtems*)
targ_defvec=bfd_elf32_littlearm_vec
@@ -157,6 +172,10 @@ case "${targ}" in
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
;;
+ arm9e-*-elf)
+ targ_defvec=bfd_elf32_littlearm_vec
+ targ_selvecs=bfd_elf32_bigarm_vec
+ ;;
arm-*-oabi)
targ_defvec=bfd_elf32_littlearm_oabi_vec
targ_selvecs=bfd_elf32_bigarm_oabi_vec
@@ -251,6 +270,11 @@ case "${targ}" in
;;
+ h8300*-*-elf)
+ targ_defvec=bfd_elf32_h8300_vec
+ targ_underscore=yes
+ ;;
+
h8300*-*-*)
targ_defvec=h8300coff_vec
targ_underscore=yes
@@ -369,11 +393,15 @@ case "${targ}" in
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
;;
-#ifdef BFD64
+#ifdef BFD64
x86_64-*-freebsd*)
targ_defvec=bfd_elf64_x86_64_vec
targ_selvecs="bfd_elf32_i386_vec i386coff_vec bfd_efi_app_ia32_vec"
;;
+ x86_64-*-netbsd*)
+ targ_defvec=bfd_elf64_x86_64_vec
+ targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec"
+ ;;
x86_64-*-linux-gnu*)
targ_defvec=bfd_elf64_x86_64_vec
targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec"
@@ -544,7 +572,16 @@ case "${targ}" in
targ_selvecs="m68knetbsd_vec hp300bsd_vec sunos_big_vec"
targ_underscore=yes
;;
- m68*-*-netbsd* | m68*-*-openbsd*)
+ m68*-*-netbsdelf*)
+ targ_defvec=bfd_elf32_m68k_vec
+ targ_selvecs="m68knetbsd_vec m68k4knetbsd_vec hp300bsd_vec sunos_big_vec"
+ ;;
+ m68*-*-netbsdaout* | m68*-*-netbsd*)
+ targ_defvec=m68knetbsd_vec
+ targ_selvecs="m68k4knetbsd_vec bfd_elf32_m68k_vec hp300bsd_vec sunos_big_vec"
+ targ_underscore=yes
+ ;;
+ m68*-*-openbsd*)
targ_defvec=m68knetbsd_vec
targ_selvecs="m68k4knetbsd_vec hp300bsd_vec sunos_big_vec"
targ_underscore=yes
@@ -598,11 +635,11 @@ case "${targ}" in
targ_defvec=ecoff_big_vec
targ_selvecs=ecoff_little_vec
;;
- mips-dec-netbsd* | mips*el*-*-netbsd*)
+ mips*el-*-netbsd*)
targ_defvec=bfd_elf32_littlemips_vec
targ_selvecs="bfd_elf32_bigmips_vec ecoff_little_vec ecoff_big_vec"
;;
- mips*-*-netbsd*)
+ mips*-*-netbsd*)
targ_defvec=bfd_elf32_bigmips_vec
targ_selvecs="bfd_elf32_littlemips_vec ecoff_big_vec ecoff_little_vec"
;;
@@ -622,10 +659,12 @@ case "${targ}" in
targ_defvec=ecoff_big_vec
targ_selvecs=ecoff_little_vec
;;
+#ifdef BFD64
mips*-*-irix6*)
targ_defvec=bfd_elf32_bigmips_vec
targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
;;
+#endif
mips*-*-irix5*)
targ_defvec=bfd_elf32_bigmips_vec
targ_selvecs="bfd_elf32_littlemips_vec ecoff_big_vec ecoff_little_vec"
@@ -667,23 +706,38 @@ case "${targ}" in
targ_defvec=bfd_elf32_bigmips_vec
targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
;;
- mips*el*-*-openbsd*)
+ mips*el-*-openbsd*)
targ_defvec=bfd_elf32_littlemips_vec
targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_little_vec ecoff_big_vec"
;;
- mips*el*-*-linux-gnu*)
- targ_defvec=bfd_elf32_tradlittlemips_vec
- targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf64_tradbigmips_vec ecoff_little_vec ecoff_big_vec"
- ;;
mips*-*-openbsd*)
targ_defvec=bfd_elf32_bigmips_vec
targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_big_vec ecoff_little_vec"
;;
- mips*-*-linux-gnu*)
+#ifdef BFD64
+ mips64*el-*-linux*)
+ targ_defvec=bfd_elf32_tradlittlemips_vec
+ targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf64_tradbigmips_vec"
+ ;;
+ mips64*-*-linux*)
+ targ_defvec=bfd_elf32_tradbigmips_vec
+ targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
+ ;;
+#endif
+ mips*el-*-linux*)
+ targ_defvec=bfd_elf32_tradlittlemips_vec
+ targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf64_tradbigmips_vec ecoff_little_vec ecoff_big_vec"
+ ;;
+ mips*-*-linux*)
targ_defvec=bfd_elf32_tradbigmips_vec
targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_big_vec ecoff_little_vec"
;;
-
+#ifdef BFD64
+ mmix-*-*)
+ targ_defvec=bfd_elf64_mmix_vec
+ targ_selvecs=bfd_mmo_vec
+ ;;
+#endif
mn10200-*-*)
targ_defvec=bfd_elf32_mn10200_vec
;;
@@ -701,6 +755,15 @@ case "${targ}" in
targ_underscore=yes
;;
+ openrisc-*-elf)
+ targ_defvec=bfd_elf32_openrisc_vec
+ ;;
+
+ pdp11-*-*)
+ targ_defvec=pdp11_aout_vec
+ targ_underscore=yes
+ ;;
+
pj-*-*)
targ_defvec=bfd_elf32_pj_vec
targ_selvecs="bfd_elf32_pj_vec bfd_elf32_pjl_vec"
@@ -711,15 +774,34 @@ case "${targ}" in
targ_selvecs="bfd_elf32_pjl_vec bfd_elf32_pj_vec bfd_elf32_i386_vec"
;;
- powerpc-*-aix* | powerpc-*-beos*)
+ powerpc-*-aix* | powerpc-*-beos* | rs6000-*-*)
targ_defvec=rs6000coff_vec
- targ_selvecs="rs6000coff64_vec"
+ targ64_selvecs=rs6000coff64_vec
+ case "${targ}" in
+ *-*-aix4.[3456789]* | *-*-aix[56789]*)
+ want64=true;;
+ esac
+ ;;
+#ifdef BFD64
+ powerpc64-*-aix*)
+ targ_defvec=rs6000coff64_vec
+ targ_selvecs=rs6000coff_vec
+ ;;
+ powerpc64-*-elf* | powerpc-*-elf64* | powerpc64-*-linux*)
+ targ_defvec=bfd_elf64_powerpc_vec
+ targ_selvecs="bfd_elf64_powerpcle_vec bfd_elf32_powerpc_vec bfd_elf32_powerpcle_vec rs6000coff_vec rs6000coff64_vec"
+ ;;
+ powerpc64le-*-elf* | powerpcle-*-elf64*)
+ targ_defvec=bfd_elf64_powerpcle_vec
+ targ_selvecs="bfd_elf64_powerpc_vec bfd_elf32_powerpcle_vec bfd_elf32_powerpc_vec rs6000coff_vec rs6000coff64_vec"
;;
+#endif
powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
powerpc-*-chorus* | powerpc-*-vxworks*)
targ_defvec=bfd_elf32_powerpc_vec
targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
+ targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
;;
powerpc-*-macos* | powerpc-*-mpw*)
targ_defvec=pmac_xcoff_vec
@@ -733,6 +815,7 @@ case "${targ}" in
powerpcle-*-rtems*)
targ_defvec=bfd_elf32_powerpcle_vec
targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
+ targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
;;
powerpcle-*-pe | powerpcle-*-winnt* | powerpcle-*-cygwin*)
@@ -740,14 +823,34 @@ case "${targ}" in
targ_selvecs="bfd_powerpcle_pei_vec bfd_powerpc_pei_vec bfd_powerpcle_pe_vec bfd_powerpc_pe_vec"
;;
- rs6000-*-*)
- targ_defvec=rs6000coff_vec
+ s390-*-linux*)
+ targ_defvec=bfd_elf32_s390_vec
+ ;;
+#ifdef BFD64
+ s390x-*-linux*)
+ targ_defvec=bfd_elf64_s390_vec
;;
+#endif
sh-*-linux*)
targ_defvec=bfd_elf32_shblin_vec
targ_selvecs=bfd_elf32_shlin_vec
;;
+ sh*eb-*-linux*)
+ targ_defvec=bfd_elf32_shblin_vec
+ ;;
+ sh*-*-linux*)
+ targ_defvec=bfd_elf32_shlin_vec
+ ;;
+
+ sh*le-*-netbsdelf*)
+ targ_defvec=bfd_elf32_shlnbsd_vec
+ targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec"
+ ;;
+ sh*-*-netbsdelf*)
+ targ_defvec=bfd_elf32_shnbsd_vec
+ targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec"
+ ;;
sh-*-elf* | sh-*-rtemself*)
targ_defvec=bfd_elf32_sh_vec
@@ -895,6 +998,10 @@ case "${targ}" in
targ_defvec=w65_vec
;;
+ xstormy16-*-elf)
+ targ_defvec=bfd_elf32_xstormy16_vec
+ ;;
+
z8k*-*-*)
targ_defvec=z8kcoff_vec
targ_underscore=yes
@@ -926,6 +1033,12 @@ case "${targ}" in
;;
esac
+case "${host64}${want64}" in
+ *true*)
+ targ_selvecs="${targ_selvecs} ${targ64_selvecs}"
+ ;;
+esac
+
# If we support any ELF target, then automatically add support for the
# generic ELF targets. This permits an objdump with some ELF support
# to be used on an arbitrary ELF file for anything other than
diff --git a/contrib/binutils/bfd/configure b/contrib/binutils/bfd/configure
index 75270e2..2176f31 100755
--- a/contrib/binutils/bfd/configure
+++ b/contrib/binutils/bfd/configure
@@ -57,7 +57,6 @@ program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
-sitefile=
srcdir=
target=NONE
verbose=
@@ -172,7 +171,6 @@ Configuration:
--help print this message
--no-create do not create output files
--quiet, --silent do not print \`checking...' messages
- --site-file=FILE use FILE as the site file
--version print the version of autoconf that created configure
Directory and file names:
--prefix=PREFIX install architecture-independent files in PREFIX
@@ -343,11 +341,6 @@ EOF
-site=* | --site=* | --sit=*)
site="$ac_optarg" ;;
- -site-file | --site-file | --site-fil | --site-fi | --site-f)
- ac_prev=sitefile ;;
- -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
- sitefile="$ac_optarg" ;;
-
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
@@ -513,16 +506,12 @@ fi
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
# Prefer explicitly selected file to automatically selected ones.
-if test -z "$sitefile"; then
- if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
fi
-else
- CONFIG_SITE="$sitefile"
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
@@ -561,12 +550,12 @@ else
fi
echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:565: checking for Cygwin environment" >&5
+echo "configure:554: checking for Cygwin environment" >&5
if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 570 "configure"
+#line 559 "configure"
#include "confdefs.h"
int main() {
@@ -577,7 +566,7 @@ int main() {
return __CYGWIN__;
; return 0; }
EOF
-if { (eval echo configure:581: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:570: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cygwin=yes
else
@@ -594,19 +583,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6
CYGWIN=
test "$ac_cv_cygwin" = yes && CYGWIN=yes
echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:598: checking for mingw32 environment" >&5
+echo "configure:587: checking for mingw32 environment" >&5
if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 603 "configure"
+#line 592 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
-if { (eval echo configure:610: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:599: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
@@ -671,7 +660,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:675: checking host system type" >&5
+echo "configure:664: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -692,7 +681,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$host" 1>&6
echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:696: checking target system type" >&5
+echo "configure:685: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@@ -710,7 +699,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$target" 1>&6
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:714: checking build system type" >&5
+echo "configure:703: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -735,7 +724,7 @@ test "$host_alias" != "$target_alias" &&
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:739: checking for $ac_word" >&5
+echo "configure:728: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -765,7 +754,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:769: checking for $ac_word" >&5
+echo "configure:758: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -816,7 +805,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:820: checking for $ac_word" >&5
+echo "configure:809: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -848,7 +837,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:852: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:841: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -859,12 +848,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 863 "configure"
+#line 852 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:868: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -890,12 +879,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:894: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:883: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:899: checking whether we are using GNU C" >&5
+echo "configure:888: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -904,7 +893,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:908: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:897: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -923,7 +912,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:927: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:916: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -955,7 +944,7 @@ else
fi
echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:959: checking for POSIXized ISC" >&5
+echo "configure:948: checking for POSIXized ISC" >&5
if test -d /etc/conf/kconfig.d &&
grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
then
@@ -988,7 +977,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:992: checking for a BSD compatible install" >&5
+echo "configure:981: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1041,7 +1030,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:1045: checking whether build environment is sane" >&5
+echo "configure:1034: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
@@ -1098,7 +1087,7 @@ test "$program_suffix" != NONE &&
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1102: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1091: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1127,7 +1116,7 @@ fi
PACKAGE=bfd
-VERSION=2.11.2
+VERSION=2.11.93
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
{ echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
@@ -1144,7 +1133,7 @@ EOF
missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:1148: checking for working aclocal" >&5
+echo "configure:1137: checking for working aclocal" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1157,7 +1146,7 @@ else
fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1161: checking for working autoconf" >&5
+echo "configure:1150: checking for working autoconf" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1170,7 +1159,7 @@ else
fi
echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1174: checking for working automake" >&5
+echo "configure:1163: checking for working automake" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1183,7 +1172,7 @@ else
fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1187: checking for working autoheader" >&5
+echo "configure:1176: checking for working autoheader" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1196,7 +1185,7 @@ else
fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1200: checking for working makeinfo" >&5
+echo "configure:1189: checking for working makeinfo" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1209,6 +1198,19 @@ else
fi
+# Uncomment the next line to remove the date from the reported bfd version
+#is_release=y
+
+bfd_version=`echo "${VERSION}" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$/\1\2\3\4\5/'`
+
+bfd_version_string="\"${VERSION}\""
+bfd_version_date=`sed -e 's/.*DATE //' < ${srcdir}/version.h`
+if test x${is_release} = x; then
+ bfd_version_string="\"${VERSION} ${bfd_version_date}\""
+fi
+
+
+
if test $host != $build; then
ac_tool_prefix=${host_alias}-
@@ -1219,7 +1221,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1223: checking for $ac_word" >&5
+echo "configure:1225: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1251,7 +1253,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1255: checking for $ac_word" >&5
+echo "configure:1257: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1283,7 +1285,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1287: checking for $ac_word" >&5
+echo "configure:1289: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1320,7 +1322,7 @@ fi
if test "${enable_shared+set}" = set; then
enableval="$enable_shared"
p=${PACKAGE-default}
-case "$enableval" in
+case $enableval in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
@@ -1344,7 +1346,7 @@ fi
if test "${enable_static+set}" = set; then
enableval="$enable_static"
p=${PACKAGE-default}
-case "$enableval" in
+case $enableval in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
@@ -1367,7 +1369,7 @@ fi
if test "${enable_fast_install+set}" = set; then
enableval="$enable_fast_install"
p=${PACKAGE-default}
-case "$enableval" in
+case $enableval in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
@@ -1395,10 +1397,10 @@ else
fi
ac_prog=ld
-if test "$ac_cv_prog_gcc" = yes; then
+if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:1402: checking for ld used by GCC" >&5
+echo "configure:1404: checking for ld used by GCC" >&5
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
@@ -1406,7 +1408,7 @@ echo "configure:1402: checking for ld used by GCC" >&5
*)
ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
esac
- case "$ac_prog" in
+ case $ac_prog in
# Accept absolute paths.
[\\/]* | [A-Za-z]:[\\/]*)
re_direlt='/[^/][^/]*/\.\./'
@@ -1428,12 +1430,12 @@ echo "configure:1402: checking for ld used by GCC" >&5
esac
elif test "$with_gnu_ld" = yes; then
echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1432: checking for GNU ld" >&5
+echo "configure:1434: checking for GNU ld" >&5
else
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1435: checking for non-GNU ld" >&5
+echo "configure:1437: checking for non-GNU ld" >&5
fi
-if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
+if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -z "$LD"; then
@@ -1441,11 +1443,11 @@ else
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
- ac_cv_path_LD="$ac_dir/$ac_prog"
+ lt_cv_path_LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some GNU ld's only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
- if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
test "$with_gnu_ld" != no && break
else
test "$with_gnu_ld" != yes && break
@@ -1454,11 +1456,11 @@ else
done
IFS="$ac_save_ifs"
else
- ac_cv_path_LD="$LD" # Let the user override the test with a path.
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
fi
fi
-LD="$ac_cv_path_LD"
+LD="$lt_cv_path_LD"
if test -n "$LD"; then
echo "$ac_t""$LD" 1>&6
else
@@ -1466,24 +1468,24 @@ else
fi
test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1470: checking if the linker ($LD) is GNU ld" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
+echo "configure:1472: checking if the linker ($LD) is GNU ld" >&5
+if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# I'd rather use --version here, but apparently some GNU ld's only accept -v.
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
- ac_cv_prog_gnu_ld=yes
+ lt_cv_prog_gnu_ld=yes
else
- ac_cv_prog_gnu_ld=no
+ lt_cv_prog_gnu_ld=no
fi
fi
-echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6
-with_gnu_ld=$ac_cv_prog_gnu_ld
+echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6
+with_gnu_ld=$lt_cv_prog_gnu_ld
echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
-echo "configure:1487: checking for $LD option to reload object files" >&5
+echo "configure:1489: checking for $LD option to reload object files" >&5
if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1495,13 +1497,13 @@ reload_flag=$lt_cv_ld_reload_flag
test -n "$reload_flag" && reload_flag=" $reload_flag"
echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1499: checking for BSD-compatible nm" >&5
-if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
+echo "configure:1501: checking for BSD-compatible nm" >&5
+if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$NM"; then
# Let the user override the test.
- ac_cv_path_NM="$NM"
+ lt_cv_path_NM="$NM"
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
@@ -1513,27 +1515,27 @@ else
# nm: unknown option "B" ignored
# Tru64's nm complains that /dev/null is an invalid object file
if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
- ac_cv_path_NM="$tmp_nm -B"
+ lt_cv_path_NM="$tmp_nm -B"
break
elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
- ac_cv_path_NM="$tmp_nm -p"
+ lt_cv_path_NM="$tmp_nm -p"
break
else
- ac_cv_path_NM=${ac_cv_path_NM="$tmp_nm"} # keep the first match, but
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
continue # so that we can try to find one that supports BSD flags
fi
fi
done
IFS="$ac_save_ifs"
- test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
fi
fi
-NM="$ac_cv_path_NM"
+NM="$lt_cv_path_NM"
echo "$ac_t""$NM" 1>&6
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1537: checking whether ln -s works" >&5
+echo "configure:1539: checking whether ln -s works" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1554,7 +1556,7 @@ else
fi
echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
-echo "configure:1558: checking how to recognise dependant libraries" >&5
+echo "configure:1560: checking how to recognise dependant libraries" >&5
if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1572,8 +1574,8 @@ lt_cv_deplibs_check_method='unknown'
# If you have `file' or equivalent on your system and you're not sure
# whether `pass_all' will *always* work, you probably want this one.
-case "$host_os" in
-aix4*)
+case $host_os in
+aix*)
lt_cv_deplibs_check_method=pass_all
;;
@@ -1582,8 +1584,8 @@ beos*)
;;
bsdi4*)
- lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
- lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
lt_cv_file_magic_test_file=/shlib/libc.so
;;
@@ -1592,14 +1594,27 @@ cygwin* | mingw* |pw32*)
lt_cv_file_magic_cmd='$OBJDUMP -f'
;;
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ case "$host_os" in
+ rhapsody* | darwin1.012)
+ lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System'
+ ;;
+ *) # Darwin 1.3 on
+ lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+ ;;
+ esac
+ ;;
+
freebsd* )
if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
- case "$host_cpu" in
+ case $host_cpu in
i*86 )
# Not sure whether the presence of OpenBSD here was a mistake.
# Let's accept both of them until this is cleared up.
- lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
- lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
;;
esac
@@ -1612,29 +1627,28 @@ gnu*)
lt_cv_deplibs_check_method=pass_all
;;
-hpux10.20*)
- # TODO: Does this work for hpux-11 too?
- lt_cv_deplibs_check_method='file_magic (s0-90-90-9|PA-RISC0-9.0-9) shared library'
+hpux10.20*|hpux11*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
lt_cv_file_magic_cmd=/usr/bin/file
lt_cv_file_magic_test_file=/usr/lib/libc.sl
;;
irix5* | irix6*)
- case "$host_os" in
+ case $host_os in
irix5*)
# this will be overridden with pass_all, but let us keep it just in case
lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
;;
*)
- case "$LD" in
+ case $LD in
*-32|*"-32 ") libmagic=32-bit;;
*-n32|*"-n32 ") libmagic=N32;;
*-64|*"-64 ") libmagic=64-bit;;
*) libmagic=never-match;;
esac
# this will be overridden with pass_all, but let us keep it just in case
- lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
- ;;
+ lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
+ ;;
esac
lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
lt_cv_deplibs_check_method=pass_all
@@ -1642,25 +1656,30 @@ irix5* | irix6*)
# This must be Linux ELF.
linux-gnu*)
- case "$host_cpu" in
- alpha* | i*86 | powerpc* | sparc* | ia64* )
+ case $host_cpu in
+ alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* )
lt_cv_deplibs_check_method=pass_all ;;
*)
# glibc up to 2.1.1 does not perform some relocations on ARM
- lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
- esac
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
+ esac
lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
;;
netbsd*)
- if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then :
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
else
- lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
- lt_cv_file_magic_cmd='/usr/bin/file -L'
- lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'
fi
;;
+newsos6)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
osf3* | osf4* | osf5*)
# this will be overridden with pass_all, but let us keep it just in case
lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
@@ -1677,14 +1696,18 @@ solaris*)
lt_cv_file_magic_test_file=/lib/libc.so
;;
+sysv5uw[78]* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
- case "$host_vendor" in
+ case $host_vendor in
ncr)
lt_cv_deplibs_check_method=pass_all
;;
motorola)
- lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
- lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
;;
esac
;;
@@ -1697,13 +1720,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:1701: checking for object suffix" >&5
+echo "configure:1724: checking for object suffix" >&5
if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
rm -f conftest*
echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:1707: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1730: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
for ac_file in conftest.*; do
case $ac_file in
*.c) ;;
@@ -1723,7 +1746,7 @@ ac_objext=$ac_cv_objext
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1727: checking for executable suffix" >&5
+echo "configure:1750: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1733,10 +1756,10 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:1737: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:1760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
- *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+ *.c | *.o | *.obj) ;;
*) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
esac
done
@@ -1756,15 +1779,15 @@ ac_exeext=$EXEEXT
# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
# Only perform the check for file, if the check method requires it
-case "$deplibs_check_method" in
+case $deplibs_check_method in
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
-echo "configure:1764: checking for ${ac_tool_prefix}file" >&5
+echo "configure:1787: checking for ${ac_tool_prefix}file" >&5
if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- case "$MAGIC_CMD" in
+ case $MAGIC_CMD in
/*)
lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
;;
@@ -1780,7 +1803,7 @@ else
if test -f $ac_dir/${ac_tool_prefix}file; then
lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
if test -n "$file_magic_test_file"; then
- case "$deplibs_check_method" in
+ case $deplibs_check_method in
"file_magic "*)
file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
@@ -1822,11 +1845,11 @@ fi
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
echo $ac_n "checking for file""... $ac_c" 1>&6
-echo "configure:1826: checking for file" >&5
+echo "configure:1849: checking for file" >&5
if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- case "$MAGIC_CMD" in
+ case $MAGIC_CMD in
/*)
lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
;;
@@ -1842,7 +1865,7 @@ else
if test -f $ac_dir/file; then
lt_cv_path_MAGIC_CMD="$ac_dir/file"
if test -n "$file_magic_test_file"; then
- case "$deplibs_check_method" in
+ case $deplibs_check_method in
"file_magic "*)
file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
@@ -1893,7 +1916,7 @@ esac
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1897: checking for $ac_word" >&5
+echo "configure:1920: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1925,7 +1948,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1929: checking for $ac_word" >&5
+echo "configure:1952: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1960,7 +1983,7 @@ fi
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1964: checking for $ac_word" >&5
+echo "configure:1987: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1992,7 +2015,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1996: checking for $ac_word" >&5
+echo "configure:2019: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2030,8 +2053,8 @@ libtool_flags="--cache-file=$cache_file"
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
-test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
-test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
@@ -2056,12 +2079,12 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
# Some flags need to be propagated to the compiler or linker for good
# libtool support.
-case "$host" in
+case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 2063 "configure"' > conftest.$ac_ext
- if { (eval echo configure:2064: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- case "`/usr/bin/file conftest.o`" in
+ echo '#line 2086 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:2087: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ case `/usr/bin/file conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -32"
;;
@@ -2081,7 +2104,7 @@ case "$host" in
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:2085: checking whether the C compiler needs -belf" >&5
+echo "configure:2108: checking whether the C compiler needs -belf" >&5
if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2094,14 +2117,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
-#line 2098 "configure"
+#line 2121 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:2105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lt_cv_cc_needs_belf=yes
else
@@ -2211,7 +2234,6 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
# clobbered by the next message.
exec 5>>./config.log
-
@@ -2260,7 +2282,7 @@ else
want_mmap=false
fi
-build_warnings="-W -Wall"
+build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
# Check whether --enable-build-warnings or --disable-build-warnings was given.
if test "${enable_build_warnings+set}" = set; then
enableval="$enable_build_warnings"
@@ -2290,28 +2312,9 @@ fi
if test -z "$target" ; then
{ echo "configure: error: Unrecognized target system type; please check config.sub." 1>&2; exit 1; }
fi
-if test "$program_transform_name" = s,x,x,; then
- program_transform_name=
-else
- # Double any \ or $. echo might interpret backslashes.
- cat <<\EOF_SED > conftestsed
-s,\\,\\\\,g; s,\$,$$,g
-EOF_SED
- program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
- rm -f conftestsed
-fi
-test "$program_prefix" != NONE &&
- program_transform_name="s,^,${program_prefix},; $program_transform_name"
-# Use a double $ so make ignores it.
-test "$program_suffix" != NONE &&
- program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
-
-# sed with no file args requires a program.
-test "$program_transform_name" = "" && program_transform_name="s,x,x,"
-
echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:2315: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:2318: checking whether to enable maintainer-specific portions of Makefiles" >&5
# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
if test "${enable_maintainer_mode+set}" = set; then
enableval="$enable_maintainer_mode"
@@ -2336,7 +2339,7 @@ fi
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:2340: checking for executable suffix" >&5
+echo "configure:2343: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2346,10 +2349,10 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:2350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:2353: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
- *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+ *.c | *.o | *.obj) ;;
*) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
esac
done
@@ -2369,13 +2372,14 @@ ac_exeext=$EXEEXT
host64=false
target64=false
+bfd_default_target_size=32
# host stuff:
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2379: checking for $ac_word" >&5
+echo "configure:2383: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2405,7 +2409,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2409: checking for $ac_word" >&5
+echo "configure:2413: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2456,7 +2460,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2460: checking for $ac_word" >&5
+echo "configure:2464: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2488,7 +2492,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2492: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:2496: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -2499,12 +2503,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 2503 "configure"
+#line 2507 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:2508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2512: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -2530,12 +2534,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:2534: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2538: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:2539: checking whether we are using GNU C" >&5
+echo "configure:2543: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2544,7 +2548,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2548: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2552: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -2563,7 +2567,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2567: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2571: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2595,9 +2599,9 @@ else
fi
-ALL_LINGUAS=
+ALL_LINGUAS="fr tr ja es sv"
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2601: checking how to run the C preprocessor" >&5
+echo "configure:2605: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -2612,13 +2616,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 2616 "configure"
+#line 2620 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2622: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2626: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -2629,13 +2633,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 2633 "configure"
+#line 2637 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2639: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2643: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -2646,13 +2650,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 2650 "configure"
+#line 2654 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2656: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2660: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -2679,7 +2683,7 @@ echo "$ac_t""$CPP" 1>&6
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2683: checking for $ac_word" >&5
+echo "configure:2687: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2707,12 +2711,12 @@ else
fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2711: checking for ANSI C header files" >&5
+echo "configure:2715: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2716 "configure"
+#line 2720 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -2720,7 +2724,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2724: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2728: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2737,7 +2741,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 2741 "configure"
+#line 2745 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -2755,7 +2759,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 2759 "configure"
+#line 2763 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -2776,7 +2780,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 2780 "configure"
+#line 2784 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2787,7 +2791,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:2791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -2811,12 +2815,12 @@ EOF
fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2815: checking for working const" >&5
+echo "configure:2819: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2820 "configure"
+#line 2824 "configure"
#include "confdefs.h"
int main() {
@@ -2865,7 +2869,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:2869: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2873: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -2886,21 +2890,21 @@ EOF
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2890: checking for inline" >&5
+echo "configure:2894: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
-#line 2897 "configure"
+#line 2901 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:2904: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2908: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@@ -2926,12 +2930,12 @@ EOF
esac
echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:2930: checking for off_t" >&5
+echo "configure:2934: checking for off_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2935 "configure"
+#line 2939 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2959,12 +2963,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2963: checking for size_t" >&5
+echo "configure:2967: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2968 "configure"
+#line 2972 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2994,19 +2998,19 @@ fi
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:2998: checking for working alloca.h" >&5
+echo "configure:3002: checking for working alloca.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3003 "configure"
+#line 3007 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:3010: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3014: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_header_alloca_h=yes
else
@@ -3027,12 +3031,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:3031: checking for alloca" >&5
+echo "configure:3035: checking for alloca" >&5
if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3036 "configure"
+#line 3040 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -3060,7 +3064,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:3064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_func_alloca_works=yes
else
@@ -3092,12 +3096,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:3096: checking whether alloca needs Cray hooks" >&5
+echo "configure:3100: checking whether alloca needs Cray hooks" >&5
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3101 "configure"
+#line 3105 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -3122,12 +3126,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3126: checking for $ac_func" >&5
+echo "configure:3130: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3131 "configure"
+#line 3135 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3150,7 +3154,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3158: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3177,7 +3181,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:3181: checking stack direction for C alloca" >&5
+echo "configure:3185: checking stack direction for C alloca" >&5
if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3185,7 +3189,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 3189 "configure"
+#line 3193 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -3204,7 +3208,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:3208: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_stack_direction=1
else
@@ -3229,17 +3233,17 @@ for ac_hdr in unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3233: checking for $ac_hdr" >&5
+echo "configure:3237: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3238 "configure"
+#line 3242 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3243: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3247: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -3268,12 +3272,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3272: checking for $ac_func" >&5
+echo "configure:3276: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3277 "configure"
+#line 3281 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3296,7 +3300,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3300: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3321,7 +3325,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:3325: checking for working mmap" >&5
+echo "configure:3329: checking for working mmap" >&5
if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3329,7 +3333,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 3333 "configure"
+#line 3337 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -3469,7 +3473,7 @@ main()
}
EOF
-if { (eval echo configure:3473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_mmap_fixed_mapped=yes
else
@@ -3497,17 +3501,17 @@ unistd.h values.h sys/param.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3501: checking for $ac_hdr" >&5
+echo "configure:3505: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3506 "configure"
+#line 3510 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3511: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3515: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -3537,12 +3541,12 @@ done
__argz_count __argz_stringify __argz_next
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3541: checking for $ac_func" >&5
+echo "configure:3545: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3546 "configure"
+#line 3550 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3565,7 +3569,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3569: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3573: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3594,12 +3598,12 @@ done
for ac_func in stpcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3598: checking for $ac_func" >&5
+echo "configure:3602: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3603 "configure"
+#line 3607 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3622,7 +3626,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3626: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3656,19 +3660,19 @@ EOF
if test $ac_cv_header_locale_h = yes; then
echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:3660: checking for LC_MESSAGES" >&5
+echo "configure:3664: checking for LC_MESSAGES" >&5
if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3665 "configure"
+#line 3669 "configure"
#include "confdefs.h"
#include <locale.h>
int main() {
return LC_MESSAGES
; return 0; }
EOF
-if { (eval echo configure:3672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3676: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
am_cv_val_LC_MESSAGES=yes
else
@@ -3689,7 +3693,7 @@ EOF
fi
fi
echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
-echo "configure:3693: checking whether NLS is requested" >&5
+echo "configure:3697: checking whether NLS is requested" >&5
# Check whether --enable-nls or --disable-nls was given.
if test "${enable_nls+set}" = set; then
enableval="$enable_nls"
@@ -3709,7 +3713,7 @@ fi
EOF
echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
-echo "configure:3713: checking whether included gettext is requested" >&5
+echo "configure:3717: checking whether included gettext is requested" >&5
# Check whether --with-included-gettext or --without-included-gettext was given.
if test "${with_included_gettext+set}" = set; then
withval="$with_included_gettext"
@@ -3728,17 +3732,17 @@ fi
ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
-echo "configure:3732: checking for libintl.h" >&5
+echo "configure:3736: checking for libintl.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3737 "configure"
+#line 3741 "configure"
#include "confdefs.h"
#include <libintl.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3742: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3746: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -3755,19 +3759,19 @@ fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6
-echo "configure:3759: checking for gettext in libc" >&5
+echo "configure:3763: checking for gettext in libc" >&5
if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3764 "configure"
+#line 3768 "configure"
#include "confdefs.h"
#include <libintl.h>
int main() {
return (int) gettext ("")
; return 0; }
EOF
-if { (eval echo configure:3771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3775: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
gt_cv_func_gettext_libc=yes
else
@@ -3783,7 +3787,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6
if test "$gt_cv_func_gettext_libc" != "yes"; then
echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
-echo "configure:3787: checking for bindtextdomain in -lintl" >&5
+echo "configure:3791: checking for bindtextdomain in -lintl" >&5
ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3791,7 +3795,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lintl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3795 "configure"
+#line 3799 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3802,7 +3806,7 @@ int main() {
bindtextdomain()
; return 0; }
EOF
-if { (eval echo configure:3806: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3810: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3818,19 +3822,19 @@ fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6
-echo "configure:3822: checking for gettext in libintl" >&5
+echo "configure:3826: checking for gettext in libintl" >&5
if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3827 "configure"
+#line 3831 "configure"
#include "confdefs.h"
int main() {
return (int) gettext ("")
; return 0; }
EOF
-if { (eval echo configure:3834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
gt_cv_func_gettext_libintl=yes
else
@@ -3858,7 +3862,7 @@ EOF
# Extract the first word of "msgfmt", so it can be a program name with args.
set dummy msgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3862: checking for $ac_word" >&5
+echo "configure:3866: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3892,12 +3896,12 @@ fi
for ac_func in dcgettext
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3896: checking for $ac_func" >&5
+echo "configure:3900: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3901 "configure"
+#line 3905 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3920,7 +3924,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3924: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3947,7 +3951,7 @@ done
# Extract the first word of "gmsgfmt", so it can be a program name with args.
set dummy gmsgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3951: checking for $ac_word" >&5
+echo "configure:3955: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3983,7 +3987,7 @@ fi
# Extract the first word of "xgettext", so it can be a program name with args.
set dummy xgettext; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3987: checking for $ac_word" >&5
+echo "configure:3991: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4015,7 +4019,7 @@ else
fi
cat > conftest.$ac_ext <<EOF
-#line 4019 "configure"
+#line 4023 "configure"
#include "confdefs.h"
int main() {
@@ -4023,7 +4027,7 @@ extern int _nl_msg_cat_cntr;
return _nl_msg_cat_cntr
; return 0; }
EOF
-if { (eval echo configure:4027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4031: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
CATOBJEXT=.gmo
DATADIRNAME=share
@@ -4055,7 +4059,7 @@ fi
# Extract the first word of "msgfmt", so it can be a program name with args.
set dummy msgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4059: checking for $ac_word" >&5
+echo "configure:4063: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4089,7 +4093,7 @@ fi
# Extract the first word of "gmsgfmt", so it can be a program name with args.
set dummy gmsgfmt; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4093: checking for $ac_word" >&5
+echo "configure:4097: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4125,7 +4129,7 @@ fi
# Extract the first word of "xgettext", so it can be a program name with args.
set dummy xgettext; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4129: checking for $ac_word" >&5
+echo "configure:4133: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4215,7 +4219,7 @@ fi
LINGUAS=
else
echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
-echo "configure:4219: checking for catalogs to be installed" >&5
+echo "configure:4223: checking for catalogs to be installed" >&5
NEW_LINGUAS=
for lang in ${LINGUAS=$ALL_LINGUAS}; do
case "$ALL_LINGUAS" in
@@ -4243,17 +4247,17 @@ echo "configure:4219: checking for catalogs to be installed" >&5
if test "$CATOBJEXT" = ".cat"; then
ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6
-echo "configure:4247: checking for linux/version.h" >&5
+echo "configure:4251: checking for linux/version.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4252 "configure"
+#line 4256 "configure"
#include "confdefs.h"
#include <linux/version.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4257: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4261: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4298,7 +4302,7 @@ fi
l=
- if test -d $srcdir/po; then
+ if test -f $srcdir/po/POTFILES.in; then
test -d po || mkdir po
if test "x$srcdir" != "x."; then
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
@@ -4331,7 +4335,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:4335: checking for a BSD compatible install" >&5
+echo "configure:4339: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4414,7 +4418,7 @@ if test "x$cross_compiling" = "xno"; then
EXEEXT_FOR_BUILD='$(EXEEXT)'
else
echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6
-echo "configure:4418: checking for build system executable suffix" >&5
+echo "configure:4422: checking for build system executable suffix" >&5
if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4442,17 +4446,17 @@ for ac_hdr in stddef.h string.h strings.h stdlib.h time.h unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4446: checking for $ac_hdr" >&5
+echo "configure:4450: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4451 "configure"
+#line 4455 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4456: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4460: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4482,17 +4486,17 @@ for ac_hdr in fcntl.h sys/file.h sys/time.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4486: checking for $ac_hdr" >&5
+echo "configure:4490: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4491 "configure"
+#line 4495 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4496: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4500: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4519,12 +4523,12 @@ fi
done
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:4523: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:4527: checking whether time.h and sys/time.h may both be included" >&5
if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4528 "configure"
+#line 4532 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
@@ -4533,7 +4537,7 @@ int main() {
struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:4537: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4541: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
@@ -4558,12 +4562,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:4562: checking for $ac_hdr that defines DIR" >&5
+echo "configure:4566: checking for $ac_hdr that defines DIR" >&5
if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4567 "configure"
+#line 4571 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
@@ -4571,7 +4575,7 @@ int main() {
DIR *dirp = 0;
; return 0; }
EOF
-if { (eval echo configure:4575: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4579: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=yes"
else
@@ -4596,7 +4600,7 @@ done
# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
if test $ac_header_dirent = dirent.h; then
echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:4600: checking for opendir in -ldir" >&5
+echo "configure:4604: checking for opendir in -ldir" >&5
ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4604,7 +4608,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4608 "configure"
+#line 4612 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4615,7 +4619,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:4619: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4637,7 +4641,7 @@ fi
else
echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:4641: checking for opendir in -lx" >&5
+echo "configure:4645: checking for opendir in -lx" >&5
ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4645,7 +4649,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4649 "configure"
+#line 4653 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4656,7 +4660,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:4660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4681,12 +4685,12 @@ fi
for ac_func in fcntl getpagesize setitimer sysconf fdopen getuid getgid
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4685: checking for $ac_func" >&5
+echo "configure:4689: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4690 "configure"
+#line 4694 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4709,7 +4713,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4744,12 +4748,12 @@ EOF
esac
echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6
-echo "configure:4748: checking whether strstr must be declared" >&5
+echo "configure:4752: checking whether strstr must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4753 "configure"
+#line 4757 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -4770,7 +4774,7 @@ int main() {
char *(*pfn) = (char *(*)) strstr
; return 0; }
EOF
-if { (eval echo configure:4774: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4778: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_strstr=no
else
@@ -4791,12 +4795,12 @@ EOF
fi
echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6
-echo "configure:4795: checking whether malloc must be declared" >&5
+echo "configure:4799: checking whether malloc must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4800 "configure"
+#line 4804 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -4817,7 +4821,7 @@ int main() {
char *(*pfn) = (char *(*)) malloc
; return 0; }
EOF
-if { (eval echo configure:4821: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4825: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_malloc=no
else
@@ -4838,12 +4842,12 @@ EOF
fi
echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6
-echo "configure:4842: checking whether realloc must be declared" >&5
+echo "configure:4846: checking whether realloc must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4847 "configure"
+#line 4851 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -4864,7 +4868,7 @@ int main() {
char *(*pfn) = (char *(*)) realloc
; return 0; }
EOF
-if { (eval echo configure:4868: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4872: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_realloc=no
else
@@ -4885,12 +4889,12 @@ EOF
fi
echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6
-echo "configure:4889: checking whether free must be declared" >&5
+echo "configure:4893: checking whether free must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4894 "configure"
+#line 4898 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -4911,7 +4915,7 @@ int main() {
char *(*pfn) = (char *(*)) free
; return 0; }
EOF
-if { (eval echo configure:4915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4919: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_free=no
else
@@ -4932,12 +4936,12 @@ EOF
fi
echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6
-echo "configure:4936: checking whether getenv must be declared" >&5
+echo "configure:4940: checking whether getenv must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4941 "configure"
+#line 4945 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -4958,7 +4962,7 @@ int main() {
char *(*pfn) = (char *(*)) getenv
; return 0; }
EOF
-if { (eval echo configure:4962: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_getenv=no
else
@@ -4995,13 +4999,14 @@ if test "${target}" = "${host}"; then
alpha*-*-netbsd*) COREFILE=netbsd-core.lo ;;
alpha*-*-*) COREFILE=osf-core.lo ;;
arm-*-freebsd*) COREFILE='' ;;
+ arm-*-netbsd*) COREFILE=netbsd-core.lo ;;
arm-*-riscix) COREFILE=trad-core.lo ;;
hppa*-*-hpux*) COREFILE=hpux-core.lo ;;
hppa*-*-hiux*) COREFILE=hpux-core.lo ;;
hppa*-*-mpeix*) COREFILE=hpux-core.lo ;;
hppa*-*-bsd*) COREFILE="hpux-core.lo hppabsd-core.lo"
COREFLAG="-DHPUX_CORE -DHPPABSD_CORE" ;;
- i370-*-*)
+ i370-*-*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i370linux.h"'
;;
@@ -5015,6 +5020,9 @@ if test "${target}" = "${host}"; then
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/symmetry.h"'
;;
+ i[3456]86-*-bsdi)
+ COREFILE=
+ ;;
i[3456]86-*-bsd* | i[34567]86-*-freebsd[1234] | i[34567]86-*-freebsd[1234]\.* | i[34567]86-*-freebsd*aout*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386bsd.h"'
@@ -5136,6 +5144,8 @@ if test "${target}" = "${host}"; then
powerpc-*-freebsd*) COREFILE='' ;;
powerpc-*-netbsd*) COREFILE=netbsd-core.lo ;;
powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;;
+ s390*-*-*) COREFILE=trad-core.lo ;;
+ sh*-*-netbsd*) COREFILE=netbsd-core.lo ;;
sparc-*-netbsd* | sparc-*-openbsd*)
COREFILE=netbsd-core.lo
;;
@@ -5155,6 +5165,7 @@ if test "${target}" = "${host}"; then
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxbsd.h"'
;;
+ x86_64-*-netbsd*) COREFILE=netbsd-core.lo ;;
esac
case "$COREFILE" in
@@ -5177,17 +5188,17 @@ if test "${target}" = "${host}"; then
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5181: checking for $ac_hdr" >&5
+echo "configure:5192: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5186 "configure"
+#line 5197 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5191: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5202: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5215,12 +5226,12 @@ done
if test "$ac_cv_header_sys_procfs_h" = yes; then
echo $ac_n "checking for prstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5219: checking for prstatus_t in sys/procfs.h" >&5
+echo "configure:5230: checking for prstatus_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5224 "configure"
+#line 5235 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5229,7 +5240,7 @@ int main() {
prstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:5233: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5244: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_prstatus_t=yes
else
@@ -5251,12 +5262,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus_t" 1>&6
echo $ac_n "checking for prstatus32_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5255: checking for prstatus32_t in sys/procfs.h" >&5
+echo "configure:5266: checking for prstatus32_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5260 "configure"
+#line 5271 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5265,7 +5276,7 @@ int main() {
prstatus32_t avar
; return 0; }
EOF
-if { (eval echo configure:5269: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5280: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_prstatus32_t=yes
else
@@ -5287,12 +5298,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus32_t" 1>&6
echo $ac_n "checking for prstatus_t.pr_who in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5291: checking for prstatus_t.pr_who in sys/procfs.h" >&5
+echo "configure:5302: checking for prstatus_t.pr_who in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5296 "configure"
+#line 5307 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5301,7 +5312,7 @@ int main() {
prstatus_t avar; void* aref = (void*) &avar.pr_who
; return 0; }
EOF
-if { (eval echo configure:5305: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5316: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=yes
else
@@ -5323,12 +5334,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" 1>&6
echo $ac_n "checking for prstatus32_t.pr_who in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5327: checking for prstatus32_t.pr_who in sys/procfs.h" >&5
+echo "configure:5338: checking for prstatus32_t.pr_who in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5332 "configure"
+#line 5343 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5337,7 +5348,7 @@ int main() {
prstatus32_t avar; void* aref = (void*) &avar.pr_who
; return 0; }
EOF
-if { (eval echo configure:5341: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5352: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=yes
else
@@ -5359,12 +5370,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" 1>&6
echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5363: checking for pstatus_t in sys/procfs.h" >&5
+echo "configure:5374: checking for pstatus_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5368 "configure"
+#line 5379 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5373,7 +5384,7 @@ int main() {
pstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:5377: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5388: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_pstatus_t=yes
else
@@ -5395,12 +5406,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6
echo $ac_n "checking for pxstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5399: checking for pxstatus_t in sys/procfs.h" >&5
+echo "configure:5410: checking for pxstatus_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pxstatus_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5404 "configure"
+#line 5415 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5409,7 +5420,7 @@ int main() {
pxstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:5413: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5424: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_pxstatus_t=yes
else
@@ -5431,12 +5442,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_pxstatus_t" 1>&6
echo $ac_n "checking for pstatus32_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5435: checking for pstatus32_t in sys/procfs.h" >&5
+echo "configure:5446: checking for pstatus32_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5440 "configure"
+#line 5451 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5445,7 +5456,7 @@ int main() {
pstatus32_t avar
; return 0; }
EOF
-if { (eval echo configure:5449: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5460: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_pstatus32_t=yes
else
@@ -5467,12 +5478,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus32_t" 1>&6
echo $ac_n "checking for prpsinfo_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5471: checking for prpsinfo_t in sys/procfs.h" >&5
+echo "configure:5482: checking for prpsinfo_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5476 "configure"
+#line 5487 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5481,7 +5492,7 @@ int main() {
prpsinfo_t avar
; return 0; }
EOF
-if { (eval echo configure:5485: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5496: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_prpsinfo_t=yes
else
@@ -5503,12 +5514,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo_t" 1>&6
echo $ac_n "checking for prpsinfo32_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5507: checking for prpsinfo32_t in sys/procfs.h" >&5
+echo "configure:5518: checking for prpsinfo32_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5512 "configure"
+#line 5523 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5517,7 +5528,7 @@ int main() {
prpsinfo32_t avar
; return 0; }
EOF
-if { (eval echo configure:5521: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5532: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes
else
@@ -5539,12 +5550,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo32_t" 1>&6
echo $ac_n "checking for psinfo_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5543: checking for psinfo_t in sys/procfs.h" >&5
+echo "configure:5554: checking for psinfo_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5548 "configure"
+#line 5559 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5553,7 +5564,7 @@ int main() {
psinfo_t avar
; return 0; }
EOF
-if { (eval echo configure:5557: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5568: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_psinfo_t=yes
else
@@ -5575,12 +5586,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo_t" 1>&6
echo $ac_n "checking for psinfo32_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5579: checking for psinfo32_t in sys/procfs.h" >&5
+echo "configure:5590: checking for psinfo32_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5584 "configure"
+#line 5595 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5589,7 +5600,7 @@ int main() {
psinfo32_t avar
; return 0; }
EOF
-if { (eval echo configure:5593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_psinfo32_t=yes
else
@@ -5611,12 +5622,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo32_t" 1>&6
echo $ac_n "checking for lwpstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5615: checking for lwpstatus_t in sys/procfs.h" >&5
+echo "configure:5626: checking for lwpstatus_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpstatus_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5620 "configure"
+#line 5631 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5625,7 +5636,7 @@ int main() {
lwpstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:5629: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5640: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_lwpstatus_t=yes
else
@@ -5647,12 +5658,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6
echo $ac_n "checking for lwpxstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5651: checking for lwpxstatus_t in sys/procfs.h" >&5
+echo "configure:5662: checking for lwpxstatus_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpxstatus_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5656 "configure"
+#line 5667 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5661,7 +5672,7 @@ int main() {
lwpxstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:5665: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5676: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes
else
@@ -5683,12 +5694,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpxstatus_t" 1>&6
echo $ac_n "checking for lwpstatus_t.pr_context in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5687: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5
+echo "configure:5698: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5692 "configure"
+#line 5703 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5697,7 +5708,7 @@ int main() {
lwpstatus_t avar; void* aref = (void*) &avar.pr_context
; return 0; }
EOF
-if { (eval echo configure:5701: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5712: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=yes
else
@@ -5719,12 +5730,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" 1>&6
echo $ac_n "checking for lwpstatus_t.pr_reg in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5723: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5
+echo "configure:5734: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5728 "configure"
+#line 5739 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5733,7 +5744,7 @@ int main() {
lwpstatus_t avar; void* aref = (void*) &avar.pr_reg
; return 0; }
EOF
-if { (eval echo configure:5737: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5748: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=yes
else
@@ -5755,12 +5766,12 @@ EOF
echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" 1>&6
echo $ac_n "checking for win32_pstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:5759: checking for win32_pstatus_t in sys/procfs.h" >&5
+echo "configure:5770: checking for win32_pstatus_t in sys/procfs.h" >&5
if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_win32_pstatus_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5764 "configure"
+#line 5775 "configure"
#include "confdefs.h"
#define _SYSCALL32
@@ -5769,7 +5780,7 @@ int main() {
win32_pstatus_t avar
; return 0; }
EOF
-if { (eval echo configure:5773: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5784: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes
else
@@ -5811,6 +5822,25 @@ case "${host}" in
WIN32LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32"
fi
;;
+*-*-linux*)
+ # We borrow WIN32LIBADD so that the shared libbfd won't depend on
+ # libiberty.a.
+ case "${host}" in
+ mips*-*-linux*)
+ # Linux/MIPS uses PIC by default.
+ if test "$enable_shared" = "yes"; then
+ WIN32LIBADD="-L../libiberty -liberty"
+ fi
+ ;;
+ *)
+ PICFLAG=
+ eval `grep "^[ ]*PICFLAG[ ]*=" ../libiberty/Makefile | sed -e "s/[ ]*//g"`
+ if test -n "$PICFLAG"; then
+ WIN32LIBADD="-L../libiberty/pic -liberty"
+ fi
+ ;;
+ esac
+ ;;
esac
@@ -5883,76 +5913,63 @@ selarchs="$f"
# Target backend .o files.
tb=
-elf="elf.lo elflink.lo dwarf1.lo"
+elf="elf.lo elflink.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo"
for vec in $selvecs
do
+ target_size=32
case "$vec" in
# This list is alphabetized to make it easy to compare
- # with the two vector lists in targets.c.
+ # with the two vector lists in targets.c. For the same reason,
+ # use one entry per line, even though this leads to long lines.
a29kcoff_big_vec) tb="$tb coff-a29k.lo cofflink.lo" ;;
a_out_adobe_vec) tb="$tb aout-adobe.lo aout32.lo" ;;
- armcoff_little_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
- armcoff_big_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
- armnetbsd_vec) tb="$tb armnetbsd.lo aout32.lo" ;;
- armpe_little_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;;
- armpe_big_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;;
- armpei_little_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;;
- armpei_big_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;;
- arm_epoc_pe_little_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
- arm_epoc_pe_big_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
- arm_epoc_pei_little_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
- arm_epoc_pei_big_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;;
aout_arm_big_vec) tb="$tb aout-arm.lo aout32.lo" ;;
aout_arm_little_vec) tb="$tb aout-arm.lo aout32.lo" ;;
aout_mips_big_vec) tb="$tb mipsbsd.lo aout32.lo" ;;
aout_mips_little_vec) tb="$tb mipsbsd.lo aout32.lo" ;;
apollocoff_vec) tb="$tb coff-apollo.lo" ;;
+ arm_epoc_pe_big_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
+ arm_epoc_pe_little_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
+ arm_epoc_pei_big_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
+ arm_epoc_pei_little_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
+ armcoff_big_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
+ armcoff_little_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
+ armnetbsd_vec) tb="$tb armnetbsd.lo aout32.lo" ;;
+ armpe_big_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;;
+ armpe_little_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;;
+ armpei_big_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;;
+ armpei_little_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;;
b_out_vec_big_host) tb="$tb bout.lo aout32.lo" ;;
b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;;
bfd_efi_app_ia32_vec) tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;;
- bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"
- target64=true ;;
- bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"
- target64=true ;;
- bfd_elf64_hppa_vec | bfd_elf64_hppa_linux_vec)
- tb="$tb elf64-hppa.lo elf64.lo $elf"
- target64=true ;;
- bfd_elf64_ia64_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"
- target64=true ;;
- bfd_elf64_ia64_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"
- target64=true ;;
- bfd_elf32_ia64_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf" ;;
+ bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;;
- bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
- bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
- bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
+ bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
bfd_elf32_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
- bfd_elf32_bigarm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
bfd_elf32_bigarm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
- bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
+ bfd_elf32_bigarm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
- bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"
- target64=true ;;
bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
- bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
bfd_elf32_d10v_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;;
bfd_elf32_d30v_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;;
bfd_elf32_fr30_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;;
- bfd_elf32_hppa_vec | bfd_elf32_hppa_linux_vec)
- tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
+ bfd_elf32_h8300_vec) tb="$tb elf32-h8300.lo elf32.lo $elf" ;;
+ bfd_elf32_hppa_linux_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
+ bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
- bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"
- target64=true ;;
- bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
+ bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;;
+ bfd_elf32_ia64_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf" ;;
+ bfd_elf32_ia64_hpux_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf";;
bfd_elf32_little_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
+ bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
+ bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
+ bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
- bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"
- target64=true ;;
bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
bfd_elf32_m68hc11_vec) tb="$tb elf32-m68hc11.lo elf32.lo $elf" ;;
bfd_elf32_m68hc12_vec) tb="$tb elf32-m68hc12.lo elf32.lo $elf" ;;
@@ -5962,38 +5979,57 @@ do
bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;;
bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;;
+ bfd_elf32_openrisc_vec) tb="$tb elf32-openrisc.lo elf32.lo $elf" ;;
bfd_elf32_pj_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
bfd_elf32_pjl_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
+ bfd_elf32_s390_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_shblin_vec) tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
bfd_elf32_shlin_vec) tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
- bfd_elf32_shblin_vec) tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh-nbsd.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shnbsd_vec) tb="$tb elf32-sh-nbsd.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;;
bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
+ bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;;
- bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"
- target64=true ;;
- bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"
- target64=true ;;
- bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elf64.lo $elf"
- target64=true ;;
- bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo $elf ecofflink.lo"
- target64=true ;;
- bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo $elf ecofflink.lo"
- target64=true ;;
+ bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;;
+ bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf64_hppa_linux_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_hppa_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_ia64_aix_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_ia64_aix_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_ia64_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_ia64_hpux_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_ia64_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf64_mmix_vec) tb="$tb elf64-mmix.lo elf64.lo $elf" target_size=64 ;;
+ bfd_elf64_powerpc_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_powerpcle_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;;
+ bfd_elf64_s390_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_mmo_vec) tb="$tb mmo.lo" target_size=64 ;;
+ bfd_powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;;
+ bfd_powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
+ bfd_powerpcle_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;;
+ bfd_powerpcle_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
cisco_core_big_vec) tb="$tb cisco-core.lo" ;;
cisco_core_little_vec) tb="$tb cisco-core.lo" ;;
cris_aout_vec) tb="$tb aout-cris.lo" ;;
- demo_64_vec) tb="$tb demo64.lo aout64.lo"
- target64=true ;;
+ demo_64_vec) tb="$tb demo64.lo aout64.lo"; target_size=64 ;;
ecoff_big_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
- ecoff_little_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
ecoff_biglittle_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
- ecoffalpha_little_vec) tb="$tb coff-alpha.lo ecoff.lo ecofflink.lo"
- target64=true ;;
+ ecoff_little_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
+ ecoffalpha_little_vec) tb="$tb coff-alpha.lo ecoff.lo ecofflink.lo"; target_size=64 ;;
go32coff_vec) tb="$tb coff-go32.lo cofflink.lo" ;;
go32stubbedcoff_vec) tb="$tb coff-stgo32.lo cofflink.lo" ;;
h8300coff_vec) tb="$tb coff-h8300.lo reloc16.lo" ;;
@@ -6006,82 +6042,76 @@ do
i386coff_vec) tb="$tb coff-i386.lo cofflink.lo" ;;
i386dynix_vec) tb="$tb i386dynix.lo aout32.lo" ;;
i386freebsd_vec) tb="$tb i386freebsd.lo aout32.lo" ;;
- i386msdos_vec) tb="$tb i386msdos.lo" ;;
- i386pe_vec) tb="$tb pe-i386.lo peigen.lo cofflink.lo" ;;
- i386pei_vec) tb="$tb pei-i386.lo peigen.lo cofflink.lo" ;;
i386linux_vec) tb="$tb i386linux.lo aout32.lo" ;;
i386lynx_aout_vec) tb="$tb i386lynx.lo lynx-core.lo aout32.lo" ;;
i386lynx_coff_vec) tb="$tb cf-i386lynx.lo cofflink.lo lynx-core.lo" ;;
i386mach3_vec) tb="$tb i386mach3.lo aout32.lo" ;;
+ i386msdos_vec) tb="$tb i386msdos.lo" ;;
i386netbsd_vec) tb="$tb i386netbsd.lo aout32.lo" ;;
i386os9k_vec) tb="$tb i386os9k.lo aout32.lo" ;;
+ i386pe_vec) tb="$tb pe-i386.lo peigen.lo cofflink.lo" ;;
+ i386pei_vec) tb="$tb pei-i386.lo peigen.lo cofflink.lo" ;;
i860coff_vec) tb="$tb coff-i860.lo cofflink.lo" ;;
icoff_big_vec) tb="$tb coff-i960.lo cofflink.lo" ;;
icoff_little_vec) tb="$tb coff-i960.lo cofflink.lo" ;;
ieee_vec) tb="$tb ieee.lo" ;;
+ m68k4knetbsd_vec) tb="$tb m68k4knetbsd.lo aout32.lo" ;;
+ m68kaux_coff_vec) tb="$tb coff-aux.lo coff-m68k.lo cofflink.lo" ;;
m68kcoff_vec) tb="$tb coff-m68k.lo cofflink.lo" ;;
m68kcoffun_vec) tb="$tb coff-u68k.lo coff-m68k.lo cofflink.lo" ;;
m68klinux_vec) tb="$tb m68klinux.lo aout32.lo" ;;
m68klynx_aout_vec) tb="$tb m68klynx.lo lynx-core.lo aout32.lo" ;;
m68klynx_coff_vec) tb="$tb cf-m68klynx.lo coff-m68k.lo cofflink.lo lynx-core.lo" ;;
m68knetbsd_vec) tb="$tb m68knetbsd.lo aout32.lo" ;;
- m68k4knetbsd_vec) tb="$tb m68k4knetbsd.lo aout32.lo" ;;
- m68kaux_coff_vec) tb="$tb coff-aux.lo coff-m68k.lo cofflink.lo" ;;
m68ksysvcoff_vec) tb="$tb coff-svm68k.lo cofflink.lo" ;;
m88kbcs_vec) tb="$tb coff-m88k.lo" ;;
- mipslpe_vec) tb="$tb pe-mips.lo peigen.lo cofflink.lo" ;;
- mipslpei_vec) tb="$tb pei-mips.lo peigen.lo cofflink.lo" ;;
mcore_pe_big_vec) tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;;
mcore_pe_little_vec) tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;;
mcore_pei_big_vec) tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;;
mcore_pei_little_vec) tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;;
+ mipslpe_vec) tb="$tb pe-mips.lo peigen.lo cofflink.lo" ;;
+ mipslpei_vec) tb="$tb pei-mips.lo peigen.lo cofflink.lo" ;;
newsos3_vec) tb="$tb newsos3.lo aout32.lo" ;;
+ nlm32_alpha_vec) tb="$tb nlm32-alpha.lo nlm32.lo nlm.lo"; target_size=64 ;;
nlm32_i386_vec) tb="$tb nlm32-i386.lo nlm32.lo nlm.lo" ;;
- rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo"
- target64=true ;;
- nlm32_sparc_vec) tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;;
- nlm32_alpha_vec) tb="$tb nlm32-alpha.lo nlm32.lo nlm.lo"
- target64=true ;;
- riscix_vec) tb="$tb aout32.lo riscix.lo" ;;
nlm32_powerpc_vec) tb="$tb nlm32-ppc.lo nlm32.lo nlm.lo" ;;
- pc532netbsd_vec) tb="$tb ns32knetbsd.lo aout-ns32k.lo" ;;
+ nlm32_sparc_vec) tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;;
pc532machaout_vec) tb="$tb pc532-mach.lo aout-ns32k.lo" ;;
- pmac_xcoff_vec) tb="$tb coff-pmac.lo xcofflink.lo" ;;
- rs6000coff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;;
- bfd_powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;;
- bfd_powerpcle_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;;
- bfd_powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
- bfd_powerpcle_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
+ pc532netbsd_vec) tb="$tb ns32knetbsd.lo aout-ns32k.lo" ;;
+ pdp11_aout_vec) tb="$tb pdp11.lo" ;;
+ pmac_xcoff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;;
ppcboot_vec) tb="$tb ppcboot.lo" ;;
- shcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
- shlcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
+ riscix_vec) tb="$tb aout32.lo riscix.lo" ;;
+ rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo"; target_size=64 ;;
+ rs6000coff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;;
shcoff_small_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
+ shcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
shlcoff_small_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
+ shlcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
shlpe_vec) tb="$tb pe-sh.lo coff-sh.lo peigen.lo cofflink.lo" ;;
shlpei_vec) tb="$tb pei-sh.lo coff-sh.lo peigen.lo cofflink.lo" ;;
som_vec) tb="$tb som.lo" ;;
+ sparccoff_vec) tb="$tb coff-sparc.lo" ;;
sparcle_aout_vec) tb="$tb aout-sparcle.lo aout32.lo" ;;
sparclinux_vec) tb="$tb sparclinux.lo aout32.lo" ;;
sparclynx_aout_vec) tb="$tb sparclynx.lo lynx-core.lo aout32.lo" ;;
sparclynx_coff_vec) tb="$tb cf-sparclynx.lo lynx-core.lo" ;;
sparcnetbsd_vec) tb="$tb sparcnetbsd.lo aout32.lo" ;;
- sparccoff_vec) tb="$tb coff-sparc.lo" ;;
srec_vec) tb="$tb srec.lo" ;;
sunos_big_vec) tb="$tb sunos.lo aout32.lo" ;;
symbolsrec_vec) tb="$tb srec.lo" ;;
tekhex_vec) tb="$tb tekhex.lo" ;;
tic30_aout_vec) tb="$tb aout-tic30.lo" ;;
tic30_coff_vec) tb="$tb coff-tic30.lo" ;;
- tic54x_coff0_vec) tb="$tb coff-tic54x.lo" ;;
tic54x_coff0_beh_vec) tb="$tb coff-tic54x.lo" ;;
- tic54x_coff1_vec) tb="$tb coff-tic54x.lo" ;;
+ tic54x_coff0_vec) tb="$tb coff-tic54x.lo" ;;
tic54x_coff1_beh_vec) tb="$tb coff-tic54x.lo" ;;
- tic54x_coff2_vec) tb="$tb coff-tic54x.lo" ;;
+ tic54x_coff1_vec) tb="$tb coff-tic54x.lo" ;;
tic54x_coff2_beh_vec) tb="$tb coff-tic54x.lo" ;;
+ tic54x_coff2_vec) tb="$tb coff-tic54x.lo" ;;
tic80coff_vec) tb="$tb coff-tic80.lo cofflink.lo" ;;
versados_vec) tb="$tb versados.lo" ;;
- vms_alpha_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo"
- target64=true ;;
+ vms_alpha_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo"; target_size=64 ;;
vms_vax_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo" ;;
w65_vec) tb="$tb coff-w65.lo reloc16.lo" ;;
we32kcoff_vec) tb="$tb coff-we32k.lo" ;;
@@ -6090,6 +6120,13 @@ do
"") ;;
*) { echo "configure: error: *** unknown target vector $vec" 1>&2; exit 1; } ;;
esac
+
+ if test ${target_size} = 64; then
+ target64=true
+ fi
+ if test x"${vec}" = x"${defvec}"; then
+ bfd_default_target_size=${target_size}
+ fi
done
# Target architecture .o files.
@@ -6139,14 +6176,41 @@ fi # all_targets is true
case ${host64}-${target64}-${want64} in
*true*)
wordsize=64
+ bfd_libs='$(BFD64_LIBS) $(BFD32_LIBS)'
all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)'
if test -z "$GCC" && test "$BFD_HOST_64BIT_LONG" = "0" && test "$BFD_HOST_64_BIT_DEFINED" = "0"; then
echo "configure: warning: You have requested a 64 bit BFD configuration, but" 1>&2
echo "configure: warning: your compiler may not have a 64 bit integral type" 1>&2
fi
+ if test -n "$GCC" ; then
+ bad_64bit_gcc=no;
+ echo $ac_n "checking for gcc version with buggy 64-bit support""... $ac_c" 1>&6
+echo "configure:6189: checking for gcc version with buggy 64-bit support" >&5
+ # Add more tests for gcc versions with non-working 64-bit support here.
+ cat > conftest.$ac_ext <<EOF
+#line 6192 "configure"
+#include "confdefs.h"
+:__GNUC__:__GNUC_MINOR__:__i386__:
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep ": 2 : 91 : 1 :" >/dev/null 2>&1; then
+ rm -rf conftest*
+ bad_64bit_gcc=yes;
+ echo "$ac_t""yes: egcs-1.1.2 on ix86 spotted" 1>&6
+else
+ rm -rf conftest*
+ echo "$ac_t""no" 1>&6
+fi
+rm -f conftest*
+
+ if test $bad_64bit_gcc = yes ; then
+ { echo "configure: error: A newer version of gcc is needed for the requested 64-bit BFD configuration" 1>&2; exit 1; }
+ fi
+ fi
;;
false-false-false)
wordsize=32
+ bfd_libs='$(BFD32_LIBS)'
all_backends='$(BFD32_BACKENDS)'
;;
esac
@@ -6156,6 +6220,8 @@ esac
+
+
tdefaults=""
test -n "${defvec}" && tdefaults="${tdefaults} -DDEFAULT_VECTOR=${defvec}"
test -n "${selvecs}" && tdefaults="${tdefaults} -DSELECT_VECS='${selvecs}'"
@@ -6167,17 +6233,17 @@ for ac_hdr in unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6171: checking for $ac_hdr" >&5
+echo "configure:6237: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6176 "configure"
+#line 6242 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6181: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6247: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -6206,12 +6272,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6210: checking for $ac_func" >&5
+echo "configure:6276: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6215 "configure"
+#line 6281 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6234,7 +6300,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6259,7 +6325,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:6263: checking for working mmap" >&5
+echo "configure:6329: checking for working mmap" >&5
if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -6267,7 +6333,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 6271 "configure"
+#line 6337 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -6407,7 +6473,7 @@ main()
}
EOF
-if { (eval echo configure:6411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_mmap_fixed_mapped=yes
else
@@ -6432,12 +6498,12 @@ fi
for ac_func in madvise mprotect
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6436: checking for $ac_func" >&5
+echo "configure:6502: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6441 "configure"
+#line 6507 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -6460,7 +6526,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:6464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6530: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6652,6 +6718,9 @@ s%@AUTOMAKE@%$AUTOMAKE%g
s%@AUTOHEADER@%$AUTOHEADER%g
s%@MAKEINFO@%$MAKEINFO%g
s%@SET_MAKE@%$SET_MAKE%g
+s%@bfd_version@%$bfd_version%g
+s%@bfd_version_date@%$bfd_version_date%g
+s%@bfd_version_string@%$bfd_version_string%g
s%@AR@%$AR%g
s%@RANLIB@%$RANLIB%g
s%@LN_S@%$LN_S%g
@@ -6698,9 +6767,11 @@ s%@WIN32LDFLAGS@%$WIN32LDFLAGS%g
s%@WIN32LIBADD@%$WIN32LIBADD%g
s%@TDEFINES@%$TDEFINES%g
s%@wordsize@%$wordsize%g
+s%@bfd_libs@%$bfd_libs%g
s%@all_backends@%$all_backends%g
s%@bfd_backends@%$bfd_backends%g
s%@bfd_machines@%$bfd_machines%g
+s%@bfd_default_target_size@%$bfd_default_target_size%g
s%@tdefaults@%$tdefaults%g
CEOF
diff --git a/contrib/binutils/bfd/configure.host b/contrib/binutils/bfd/configure.host
index c72a4b3..207e4c0 100644
--- a/contrib/binutils/bfd/configure.host
+++ b/contrib/binutils/bfd/configure.host
@@ -21,19 +21,23 @@ case "${host}" in
alpha*-*-*) host64=true; HOST_64BIT_TYPE=long ;;
+hppa*64*-*-hpux*) HDEFINES=-DHOST_HPPAHPUX;
+ host64=true; HOST_64BIT_TYPE=long ;;
hppa*-*-hpux*) HDEFINES=-DHOST_HPPAHPUX ;;
hppa*-*-hiux*) HDEFINES=-DHOST_HPPAHPUX ;;
+hppa*64*-*-linux*) host64=true; HOST_64BIT_TYPE=long ;;
hppa*-*-mpeix*) HDEFINES=-DHOST_HPPAMPEIX ;;
hppa*-*-bsd*) HDEFINES=-DHOST_HPPABSD ;;
hppa*-*-osf*) HDEFINES=-DHOST_HPPAOSF ;;
ia64-*-linux*) host64=true; HOST_64BIT_TYPE=long ;;
+ia64-*-aix*) host64=true; HOST_64BIT_TYPE=long ;;
i[3456]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;;
i[3456]86-sequent-sysv4*) ;;
i[3456]86-sequent-sysv*) HDEFINES=-Dshared=genshared ;;
-mips*-dec-netbsd*) ;;
+mips*-*-netbsd*) ;;
mips*-*-openbsd*) ;;
mips*-dec-*) HDEFINES="-G 4" ;;
mips*-sgi-irix3*) HDEFINES="-G 4" ;;
@@ -42,6 +46,10 @@ mips*-sgi-irix6*) host64=true
HOST_64BIT_TYPE="long long";
HOST_U_64BIT_TYPE="unsigned long long";
;;
+mips64*-*-linux*) host64=true
+ HOST_64BIT_TYPE="long long";
+ HOST_U_64BIT_TYPE="unsigned long long";
+ ;;
mips*-*-sysv4*) ;;
mips*-*-sysv*) HDEFINES="-G 4" ;;
mips*-*-riscos*) HDEFINES="-G 4" ;;
diff --git a/contrib/binutils/bfd/configure.in b/contrib/binutils/bfd/configure.in
index b639e3b..239bde8 100644
--- a/contrib/binutils/bfd/configure.in
+++ b/contrib/binutils/bfd/configure.in
@@ -7,7 +7,27 @@ AC_INIT(libbfd.c)
AC_CANONICAL_SYSTEM
AC_ISC_POSIX
-AM_INIT_AUTOMAKE(bfd, 2.11.2)
+AM_INIT_AUTOMAKE(bfd, 2.11.93)
+# Uncomment the next line to remove the date from the reported bfd version
+#is_release=y
+
+changequote(,)dnl
+bfd_version=`echo "${VERSION}" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$/\1\2\3\4\5/'`
+changequote([,])dnl
+
+bfd_version_string="\"${VERSION}\""
+bfd_version_date=`sed -e 's/.*DATE //' < ${srcdir}/version.h`
+if test x${is_release} = x; then
+dnl Sad, but we can't use XSTRING here to pick up the date from version.h
+dnl because traditional C doesn't allow it.
+ bfd_version_string="\"${VERSION} ${bfd_version_date}\""
+fi
+dnl Since we need to edit bfd-in3.h to get the date for bfd_version_string,
+dnl we may as well substitute for bfd_version_date too. That way we don't
+dnl need to #include version.h
+AC_SUBST(bfd_version)
+AC_SUBST(bfd_version_date)
+AC_SUBST(bfd_version_string)
dnl These must be called before AM_PROG_LIBTOOL, because it may want
dnl to call AC_CHECK_PROG.
@@ -50,7 +70,7 @@ AC_ARG_WITH(mmap,
*) AC_MSG_ERROR(bad value ${withval} for BFD with-mmap option) ;;
esac],[want_mmap=false])dnl
-build_warnings="-W -Wall"
+build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
AC_ARG_ENABLE(build-warnings,
[ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
[case "${enableval}" in
@@ -76,19 +96,19 @@ AM_CONFIG_HEADER(config.h:config.in)
if test -z "$target" ; then
AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
fi
-AC_ARG_PROGRAM
AM_MAINTAINER_MODE
AC_EXEEXT
host64=false
target64=false
+bfd_default_target_size=32
# host stuff:
AC_PROG_CC
-ALL_LINGUAS=
+ALL_LINGUAS="fr tr ja es sv"
CY_GNU_GETTEXT
# Permit host specific settings.
@@ -145,13 +165,14 @@ if test "${target}" = "${host}"; then
alpha*-*-netbsd*) COREFILE=netbsd-core.lo ;;
alpha*-*-*) COREFILE=osf-core.lo ;;
arm-*-freebsd*) COREFILE='' ;;
+ arm-*-netbsd*) COREFILE=netbsd-core.lo ;;
arm-*-riscix) COREFILE=trad-core.lo ;;
hppa*-*-hpux*) COREFILE=hpux-core.lo ;;
hppa*-*-hiux*) COREFILE=hpux-core.lo ;;
hppa*-*-mpeix*) COREFILE=hpux-core.lo ;;
hppa*-*-bsd*) COREFILE="hpux-core.lo hppabsd-core.lo"
COREFLAG="-DHPUX_CORE -DHPPABSD_CORE" ;;
- i370-*-*)
+ i370-*-*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i370linux.h"'
;;
@@ -170,6 +191,11 @@ changequote([,])dnl
TRAD_HEADER='"hosts/symmetry.h"'
;;
changequote(,)dnl
+ i[3456]86-*-bsdi)
+changequote([,])dnl
+ COREFILE=
+ ;;
+changequote(,)dnl
i[3456]86-*-bsd* | i[34567]86-*-freebsd[1234] | i[34567]86-*-freebsd[1234]\.* | i[34567]86-*-freebsd*aout*)
changequote([,])dnl
COREFILE=trad-core.lo
@@ -310,6 +336,8 @@ changequote([,])dnl
powerpc-*-freebsd*) COREFILE='' ;;
powerpc-*-netbsd*) COREFILE=netbsd-core.lo ;;
powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;;
+ s390*-*-*) COREFILE=trad-core.lo ;;
+ sh*-*-netbsd*) COREFILE=netbsd-core.lo ;;
sparc-*-netbsd* | sparc-*-openbsd*)
COREFILE=netbsd-core.lo
;;
@@ -329,6 +357,7 @@ changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/vaxbsd.h"'
;;
+ x86_64-*-netbsd*) COREFILE=netbsd-core.lo ;;
esac
case "$COREFILE" in
@@ -384,6 +413,27 @@ case "${host}" in
WIN32LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32"
fi
;;
+*-*-linux*)
+ # We borrow WIN32LIBADD so that the shared libbfd won't depend on
+ # libiberty.a.
+ case "${host}" in
+ mips*-*-linux*)
+ # Linux/MIPS uses PIC by default.
+ if test "$enable_shared" = "yes"; then
+ WIN32LIBADD="-L../libiberty -liberty"
+ fi
+ ;;
+ *)
+ PICFLAG=
+ changequote(,)dnl
+ eval `grep "^[ ]*PICFLAG[ ]*=" ../libiberty/Makefile | sed -e "s/[ ]*//g"`
+ changequote([,])dnl
+ if test -n "$PICFLAG"; then
+ WIN32LIBADD="-L../libiberty/pic -liberty"
+ fi
+ ;;
+ esac
+ ;;
esac
AC_SUBST(WIN32LDFLAGS)
AC_SUBST(WIN32LIBADD)
@@ -456,76 +506,63 @@ selarchs="$f"
# Target backend .o files.
tb=
-elf="elf.lo elflink.lo dwarf1.lo"
+elf="elf.lo elflink.lo elf-strtab.lo elf-eh-frame.lo dwarf1.lo"
for vec in $selvecs
do
+ target_size=32
case "$vec" in
# This list is alphabetized to make it easy to compare
- # with the two vector lists in targets.c.
+ # with the two vector lists in targets.c. For the same reason,
+ # use one entry per line, even though this leads to long lines.
a29kcoff_big_vec) tb="$tb coff-a29k.lo cofflink.lo" ;;
a_out_adobe_vec) tb="$tb aout-adobe.lo aout32.lo" ;;
- armcoff_little_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
- armcoff_big_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
- armnetbsd_vec) tb="$tb armnetbsd.lo aout32.lo" ;;
- armpe_little_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;;
- armpe_big_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;;
- armpei_little_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;;
- armpei_big_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;;
- arm_epoc_pe_little_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
- arm_epoc_pe_big_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
- arm_epoc_pei_little_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
- arm_epoc_pei_big_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;;
aout_arm_big_vec) tb="$tb aout-arm.lo aout32.lo" ;;
aout_arm_little_vec) tb="$tb aout-arm.lo aout32.lo" ;;
aout_mips_big_vec) tb="$tb mipsbsd.lo aout32.lo" ;;
aout_mips_little_vec) tb="$tb mipsbsd.lo aout32.lo" ;;
apollocoff_vec) tb="$tb coff-apollo.lo" ;;
+ arm_epoc_pe_big_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
+ arm_epoc_pe_little_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
+ arm_epoc_pei_big_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
+ arm_epoc_pei_little_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
+ armcoff_big_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
+ armcoff_little_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
+ armnetbsd_vec) tb="$tb armnetbsd.lo aout32.lo" ;;
+ armpe_big_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;;
+ armpe_little_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;;
+ armpei_big_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;;
+ armpei_little_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;;
b_out_vec_big_host) tb="$tb bout.lo aout32.lo" ;;
b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;;
bfd_efi_app_ia32_vec) tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;;
- bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"
- target64=true ;;
- bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"
- target64=true ;;
- bfd_elf64_hppa_vec | bfd_elf64_hppa_linux_vec)
- tb="$tb elf64-hppa.lo elf64.lo $elf"
- target64=true ;;
- bfd_elf64_ia64_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"
- target64=true ;;
- bfd_elf64_ia64_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"
- target64=true ;;
- bfd_elf32_ia64_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf" ;;
+ bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;;
- bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
- bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
- bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
+ bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
bfd_elf32_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
- bfd_elf32_bigarm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
bfd_elf32_bigarm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
- bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
+ bfd_elf32_bigarm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
- bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"
- target64=true ;;
bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
- bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
bfd_elf32_d10v_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;;
bfd_elf32_d30v_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;;
bfd_elf32_fr30_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;;
- bfd_elf32_hppa_vec | bfd_elf32_hppa_linux_vec)
- tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
+ bfd_elf32_h8300_vec) tb="$tb elf32-h8300.lo elf32.lo $elf" ;;
+ bfd_elf32_hppa_linux_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
+ bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
- bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"
- target64=true ;;
- bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
+ bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;;
+ bfd_elf32_ia64_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf" ;;
+ bfd_elf32_ia64_hpux_big_vec) tb="$tb elf32-ia64.lo elf32.lo $elf";;
bfd_elf32_little_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
+ bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
+ bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
+ bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
- bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"
- target64=true ;;
bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
bfd_elf32_m68hc11_vec) tb="$tb elf32-m68hc11.lo elf32.lo $elf" ;;
bfd_elf32_m68hc12_vec) tb="$tb elf32-m68hc12.lo elf32.lo $elf" ;;
@@ -535,38 +572,57 @@ do
bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;;
bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;;
+ bfd_elf32_openrisc_vec) tb="$tb elf32-openrisc.lo elf32.lo $elf" ;;
bfd_elf32_pj_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
bfd_elf32_pjl_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
+ bfd_elf32_s390_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
+ bfd_elf32_shblin_vec) tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
bfd_elf32_shlin_vec) tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
- bfd_elf32_shblin_vec) tb="$tb elf32-sh-lin.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh-nbsd.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
+ bfd_elf32_shnbsd_vec) tb="$tb elf32-sh-nbsd.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;;
bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;;
bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
+ bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;;
- bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"
- target64=true ;;
- bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"
- target64=true ;;
- bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elf64.lo $elf"
- target64=true ;;
- bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo $elf ecofflink.lo"
- target64=true ;;
- bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo $elf ecofflink.lo"
- target64=true ;;
+ bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;;
+ bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf64_hppa_linux_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_hppa_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_ia64_aix_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_ia64_aix_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_ia64_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_ia64_hpux_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_ia64_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf64_mmix_vec) tb="$tb elf64-mmix.lo elf64.lo $elf" target_size=64 ;;
+ bfd_elf64_powerpc_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_powerpcle_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;;
+ bfd_elf64_s390_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_mmo_vec) tb="$tb mmo.lo" target_size=64 ;;
+ bfd_powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;;
+ bfd_powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
+ bfd_powerpcle_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;;
+ bfd_powerpcle_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
cisco_core_big_vec) tb="$tb cisco-core.lo" ;;
cisco_core_little_vec) tb="$tb cisco-core.lo" ;;
cris_aout_vec) tb="$tb aout-cris.lo" ;;
- demo_64_vec) tb="$tb demo64.lo aout64.lo"
- target64=true ;;
+ demo_64_vec) tb="$tb demo64.lo aout64.lo"; target_size=64 ;;
ecoff_big_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
- ecoff_little_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
ecoff_biglittle_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
- ecoffalpha_little_vec) tb="$tb coff-alpha.lo ecoff.lo ecofflink.lo"
- target64=true ;;
+ ecoff_little_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
+ ecoffalpha_little_vec) tb="$tb coff-alpha.lo ecoff.lo ecofflink.lo"; target_size=64 ;;
go32coff_vec) tb="$tb coff-go32.lo cofflink.lo" ;;
go32stubbedcoff_vec) tb="$tb coff-stgo32.lo cofflink.lo" ;;
h8300coff_vec) tb="$tb coff-h8300.lo reloc16.lo" ;;
@@ -579,82 +635,76 @@ do
i386coff_vec) tb="$tb coff-i386.lo cofflink.lo" ;;
i386dynix_vec) tb="$tb i386dynix.lo aout32.lo" ;;
i386freebsd_vec) tb="$tb i386freebsd.lo aout32.lo" ;;
- i386msdos_vec) tb="$tb i386msdos.lo" ;;
- i386pe_vec) tb="$tb pe-i386.lo peigen.lo cofflink.lo" ;;
- i386pei_vec) tb="$tb pei-i386.lo peigen.lo cofflink.lo" ;;
i386linux_vec) tb="$tb i386linux.lo aout32.lo" ;;
i386lynx_aout_vec) tb="$tb i386lynx.lo lynx-core.lo aout32.lo" ;;
i386lynx_coff_vec) tb="$tb cf-i386lynx.lo cofflink.lo lynx-core.lo" ;;
i386mach3_vec) tb="$tb i386mach3.lo aout32.lo" ;;
+ i386msdos_vec) tb="$tb i386msdos.lo" ;;
i386netbsd_vec) tb="$tb i386netbsd.lo aout32.lo" ;;
i386os9k_vec) tb="$tb i386os9k.lo aout32.lo" ;;
+ i386pe_vec) tb="$tb pe-i386.lo peigen.lo cofflink.lo" ;;
+ i386pei_vec) tb="$tb pei-i386.lo peigen.lo cofflink.lo" ;;
i860coff_vec) tb="$tb coff-i860.lo cofflink.lo" ;;
icoff_big_vec) tb="$tb coff-i960.lo cofflink.lo" ;;
icoff_little_vec) tb="$tb coff-i960.lo cofflink.lo" ;;
ieee_vec) tb="$tb ieee.lo" ;;
+ m68k4knetbsd_vec) tb="$tb m68k4knetbsd.lo aout32.lo" ;;
+ m68kaux_coff_vec) tb="$tb coff-aux.lo coff-m68k.lo cofflink.lo" ;;
m68kcoff_vec) tb="$tb coff-m68k.lo cofflink.lo" ;;
m68kcoffun_vec) tb="$tb coff-u68k.lo coff-m68k.lo cofflink.lo" ;;
m68klinux_vec) tb="$tb m68klinux.lo aout32.lo" ;;
m68klynx_aout_vec) tb="$tb m68klynx.lo lynx-core.lo aout32.lo" ;;
m68klynx_coff_vec) tb="$tb cf-m68klynx.lo coff-m68k.lo cofflink.lo lynx-core.lo" ;;
m68knetbsd_vec) tb="$tb m68knetbsd.lo aout32.lo" ;;
- m68k4knetbsd_vec) tb="$tb m68k4knetbsd.lo aout32.lo" ;;
- m68kaux_coff_vec) tb="$tb coff-aux.lo coff-m68k.lo cofflink.lo" ;;
m68ksysvcoff_vec) tb="$tb coff-svm68k.lo cofflink.lo" ;;
m88kbcs_vec) tb="$tb coff-m88k.lo" ;;
- mipslpe_vec) tb="$tb pe-mips.lo peigen.lo cofflink.lo" ;;
- mipslpei_vec) tb="$tb pei-mips.lo peigen.lo cofflink.lo" ;;
mcore_pe_big_vec) tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;;
mcore_pe_little_vec) tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;;
mcore_pei_big_vec) tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;;
mcore_pei_little_vec) tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;;
+ mipslpe_vec) tb="$tb pe-mips.lo peigen.lo cofflink.lo" ;;
+ mipslpei_vec) tb="$tb pei-mips.lo peigen.lo cofflink.lo" ;;
newsos3_vec) tb="$tb newsos3.lo aout32.lo" ;;
+ nlm32_alpha_vec) tb="$tb nlm32-alpha.lo nlm32.lo nlm.lo"; target_size=64 ;;
nlm32_i386_vec) tb="$tb nlm32-i386.lo nlm32.lo nlm.lo" ;;
- rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo"
- target64=true ;;
- nlm32_sparc_vec) tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;;
- nlm32_alpha_vec) tb="$tb nlm32-alpha.lo nlm32.lo nlm.lo"
- target64=true ;;
- riscix_vec) tb="$tb aout32.lo riscix.lo" ;;
nlm32_powerpc_vec) tb="$tb nlm32-ppc.lo nlm32.lo nlm.lo" ;;
- pc532netbsd_vec) tb="$tb ns32knetbsd.lo aout-ns32k.lo" ;;
+ nlm32_sparc_vec) tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;;
pc532machaout_vec) tb="$tb pc532-mach.lo aout-ns32k.lo" ;;
- pmac_xcoff_vec) tb="$tb coff-pmac.lo xcofflink.lo" ;;
- rs6000coff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;;
- bfd_powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;;
- bfd_powerpcle_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;;
- bfd_powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
- bfd_powerpcle_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
+ pc532netbsd_vec) tb="$tb ns32knetbsd.lo aout-ns32k.lo" ;;
+ pdp11_aout_vec) tb="$tb pdp11.lo" ;;
+ pmac_xcoff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;;
ppcboot_vec) tb="$tb ppcboot.lo" ;;
- shcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
- shlcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
+ riscix_vec) tb="$tb aout32.lo riscix.lo" ;;
+ rs6000coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo"; target_size=64 ;;
+ rs6000coff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;;
shcoff_small_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
+ shcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
shlcoff_small_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
+ shlcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
shlpe_vec) tb="$tb pe-sh.lo coff-sh.lo peigen.lo cofflink.lo" ;;
shlpei_vec) tb="$tb pei-sh.lo coff-sh.lo peigen.lo cofflink.lo" ;;
som_vec) tb="$tb som.lo" ;;
+ sparccoff_vec) tb="$tb coff-sparc.lo" ;;
sparcle_aout_vec) tb="$tb aout-sparcle.lo aout32.lo" ;;
sparclinux_vec) tb="$tb sparclinux.lo aout32.lo" ;;
sparclynx_aout_vec) tb="$tb sparclynx.lo lynx-core.lo aout32.lo" ;;
sparclynx_coff_vec) tb="$tb cf-sparclynx.lo lynx-core.lo" ;;
sparcnetbsd_vec) tb="$tb sparcnetbsd.lo aout32.lo" ;;
- sparccoff_vec) tb="$tb coff-sparc.lo" ;;
srec_vec) tb="$tb srec.lo" ;;
sunos_big_vec) tb="$tb sunos.lo aout32.lo" ;;
symbolsrec_vec) tb="$tb srec.lo" ;;
tekhex_vec) tb="$tb tekhex.lo" ;;
tic30_aout_vec) tb="$tb aout-tic30.lo" ;;
tic30_coff_vec) tb="$tb coff-tic30.lo" ;;
- tic54x_coff0_vec) tb="$tb coff-tic54x.lo" ;;
tic54x_coff0_beh_vec) tb="$tb coff-tic54x.lo" ;;
- tic54x_coff1_vec) tb="$tb coff-tic54x.lo" ;;
+ tic54x_coff0_vec) tb="$tb coff-tic54x.lo" ;;
tic54x_coff1_beh_vec) tb="$tb coff-tic54x.lo" ;;
- tic54x_coff2_vec) tb="$tb coff-tic54x.lo" ;;
+ tic54x_coff1_vec) tb="$tb coff-tic54x.lo" ;;
tic54x_coff2_beh_vec) tb="$tb coff-tic54x.lo" ;;
+ tic54x_coff2_vec) tb="$tb coff-tic54x.lo" ;;
tic80coff_vec) tb="$tb coff-tic80.lo cofflink.lo" ;;
versados_vec) tb="$tb versados.lo" ;;
- vms_alpha_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo"
- target64=true ;;
+ vms_alpha_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo"; target_size=64 ;;
vms_vax_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo" ;;
w65_vec) tb="$tb coff-w65.lo reloc16.lo" ;;
we32kcoff_vec) tb="$tb coff-we32k.lo" ;;
@@ -663,6 +713,13 @@ do
"") ;;
*) AC_MSG_ERROR(*** unknown target vector $vec) ;;
esac
+
+ if test ${target_size} = 64; then
+ target64=true
+ fi
+ if test x"${vec}" = x"${defvec}"; then
+ bfd_default_target_size=${target_size}
+ fi
done
# Target architecture .o files.
@@ -712,22 +769,38 @@ fi # all_targets is true
case ${host64}-${target64}-${want64} in
*true*)
wordsize=64
+ bfd_libs='$(BFD64_LIBS) $(BFD32_LIBS)'
all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)'
if test -z "$GCC" && test "$BFD_HOST_64BIT_LONG" = "0" && test "$BFD_HOST_64_BIT_DEFINED" = "0"; then
AC_MSG_WARN([You have requested a 64 bit BFD configuration, but])
AC_MSG_WARN([your compiler may not have a 64 bit integral type])
fi
+ if test -n "$GCC" ; then
+ bad_64bit_gcc=no;
+ AC_MSG_CHECKING([for gcc version with buggy 64-bit support])
+ # Add more tests for gcc versions with non-working 64-bit support here.
+ AC_EGREP_CPP([: 2 : 91 : 1 :],[:__GNUC__:__GNUC_MINOR__:__i386__:],
+ bad_64bit_gcc=yes;
+ AC_MSG_RESULT([yes: egcs-1.1.2 on ix86 spotted]),
+ AC_MSG_RESULT(no))
+ if test $bad_64bit_gcc = yes ; then
+ AC_ERROR([A newer version of gcc is needed for the requested 64-bit BFD configuration])
+ fi
+ fi
;;
false-false-false)
wordsize=32
+ bfd_libs='$(BFD32_LIBS)'
all_backends='$(BFD32_BACKENDS)'
;;
esac
AC_SUBST(wordsize)
+AC_SUBST(bfd_libs)
AC_SUBST(all_backends)
AC_SUBST(bfd_backends)
AC_SUBST(bfd_machines)
+AC_SUBST(bfd_default_target_size)
tdefaults=""
test -n "${defvec}" && tdefaults="${tdefaults} -DDEFAULT_VECTOR=${defvec}"
diff --git a/contrib/binutils/bfd/corefile.c b/contrib/binutils/bfd/corefile.c
index 3ce0785..609c4e6 100644
--- a/contrib/binutils/bfd/corefile.c
+++ b/contrib/binutils/bfd/corefile.c
@@ -1,5 +1,5 @@
/* Core file generic interface routines for BFD.
- Copyright 1990, 1991, 1992, 1993, 1994, 2000
+ Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -36,7 +36,7 @@ FUNCTION
bfd_core_file_failing_command
SYNOPSIS
- CONST char *bfd_core_file_failing_command(bfd *abfd);
+ const char *bfd_core_file_failing_command(bfd *abfd);
DESCRIPTION
Return a read-only string explaining which program was running
diff --git a/contrib/binutils/bfd/cpu-arc.c b/contrib/binutils/bfd/cpu-arc.c
index 2904ae3..204eb48 100644
--- a/contrib/binutils/bfd/cpu-arc.c
+++ b/contrib/binutils/bfd/cpu-arc.c
@@ -55,6 +55,8 @@ const bfd_arch_info_type bfd_arc_arch =
/* Given cpu type NAME, return its bfd_mach_arc_xxx value.
Returns -1 if not found. */
+int arc_get_mach PARAMS ((char *));
+
int
arc_get_mach (name)
char *name;
diff --git a/contrib/binutils/bfd/cpu-i386.c b/contrib/binutils/bfd/cpu-i386.c
index 860d91a..8619fbf 100644
--- a/contrib/binutils/bfd/cpu-i386.c
+++ b/contrib/binutils/bfd/cpu-i386.c
@@ -44,8 +44,8 @@ const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
8, /* 8 bits in a byte */
bfd_arch_i386,
bfd_mach_x86_64_intel_syntax,
- "x86_64:intel",
- "x86_64:intel",
+ "x86-64:intel",
+ "x86-64:intel",
3,
true,
bfd_default_compatible,
@@ -75,8 +75,8 @@ const bfd_arch_info_type bfd_x86_64_arch =
8, /* 8 bits in a byte */
bfd_arch_i386,
bfd_mach_x86_64,
- "x86_64",
- "x86_64",
+ "x86-64",
+ "x86-64",
3,
true,
bfd_default_compatible,
diff --git a/contrib/binutils/bfd/cpu-ia64-opc.c b/contrib/binutils/bfd/cpu-ia64-opc.c
index 8c22942..a228b1c 100644
--- a/contrib/binutils/bfd/cpu-ia64-opc.c
+++ b/contrib/binutils/bfd/cpu-ia64-opc.c
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Logically, this code should be part of libopcode but since some of
the operand insertion/extraction functions help bfd to implement
- relocations, this code is included as part of elf64-ia64.c. This
+ relocations, this code is included as part of cpu-ia64.c. This
avoids circular dependencies between libopcode and libbfd and also
obviates the need for applications to link in libopcode when all
they really want is libbfd.
diff --git a/contrib/binutils/bfd/cpu-powerpc.c b/contrib/binutils/bfd/cpu-powerpc.c
index 235ec29..3e7a51c 100644
--- a/contrib/binutils/bfd/cpu-powerpc.c
+++ b/contrib/binutils/bfd/cpu-powerpc.c
@@ -1,5 +1,5 @@
/* BFD PowerPC CPU definition
- Copyright 1994, 1995, 1996, 2000 Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1996, 2000, 2001 Free Software Foundation, Inc.
Contributed by Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -128,7 +128,7 @@ static const bfd_arch_info_type arch_info_struct[] =
"powerpc",
"powerpc:620",
3,
- false, /* not the default */
+ BFD_DEFAULT_TARGET_SIZE == 64, /* default for 64 bit target */
powerpc_compatible,
bfd_default_scan,
&arch_info_struct[6]
@@ -229,7 +229,7 @@ const bfd_arch_info_type bfd_powerpc_arch =
"powerpc",
"powerpc:common",
3,
- true, /* the default */
+ BFD_DEFAULT_TARGET_SIZE != 64, /* default for 32 bit target */
powerpc_compatible,
bfd_default_scan,
&arch_info_struct[0]
diff --git a/contrib/binutils/bfd/demo64.c b/contrib/binutils/bfd/demo64.c
index b64499b..a8c0b32 100644
--- a/contrib/binutils/bfd/demo64.c
+++ b/contrib/binutils/bfd/demo64.c
@@ -1,5 +1,6 @@
/* BFD backend for demonstration 64-bit a.out binaries.
- Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1993, 1994, 2001
+ Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,6 +20,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define ARCH_SIZE 64
-#define MY(OP) CAT(demo_64_,OP)
+
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define MY(OP) CONCAT2 (demo_64_,OP)
+
#define TARGETNAME "demo64"
#include "aoutf1.h"
diff --git a/contrib/binutils/bfd/dep-in.sed b/contrib/binutils/bfd/dep-in.sed
index c3781f2..4a706aa 100644
--- a/contrib/binutils/bfd/dep-in.sed
+++ b/contrib/binutils/bfd/dep-in.sed
@@ -9,12 +9,13 @@ s!@INCDIR@!$(INCDIR)!g
s!@SRCDIR@/../opcodes!$(srcdir)/../opcodes!g
s!@SRCDIR@/!!g
s! hosts/[^ ]*\.h! !g
-s/ sysdep.h//g
+s! sysdep.h!!g
s! \.\./bfd/sysdep.h!!g
-s/ libbfd.h//g
-s/ config.h//g
+s! libbfd.h!!g
+s! config.h!!g
s! \$(INCDIR)/fopen-[^ ]*\.h!!g
s! \$(INCDIR)/ansidecl\.h!!g
+s! \$(INCDIR)/symcat\.h!!g
s/\\\n */ /g
diff --git a/contrib/binutils/bfd/doc/ChangeLog b/contrib/binutils/bfd/doc/ChangeLog
index 363ea91..2f3db6f 100644
--- a/contrib/binutils/bfd/doc/ChangeLog
+++ b/contrib/binutils/bfd/doc/ChangeLog
@@ -1,7 +1,57 @@
-2001-06-11 Alan Modra <amodra@bigpond.net.au>
+2001-10-30 Hans-Peter Nilsson <hp@bitrange.com>
- * bfdint.texi (BFD target vector miscellaneous): --oformat, not
- -oformat.
+ * doc/bfdint.texi (BFD target vector miscellaneous): Add
+ bfd_target_mmo_flavour.
+ * doc/bfd.texinfo (BFD back ends): Add entry for mmo.
+ * doc/Makefile.am (DOCFILES): Add mmo.texi.
+ (SRCDOC): Add mmo.c.
+ (s-mmo, mmo.texi): New rules.
+
+2001-10-29 Kazu Hirata <kazu@hxi.com>
+
+ * bfdsumm.texi: Fix a typo.
+
+2001-10-26 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * bfd.texinfo: Change footer to refer to FSF. Change subtitle
+ to refer to original creation date.
+
+2001-10-03 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am (BFD_H_DEP): Add ../version.h.
+ * Makefile.in: Regenerate.
+
+2001-10-02 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2001-10-01 Alan Modra <amodra@bigpond.net.au>
+
+ * header.sed: New file, adds header to generated files.
+ * Makefile.am: Rewrite rules generating libbfd.h, libcoff.h and
+ bfd.h, using above. Add missing elf.c dependecy for libbfd.h.
+ * Makefile.in: Regenerate.
+
+2001-09-21 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2001-09-18 Alan Modra <amodra@bigpond.net.au>
+
+ * bfdint.texi: Replace reference to bfd_read with bfd_bread.
+ Likewise for bfd_write.
+
+2001-07-24 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.in: Regenerate.
+
+2001-06-21 Hans-Peter Nilsson <hp@axis.com>
+
+ * bfdint.texi (BFD relocation functions) <different formats>:
+ Mention that the GNU linker is aware of input-output format
+ restrictions when generating relocatable output. Make new
+ paragraph for final-link case.
+ (BFD target vector swap): Fix typo.
2001-01-25 Kazu Hirata <kazu@hxi.com>
@@ -240,7 +290,7 @@ Fri Sep 2 13:33:44 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
Wed Jan 12 18:37:12 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* bfd.texinfo: Added Linker Functions node.
- * doc/Makefile.in (DOCFILES): Added linker.texi.
+ * Makefile.in (DOCFILES): Added linker.texi.
(SRCDOC): Added linker.c.
(linker.texi): New target.
@@ -355,9 +405,9 @@ Thu Nov 5 03:13:55 1992 John Gilmore (gnu@cygnus.com)
Cleanup: Replace all uses of EXFUN in the BFD sources, with PARAMS.
- * doc/chew.c (exfunstuff): Eliminate.
+ * chew.c (exfunstuff): Eliminate.
(paramstuff): Replace exfunstuff with function to generate PARAMS.
- * doc/proto.str: Use paramstuff rather than exfunstuff.
+ * proto.str: Use paramstuff rather than exfunstuff.
Mon Aug 17 12:40:32 1992 Steve Chamberlain (sac@thepub.cygnus.com)
diff --git a/contrib/binutils/bfd/doc/Makefile.am b/contrib/binutils/bfd/doc/Makefile.am
index 0d5268e..075c9f3 100644
--- a/contrib/binutils/bfd/doc/Makefile.am
+++ b/contrib/binutils/bfd/doc/Makefile.am
@@ -6,7 +6,8 @@ DOCFILES = aoutx.texi archive.texi archures.texi \
bfdt.texi cache.texi coffcode.texi \
core.texi elf.texi elfcode.texi format.texi libbfd.texi \
opncls.texi reloc.texi section.texi \
- syms.texi targets.texi init.texi hash.texi linker.texi
+ syms.texi targets.texi init.texi hash.texi linker.texi \
+ mmo.texi
PROTOS = archive.p archures.p bfd.p \
core.p format.p \
@@ -27,7 +28,8 @@ SRCDOC = $(srcdir)/../aoutx.h $(srcdir)/../archive.c \
$(srcdir)/../libbfd.c $(srcdir)/../opncls.c \
$(srcdir)/../reloc.c $(srcdir)/../section.c \
$(srcdir)/../syms.c $(srcdir)/../targets.c \
- $(srcdir)/../hash.c $(srcdir)/../linker.c
+ $(srcdir)/../hash.c $(srcdir)/../linker.c \
+ $(srcdir)/../mmo.c
SRCPROT = $(srcdir)/../archive.c $(srcdir)/../archures.c \
$(srcdir)/../bfd.c $(srcdir)/../coffcode.h $(srcdir)/../corefile.c \
@@ -123,6 +125,12 @@ s-elfcode: $(MKDOC) $(srcdir)/../elfcode.h $(srcdir)/doc.str
touch s-elfcode
elfcode.texi: s-elfcode
+s-mmo: $(MKDOC) $(srcdir)/../mmo.c $(srcdir)/doc.str
+ ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../mmo.c >mmo.tmp
+ $(srcdir)/../../move-if-change mmo.tmp mmo.texi
+ touch s-mmo
+mmo.texi: s-mmo
+
s-format: $(MKDOC) $(srcdir)/../format.c $(srcdir)/doc.str
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../format.c >format.tmp
$(srcdir)/../../move-if-change format.tmp format.texi
@@ -183,30 +191,47 @@ s-linker: $(MKDOC) $(srcdir)/../linker.c $(srcdir)/doc.str
touch s-linker
linker.texi: s-linker
-libbfd.h: $(srcdir)/../libbfd-in.h \
+LIBBFD_H_DEP = \
+ $(srcdir)/../libbfd-in.h \
$(srcdir)/../init.c \
$(srcdir)/../libbfd.c \
$(srcdir)/../cache.c \
$(srcdir)/../reloc.c \
$(srcdir)/../archures.c \
+ $(srcdir)/../elf.c \
+ $(srcdir)/header.sed \
$(srcdir)/proto.str \
$(MKDOC)
- cat $(srcdir)/../libbfd-in.h >libbfd.h
- ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../init.c >>libbfd.h
- ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../libbfd.c >>libbfd.h
- ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../cache.c >>libbfd.h
- ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../reloc.c >>libbfd.h
- ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../archures.c >>libbfd.h
- ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../elf.c >>libbfd.h
-
-libcoff.h: $(srcdir)/../libcoff-in.h \
+
+libbfd.h: $(LIBBFD_H_DEP)
+ echo "$(LIBBFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@
+ for file in $(LIBBFD_H_DEP); do \
+ case $$file in \
+ *-in.h) cat $$file >> $@ ;; \
+ */header.sed) break ;; \
+ *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
+ esac; \
+ done
+
+LIBCOFF_H_DEP = \
+ $(srcdir)/../libcoff-in.h \
$(srcdir)/../coffcode.h \
+ $(srcdir)/header.sed \
$(srcdir)/proto.str \
$(MKDOC)
- cat $(srcdir)/../libcoff-in.h >libcoff.h
- ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../coffcode.h >>libcoff.h
-bfd.h: $(srcdir)/../bfd-in.h \
+libcoff.h: $(LIBCOFF_H_DEP)
+ echo "$(LIBCOFF_H_DEP)" | sed -f $(srcdir)/header.sed > $@
+ for file in $(LIBCOFF_H_DEP); do \
+ case $$file in \
+ *-in.h) cat $$file >> $@ ;; \
+ */header.sed) break ;; \
+ *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
+ esac; \
+ done
+
+BFD_H_DEP = \
+ $(srcdir)/../bfd-in.h \
$(srcdir)/../init.c \
$(srcdir)/../opncls.c \
$(srcdir)/../libbfd.c \
@@ -219,25 +244,24 @@ bfd.h: $(srcdir)/../bfd-in.h \
$(srcdir)/../corefile.c \
$(srcdir)/../targets.c \
$(srcdir)/../format.c \
+ $(srcdir)/header.sed \
$(srcdir)/proto.str \
+ $(srcdir)/../version.h \
$(MKDOC)
- cat $(srcdir)/../bfd-in.h >bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../init.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../opncls.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../libbfd.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../section.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../archures.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../reloc.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../syms.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../bfd.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../archive.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../corefile.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../targets.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../format.c >>bfd.h
- echo "#ifdef __cplusplus" >>bfd.h
- echo "}" >>bfd.h
- echo "#endif" >>bfd.h
- echo "#endif" >>bfd.h
+
+bfd.h: $(BFD_H_DEP)
+ echo "$(BFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@
+ for file in $(BFD_H_DEP); do \
+ case $$file in \
+ *-in.h) cat $$file >> $@ ;; \
+ */header.sed) break ;; \
+ *) ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \
+ esac; \
+ done
+ echo "#ifdef __cplusplus" >> $@
+ echo "}" >> $@
+ echo "#endif" >> $@
+ echo "#endif" >> $@
noinst_TEXINFOS = bfdint.texi
diff --git a/contrib/binutils/bfd/doc/Makefile.in b/contrib/binutils/bfd/doc/Makefile.in
index d4c30a6..dc85d4b 100644
--- a/contrib/binutils/bfd/doc/Makefile.in
+++ b/contrib/binutils/bfd/doc/Makefile.in
@@ -115,7 +115,11 @@ WIN32LDFLAGS = @WIN32LDFLAGS@
WIN32LIBADD = @WIN32LIBADD@
all_backends = @all_backends@
bfd_backends = @bfd_backends@
+bfd_default_target_size = @bfd_default_target_size@
bfd_machines = @bfd_machines@
+bfd_version = @bfd_version@
+bfd_version_date = @bfd_version_date@
+bfd_version_string = @bfd_version_string@
l = @l@
tdefaults = @tdefaults@
wordsize = @wordsize@
@@ -126,7 +130,8 @@ DOCFILES = aoutx.texi archive.texi archures.texi \
bfdt.texi cache.texi coffcode.texi \
core.texi elf.texi elfcode.texi format.texi libbfd.texi \
opncls.texi reloc.texi section.texi \
- syms.texi targets.texi init.texi hash.texi linker.texi
+ syms.texi targets.texi init.texi hash.texi linker.texi \
+ mmo.texi
PROTOS = archive.p archures.p bfd.p \
@@ -149,7 +154,8 @@ SRCDOC = $(srcdir)/../aoutx.h $(srcdir)/../archive.c \
$(srcdir)/../libbfd.c $(srcdir)/../opncls.c \
$(srcdir)/../reloc.c $(srcdir)/../section.c \
$(srcdir)/../syms.c $(srcdir)/../targets.c \
- $(srcdir)/../hash.c $(srcdir)/../linker.c
+ $(srcdir)/../hash.c $(srcdir)/../linker.c \
+ $(srcdir)/../mmo.c
SRCPROT = $(srcdir)/../archive.c $(srcdir)/../archures.c \
@@ -172,6 +178,47 @@ info_TEXINFOS = bfd.texinfo
MKDOC = chew$(EXEEXT_FOR_BUILD)
+LIBBFD_H_DEP = \
+ $(srcdir)/../libbfd-in.h \
+ $(srcdir)/../init.c \
+ $(srcdir)/../libbfd.c \
+ $(srcdir)/../cache.c \
+ $(srcdir)/../reloc.c \
+ $(srcdir)/../archures.c \
+ $(srcdir)/../elf.c \
+ $(srcdir)/header.sed \
+ $(srcdir)/proto.str \
+ $(MKDOC)
+
+
+LIBCOFF_H_DEP = \
+ $(srcdir)/../libcoff-in.h \
+ $(srcdir)/../coffcode.h \
+ $(srcdir)/header.sed \
+ $(srcdir)/proto.str \
+ $(MKDOC)
+
+
+BFD_H_DEP = \
+ $(srcdir)/../bfd-in.h \
+ $(srcdir)/../init.c \
+ $(srcdir)/../opncls.c \
+ $(srcdir)/../libbfd.c \
+ $(srcdir)/../section.c \
+ $(srcdir)/../archures.c \
+ $(srcdir)/../reloc.c \
+ $(srcdir)/../syms.c \
+ $(srcdir)/../bfd.c \
+ $(srcdir)/../archive.c \
+ $(srcdir)/../corefile.c \
+ $(srcdir)/../targets.c \
+ $(srcdir)/../format.c \
+ $(srcdir)/header.sed \
+ $(srcdir)/proto.str \
+ $(srcdir)/../version.h \
+ $(MKDOC)
+
+
noinst_TEXINFOS = bfdint.texi
MOSTLYCLEANFILES = $(MKDOC) *.o
@@ -194,7 +241,7 @@ DIST_COMMON = ChangeLog Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = tar
+TAR = gtar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
@@ -484,6 +531,12 @@ s-elfcode: $(MKDOC) $(srcdir)/../elfcode.h $(srcdir)/doc.str
touch s-elfcode
elfcode.texi: s-elfcode
+s-mmo: $(MKDOC) $(srcdir)/../mmo.c $(srcdir)/doc.str
+ ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../mmo.c >mmo.tmp
+ $(srcdir)/../../move-if-change mmo.tmp mmo.texi
+ touch s-mmo
+mmo.texi: s-mmo
+
s-format: $(MKDOC) $(srcdir)/../format.c $(srcdir)/doc.str
./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../format.c >format.tmp
$(srcdir)/../../move-if-change format.tmp format.texi
@@ -544,61 +597,39 @@ s-linker: $(MKDOC) $(srcdir)/../linker.c $(srcdir)/doc.str
touch s-linker
linker.texi: s-linker
-libbfd.h: $(srcdir)/../libbfd-in.h \
- $(srcdir)/../init.c \
- $(srcdir)/../libbfd.c \
- $(srcdir)/../cache.c \
- $(srcdir)/../reloc.c \
- $(srcdir)/../archures.c \
- $(srcdir)/proto.str \
- $(MKDOC)
- cat $(srcdir)/../libbfd-in.h >libbfd.h
- ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../init.c >>libbfd.h
- ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../libbfd.c >>libbfd.h
- ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../cache.c >>libbfd.h
- ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../reloc.c >>libbfd.h
- ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../archures.c >>libbfd.h
- ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../elf.c >>libbfd.h
-
-libcoff.h: $(srcdir)/../libcoff-in.h \
- $(srcdir)/../coffcode.h \
- $(srcdir)/proto.str \
- $(MKDOC)
- cat $(srcdir)/../libcoff-in.h >libcoff.h
- ./$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../coffcode.h >>libcoff.h
+libbfd.h: $(LIBBFD_H_DEP)
+ echo "$(LIBBFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@
+ for file in $(LIBBFD_H_DEP); do \
+ case $$file in \
+ *-in.h) cat $$file >> $@ ;; \
+ */header.sed) break ;; \
+ *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
+ esac; \
+ done
-bfd.h: $(srcdir)/../bfd-in.h \
- $(srcdir)/../init.c \
- $(srcdir)/../opncls.c \
- $(srcdir)/../libbfd.c \
- $(srcdir)/../section.c \
- $(srcdir)/../archures.c \
- $(srcdir)/../reloc.c \
- $(srcdir)/../syms.c \
- $(srcdir)/../bfd.c \
- $(srcdir)/../archive.c \
- $(srcdir)/../corefile.c \
- $(srcdir)/../targets.c \
- $(srcdir)/../format.c \
- $(srcdir)/proto.str \
- $(MKDOC)
- cat $(srcdir)/../bfd-in.h >bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../init.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../opncls.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../libbfd.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../section.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../archures.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../reloc.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../syms.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../bfd.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../archive.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../corefile.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../targets.c >>bfd.h
- ./$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../format.c >>bfd.h
- echo "#ifdef __cplusplus" >>bfd.h
- echo "}" >>bfd.h
- echo "#endif" >>bfd.h
- echo "#endif" >>bfd.h
+libcoff.h: $(LIBCOFF_H_DEP)
+ echo "$(LIBCOFF_H_DEP)" | sed -f $(srcdir)/header.sed > $@
+ for file in $(LIBCOFF_H_DEP); do \
+ case $$file in \
+ *-in.h) cat $$file >> $@ ;; \
+ */header.sed) break ;; \
+ *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
+ esac; \
+ done
+
+bfd.h: $(BFD_H_DEP)
+ echo "$(BFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@
+ for file in $(BFD_H_DEP); do \
+ case $$file in \
+ *-in.h) cat $$file >> $@ ;; \
+ */header.sed) break ;; \
+ *) ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \
+ esac; \
+ done
+ echo "#ifdef __cplusplus" >> $@
+ echo "}" >> $@
+ echo "#endif" >> $@
+ echo "#endif" >> $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/contrib/binutils/bfd/doc/bfd.texinfo b/contrib/binutils/bfd/doc/bfd.texinfo
index bcc9c38..380501e 100644
--- a/contrib/binutils/bfd/doc/bfd.texinfo
+++ b/contrib/binutils/bfd/doc/bfd.texinfo
@@ -30,7 +30,7 @@ END-INFO-DIR-ENTRY
@ifinfo
This file documents the BFD library.
-Copyright (C) 1991, 2000 Free Software Foundation, Inc.
+Copyright (C) 1991, 2000, 2001 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
@@ -56,18 +56,18 @@ notice identical to this one except for the removal of this paragraph
@title{libbfd}
@subtitle{The Binary File Descriptor Library}
@sp 1
-@subtitle First Edition---BFD version < 3.0
-@subtitle April 1991
+@subtitle First Edition---BFD version < 3.0 % Since no product is stable berfore version 3.0 :-)
+@subtitle Original Document Created: April 1991
@author {Steve Chamberlain}
@author {Cygnus Support}
@page
@tex
\def\$#1${{#1}} % Kluge: collect RCS revision info without $...$
-\xdef\manvers{\$Revision: 1.2.2.1 $} % For use in headers, footers too
+\xdef\manvers{\$Revision: 1.5 $} % For use in headers, footers too
{\parskip=0pt
-\hfill Cygnus Support\par
-\hfill sac\@cygnus.com\par
+\hfill Free Software Foundation\par
+\hfill sac\@www.gnu.org\par
\hfill {\it BFD}, \manvers\par
\hfill \TeX{}info \texinfoversion\par
}
@@ -75,7 +75,7 @@ notice identical to this one except for the removal of this paragraph
@end tex
@vskip 0pt plus 1filll
-Copyright @copyright{} 1991 Free Software Foundation, Inc.
+Copyright @copyright{} 1991, 2001 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
@@ -298,6 +298,7 @@ structures.
* aout :: a.out backends
* coff :: coff backends
* elf :: elf backends
+* mmo :: mmo backend
@ignore
* oasys :: oasys backends
* ieee :: ieee backend
@@ -313,11 +314,14 @@ All of BFD lives in one directory.
@node coff, elf, aout, BFD back ends
@include coffcode.texi
-@node elf, , coff, BFD back ends
+@node elf, mmo, coff, BFD back ends
@include elf.texi
@c Leave this out until the file has some actual contents...
@c @include elfcode.texi
+@node mmo, , elf, BFD back ends
+@include mmo.texi
+
@node GNU Free Documentation License, Index, BFD back ends, Top
@chapter GNU Free Documentation License
@cindex GNU Free Documentation License
diff --git a/contrib/binutils/bfd/doc/bfdint.texi b/contrib/binutils/bfd/doc/bfdint.texi
index 5aa8ed3..76fd832 100644
--- a/contrib/binutils/bfd/doc/bfdint.texi
+++ b/contrib/binutils/bfd/doc/bfdint.texi
@@ -1,6 +1,6 @@
\input texinfo
@c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,
-@c 2000
+@c 2000, 2001
@c Free Software Foundation, Inc.
@setfilename bfdint.info
@@ -335,6 +335,8 @@ VERSAdos.
MS-DOS.
@item bfd_target_evax_flavour
openVMS.
+@item bfd_target_mmo_flavour
+Donald Knuth's MMIXware object format.
@end table
@item byteorder
@@ -379,7 +381,7 @@ vectors which use the same sets of functions.
@node BFD target vector swap
@subsection Swapping functions
-Every target vector has fuction pointers used for swapping information
+Every target vector has function pointers used for swapping information
in and out of the target representation. There are two sets of
functions: one for data information, and one for header information.
Each set has three sizes: 64-bit, 32-bit, and 16-bit. Each size has
@@ -503,7 +505,7 @@ corresponds to an actual section in an actual BFD.
Get the contents of a section. This is called from
@samp{bfd_get_section_contents}. Most targets set this to
@samp{_bfd_generic_get_section_contents}, which does a @samp{bfd_seek}
-based on the section's @samp{filepos} field and a @samp{bfd_read}. The
+based on the section's @samp{filepos} field and a @samp{bfd_bread}. The
corresponding field in the target vector is named
@samp{_bfd_get_section_contents}.
@@ -636,7 +638,7 @@ always uses extended name tables anyhow. The corresponding field in the
target vector is named @samp{_bfd_truncate_arname}.
@item _write_armap
-Write out the archive symbol table using calls to @samp{bfd_write}.
+Write out the archive symbol table using calls to @samp{bfd_bwrite}.
This is normally called from the archive @samp{write_contents} routine.
The corresponding field in the target vector is named @samp{write_armap}
(no leading underscore).
@@ -1291,10 +1293,13 @@ doing a link in which the output object file format is S-records.
@item
Using the linker to generate relocateable output in a different object
file format is impossible in the general case, so you generally don't
-have to worry about that. Linking input files of different object file
-formats together is quite unusual, but if you're really dedicated you
-may want to consider testing this case, both when the output object file
-format is the same as your format, and when it is different.
+have to worry about that. The GNU linker makes sure to stop that from
+happening when an input file in a different format has relocations.
+
+Linking input files of different object file formats together is quite
+unusual, but if you're really dedicated you may want to consider testing
+this case, both when the output object file format is the same as your
+format, and when it is different.
@end itemize
@node BFD relocation codes
diff --git a/contrib/binutils/bfd/doc/bfdsumm.texi b/contrib/binutils/bfd/doc/bfdsumm.texi
index 844531a..77a5f09 100644
--- a/contrib/binutils/bfd/doc/bfdsumm.texi
+++ b/contrib/binutils/bfd/doc/bfdsumm.texi
@@ -4,7 +4,7 @@ the format of the input object file. They then build a descriptor in
memory with pointers to routines that will be used to access elements of
the object file's data structures.
-As different information from the the object files is required,
+As different information from the object files is required,
BFD reads from different sections of the file and processes them.
For example, a very common operation for the linker is processing symbol
tables. Each BFD back end provides a routine for converting
diff --git a/contrib/binutils/bfd/doc/header.sed b/contrib/binutils/bfd/doc/header.sed
new file mode 100644
index 0000000..ed27040
--- /dev/null
+++ b/contrib/binutils/bfd/doc/header.sed
@@ -0,0 +1,12 @@
+s|\(.*\) [^ ]*header.sed.*|\1|
+s|[^ ]*/||g
+s|^ *|"|
+s| |", "|g
+s|$|"|
+s|, \([^ ]*\)$| and \1|
+s|^|/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically generated from |
+s|\(.\{60\}[^ ]* \)|\1\
+ |g
+s|$|.\
+ Run "make headers" in your build bfd/ to regenerate. */\
+|
diff --git a/contrib/binutils/bfd/dwarf1.c b/contrib/binutils/bfd/dwarf1.c
index 2fef2ef..6531986 100644
--- a/contrib/binutils/bfd/dwarf1.c
+++ b/contrib/binutils/bfd/dwarf1.c
@@ -1,5 +1,5 @@
/* DWARF 1 find nearest line (_bfd_dwarf1_find_nearest_line).
- Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com).
@@ -126,6 +126,18 @@ struct linenumber {
/* Find the form of an attr, from the attr field. */
#define FORM_FROM_ATTR(attr) ((attr) & 0xF) /* Implicitly specified */
+static struct dwarf1_unit *alloc_dwarf1_unit PARAMS ((struct dwarf1_debug *));
+static struct dwarf1_func *alloc_dwarf1_func
+ PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *));
+static boolean parse_die PARAMS ((bfd *, struct die_info *, char *, char *));
+static boolean parse_line_table
+ PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *));
+static boolean parse_functions_in_unit
+ PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *));
+static boolean dwarf1_unit_find_nearest_line
+ PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *, unsigned long,
+ const char **, const char **, unsigned int *));
+
/* Return a newly allocated dwarf1_unit. It should be cleared and
then attached into the 'stash' at 'stash->lastUnit'. */
@@ -133,9 +145,9 @@ static struct dwarf1_unit*
alloc_dwarf1_unit (stash)
struct dwarf1_debug* stash;
{
- struct dwarf1_unit* x =
- (struct dwarf1_unit*) bfd_zalloc (stash->abfd,
- sizeof (struct dwarf1_unit));
+ bfd_size_type amt = sizeof (struct dwarf1_unit);
+
+ struct dwarf1_unit* x = (struct dwarf1_unit*) bfd_zalloc (stash->abfd, amt);
x->prev = stash->lastUnit;
stash->lastUnit = x;
@@ -150,9 +162,9 @@ alloc_dwarf1_func (stash, aUnit)
struct dwarf1_debug* stash;
struct dwarf1_unit* aUnit;
{
- struct dwarf1_func* x =
- (struct dwarf1_func*) bfd_zalloc (stash->abfd,
- sizeof (struct dwarf1_func));
+ bfd_size_type amt = sizeof (struct dwarf1_func);
+
+ struct dwarf1_func* x = (struct dwarf1_func*) bfd_zalloc (stash->abfd, amt);
x->prev = aUnit->func_list;
aUnit->func_list = x;
@@ -167,10 +179,11 @@ alloc_dwarf1_func (stash, aUnit)
Return false if the die is invalidly formatted; true otherwise. */
static boolean
-parse_die (abfd, aDieInfo, aDiePtr)
+parse_die (abfd, aDieInfo, aDiePtr, aDiePtrEnd)
bfd* abfd;
struct die_info* aDieInfo;
char* aDiePtr;
+ char* aDiePtrEnd;
{
char* this_die = aDiePtr;
char* xptr = this_die;
@@ -180,7 +193,8 @@ parse_die (abfd, aDieInfo, aDiePtr)
/* First comes the length. */
aDieInfo->length = bfd_get_32 (abfd, (bfd_byte *) xptr);
xptr += 4;
- if (aDieInfo->length == 0)
+ if (aDieInfo->length == 0
+ || (this_die + aDieInfo->length) >= aDiePtrEnd)
return false;
if (aDieInfo->length < 6)
{
@@ -263,7 +277,7 @@ parse_line_table (stash, aUnit)
if (stash->line_section == 0)
{
asection *msec;
- unsigned long size;
+ bfd_size_type size;
msec = bfd_get_section_by_name (stash->abfd, ".line");
if (! msec)
@@ -275,7 +289,8 @@ parse_line_table (stash, aUnit)
if (! stash->line_section)
return false;
- if (! bfd_get_section_contents (stash->abfd, msec, stash->line_section, 0, size))
+ if (! bfd_get_section_contents (stash->abfd, msec, stash->line_section,
+ (bfd_vma) 0, size))
{
stash->line_section = 0;
return false;
@@ -288,9 +303,9 @@ parse_line_table (stash, aUnit)
if (xptr < stash->line_section_end)
{
unsigned long eachLine;
-
- char* tblend;
+ char *tblend;
unsigned long base;
+ bfd_size_type amt;
/* First comes the length. */
tblend = bfd_get_32 (stash->abfd, (bfd_byte *) xptr) + xptr;
@@ -305,9 +320,9 @@ parse_line_table (stash, aUnit)
aUnit->line_count = (tblend - xptr) / 10;
/* Allocate an array for the entries. */
- aUnit->linenumber_table = (struct linenumber *)
- bfd_alloc (stash->abfd,
- sizeof (struct linenumber) * aUnit->line_count);
+ amt = sizeof (struct linenumber) * aUnit->line_count;
+ aUnit->linenumber_table = ((struct linenumber *)
+ bfd_alloc (stash->abfd, amt));
for (eachLine = 0; eachLine < aUnit->line_count; eachLine++)
{
@@ -348,7 +363,8 @@ parse_functions_in_unit (stash, aUnit)
{
struct die_info eachDieInfo;
- if (! parse_die (stash->abfd, &eachDieInfo, eachDie))
+ if (! parse_die (stash->abfd, &eachDieInfo, eachDie,
+ stash->debug_section_end))
return false;
if (eachDieInfo.tag == TAG_global_subroutine
@@ -467,10 +483,10 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
if (! stash)
{
asection *msec;
- unsigned long size;
+ bfd_size_type size = sizeof (struct dwarf1_debug);
- stash = elf_tdata (abfd)->dwarf1_find_line_info =
- (struct dwarf1_debug*) bfd_zalloc (abfd, sizeof (struct dwarf1_debug));
+ stash = elf_tdata (abfd)->dwarf1_find_line_info
+ = (struct dwarf1_debug *) bfd_zalloc (abfd, size);
if (! stash)
return false;
@@ -490,7 +506,8 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
if (! stash->debug_section)
return false;
- if (! bfd_get_section_contents (abfd, msec, stash->debug_section, 0, size))
+ if (! bfd_get_section_contents (abfd, msec, stash->debug_section,
+ (bfd_vma) 0, size))
{
stash->debug_section = 0;
return false;
@@ -522,7 +539,8 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
{
struct die_info aDieInfo;
- if (! parse_die (stash->abfd, &aDieInfo, stash->currentDie))
+ if (! parse_die (stash->abfd, &aDieInfo, stash->currentDie,
+ stash->debug_section_end))
return false;
if (aDieInfo.tag == TAG_compile_unit)
diff --git a/contrib/binutils/bfd/dwarf2.c b/contrib/binutils/bfd/dwarf2.c
index 2161846..6398d4e 100644
--- a/contrib/binutils/bfd/dwarf2.c
+++ b/contrib/binutils/bfd/dwarf2.c
@@ -40,7 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
struct line_head
{
- unsigned int total_length;
+ bfd_vma total_length;
unsigned short version;
unsigned int prologue_length;
unsigned char minimum_instruction_length;
@@ -96,6 +96,14 @@ struct dwarf2_debug
/* Pointer to the end of the .debug_info section memory buffer. */
char* info_ptr_end;
+ /* Pointer to the section and address of the beginning of the
+ section. */
+ asection* sec;
+ char* sec_info_ptr;
+
+ /* Pointer to the symbol table. */
+ asymbol** syms;
+
/* Pointer to the .debug_abbrev section loaded into memory. */
char* dwarf_abbrev_buffer;
@@ -107,6 +115,12 @@ struct dwarf2_debug
/* Length of the loaded .debug_line section. */
unsigned long dwarf_line_size;
+
+ /* Pointer to the .debug_str section loaded into memory. */
+ char* dwarf_str_buffer;
+
+ /* Length of the loaded .debug_str section. */
+ unsigned long dwarf_str_size;
};
struct arange
@@ -161,10 +175,86 @@ struct comp_unit
/* A list of the functions found in this comp. unit. */
struct funcinfo* function_table;
+ /* Pointer to dwarf2_debug structure. */
+ struct dwarf2_debug *stash;
+
/* Address size for this unit - from unit header. */
unsigned char addr_size;
+
+ /* Offset size for this unit - from unit header. */
+ unsigned char offset_size;
+};
+
+/* This data structure holds the information of an abbrev. */
+struct abbrev_info
+{
+ unsigned int number; /* Number identifying abbrev. */
+ enum dwarf_tag tag; /* DWARF tag. */
+ int has_children; /* Boolean. */
+ unsigned int num_attrs; /* Number of attributes. */
+ struct attr_abbrev *attrs; /* An array of attribute descriptions. */
+ struct abbrev_info *next; /* Next in chain. */
+};
+
+struct attr_abbrev
+{
+ enum dwarf_attribute name;
+ enum dwarf_form form;
};
+#ifndef ABBREV_HASH_SIZE
+#define ABBREV_HASH_SIZE 121
+#endif
+#ifndef ATTR_ALLOC_CHUNK
+#define ATTR_ALLOC_CHUNK 4
+#endif
+
+static unsigned int read_1_byte PARAMS ((bfd *, char *));
+static int read_1_signed_byte PARAMS ((bfd *, char *));
+static unsigned int read_2_bytes PARAMS ((bfd *, char *));
+static unsigned int read_4_bytes PARAMS ((bfd *, char *));
+static bfd_vma read_8_bytes PARAMS ((bfd *, char *));
+static char *read_n_bytes PARAMS ((bfd *, char *, unsigned int));
+static char *read_string PARAMS ((bfd *, char *, unsigned int *));
+static char *read_indirect_string PARAMS ((struct comp_unit *, char *, unsigned int *));
+static unsigned int read_unsigned_leb128
+ PARAMS ((bfd *, char *, unsigned int *));
+static int read_signed_leb128
+ PARAMS ((bfd *, char *, unsigned int *));
+static bfd_vma read_address PARAMS ((struct comp_unit *, char *));
+static struct abbrev_info *lookup_abbrev
+ PARAMS ((unsigned int, struct abbrev_info **));
+static struct abbrev_info **read_abbrevs
+ PARAMS ((bfd *, unsigned int, struct dwarf2_debug *));
+static char *read_attribute
+ PARAMS ((struct attribute *, struct attr_abbrev *,
+ struct comp_unit *, char *));
+static char *read_attribute_value
+ PARAMS ((struct attribute *, unsigned,
+ struct comp_unit *, char *));
+static void add_line_info
+ PARAMS ((struct line_info_table *, bfd_vma, char *,
+ unsigned int, unsigned int, int));
+static char *concat_filename PARAMS ((struct line_info_table *, unsigned int));
+static void arange_add PARAMS ((struct comp_unit *, bfd_vma, bfd_vma));
+static struct line_info_table *decode_line_info
+ PARAMS ((struct comp_unit *, struct dwarf2_debug *));
+static boolean lookup_address_in_line_info_table
+ PARAMS ((struct line_info_table *, bfd_vma, const char **, unsigned int *));
+static boolean lookup_address_in_function_table
+ PARAMS ((struct funcinfo *, bfd_vma, const char **));
+static boolean scan_unit_for_functions PARAMS ((struct comp_unit *));
+static bfd_vma find_rela_addend
+ PARAMS ((bfd *, asection *, bfd_size_type, asymbol**));
+static struct comp_unit *parse_comp_unit
+ PARAMS ((bfd *, struct dwarf2_debug *, bfd_vma, unsigned int));
+static boolean comp_unit_contains_address
+ PARAMS ((struct comp_unit *, bfd_vma));
+static boolean comp_unit_find_nearest_line
+ PARAMS ((struct comp_unit *, bfd_vma, const char **, const char **,
+ unsigned int *, struct dwarf2_debug *));
+static asection *find_debug_info PARAMS ((bfd *, asection *));
+
/* VERBATIM
The following function up to the END VERBATIM mark are
copied directly from dwarf2read.c. */
@@ -227,7 +317,7 @@ read_4_signed_bytes (abfd, buf)
#endif
-static unsigned int
+static bfd_vma
read_8_bytes (abfd, buf)
bfd *abfd;
char *buf;
@@ -253,9 +343,7 @@ read_string (abfd, buf, bytes_read_ptr)
char *buf;
unsigned int *bytes_read_ptr;
{
- /* If the size of a host char is 8 bits, we can return a pointer
- to the string, otherwise we have to copy the string to a buffer
- allocated on the temporary obstack. */
+ /* Return a pointer to the embedded string. */
if (*buf == '\0')
{
*bytes_read_ptr = 1;
@@ -266,6 +354,59 @@ read_string (abfd, buf, bytes_read_ptr)
return buf;
}
+static char *
+read_indirect_string (unit, buf, bytes_read_ptr)
+ struct comp_unit* unit;
+ char *buf;
+ unsigned int *bytes_read_ptr;
+{
+ bfd_vma offset;
+ struct dwarf2_debug *stash = unit->stash;
+
+ if (unit->offset_size == 4)
+ offset = read_4_bytes (unit->abfd, buf);
+ else
+ offset = read_8_bytes (unit->abfd, buf);
+ *bytes_read_ptr = unit->offset_size;
+
+ if (! stash->dwarf_str_buffer)
+ {
+ asection *msec;
+ bfd *abfd = unit->abfd;
+
+ msec = bfd_get_section_by_name (abfd, ".debug_str");
+ if (! msec)
+ {
+ (*_bfd_error_handler)
+ (_("Dwarf Error: Can't find .debug_str section."));
+ bfd_set_error (bfd_error_bad_value);
+ return NULL;
+ }
+
+ stash->dwarf_str_size = msec->_raw_size;
+ stash->dwarf_str_buffer = (char*) bfd_alloc (abfd, msec->_raw_size);
+ if (! stash->dwarf_abbrev_buffer)
+ return NULL;
+
+ if (! bfd_get_section_contents (abfd, msec, stash->dwarf_str_buffer,
+ (bfd_vma) 0, msec->_raw_size))
+ return NULL;
+ }
+
+ if (offset >= stash->dwarf_str_size)
+ {
+ (*_bfd_error_handler) (_("Dwarf Error: DW_FORM_strp offset (%u) greater than or equal to .debug_str size (%u)."),
+ offset, stash->dwarf_str_size );
+ bfd_set_error (bfd_error_bad_value);
+ return NULL;
+ }
+
+ buf = stash->dwarf_str_buffer + offset;
+ if (*buf == '\0')
+ return NULL;
+ return buf;
+}
+
static unsigned int
read_unsigned_leb128 (abfd, buf, bytes_read_ptr)
bfd *abfd ATTRIBUTE_UNUSED;
@@ -349,30 +490,6 @@ read_address (unit, buf)
}
}
-/* This data structure holds the information of an abbrev. */
-struct abbrev_info
-{
- unsigned int number; /* Number identifying abbrev. */
- enum dwarf_tag tag; /* DWARF tag. */
- int has_children; /* Boolean. */
- unsigned int num_attrs; /* Number of attributes. */
- struct attr_abbrev *attrs; /* An array of attribute descriptions. */
- struct abbrev_info *next; /* Next in chain. */
-};
-
-struct attr_abbrev
-{
- enum dwarf_attribute name;
- enum dwarf_form form;
-};
-
-#ifndef ABBREV_HASH_SIZE
-#define ABBREV_HASH_SIZE 121
-#endif
-#ifndef ATTR_ALLOC_CHUNK
-#define ATTR_ALLOC_CHUNK 4
-#endif
-
/* Lookup an abbrev_info structure in the abbrev hash table. */
static struct abbrev_info *
@@ -413,6 +530,7 @@ read_abbrevs (abfd, offset, stash)
struct abbrev_info *cur_abbrev;
unsigned int abbrev_number, bytes_read, abbrev_name;
unsigned int abbrev_form, hash_number;
+ bfd_size_type amt;
if (! stash->dwarf_abbrev_buffer)
{
@@ -427,13 +545,12 @@ read_abbrevs (abfd, offset, stash)
}
stash->dwarf_abbrev_size = msec->_raw_size;
- stash->dwarf_abbrev_buffer = (char*) bfd_alloc (abfd, stash->dwarf_abbrev_size);
+ stash->dwarf_abbrev_buffer = (char*) bfd_alloc (abfd, msec->_raw_size);
if (! stash->dwarf_abbrev_buffer)
return 0;
- if (! bfd_get_section_contents (abfd, msec,
- stash->dwarf_abbrev_buffer, 0,
- stash->dwarf_abbrev_size))
+ if (! bfd_get_section_contents (abfd, msec, stash->dwarf_abbrev_buffer,
+ (bfd_vma) 0, msec->_raw_size))
return 0;
}
@@ -445,7 +562,8 @@ read_abbrevs (abfd, offset, stash)
return 0;
}
- abbrevs = (struct abbrev_info**) bfd_zalloc (abfd, sizeof (struct abbrev_info*) * ABBREV_HASH_SIZE);
+ amt = sizeof (struct abbrev_info*) * ABBREV_HASH_SIZE;
+ abbrevs = (struct abbrev_info**) bfd_zalloc (abfd, amt);
abbrev_ptr = stash->dwarf_abbrev_buffer + offset;
abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
@@ -454,7 +572,8 @@ read_abbrevs (abfd, offset, stash)
/* Loop until we reach an abbrev number of 0. */
while (abbrev_number)
{
- cur_abbrev = (struct abbrev_info*)bfd_zalloc (abfd, sizeof (struct abbrev_info));
+ amt = sizeof (struct abbrev_info);
+ cur_abbrev = (struct abbrev_info *) bfd_zalloc (abfd, amt);
/* Read in abbrev header. */
cur_abbrev->number = abbrev_number;
@@ -473,10 +592,10 @@ read_abbrevs (abfd, offset, stash)
{
if ((cur_abbrev->num_attrs % ATTR_ALLOC_CHUNK) == 0)
{
- cur_abbrev->attrs = (struct attr_abbrev *)
- bfd_realloc (cur_abbrev->attrs,
- (cur_abbrev->num_attrs + ATTR_ALLOC_CHUNK)
- * sizeof (struct attr_abbrev));
+ amt = cur_abbrev->num_attrs + ATTR_ALLOC_CHUNK;
+ amt *= sizeof (struct attr_abbrev);
+ cur_abbrev->attrs = ((struct attr_abbrev *)
+ bfd_realloc (cur_abbrev->attrs, amt));
if (! cur_abbrev->attrs)
return 0;
}
@@ -512,31 +631,33 @@ read_abbrevs (abfd, offset, stash)
return abbrevs;
}
-/* Read an attribute described by an abbreviated attribute. */
+/* Read an attribute value described by an attribute form. */
static char *
-read_attribute (attr, abbrev, unit, info_ptr)
+read_attribute_value (attr, form, unit, info_ptr)
struct attribute *attr;
- struct attr_abbrev *abbrev;
+ unsigned form;
struct comp_unit *unit;
char *info_ptr;
{
bfd *abfd = unit->abfd;
unsigned int bytes_read;
struct dwarf_block *blk;
+ bfd_size_type amt;
- attr->name = abbrev->name;
- attr->form = abbrev->form;
+ attr->form = form;
- switch (abbrev->form)
+ switch (form)
{
case DW_FORM_addr:
+ /* FIXME: DWARF3 draft sais DW_FORM_ref_addr is offset_size. */
case DW_FORM_ref_addr:
DW_ADDR (attr) = read_address (unit, info_ptr);
info_ptr += unit->addr_size;
break;
case DW_FORM_block2:
- blk = (struct dwarf_block *) bfd_alloc (abfd, sizeof (struct dwarf_block));
+ amt = sizeof (struct dwarf_block);
+ blk = (struct dwarf_block *) bfd_alloc (abfd, amt);
blk->size = read_2_bytes (abfd, info_ptr);
info_ptr += 2;
blk->data = read_n_bytes (abfd, info_ptr, blk->size);
@@ -544,7 +665,8 @@ read_attribute (attr, abbrev, unit, info_ptr)
DW_BLOCK (attr) = blk;
break;
case DW_FORM_block4:
- blk = (struct dwarf_block *) bfd_alloc (abfd, sizeof (struct dwarf_block));
+ amt = sizeof (struct dwarf_block);
+ blk = (struct dwarf_block *) bfd_alloc (abfd, amt);
blk->size = read_4_bytes (abfd, info_ptr);
info_ptr += 4;
blk->data = read_n_bytes (abfd, info_ptr, blk->size);
@@ -567,8 +689,13 @@ read_attribute (attr, abbrev, unit, info_ptr)
DW_STRING (attr) = read_string (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read;
break;
+ case DW_FORM_strp:
+ DW_STRING (attr) = read_indirect_string (unit, info_ptr, &bytes_read);
+ info_ptr += bytes_read;
+ break;
case DW_FORM_block:
- blk = (struct dwarf_block *) bfd_alloc (abfd, sizeof (struct dwarf_block));
+ amt = sizeof (struct dwarf_block);
+ blk = (struct dwarf_block *) bfd_alloc (abfd, amt);
blk->size = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read;
blk->data = read_n_bytes (abfd, info_ptr, blk->size);
@@ -576,7 +703,8 @@ read_attribute (attr, abbrev, unit, info_ptr)
DW_BLOCK (attr) = blk;
break;
case DW_FORM_block1:
- blk = (struct dwarf_block *) bfd_alloc (abfd, sizeof (struct dwarf_block));
+ amt = sizeof (struct dwarf_block);
+ blk = (struct dwarf_block *) bfd_alloc (abfd, amt);
blk->size = read_1_byte (abfd, info_ptr);
info_ptr += 1;
blk->data = read_n_bytes (abfd, info_ptr, blk->size);
@@ -619,16 +747,33 @@ read_attribute (attr, abbrev, unit, info_ptr)
DW_UNSND (attr) = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read;
break;
- case DW_FORM_strp:
case DW_FORM_indirect:
+ form = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
+ info_ptr += bytes_read;
+ info_ptr = read_attribute_value (attr, form, unit, info_ptr);
+ break;
default:
(*_bfd_error_handler) (_("Dwarf Error: Invalid or unhandled FORM value: %d."),
- abbrev->form);
+ form);
bfd_set_error (bfd_error_bad_value);
}
return info_ptr;
}
+/* Read an attribute described by an abbreviated attribute. */
+
+static char *
+read_attribute (attr, abbrev, unit, info_ptr)
+ struct attribute *attr;
+ struct attr_abbrev *abbrev;
+ struct comp_unit *unit;
+ char *info_ptr;
+{
+ attr->name = abbrev->name;
+ info_ptr = read_attribute_value (attr, abbrev->form, unit, info_ptr);
+ return info_ptr;
+}
+
/* Source line information table routines. */
#define FILE_ALLOC_CHUNK 5
@@ -672,8 +817,8 @@ add_line_info (table, address, filename, line, column, end_sequence)
unsigned int column;
int end_sequence;
{
- struct line_info* info = (struct line_info*)
- bfd_alloc (table->abfd, sizeof (struct line_info));
+ bfd_size_type amt = sizeof (struct line_info);
+ struct line_info* info = (struct line_info*) bfd_alloc (table->abfd, amt);
info->prev_line = table->last_line;
table->last_line = info;
@@ -749,7 +894,7 @@ arange_add (unit, low_pc, high_pc)
}
/* Need to allocate a new arange and insert it into the arange list. */
- arange = bfd_zalloc (unit->abfd, sizeof (*arange));
+ arange = bfd_zalloc (unit->abfd, (bfd_size_type) sizeof (*arange));
arange->low = low_pc;
arange->high = high_pc;
@@ -769,9 +914,10 @@ decode_line_info (unit, stash)
char *line_ptr;
char *line_end;
struct line_head lh;
- unsigned int i, bytes_read;
+ unsigned int i, bytes_read, offset_size;
char *cur_file, *cur_dir;
unsigned char op_code, extended_op, adj_opcode;
+ bfd_size_type amt;
if (! stash->dwarf_line_buffer)
{
@@ -786,13 +932,12 @@ decode_line_info (unit, stash)
}
stash->dwarf_line_size = msec->_raw_size;
- stash->dwarf_line_buffer = (char *) bfd_alloc (abfd, stash->dwarf_line_size);
+ stash->dwarf_line_buffer = (char *) bfd_alloc (abfd, msec->_raw_size);
if (! stash->dwarf_line_buffer)
return 0;
- if (! bfd_get_section_contents (abfd, msec,
- stash->dwarf_line_buffer, 0,
- stash->dwarf_line_size))
+ if (! bfd_get_section_contents (abfd, msec, stash->dwarf_line_buffer,
+ (bfd_vma) 0, msec->_raw_size))
return 0;
/* FIXME: We ought to apply the relocs against this section before
@@ -810,8 +955,8 @@ decode_line_info (unit, stash)
return 0;
}
- table = (struct line_info_table*) bfd_alloc (abfd,
- sizeof (struct line_info_table));
+ amt = sizeof (struct line_info_table);
+ table = (struct line_info_table*) bfd_alloc (abfd, amt);
table->abfd = abfd;
table->comp_dir = unit->comp_dir;
@@ -829,11 +974,21 @@ decode_line_info (unit, stash)
/* Read in the prologue. */
lh.total_length = read_4_bytes (abfd, line_ptr);
line_ptr += 4;
+ offset_size = 4;
+ if (lh.total_length == 0xffffffff)
+ {
+ lh.total_length = read_8_bytes (abfd, line_ptr);
+ line_ptr += 8;
+ offset_size = 8;
+ }
line_end = line_ptr + lh.total_length;
lh.version = read_2_bytes (abfd, line_ptr);
line_ptr += 2;
- lh.prologue_length = read_4_bytes (abfd, line_ptr);
- line_ptr += 4;
+ if (offset_size == 4)
+ lh.prologue_length = read_4_bytes (abfd, line_ptr);
+ else
+ lh.prologue_length = read_8_bytes (abfd, line_ptr);
+ line_ptr += offset_size;
lh.minimum_instruction_length = read_1_byte (abfd, line_ptr);
line_ptr += 1;
lh.default_is_stmt = read_1_byte (abfd, line_ptr);
@@ -844,8 +999,8 @@ decode_line_info (unit, stash)
line_ptr += 1;
lh.opcode_base = read_1_byte (abfd, line_ptr);
line_ptr += 1;
- lh.standard_opcode_lengths = (unsigned char *)
- bfd_alloc (abfd, lh.opcode_base * sizeof (unsigned char));
+ amt = lh.opcode_base * sizeof (unsigned char);
+ lh.standard_opcode_lengths = (unsigned char *) bfd_alloc (abfd, amt);
lh.standard_opcode_lengths[0] = 1;
@@ -862,9 +1017,9 @@ decode_line_info (unit, stash)
if ((table->num_dirs % DIR_ALLOC_CHUNK) == 0)
{
- table->dirs = (char **)
- bfd_realloc (table->dirs,
- (table->num_dirs + DIR_ALLOC_CHUNK) * sizeof (char *));
+ amt = table->num_dirs + DIR_ALLOC_CHUNK;
+ amt *= sizeof (char *);
+ table->dirs = (char **) bfd_realloc (table->dirs, amt);
if (! table->dirs)
return 0;
}
@@ -881,10 +1036,9 @@ decode_line_info (unit, stash)
if ((table->num_files % FILE_ALLOC_CHUNK) == 0)
{
- table->files = (struct fileinfo *)
- bfd_realloc (table->files,
- (table->num_files + FILE_ALLOC_CHUNK)
- * sizeof (struct fileinfo));
+ amt = table->num_files + FILE_ALLOC_CHUNK;
+ amt *= sizeof (struct fileinfo);
+ table->files = (struct fileinfo *) bfd_realloc (table->files, amt);
if (! table->files)
return 0;
}
@@ -923,7 +1077,22 @@ decode_line_info (unit, stash)
op_code = read_1_byte (abfd, line_ptr);
line_ptr += 1;
- switch (op_code)
+ if (op_code >= lh.opcode_base)
+ { /* Special operand. */
+ adj_opcode = op_code - lh.opcode_base;
+ address += (adj_opcode / lh.line_range)
+ * lh.minimum_instruction_length;
+ line += lh.line_base + (adj_opcode % lh.line_range);
+ /* Append row to matrix using current values. */
+ add_line_info (table, address, filename, line, column, 0);
+ basic_block = 1;
+ if (need_low_pc)
+ {
+ need_low_pc = 0;
+ low_pc = address;
+ }
+ }
+ else switch (op_code)
{
case DW_LNS_extended_op:
line_ptr += 1; /* Ignore length. */
@@ -951,10 +1120,10 @@ decode_line_info (unit, stash)
line_ptr += bytes_read;
if ((table->num_files % FILE_ALLOC_CHUNK) == 0)
{
- table->files = (struct fileinfo *)
- bfd_realloc (table->files,
- (table->num_files + FILE_ALLOC_CHUNK)
- * sizeof (struct fileinfo));
+ amt = table->num_files + FILE_ALLOC_CHUNK;
+ amt *= sizeof (struct fileinfo);
+ table->files =
+ (struct fileinfo *) bfd_realloc (table->files, amt);
if (! table->files)
return 0;
}
@@ -1023,19 +1192,15 @@ decode_line_info (unit, stash)
address += read_2_bytes (abfd, line_ptr);
line_ptr += 2;
break;
- default: /* Special operand. */
- adj_opcode = op_code - lh.opcode_base;
- address += (adj_opcode / lh.line_range)
- * lh.minimum_instruction_length;
- line += lh.line_base + (adj_opcode % lh.line_range);
- /* Append row to matrix using current values. */
- add_line_info (table, address, filename, line, column, 0);
- basic_block = 1;
- if (need_low_pc)
- {
- need_low_pc = 0;
- low_pc = address;
- }
+ default:
+ { /* Unknown standard opcode, ignore it. */
+ int i;
+ for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++)
+ {
+ (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+ }
+ }
}
}
}
@@ -1158,7 +1323,8 @@ scan_unit_for_functions (unit)
if (abbrev->tag == DW_TAG_subprogram)
{
- func = (struct funcinfo*) bfd_zalloc (abfd, sizeof (struct funcinfo));
+ bfd_size_type amt = sizeof (struct funcinfo);
+ func = (struct funcinfo *) bfd_zalloc (abfd, amt);
func->prev_func = unit->function_table;
unit->function_table = func;
}
@@ -1219,22 +1385,75 @@ scan_unit_for_functions (unit)
return true;
}
+/* Look for a RELA relocation to be applied on OFFSET of section SEC,
+ and return the addend if such a relocation is found. Since this is
+ only used to find relocations referring to the .debug_abbrev
+ section, we make sure the relocation refers to this section, but
+ this is not strictly necessary, and it can probably be safely
+ removed if needed. However, it is important to note that this
+ function only returns the addend, it doesn't serve the purpose of
+ applying a generic relocation.
+
+ If no suitable relocation is found, or if it is not a real RELA
+ relocation, this function returns 0. */
+
+static bfd_vma
+find_rela_addend (abfd, sec, offset, syms)
+ bfd* abfd;
+ asection* sec;
+ bfd_size_type offset;
+ asymbol** syms;
+{
+ long reloc_size = bfd_get_reloc_upper_bound (abfd, sec);
+ arelent **relocs = NULL;
+ long reloc_count, relc;
+
+ if (reloc_size <= 0)
+ return 0;
+
+ relocs = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
+ if (relocs == NULL)
+ return 0;
+
+ reloc_count = bfd_canonicalize_reloc (abfd, sec, relocs, syms);
+
+ if (reloc_count <= 0)
+ {
+ free (relocs);
+ return 0;
+ }
+
+ for (relc = 0; relc < reloc_count; relc++)
+ if (relocs[relc]->address == offset
+ && (*relocs[relc]->sym_ptr_ptr)->flags & BSF_SECTION_SYM
+ && strcmp ((*relocs[relc]->sym_ptr_ptr)->name,
+ ".debug_abbrev") == 0)
+ {
+ bfd_vma addend = (relocs[relc]->howto->partial_inplace
+ ? 0 : relocs[relc]->addend);
+ free (relocs);
+ return addend;
+ }
+
+ free (relocs);
+ return 0;
+}
+
/* Parse a DWARF2 compilation unit starting at INFO_PTR. This
includes the compilation unit header that proceeds the DIE's, but
does not include the length field that preceeds each compilation
unit header. END_PTR points one past the end of this comp unit.
- If ABBREV_LENGTH is 0, then the length of the abbreviation offset
- is assumed to be four bytes. Otherwise, it it is the size given.
+ OFFSET_SIZE is the size of DWARF2 offsets (either 4 or 8 bytes).
This routine does not read the whole compilation unit; only enough
to get to the line number information for the compilation unit. */
static struct comp_unit *
-parse_comp_unit (abfd, stash, unit_length, abbrev_length)
+parse_comp_unit (abfd, stash, unit_length, offset_size)
bfd* abfd;
struct dwarf2_debug *stash;
bfd_vma unit_length;
- unsigned int abbrev_length;
+ unsigned int offset_size;
{
struct comp_unit* unit;
@@ -1249,17 +1468,23 @@ parse_comp_unit (abfd, stash, unit_length, abbrev_length)
char *info_ptr = stash->info_ptr;
char *end_ptr = info_ptr + unit_length;
+ bfd_size_type amt;
+ bfd_size_type off;
version = read_2_bytes (abfd, info_ptr);
info_ptr += 2;
- BFD_ASSERT (abbrev_length == 0
- || abbrev_length == 4
- || abbrev_length == 8);
- if (abbrev_length == 0 || abbrev_length == 4)
+ BFD_ASSERT (offset_size == 4 || offset_size == 8);
+ if (offset_size == 4)
abbrev_offset = read_4_bytes (abfd, info_ptr);
- else if (abbrev_length == 8)
+ else
abbrev_offset = read_8_bytes (abfd, info_ptr);
- info_ptr += abbrev_length;
+ /* The abbrev offset is generally a relocation pointing to
+ .debug_abbrev+offset. On RELA targets, we have to find the
+ relocation and extract the addend to obtain the actual
+ abbrev_offset, so do it here. */
+ off = info_ptr - stash->sec_info_ptr;
+ abbrev_offset += find_rela_addend (abfd, stash->sec, off, stash->syms);
+ info_ptr += offset_size;
addr_size = read_1_byte (abfd, info_ptr);
info_ptr += 1;
@@ -1310,11 +1535,14 @@ parse_comp_unit (abfd, stash, unit_length, abbrev_length)
return 0;
}
- unit = (struct comp_unit*) bfd_zalloc (abfd, sizeof (struct comp_unit));
+ amt = sizeof (struct comp_unit);
+ unit = (struct comp_unit*) bfd_zalloc (abfd, amt);
unit->abfd = abfd;
unit->addr_size = addr_size;
+ unit->offset_size = offset_size;
unit->abbrevs = abbrevs;
unit->end_ptr = end_ptr;
+ unit->stash = stash;
for (i = 0; i < abbrev->num_attrs; ++i)
{
@@ -1499,7 +1727,7 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
addr_size, pinfo)
bfd *abfd;
asection *section;
- asymbol **symbols ATTRIBUTE_UNUSED;
+ asymbol **symbols;
bfd_vma offset;
const char **filename_ptr;
const char **functionname_ptr;
@@ -1535,11 +1763,11 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
if (! stash)
{
- unsigned long total_size;
+ bfd_size_type total_size;
asection *msec;
+ bfd_size_type amt = sizeof (struct dwarf2_debug);
- stash =
- (struct dwarf2_debug*) bfd_zalloc (abfd, sizeof (struct dwarf2_debug));
+ stash = (struct dwarf2_debug*) bfd_zalloc (abfd, amt);
if (! stash)
return false;
@@ -1570,8 +1798,8 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
msec;
msec = find_debug_info (abfd, msec))
{
- unsigned long size;
- unsigned long start;
+ bfd_size_type size;
+ bfd_size_type start;
size = msec->_raw_size;
if (size == 0)
@@ -1579,13 +1807,18 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
start = stash->info_ptr_end - stash->info_ptr;
- if (! bfd_get_section_contents (abfd, msec, stash->info_ptr + start, 0, size))
+ if (! bfd_get_section_contents (abfd, msec, stash->info_ptr + start,
+ (bfd_vma) 0, size))
continue;
stash->info_ptr_end = stash->info_ptr + start + size;
}
- BFD_ASSERT (stash->info_ptr_end = stash->info_ptr + total_size);
+ BFD_ASSERT (stash->info_ptr_end == stash->info_ptr + total_size);
+
+ stash->sec = find_debug_info (abfd, NULL);
+ stash->sec_info_ptr = stash->info_ptr;
+ stash->syms = symbols;
}
/* FIXME: There is a problem with the contents of the
@@ -1618,21 +1851,36 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
/* Read each remaining comp. units checking each as they are read. */
while (stash->info_ptr < stash->info_ptr_end)
{
- struct comp_unit* each;
bfd_vma length;
boolean found;
+ unsigned int offset_size = addr_size;
if (addr_size == 4)
- length = read_4_bytes (abfd, stash->info_ptr);
+ {
+ length = read_4_bytes (abfd, stash->info_ptr);
+ if (length == 0xffffffff)
+ {
+ offset_size = 8;
+ length = read_8_bytes (abfd, stash->info_ptr + 4);
+ stash->info_ptr += 8;
+ }
+ }
else
length = read_8_bytes (abfd, stash->info_ptr);
stash->info_ptr += addr_size;
if (length > 0)
{
- each = parse_comp_unit (abfd, stash, length, addr_size);
+ each = parse_comp_unit (abfd, stash, length, offset_size);
stash->info_ptr += length;
+ if ((bfd_vma) (stash->info_ptr - stash->sec_info_ptr)
+ == stash->sec->_raw_size)
+ {
+ stash->sec = find_debug_info (abfd, stash->sec);
+ stash->sec_info_ptr = stash->info_ptr;
+ }
+
if (each)
{
each->next_unit = stash->all_comp_units;
diff --git a/contrib/binutils/bfd/ecoff.c b/contrib/binutils/bfd/ecoff.c
index db60638..1e3b6a9 100644
--- a/contrib/binutils/bfd/ecoff.c
+++ b/contrib/binutils/bfd/ecoff.c
@@ -65,7 +65,7 @@ static boolean ecoff_compute_section_file_positions PARAMS ((bfd *abfd));
static bfd_size_type ecoff_compute_reloc_file_positions PARAMS ((bfd *abfd));
static boolean ecoff_get_extr PARAMS ((asymbol *, EXTR *));
static void ecoff_set_index PARAMS ((asymbol *, bfd_size_type));
-static unsigned int ecoff_armap_hash PARAMS ((CONST char *s,
+static unsigned int ecoff_armap_hash PARAMS ((const char *s,
unsigned int *rehash,
unsigned int size,
unsigned int hlog));
@@ -78,7 +78,7 @@ static asection bfd_debug_section =
"*DEBUG*", 0, 0, NULL, 0, 0, 0,
/* linker_mark, linker_has_input, gc_mark, segment_mark, */
0, 0, 0, 0,
- /* vma, lma, _cooked_size, _raw_size, */
+ /* vma, lma, _cooked_size, _raw_size, */
0, 0, 0, 0,
/* output_offset, output_section, alignment_power, */
0, NULL, 0,
@@ -86,8 +86,8 @@ static asection bfd_debug_section =
NULL, NULL, 0, 0, 0,
/* line_filepos, userdata, contents, lineno, lineno_count, */
0, NULL, NULL, NULL, 0,
- /* comdat, kept_section, moving_line_filepos, */
- NULL, NULL, 0,
+ /* entsize, comdat, moving_line_filepos, */
+ 0, NULL, 0,
/* target_index, used_by_bfd, constructor_chain, owner, */
0, NULL, NULL, NULL,
/* symbol, */
@@ -104,8 +104,8 @@ boolean
_bfd_ecoff_mkobject (abfd)
bfd *abfd;
{
- abfd->tdata.ecoff_obj_data = ((struct ecoff_tdata *)
- bfd_zalloc (abfd, sizeof (ecoff_data_type)));
+ bfd_size_type amt = sizeof (ecoff_data_type);
+ abfd->tdata.ecoff_obj_data = (struct ecoff_tdata *) bfd_zalloc (abfd, amt);
if (abfd->tdata.ecoff_obj_data == NULL)
return false;
@@ -371,16 +371,17 @@ ecoff_sec_to_styp_flags (name, flags)
/* Get the BFD flags to use for a section. */
-flagword
-_bfd_ecoff_styp_to_sec_flags (abfd, hdr, name, section)
+boolean
+_bfd_ecoff_styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
bfd *abfd ATTRIBUTE_UNUSED;
PTR hdr;
const char *name ATTRIBUTE_UNUSED;
asection *section ATTRIBUTE_UNUSED;
+ flagword * flags_ptr;
{
struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
long styp_flags = internal_s->s_flags;
- flagword sec_flags=0;
+ flagword sec_flags = 0;
if (styp_flags & STYP_NOLOAD)
sec_flags |= SEC_NEVER_LOAD;
@@ -422,29 +423,20 @@ _bfd_ecoff_styp_to_sec_flags (abfd, hdr, name, section)
}
else if ((styp_flags & STYP_BSS)
|| (styp_flags & STYP_SBSS))
- {
- sec_flags |= SEC_ALLOC;
- }
+ sec_flags |= SEC_ALLOC;
else if ((styp_flags & STYP_INFO) || styp_flags == STYP_COMMENT)
- {
- sec_flags |= SEC_NEVER_LOAD;
- }
+ sec_flags |= SEC_NEVER_LOAD;
else if ((styp_flags & STYP_LITA)
|| (styp_flags & STYP_LIT8)
|| (styp_flags & STYP_LIT4))
- {
- sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_READONLY;
- }
+ sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_READONLY;
else if (styp_flags & STYP_ECOFF_LIB)
- {
- sec_flags |= SEC_COFF_SHARED_LIBRARY;
- }
+ sec_flags |= SEC_COFF_SHARED_LIBRARY;
else
- {
- sec_flags |= SEC_ALLOC | SEC_LOAD;
- }
+ sec_flags |= SEC_ALLOC | SEC_LOAD;
- return sec_flags;
+ * flags_ptr = sec_flags;
+ return true;
}
/* Read in the symbolic header for an ECOFF object file. */
@@ -482,13 +474,12 @@ ecoff_slurp_symbolic_header (abfd)
}
/* Read the symbolic information header. */
- raw = (PTR) bfd_malloc ((size_t) external_hdr_size);
+ raw = (PTR) bfd_malloc (external_hdr_size);
if (raw == NULL)
goto error_return;
- if (bfd_seek (abfd, ecoff_data (abfd)->sym_filepos, SEEK_SET) == -1
- || (bfd_read (raw, external_hdr_size, 1, abfd)
- != external_hdr_size))
+ if (bfd_seek (abfd, ecoff_data (abfd)->sym_filepos, SEEK_SET) != 0
+ || bfd_bread (raw, external_hdr_size, abfd) != external_hdr_size)
goto error_return;
internal_symhdr = &ecoff_data (abfd)->debug_info.symbolic_header;
(*backend->debug_swap.swap_hdr_in) (abfd, raw, internal_symhdr);
@@ -533,6 +524,8 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
struct fdr *fdr_ptr;
bfd_size_type raw_end;
bfd_size_type cb_end;
+ bfd_size_type amt;
+ file_ptr pos;
BFD_ASSERT (debug == &ecoff_data (abfd)->debug_info);
@@ -591,11 +584,11 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
raw = (PTR) bfd_alloc (abfd, raw_size);
if (raw == NULL)
return false;
- if (bfd_seek (abfd,
- (ecoff_data (abfd)->sym_filepos
- + backend->debug_swap.external_hdr_size),
- SEEK_SET) != 0
- || bfd_read (raw, raw_size, 1, abfd) != raw_size)
+
+ pos = ecoff_data (abfd)->sym_filepos;
+ pos += backend->debug_swap.external_hdr_size;
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0
+ || bfd_bread (raw, raw_size, abfd) != raw_size)
{
bfd_release (abfd, raw);
return false;
@@ -632,9 +625,9 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
We need to look at the fdr to deal with a lot of information in
the symbols, so we swap them here. */
- debug->fdr = (struct fdr *) bfd_alloc (abfd,
- (internal_symhdr->ifdMax *
- sizeof (struct fdr)));
+ amt = internal_symhdr->ifdMax;
+ amt *= sizeof (struct fdr);
+ debug->fdr = (struct fdr *) bfd_alloc (abfd, amt);
if (debug->fdr == NULL)
return false;
external_fdr_size = backend->debug_swap.external_fdr_size;
@@ -666,8 +659,9 @@ _bfd_ecoff_make_empty_symbol (abfd)
bfd *abfd;
{
ecoff_symbol_type *new;
+ bfd_size_type amt = sizeof (ecoff_symbol_type);
- new = (ecoff_symbol_type *) bfd_alloc (abfd, sizeof (ecoff_symbol_type));
+ new = (ecoff_symbol_type *) bfd_alloc (abfd, amt);
if (new == (ecoff_symbol_type *) NULL)
return (asymbol *) NULL;
memset ((PTR) new, 0, sizeof *new);
@@ -866,6 +860,7 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak)
asection *section;
arelent_chain *reloc_chain;
unsigned int bitsize;
+ bfd_size_type amt;
/* Get a section with the same name as the symbol (usually
__CTOR_LIST__ or __DTOR_LIST__). FIXME: gcc uses the
@@ -885,7 +880,8 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak)
{
char *copy;
- copy = (char *) bfd_alloc (abfd, strlen (name) + 1);
+ amt = strlen (name) + 1;
+ copy = (char *) bfd_alloc (abfd, amt);
if (!copy)
return false;
strcpy (copy, name);
@@ -893,8 +889,8 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak)
}
/* Build a reloc pointing to this constructor. */
- reloc_chain =
- (arelent_chain *) bfd_alloc (abfd, sizeof (arelent_chain));
+ amt = sizeof (arelent_chain);
+ reloc_chain = (arelent_chain *) bfd_alloc (abfd, amt);
if (!reloc_chain)
return false;
reloc_chain->relent.sym_ptr_ptr =
@@ -966,7 +962,8 @@ _bfd_ecoff_slurp_symbol_table (abfd)
if (bfd_get_symcount (abfd) == 0)
return true;
- internal_size = bfd_get_symcount (abfd) * sizeof (ecoff_symbol_type);
+ internal_size = bfd_get_symcount (abfd);
+ internal_size *= sizeof (ecoff_symbol_type);
internal = (ecoff_symbol_type *) bfd_alloc (abfd, internal_size);
if (internal == NULL)
return false;
@@ -1671,7 +1668,7 @@ ecoff_slurp_reloc_table (abfd, section, symbols)
const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
arelent *internal_relocs;
bfd_size_type external_reloc_size;
- bfd_size_type external_relocs_size;
+ bfd_size_type amt;
char *external_relocs;
arelent *rptr;
unsigned int i;
@@ -1684,19 +1681,19 @@ ecoff_slurp_reloc_table (abfd, section, symbols)
if (_bfd_ecoff_slurp_symbol_table (abfd) == false)
return false;
- internal_relocs = (arelent *) bfd_alloc (abfd,
- (sizeof (arelent)
- * section->reloc_count));
+ amt = section->reloc_count;
+ amt *= sizeof (arelent);
+ internal_relocs = (arelent *) bfd_alloc (abfd, amt);
+
external_reloc_size = backend->external_reloc_size;
- external_relocs_size = external_reloc_size * section->reloc_count;
- external_relocs = (char *) bfd_alloc (abfd, external_relocs_size);
+ amt = external_reloc_size * section->reloc_count;
+ external_relocs = (char *) bfd_alloc (abfd, amt);
if (internal_relocs == (arelent *) NULL
|| external_relocs == (char *) NULL)
return false;
if (bfd_seek (abfd, section->rel_filepos, SEEK_SET) != 0)
return false;
- if (bfd_read (external_relocs, 1, external_relocs_size, abfd)
- != external_relocs_size)
+ if (bfd_bread (external_relocs, amt, abfd) != amt)
return false;
for (i = 0, rptr = internal_relocs; i < section->reloc_count; i++, rptr++)
@@ -1725,7 +1722,7 @@ ecoff_slurp_reloc_table (abfd, section, symbols)
}
else
{
- CONST char *sec_name;
+ const char *sec_name;
asection *sec;
/* r_symndx is a section key. */
@@ -1822,8 +1819,8 @@ _bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset,
asection *section;
asymbol **ignore_symbols ATTRIBUTE_UNUSED;
bfd_vma offset;
- CONST char **filename_ptr;
- CONST char **functionname_ptr;
+ const char **filename_ptr;
+ const char **functionname_ptr;
unsigned int *retline_ptr;
{
const struct ecoff_debug_swap * const debug_swap
@@ -1838,9 +1835,9 @@ _bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset,
if (ecoff_data (abfd)->find_line_info == NULL)
{
- ecoff_data (abfd)->find_line_info =
- ((struct ecoff_find_line *)
- bfd_zalloc (abfd, sizeof (struct ecoff_find_line)));
+ bfd_size_type amt = sizeof (struct ecoff_find_line);
+ ecoff_data (abfd)->find_line_info
+ = (struct ecoff_find_line *) bfd_zalloc (abfd, amt);
if (ecoff_data (abfd)->find_line_info == NULL)
return false;
}
@@ -2065,13 +2062,15 @@ ecoff_compute_section_file_positions (abfd)
boolean rdata_in_text;
boolean first_data, first_nonalloc;
const bfd_vma round = ecoff_backend (abfd)->round;
+ bfd_size_type amt;
sofar = _bfd_ecoff_sizeof_headers (abfd, false);
file_sofar = sofar;
/* Sort the sections by VMA. */
- sorted_hdrs = (asection **) bfd_malloc (abfd->section_count
- * sizeof (asection *));
+ amt = abfd->section_count;
+ amt *= sizeof (asection *);
+ sorted_hdrs = (asection **) bfd_malloc (amt);
if (sorted_hdrs == NULL)
return false;
for (current = abfd->sections, i = 0;
@@ -2265,6 +2264,8 @@ _bfd_ecoff_set_section_contents (abfd, section, location, offset, count)
file_ptr offset;
bfd_size_type count;
{
+ file_ptr pos;
+
/* This must be done first, because bfd_set_section_contents is
going to set output_has_begun to true. */
if (abfd->output_has_begun == false)
@@ -2293,8 +2294,9 @@ _bfd_ecoff_set_section_contents (abfd, section, location, offset, count)
if (count == 0)
return true;
- if (bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0
- || bfd_write (location, 1, count, abfd) != count)
+ pos = section->filepos + offset;
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0
+ || bfd_bwrite (location, count, abfd) != count)
return false;
return true;
@@ -2521,7 +2523,7 @@ _bfd_ecoff_write_object_contents (abfd)
siz = filhsz;
if (siz < aoutsz)
siz = aoutsz;
- buff = (PTR) bfd_malloc ((size_t) siz);
+ buff = (PTR) bfd_malloc (siz);
if (buff == NULL)
goto error_return;
}
@@ -2581,7 +2583,7 @@ _bfd_ecoff_write_object_contents (abfd)
current->flags);
if (bfd_coff_swap_scnhdr_out (abfd, (PTR) &section, buff) == 0
- || bfd_write (buff, 1, scnhsz, abfd) != scnhsz)
+ || bfd_bwrite (buff, scnhsz, abfd) != scnhsz)
goto error_return;
if ((section.s_flags & STYP_TEXT) != 0
@@ -2732,11 +2734,11 @@ _bfd_ecoff_write_object_contents (abfd)
goto error_return;
bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, buff);
- if (bfd_write (buff, 1, filhsz, abfd) != filhsz)
+ if (bfd_bwrite (buff, filhsz, abfd) != filhsz)
goto error_return;
bfd_coff_swap_aouthdr_out (abfd, (PTR) &internal_a, buff);
- if (bfd_write (buff, 1, aoutsz, abfd) != aoutsz)
+ if (bfd_bwrite (buff, aoutsz, abfd) != aoutsz)
goto error_return;
/* Build the external symbol information. This must be done before
@@ -2764,12 +2766,13 @@ _bfd_ecoff_write_object_contents (abfd)
arelent **reloc_ptr_ptr;
arelent **reloc_end;
char *out_ptr;
+ bfd_size_type amt;
if (current->reloc_count == 0)
continue;
- reloc_buff =
- bfd_alloc (abfd, current->reloc_count * external_reloc_size);
+ amt = current->reloc_count * external_reloc_size;
+ reloc_buff = bfd_alloc (abfd, amt);
if (reloc_buff == NULL)
goto error_return;
@@ -2800,7 +2803,7 @@ _bfd_ecoff_write_object_contents (abfd)
}
else
{
- CONST char *name;
+ const char *name;
name = bfd_get_section_name (abfd, bfd_get_section (sym));
if (strcmp (name, ".text") == 0)
@@ -2845,9 +2848,8 @@ _bfd_ecoff_write_object_contents (abfd)
if (bfd_seek (abfd, current->rel_filepos, SEEK_SET) != 0)
goto error_return;
- if (bfd_write (reloc_buff,
- external_reloc_size, current->reloc_count, abfd)
- != external_reloc_size * current->reloc_count)
+ amt = current->reloc_count * external_reloc_size;
+ if (bfd_bwrite (reloc_buff, amt, abfd) != amt)
goto error_return;
bfd_release (abfd, reloc_buff);
reloc_buff = NULL;
@@ -2877,12 +2879,12 @@ _bfd_ecoff_write_object_contents (abfd)
if (bfd_seek (abfd, (file_ptr) ecoff_data (abfd)->sym_filepos - 1,
SEEK_SET) != 0)
goto error_return;
- if (bfd_read (&c, 1, 1, abfd) == 0)
+ if (bfd_bread (&c, (bfd_size_type) 1, abfd) == 0)
c = 0;
if (bfd_seek (abfd, (file_ptr) ecoff_data (abfd)->sym_filepos - 1,
SEEK_SET) != 0)
goto error_return;
- if (bfd_write (&c, 1, 1, abfd) != 1)
+ if (bfd_bwrite (&c, (bfd_size_type) 1, abfd) != 1)
goto error_return;
}
@@ -2950,7 +2952,7 @@ _bfd_ecoff_write_object_contents (abfd)
static unsigned int
ecoff_armap_hash (s, rehash, size, hlog)
- CONST char *s;
+ const char *s;
unsigned int *rehash;
unsigned int size;
unsigned int hlog;
@@ -2983,9 +2985,10 @@ _bfd_ecoff_slurp_armap (abfd)
char *raw_ptr;
struct symdef *symdef_ptr;
char *stringbase;
+ bfd_size_type amt;
/* Get the name of the first element. */
- i = bfd_read ((PTR) nextname, 1, 16, abfd);
+ i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd);
if (i == 0)
return true;
if (i != 16)
@@ -3040,7 +3043,7 @@ _bfd_ecoff_slurp_armap (abfd)
if (raw_armap == (char *) NULL)
return false;
- if (bfd_read ((PTR) raw_armap, 1, parsed_size, abfd) != parsed_size)
+ if (bfd_bread ((PTR) raw_armap, parsed_size, abfd) != parsed_size)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
@@ -3050,7 +3053,7 @@ _bfd_ecoff_slurp_armap (abfd)
ardata->tdata = (PTR) raw_armap;
- count = bfd_h_get_32 (abfd, (PTR) raw_armap);
+ count = H_GET_32 (abfd, raw_armap);
ardata->symdef_count = 0;
ardata->cache = (struct ar_cache *) NULL;
@@ -3077,8 +3080,8 @@ _bfd_ecoff_slurp_armap (abfd)
unsigned int name_offset, file_offset;
unsigned int hash, rehash, srch;
- name_offset = bfd_h_get_32 (abfd, (PTR) raw_ptr);
- file_offset = bfd_h_get_32 (abfd, (PTR) (raw_ptr + 4));
+ name_offset = H_GET_32 (abfd, raw_ptr);
+ file_offset = H_GET_32 (abfd, (raw_ptr + 4));
if (file_offset == 0)
continue;
hash = ecoff_armap_hash (stringbase + name_offset, &rehash, count,
@@ -3090,8 +3093,7 @@ _bfd_ecoff_slurp_armap (abfd)
for (srch = (hash + rehash) & (count - 1);
srch != hash && srch != i;
srch = (srch + rehash) & (count - 1))
- BFD_ASSERT (bfd_h_get_32 (abfd, (PTR) (raw_armap + 8 + srch * 8))
- != 0);
+ BFD_ASSERT (H_GET_32 (abfd, (raw_armap + 8 + srch * 8)) != 0);
BFD_ASSERT (srch == i);
}
}
@@ -3100,12 +3102,12 @@ _bfd_ecoff_slurp_armap (abfd)
raw_ptr = raw_armap + 4;
for (i = 0; i < count; i++, raw_ptr += 8)
- if (bfd_h_get_32 (abfd, (PTR) (raw_ptr + 4)) != 0)
+ if (H_GET_32 (abfd, (raw_ptr + 4)) != 0)
++ardata->symdef_count;
- symdef_ptr = ((struct symdef *)
- bfd_alloc (abfd,
- ardata->symdef_count * sizeof (struct symdef)));
+ amt = ardata->symdef_count;
+ amt *= sizeof (struct symdef);
+ symdef_ptr = (struct symdef *) bfd_alloc (abfd, amt);
if (!symdef_ptr)
return false;
@@ -3116,10 +3118,10 @@ _bfd_ecoff_slurp_armap (abfd)
{
unsigned int name_offset, file_offset;
- file_offset = bfd_h_get_32 (abfd, (PTR) (raw_ptr + 4));
+ file_offset = H_GET_32 (abfd, (raw_ptr + 4));
if (file_offset == 0)
continue;
- name_offset = bfd_h_get_32 (abfd, (PTR) raw_ptr);
+ name_offset = H_GET_32 (abfd, raw_ptr);
symdef_ptr->s.name = stringbase + name_offset;
symdef_ptr->file_offset = file_offset;
++symdef_ptr;
@@ -3145,7 +3147,7 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
int stridx;
{
unsigned int hashsize, hashlog;
- unsigned int symdefsize;
+ bfd_size_type symdefsize;
int padit;
unsigned int stringsize;
unsigned int mapsize;
@@ -3218,12 +3220,12 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
if (((char *) (&hdr))[i] == '\0')
(((char *) (&hdr))[i]) = ' ';
- if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), abfd)
+ if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), abfd)
!= sizeof (struct ar_hdr))
return false;
- bfd_h_put_32 (abfd, (bfd_vma) hashsize, temp);
- if (bfd_write ((PTR) temp, 1, 4, abfd) != 4)
+ H_PUT_32 (abfd, hashsize, temp);
+ if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4)
return false;
hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize);
@@ -3238,7 +3240,7 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
/* Advance firstreal to the file position of this archive
element. */
- if (((bfd *) map[i].pos) != last_elt)
+ if (map[i].u.abfd != last_elt)
{
do
{
@@ -3246,13 +3248,13 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
firstreal += firstreal % 2;
current = current->next;
}
- while (current != (bfd *) map[i].pos);
+ while (current != map[i].u.abfd);
}
last_elt = current;
hash = ecoff_armap_hash (*map[i].name, &rehash, hashsize, hashlog);
- if (bfd_h_get_32 (abfd, (PTR) (hashtable + (hash * 8) + 4)) != 0)
+ if (H_GET_32 (abfd, (hashtable + (hash * 8) + 4)) != 0)
{
unsigned int srch;
@@ -3260,7 +3262,7 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
for (srch = (hash + rehash) & (hashsize - 1);
srch != hash;
srch = (srch + rehash) & (hashsize - 1))
- if (bfd_h_get_32 (abfd, (PTR) (hashtable + (srch * 8) + 4)) == 0)
+ if (H_GET_32 (abfd, (hashtable + (srch * 8) + 4)) == 0)
break;
BFD_ASSERT (srch != hash);
@@ -3268,27 +3270,25 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
hash = srch;
}
- bfd_h_put_32 (abfd, (bfd_vma) map[i].namidx,
- (PTR) (hashtable + hash * 8));
- bfd_h_put_32 (abfd, (bfd_vma) firstreal,
- (PTR) (hashtable + hash * 8 + 4));
+ H_PUT_32 (abfd, map[i].namidx, (hashtable + hash * 8));
+ H_PUT_32 (abfd, firstreal, (hashtable + hash * 8 + 4));
}
- if (bfd_write ((PTR) hashtable, 1, symdefsize, abfd) != symdefsize)
+ if (bfd_bwrite ((PTR) hashtable, symdefsize, abfd) != symdefsize)
return false;
bfd_release (abfd, hashtable);
/* Now write the strings. */
- bfd_h_put_32 (abfd, (bfd_vma) stringsize, temp);
- if (bfd_write ((PTR) temp, 1, 4, abfd) != 4)
+ H_PUT_32 (abfd, stringsize, temp);
+ if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4)
return false;
for (i = 0; i < orl_count; i++)
{
bfd_size_type len;
len = strlen (*map[i].name) + 1;
- if (bfd_write ((PTR) (*map[i].name), 1, len, abfd) != len)
+ if (bfd_bwrite ((PTR) (*map[i].name), len, abfd) != len)
return false;
}
@@ -3296,7 +3296,7 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
bug-compatible for DECstation ar we use a null. */
if (padit)
{
- if (bfd_write ("", 1, 1, abfd) != 1)
+ if (bfd_bwrite ("", (bfd_size_type) 1, abfd) != 1)
return false;
}
@@ -3312,10 +3312,11 @@ _bfd_ecoff_archive_p (abfd)
{
struct artdata *tdata_hold;
char armag[SARMAG + 1];
+ bfd_size_type amt;
tdata_hold = abfd->tdata.aout_ar_data;
- if (bfd_read ((PTR) armag, 1, SARMAG, abfd) != SARMAG)
+ if (bfd_bread ((PTR) armag, (bfd_size_type) SARMAG, abfd) != SARMAG)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
@@ -3331,8 +3332,8 @@ _bfd_ecoff_archive_p (abfd)
/* We are setting bfd_ardata(abfd) here, but since bfd_ardata
involves a cast, we can't do it as the left operand of
assignment. */
- abfd->tdata.aout_ar_data =
- (struct artdata *) bfd_zalloc (abfd, sizeof (struct artdata));
+ amt = sizeof (struct artdata);
+ abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt);
if (bfd_ardata (abfd) == (struct artdata *) NULL)
{
@@ -3449,9 +3450,9 @@ _bfd_ecoff_bfd_link_hash_table_create (abfd)
bfd *abfd;
{
struct ecoff_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct ecoff_link_hash_table);
- ret = ((struct ecoff_link_hash_table *)
- bfd_alloc (abfd, sizeof (struct ecoff_link_hash_table)));
+ ret = (struct ecoff_link_hash_table *) bfd_alloc (abfd, amt);
if (ret == NULL)
return NULL;
if (! _bfd_link_hash_table_init (&ret->root, abfd,
@@ -3541,7 +3542,7 @@ ecoff_link_add_archive_symbols (abfd, info)
return (_bfd_generic_link_add_archive_symbols
(abfd, info, ecoff_link_check_archive_element));
- armap_count = bfd_h_get_32 (abfd, raw_armap);
+ armap_count = H_GET_32 (abfd, raw_armap);
armap_log = 0;
for (i = 1; i < armap_count; i <<= 1)
@@ -3594,7 +3595,7 @@ ecoff_link_add_archive_symbols (abfd, info)
hash = ecoff_armap_hash (h->root.string, &rehash, armap_count,
armap_log);
- file_offset = bfd_h_get_32 (abfd, hashtable + (hash * 8) + 4);
+ file_offset = H_GET_32 (abfd, hashtable + (hash * 8) + 4);
if (file_offset == 0)
{
/* Nothing in this slot. */
@@ -3602,7 +3603,7 @@ ecoff_link_add_archive_symbols (abfd, info)
continue;
}
- name = stringbase + bfd_h_get_32 (abfd, hashtable + (hash * 8));
+ name = stringbase + H_GET_32 (abfd, hashtable + (hash * 8));
if (name[0] != h->root.string[0]
|| strcmp (name, h->root.string) != 0)
{
@@ -3615,10 +3616,10 @@ ecoff_link_add_archive_symbols (abfd, info)
srch != hash;
srch = (srch + rehash) & (armap_count - 1))
{
- file_offset = bfd_h_get_32 (abfd, hashtable + (srch * 8) + 4);
+ file_offset = H_GET_32 (abfd, hashtable + (srch * 8) + 4);
if (file_offset == 0)
break;
- name = stringbase + bfd_h_get_32 (abfd, hashtable + (srch * 8));
+ name = stringbase + H_GET_32 (abfd, hashtable + (srch * 8));
if (name[0] == h->root.string[0]
&& strcmp (name, h->root.string) == 0)
{
@@ -3636,7 +3637,7 @@ ecoff_link_add_archive_symbols (abfd, info)
hash = srch;
}
- element = (*backend->get_elt_at_filepos) (abfd, file_offset);
+ element = (*backend->get_elt_at_filepos) (abfd, (file_ptr) file_offset);
if (element == (bfd *) NULL)
return false;
@@ -3672,7 +3673,7 @@ ecoff_link_check_archive_element (abfd, info, pneeded)
HDRR *symhdr;
bfd_size_type external_ext_size;
PTR external_ext = NULL;
- size_t esize;
+ bfd_size_type esize;
char *ssext = NULL;
char *ext_ptr;
char *ext_end;
@@ -3695,17 +3696,17 @@ ecoff_link_check_archive_element (abfd, info, pneeded)
if (external_ext == NULL && esize != 0)
goto error_return;
- if (bfd_seek (abfd, symhdr->cbExtOffset, SEEK_SET) != 0
- || bfd_read (external_ext, 1, esize, abfd) != esize)
+ if (bfd_seek (abfd, (file_ptr) symhdr->cbExtOffset, SEEK_SET) != 0
+ || bfd_bread (external_ext, esize, abfd) != esize)
goto error_return;
- ssext = (char *) bfd_malloc (symhdr->issExtMax);
+ ssext = (char *) bfd_malloc ((bfd_size_type) symhdr->issExtMax);
if (ssext == NULL && symhdr->issExtMax != 0)
goto error_return;
- if (bfd_seek (abfd, symhdr->cbSsExtOffset, SEEK_SET) != 0
- || (bfd_read (ssext, 1, symhdr->issExtMax, abfd) !=
- (bfd_size_type) symhdr->issExtMax))
+ if (bfd_seek (abfd, (file_ptr) symhdr->cbSsExtOffset, SEEK_SET) != 0
+ || (bfd_bread (ssext, (bfd_size_type) symhdr->issExtMax, abfd)
+ != (bfd_size_type) symhdr->issExtMax))
goto error_return;
/* Look through the external symbols to see if they define some
@@ -3795,7 +3796,7 @@ ecoff_link_add_object_symbols (abfd, info)
HDRR *symhdr;
bfd_size_type external_ext_size;
PTR external_ext = NULL;
- size_t esize;
+ bfd_size_type esize;
char *ssext = NULL;
boolean result;
@@ -3815,16 +3816,16 @@ ecoff_link_add_object_symbols (abfd, info)
if (external_ext == NULL && esize != 0)
goto error_return;
- if (bfd_seek (abfd, symhdr->cbExtOffset, SEEK_SET) != 0
- || bfd_read (external_ext, 1, esize, abfd) != esize)
+ if (bfd_seek (abfd, (file_ptr) symhdr->cbExtOffset, SEEK_SET) != 0
+ || bfd_bread (external_ext, esize, abfd) != esize)
goto error_return;
- ssext = (char *) bfd_malloc (symhdr->issExtMax);
+ ssext = (char *) bfd_malloc ((bfd_size_type) symhdr->issExtMax);
if (ssext == NULL && symhdr->issExtMax != 0)
goto error_return;
- if (bfd_seek (abfd, symhdr->cbSsExtOffset, SEEK_SET) != 0
- || (bfd_read (ssext, 1, symhdr->issExtMax, abfd)
+ if (bfd_seek (abfd, (file_ptr) symhdr->cbSsExtOffset, SEEK_SET) != 0
+ || (bfd_bread (ssext, (bfd_size_type) symhdr->issExtMax, abfd)
!= (bfd_size_type) symhdr->issExtMax))
goto error_return;
@@ -3865,12 +3866,13 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext)
struct ecoff_link_hash_entry **sym_hash;
char *ext_ptr;
char *ext_end;
+ bfd_size_type amt;
ext_count = ecoff_data (abfd)->debug_info.symbolic_header.iextMax;
- sym_hash = ((struct ecoff_link_hash_entry **)
- bfd_alloc (abfd,
- ext_count * sizeof (struct bfd_link_hash_entry *)));
+ amt = ext_count;
+ amt *= sizeof (struct bfd_link_hash_entry *);
+ sym_hash = (struct ecoff_link_hash_entry **) bfd_alloc (abfd, amt);
if (!sym_hash)
return false;
ecoff_data (abfd)->sym_hashes = sym_hash;
@@ -4007,7 +4009,7 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext)
h = NULL;
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, name,
- esym.weakext ? BSF_WEAK : BSF_GLOBAL,
+ (flagword) (esym.weakext ? BSF_WEAK : BSF_GLOBAL),
section, value, (const char *) NULL, true, true,
(struct bfd_link_hash_entry **) &h)))
return false;
@@ -4296,25 +4298,24 @@ ecoff_final_link_debug_accumulate (output_bfd, input_bfd, info, handle)
HDRR *symhdr = &debug->symbolic_header;
boolean ret;
-#define READ(ptr, offset, count, size, type) \
- if (symhdr->count == 0) \
- debug->ptr = NULL; \
- else \
- { \
- debug->ptr = (type) bfd_malloc ((size_t) (size * symhdr->count)); \
- if (debug->ptr == NULL) \
- { \
- ret = false; \
- goto return_something; \
- } \
- if ((bfd_seek (input_bfd, (file_ptr) symhdr->offset, SEEK_SET) \
- != 0) \
- || (bfd_read (debug->ptr, size, symhdr->count, \
- input_bfd) != size * symhdr->count)) \
- { \
- ret = false; \
- goto return_something; \
- } \
+#define READ(ptr, offset, count, size, type) \
+ if (symhdr->count == 0) \
+ debug->ptr = NULL; \
+ else \
+ { \
+ bfd_size_type amt = (bfd_size_type) size * symhdr->count; \
+ debug->ptr = (type) bfd_malloc (amt); \
+ if (debug->ptr == NULL) \
+ { \
+ ret = false; \
+ goto return_something; \
+ } \
+ if (bfd_seek (input_bfd, (file_ptr) symhdr->offset, SEEK_SET) != 0 \
+ || bfd_bread (debug->ptr, amt, input_bfd) != amt) \
+ { \
+ ret = false; \
+ goto return_something; \
+ } \
}
/* If raw_syments is not NULL, then the data was already by read by
@@ -4536,6 +4537,7 @@ ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
bfd_size_type external_reloc_size;
bfd_size_type external_relocs_size;
PTR external_relocs = NULL;
+ bfd_size_type amt;
BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0);
@@ -4557,10 +4559,9 @@ ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
/* Get the section contents. We allocate memory for the larger of
the size before relocating and the size after relocating. */
- contents = (bfd_byte *) bfd_malloc (raw_size >= cooked_size
- ? (size_t) raw_size
- : (size_t) cooked_size);
- if (contents == NULL && raw_size != 0)
+ amt = raw_size >= cooked_size ? raw_size : cooked_size;
+ contents = (bfd_byte *) bfd_malloc (amt);
+ if (contents == NULL && amt != 0)
goto error_return;
/* If we are relaxing, the contents may have already been read into
@@ -4587,12 +4588,12 @@ ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
external_relocs = section_tdata->external_relocs;
else
{
- external_relocs = (PTR) bfd_malloc ((size_t) external_relocs_size);
+ external_relocs = (PTR) bfd_malloc (external_relocs_size);
if (external_relocs == NULL && external_relocs_size != 0)
goto error_return;
if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0
- || (bfd_read (external_relocs, 1, external_relocs_size, input_bfd)
+ || (bfd_bread (external_relocs, external_relocs_size, input_bfd)
!= external_relocs_size))
goto error_return;
}
@@ -4607,7 +4608,7 @@ ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
if (! bfd_set_section_contents (output_bfd,
output_section,
(PTR) contents,
- input_section->output_offset,
+ (file_ptr) input_section->output_offset,
cooked_size))
goto error_return;
@@ -4617,11 +4618,10 @@ ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
have output so far. */
if (info->relocateable)
{
- if (bfd_seek (output_bfd,
- (output_section->rel_filepos +
- output_section->reloc_count * external_reloc_size),
- SEEK_SET) != 0
- || (bfd_write (external_relocs, 1, external_relocs_size, output_bfd)
+ file_ptr pos = (output_section->rel_filepos
+ + output_section->reloc_count * external_reloc_size);
+ if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
+ || (bfd_bwrite (external_relocs, external_relocs_size, output_bfd)
!= external_relocs_size))
goto error_return;
output_section->reloc_count += input_section->reloc_count;
@@ -4661,6 +4661,7 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
bfd_size_type external_reloc_size;
bfd_byte *rbuf;
boolean ok;
+ file_ptr pos;
type = link_order->type;
section = NULL;
@@ -4720,13 +4721,13 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
bfd_size_type size;
bfd_reloc_status_type rstat;
bfd_byte *buf;
- boolean ok;
size = bfd_get_reloc_size (rel.howto);
buf = (bfd_byte *) bfd_zmalloc (size);
if (buf == (bfd_byte *) NULL)
return false;
- rstat = _bfd_relocate_contents (rel.howto, output_bfd, addend, buf);
+ rstat = _bfd_relocate_contents (rel.howto, output_bfd,
+ (bfd_vma) addend, buf);
switch (rstat)
{
case bfd_reloc_ok:
@@ -4757,7 +4758,7 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
rel.addend = 0;
- /* Move the information into a internal_reloc structure. */
+ /* Move the information into an internal_reloc structure. */
in.r_vaddr = (rel.address
+ bfd_get_section_vma (output_bfd, output_section));
in.r_type = rel.howto->type;
@@ -4785,7 +4786,7 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
}
else
{
- CONST char *name;
+ const char *name;
name = bfd_get_section_name (output_bfd, section);
if (strcmp (name, ".text") == 0)
@@ -4828,17 +4829,16 @@ ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
/* Get some memory and swap out the reloc. */
external_reloc_size = ecoff_backend (output_bfd)->external_reloc_size;
- rbuf = (bfd_byte *) bfd_malloc ((size_t) external_reloc_size);
+ rbuf = (bfd_byte *) bfd_malloc (external_reloc_size);
if (rbuf == (bfd_byte *) NULL)
return false;
(*ecoff_backend (output_bfd)->swap_reloc_out) (output_bfd, &in, (PTR) rbuf);
- ok = (bfd_seek (output_bfd,
- (output_section->rel_filepos +
- output_section->reloc_count * external_reloc_size),
- SEEK_SET) == 0
- && (bfd_write ((PTR) rbuf, 1, external_reloc_size, output_bfd)
+ pos = (output_section->rel_filepos
+ + output_section->reloc_count * external_reloc_size);
+ ok = (bfd_seek (output_bfd, pos, SEEK_SET) == 0
+ && (bfd_bwrite ((PTR) rbuf, external_reloc_size, output_bfd)
== external_reloc_size));
if (ok)
diff --git a/contrib/binutils/bfd/ecofflink.c b/contrib/binutils/bfd/ecofflink.c
index 37b3538..53d6544 100644
--- a/contrib/binutils/bfd/ecofflink.c
+++ b/contrib/binutils/bfd/ecofflink.c
@@ -1,5 +1,5 @@
/* Routines to link ECOFF debugging information.
- Copyright 1993, 1994, 1995, 1996, 1997, 2000
+ Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>.
@@ -272,7 +272,7 @@ ecoff_add_bytes (buf, bufend, need)
if (want < ALLOC_SIZE)
want = ALLOC_SIZE;
}
- newbuf = (char *) bfd_realloc (*buf, have + want);
+ newbuf = (char *) bfd_realloc (*buf, (bfd_size_type) have + want);
if (newbuf == NULL)
return false;
*buf = newbuf;
@@ -497,8 +497,9 @@ bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info)
struct bfd_link_info *info;
{
struct accumulate *ainfo;
+ bfd_size_type amt = sizeof (struct accumulate);
- ainfo = (struct accumulate *) bfd_malloc (sizeof (struct accumulate));
+ ainfo = (struct accumulate *) bfd_malloc (amt);
if (!ainfo)
return NULL;
if (! bfd_hash_table_init_n (&ainfo->fdr_hash.table, string_hash_newfunc,
@@ -621,6 +622,7 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
long newrfdbase = 0;
long oldrfdbase = 0;
bfd_byte *fdr_out;
+ bfd_size_type amt;
/* Use section_adjust to hold the value to add to a symbol in a
particular section. */
@@ -661,9 +663,9 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
}
fdr_end = fdr_start + input_symhdr->ifdMax * fdr_add;
- input_debug->ifdmap = (RFDT *) bfd_alloc (input_bfd,
- (input_symhdr->ifdMax
- * sizeof (RFDT)));
+ amt = input_symhdr->ifdMax;
+ amt *= sizeof (RFDT);
+ input_debug->ifdmap = (RFDT *) bfd_alloc (input_bfd, amt);
sz = (input_symhdr->crfd + input_symhdr->ifdMax) * external_rfd_size;
rfd_out = (bfd_byte *) objalloc_alloc (ainfo->memory, sz);
@@ -712,7 +714,7 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
merged. */
name = input_debug->ss + fdr.issBase + fdr.rss;
- lookup = (char *) bfd_malloc (strlen (name) + 20);
+ lookup = (char *) bfd_malloc ((bfd_size_type) strlen (name) + 20);
if (lookup == NULL)
return false;
sprintf (lookup, "%s %lx %lx", name, fdr.csym, fdr.caux);
@@ -937,10 +939,9 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
stabs are adjusted correctly. */
if (fdr.cbLine > 0)
{
+ file_ptr pos = input_symhdr->cbLineOffset + fdr.cbLineOffset;
if (!add_file_shuffle (ainfo, &ainfo->line, &ainfo->line_end,
- input_bfd,
- input_symhdr->cbLineOffset + fdr.cbLineOffset,
- fdr.cbLine))
+ input_bfd, pos, (unsigned long) fdr.cbLine))
return false;
fdr.ilineBase = output_symhdr->ilineMax;
fdr.cbLineOffset = output_symhdr->cbLine;
@@ -949,10 +950,10 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
}
if (fdr.caux > 0)
{
+ file_ptr pos = (input_symhdr->cbAuxOffset
+ + fdr.iauxBase * sizeof (union aux_ext));
if (!add_file_shuffle (ainfo, &ainfo->aux, &ainfo->aux_end,
- input_bfd,
- (input_symhdr->cbAuxOffset
- + fdr.iauxBase * sizeof (union aux_ext)),
+ input_bfd, pos,
fdr.caux * sizeof (union aux_ext)))
return false;
fdr.iauxBase = output_symhdr->iauxMax;
@@ -970,10 +971,9 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
}
else if (fdr.cbSs > 0)
{
+ file_ptr pos = input_symhdr->cbSsOffset + fdr.issBase;
if (!add_file_shuffle (ainfo, &ainfo->ss, &ainfo->ss_end,
- input_bfd,
- input_symhdr->cbSsOffset + fdr.issBase,
- fdr.cbSs))
+ input_bfd, pos, (unsigned long) fdr.cbSs))
return false;
fdr.issBase = output_symhdr->issMax;
output_symhdr->issMax += fdr.cbSs;
@@ -989,21 +989,21 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,
BFD_ASSERT (external_pdr_size == input_swap->external_pdr_size);
if (fdr.cpd > 0)
{
+ file_ptr pos = (input_symhdr->cbPdOffset
+ + fdr.ipdFirst * external_pdr_size);
+ unsigned long size = fdr.cpd * external_pdr_size;
if (!add_file_shuffle (ainfo, &ainfo->pdr, &ainfo->pdr_end,
- input_bfd,
- (input_symhdr->cbPdOffset
- + fdr.ipdFirst * external_pdr_size),
- fdr.cpd * external_pdr_size))
+ input_bfd, pos, size))
return false;
}
BFD_ASSERT (external_opt_size == input_swap->external_opt_size);
if (fdr.copt > 0)
{
+ file_ptr pos = (input_symhdr->cbOptOffset
+ + fdr.ioptBase * external_opt_size);
+ unsigned long size = fdr.copt * external_opt_size;
if (!add_file_shuffle (ainfo, &ainfo->opt, &ainfo->opt_end,
- input_bfd,
- (input_symhdr->cbOptOffset
- + fdr.ioptBase * external_opt_size),
- fdr.copt * external_opt_size))
+ input_bfd, pos, size))
return false;
}
}
@@ -1201,7 +1201,7 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
fdr.issBase = output_symhdr->issMax;
fdr.cbSs = 0;
fdr.rss = ecoff_add_string (ainfo, info, output_debug, &fdr,
- bfd_get_filename (input_bfd));
+ bfd_archive_filename (input_bfd));
if (fdr.rss == -1)
return false;
fdr.isymBase = output_symhdr->isymMax;
@@ -1210,7 +1210,7 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
symsize = bfd_get_symtab_upper_bound (input_bfd);
if (symsize < 0)
return false;
- symbols = (asymbol **) bfd_alloc (output_bfd, symsize);
+ symbols = (asymbol **) bfd_alloc (output_bfd, (bfd_size_type) symsize);
if (symbols == (asymbol **) NULL)
return false;
symcount = bfd_canonicalize_symtab (input_bfd, symbols);
@@ -1254,7 +1254,8 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
}
(*swap_sym_out) (output_bfd, &internal_sym, external_sym);
add_memory_shuffle (ainfo, &ainfo->sym, &ainfo->sym_end,
- external_sym, output_swap->external_sym_size);
+ external_sym,
+ (unsigned long) output_swap->external_sym_size);
++fdr.csym;
++output_symhdr->isymMax;
}
@@ -1274,7 +1275,8 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug,
}
(*output_swap->swap_fdr_out) (output_bfd, &fdr, external_fdr);
add_memory_shuffle (ainfo, &ainfo->fdr, &ainfo->fdr_end,
- external_fdr, output_swap->external_fdr_size);
+ external_fdr,
+ (unsigned long) output_swap->external_fdr_size);
++output_symhdr->ifdMax;
@@ -1386,7 +1388,7 @@ bfd_ecoff_debug_one_external (abfd, debug, swap, name, esym)
{
if (ecoff_add_bytes ((char **) &debug->external_ext,
(char **) &debug->external_ext_end,
- (symhdr->iextMax + 1) * external_ext_size)
+ (symhdr->iextMax + 1) * (size_t) external_ext_size)
== false)
return false;
}
@@ -1546,12 +1548,12 @@ ecoff_write_symhdr (abfd, debug, swap, where)
SET (cbExtOffset, iextMax, swap->external_ext_size);
#undef SET
- buff = (PTR) bfd_malloc ((size_t) swap->external_hdr_size);
+ buff = (PTR) bfd_malloc (swap->external_hdr_size);
if (buff == NULL && swap->external_hdr_size != 0)
goto error_return;
(*swap->swap_hdr_out) (abfd, symhdr, buff);
- if (bfd_write (buff, 1, swap->external_hdr_size, abfd)
+ if (bfd_bwrite (buff, swap->external_hdr_size, abfd)
!= swap->external_hdr_size)
goto error_return;
@@ -1585,7 +1587,7 @@ bfd_ecoff_write_debug (abfd, debug, swap, where)
#define WRITE(ptr, count, size, offset) \
BFD_ASSERT (symhdr->offset == 0 \
|| (bfd_vma) bfd_tell (abfd) == symhdr->offset); \
- if (bfd_write ((PTR) debug->ptr, size, symhdr->count, abfd) \
+ if (bfd_bwrite ((PTR) debug->ptr, (bfd_size_type) size * symhdr->count, abfd)\
!= size * symhdr->count) \
return false;
@@ -1594,7 +1596,8 @@ bfd_ecoff_write_debug (abfd, debug, swap, where)
WRITE (external_pdr, ipdMax, swap->external_pdr_size, cbPdOffset);
WRITE (external_sym, isymMax, swap->external_sym_size, cbSymOffset);
WRITE (external_opt, ioptMax, swap->external_opt_size, cbOptOffset);
- WRITE (external_aux, iauxMax, sizeof (union aux_ext), cbAuxOffset);
+ WRITE (external_aux, iauxMax, (bfd_size_type) sizeof (union aux_ext),
+ cbAuxOffset);
WRITE (ss, issMax, sizeof (char), cbSsOffset);
WRITE (ssext, issExtMax, sizeof (char), cbSsExtOffset);
WRITE (external_fdr, ifdMax, swap->external_fdr_size, cbFdOffset);
@@ -1626,14 +1629,16 @@ ecoff_write_shuffle (abfd, swap, shuffle, space)
{
if (! l->filep)
{
- if (bfd_write (l->u.memory, 1, l->size, abfd) != l->size)
+ if (bfd_bwrite (l->u.memory, (bfd_size_type) l->size, abfd)
+ != l->size)
return false;
}
else
{
if (bfd_seek (l->u.file.input_bfd, l->u.file.offset, SEEK_SET) != 0
- || bfd_read (space, 1, l->size, l->u.file.input_bfd) != l->size
- || bfd_write (space, 1, l->size, abfd) != l->size)
+ || bfd_bread (space, (bfd_size_type) l->size,
+ l->u.file.input_bfd) != l->size
+ || bfd_bwrite (space, (bfd_size_type) l->size, abfd) != l->size)
return false;
}
total += l->size;
@@ -1645,12 +1650,12 @@ ecoff_write_shuffle (abfd, swap, shuffle, space)
bfd_byte *s;
i = swap->debug_align - (total & (swap->debug_align - 1));
- s = (bfd_byte *) bfd_malloc (i);
+ s = (bfd_byte *) bfd_malloc ((bfd_size_type) i);
if (s == NULL && i != 0)
return false;
memset ((PTR) s, 0, i);
- if (bfd_write ((PTR) s, 1, i, abfd) != i)
+ if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i)
{
free (s);
return false;
@@ -1675,11 +1680,13 @@ bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where)
{
struct accumulate *ainfo = (struct accumulate *) handle;
PTR space = NULL;
+ bfd_size_type amt;
if (! ecoff_write_symhdr (abfd, debug, swap, where))
goto error_return;
- space = (PTR) bfd_malloc (ainfo->largest_file_shuffle);
+ amt = ainfo->largest_file_shuffle;
+ space = (PTR) bfd_malloc (amt);
if (space == NULL && ainfo->largest_file_shuffle != 0)
goto error_return;
@@ -1706,7 +1713,7 @@ bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where)
BFD_ASSERT (ainfo->ss == (struct shuffle *) NULL);
null = 0;
- if (bfd_write ((PTR) &null, 1, 1, abfd) != 1)
+ if (bfd_bwrite ((PTR) &null, (bfd_size_type) 1, abfd) != 1)
goto error_return;
total = 1;
BFD_ASSERT (ainfo->ss_hash == NULL || ainfo->ss_hash->val == 1);
@@ -1717,7 +1724,8 @@ bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where)
size_t len;
len = strlen (sh->root.string);
- if (bfd_write ((PTR) sh->root.string, 1, len + 1, abfd) != len + 1)
+ amt = len + 1;
+ if (bfd_bwrite ((PTR) sh->root.string, amt, abfd) != amt)
goto error_return;
total += len + 1;
}
@@ -1728,11 +1736,11 @@ bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where)
bfd_byte *s;
i = swap->debug_align - (total & (swap->debug_align - 1));
- s = (bfd_byte *) bfd_malloc (i);
+ s = (bfd_byte *) bfd_malloc ((bfd_size_type) i);
if (s == NULL && i != 0)
goto error_return;
memset ((PTR) s, 0, i);
- if (bfd_write ((PTR) s, 1, i, abfd) != i)
+ if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i)
{
free (s);
goto error_return;
@@ -1743,8 +1751,8 @@ bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where)
/* The external strings and symbol are not converted over to using
shuffles. FIXME: They probably should be. */
- if (bfd_write (debug->ssext, 1, debug->symbolic_header.issExtMax, abfd)
- != (bfd_size_type) debug->symbolic_header.issExtMax)
+ amt = debug->symbolic_header.issExtMax;
+ if (bfd_bwrite (debug->ssext, amt, abfd) != amt)
goto error_return;
if ((debug->symbolic_header.issExtMax & (swap->debug_align - 1)) != 0)
{
@@ -1753,11 +1761,11 @@ bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where)
i = (swap->debug_align
- (debug->symbolic_header.issExtMax & (swap->debug_align - 1)));
- s = (bfd_byte *) bfd_malloc (i);
+ s = (bfd_byte *) bfd_malloc ((bfd_size_type) i);
if (s == NULL && i != 0)
goto error_return;
memset ((PTR) s, 0, i);
- if (bfd_write ((PTR) s, 1, i, abfd) != i)
+ if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i)
{
free (s);
goto error_return;
@@ -1773,9 +1781,8 @@ bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where)
|| (debug->symbolic_header.cbExtOffset
== (bfd_vma) bfd_tell (abfd)));
- if (bfd_write (debug->external_ext, swap->external_ext_size,
- debug->symbolic_header.iextMax, abfd)
- != debug->symbolic_header.iextMax * swap->external_ext_size)
+ amt = debug->symbolic_header.iextMax * swap->external_ext_size;
+ if (bfd_bwrite (debug->external_ext, amt, abfd) != amt)
goto error_return;
if (space != NULL)
@@ -1829,6 +1836,7 @@ mk_fdrtab (abfd, debug_info, debug_swap, line_info)
FDR *fdr_end;
boolean stabs;
long len;
+ bfd_size_type amt;
fdr_start = debug_info->fdr;
fdr_end = fdr_start + debug_info->symbolic_header.ifdMax;
@@ -1843,9 +1851,8 @@ mk_fdrtab (abfd, debug_info, debug_swap, line_info)
/* Now, create and fill in the table: */
- line_info->fdrtab = ((struct ecoff_fdrtab_entry*)
- bfd_zalloc (abfd,
- len * sizeof (struct ecoff_fdrtab_entry)));
+ amt = (bfd_size_type) len * sizeof (struct ecoff_fdrtab_entry);
+ line_info->fdrtab = (struct ecoff_fdrtab_entry*) bfd_zalloc (abfd, amt);
if (line_info->fdrtab == NULL)
return false;
line_info->fdrtab_len = len;
@@ -1902,7 +1909,7 @@ mk_fdrtab (abfd, debug_info, debug_swap, line_info)
The table is mostly sorted already, but there are cases (e.g.,
static functions in include files), where this does not hold.
Use "odump -PFv" to verify... */
- qsort ((PTR) line_info->fdrtab, len,
+ qsort ((PTR) line_info->fdrtab, (size_t) len,
sizeof (struct ecoff_fdrtab_entry), cmp_fdrtab_entry);
return true;
@@ -2004,7 +2011,7 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
char *pdr_ptr;
char *best_pdr = NULL;
FDR *best_fdr;
- bfd_vma best_dist = ~0;
+ bfd_vma best_dist = ~(bfd_vma) 0;
PDR pdr;
unsigned char *line_ptr;
unsigned char *line_end;
@@ -2330,7 +2337,7 @@ lookup_line (abfd, debug_info, debug_swap, line_info)
{
if (line_info->find_buffer != NULL)
free (line_info->find_buffer);
- buffer = (char *) bfd_malloc (len);
+ buffer = (char *) bfd_malloc ((bfd_size_type) len);
if (buffer == NULL)
return false;
line_info->find_buffer = buffer;
@@ -2429,7 +2436,8 @@ ecoff_collect_shuffle (l, buff)
else
{
if (bfd_seek (l->u.file.input_bfd, l->u.file.offset, SEEK_SET) != 0
- || bfd_read (buff, 1, l->size, l->u.file.input_bfd) != l->size)
+ || (bfd_bread (buff, (bfd_size_type) l->size, l->u.file.input_bfd)
+ != l->size))
return false;
}
total += l->size;
diff --git a/contrib/binutils/bfd/ecoffswap.h b/contrib/binutils/bfd/ecoffswap.h
index dd6fa6f..24627d0 100644
--- a/contrib/binutils/bfd/ecoffswap.h
+++ b/contrib/binutils/bfd/ecoffswap.h
@@ -45,20 +45,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
with the proper byte sex and such. */
#ifdef ECOFF_32
-#define ecoff_get_off bfd_h_get_32
-#define ecoff_put_off bfd_h_put_32
+#define ECOFF_GET_OFF H_GET_32
+#define ECOFF_PUT_OFF H_PUT_32
#endif
#ifdef ECOFF_64
-#define ecoff_get_off bfd_h_get_64
-#define ecoff_put_off bfd_h_put_64
+#define ECOFF_GET_OFF H_GET_64
+#define ECOFF_PUT_OFF H_PUT_64
#endif
#ifdef ECOFF_SIGNED_32
-#define ecoff_get_off bfd_h_get_signed_32
-#define ecoff_put_off bfd_h_put_signed_32
+#define ECOFF_GET_OFF H_GET_S32
+#define ECOFF_PUT_OFF H_PUT_S32
#endif
#ifdef ECOFF_SIGNED_64
-#define ecoff_get_off bfd_h_get_signed_64
-#define ecoff_put_off bfd_h_put_signed_64
+#define ECOFF_GET_OFF H_GET_S64
+#define ECOFF_PUT_OFF H_PUT_S64
#endif
/* ECOFF auxiliary information swapping routines. These are the same
@@ -104,31 +104,31 @@ ecoff_swap_hdr_in (abfd, ext_copy, intern)
*ext = *(struct hdr_ext *) ext_copy;
- intern->magic = bfd_h_get_signed_16 (abfd, (bfd_byte *)ext->h_magic);
- intern->vstamp = bfd_h_get_signed_16 (abfd, (bfd_byte *)ext->h_vstamp);
- intern->ilineMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ilineMax);
- intern->cbLine = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbLine);
- intern->cbLineOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbLineOffset);
- intern->idnMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_idnMax);
- intern->cbDnOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbDnOffset);
- intern->ipdMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ipdMax);
- intern->cbPdOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbPdOffset);
- intern->isymMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_isymMax);
- intern->cbSymOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbSymOffset);
- intern->ioptMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ioptMax);
- intern->cbOptOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbOptOffset);
- intern->iauxMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_iauxMax);
- intern->cbAuxOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbAuxOffset);
- intern->issMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_issMax);
- intern->cbSsOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbSsOffset);
- intern->issExtMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_issExtMax);
- intern->cbSsExtOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbSsExtOffset);
- intern->ifdMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ifdMax);
- intern->cbFdOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbFdOffset);
- intern->crfd = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_crfd);
- intern->cbRfdOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbRfdOffset);
- intern->iextMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_iextMax);
- intern->cbExtOffset = ecoff_get_off (abfd, (bfd_byte *)ext->h_cbExtOffset);
+ intern->magic = H_GET_S16 (abfd, ext->h_magic);
+ intern->vstamp = H_GET_S16 (abfd, ext->h_vstamp);
+ intern->ilineMax = H_GET_32 (abfd, ext->h_ilineMax);
+ intern->cbLine = ECOFF_GET_OFF (abfd, ext->h_cbLine);
+ intern->cbLineOffset = ECOFF_GET_OFF (abfd, ext->h_cbLineOffset);
+ intern->idnMax = H_GET_32 (abfd, ext->h_idnMax);
+ intern->cbDnOffset = ECOFF_GET_OFF (abfd, ext->h_cbDnOffset);
+ intern->ipdMax = H_GET_32 (abfd, ext->h_ipdMax);
+ intern->cbPdOffset = ECOFF_GET_OFF (abfd, ext->h_cbPdOffset);
+ intern->isymMax = H_GET_32 (abfd, ext->h_isymMax);
+ intern->cbSymOffset = ECOFF_GET_OFF (abfd, ext->h_cbSymOffset);
+ intern->ioptMax = H_GET_32 (abfd, ext->h_ioptMax);
+ intern->cbOptOffset = ECOFF_GET_OFF (abfd, ext->h_cbOptOffset);
+ intern->iauxMax = H_GET_32 (abfd, ext->h_iauxMax);
+ intern->cbAuxOffset = ECOFF_GET_OFF (abfd, ext->h_cbAuxOffset);
+ intern->issMax = H_GET_32 (abfd, ext->h_issMax);
+ intern->cbSsOffset = ECOFF_GET_OFF (abfd, ext->h_cbSsOffset);
+ intern->issExtMax = H_GET_32 (abfd, ext->h_issExtMax);
+ intern->cbSsExtOffset = ECOFF_GET_OFF (abfd, ext->h_cbSsExtOffset);
+ intern->ifdMax = H_GET_32 (abfd, ext->h_ifdMax);
+ intern->cbFdOffset = ECOFF_GET_OFF (abfd, ext->h_cbFdOffset);
+ intern->crfd = H_GET_32 (abfd, ext->h_crfd);
+ intern->cbRfdOffset = ECOFF_GET_OFF (abfd, ext->h_cbRfdOffset);
+ intern->iextMax = H_GET_32 (abfd, ext->h_iextMax);
+ intern->cbExtOffset = ECOFF_GET_OFF (abfd, ext->h_cbExtOffset);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
@@ -149,34 +149,34 @@ ecoff_swap_hdr_out (abfd, intern_copy, ext_ptr)
*intern = *intern_copy;
- bfd_h_put_signed_16 (abfd, intern->magic, (bfd_byte *)ext->h_magic);
- bfd_h_put_signed_16 (abfd, intern->vstamp, (bfd_byte *)ext->h_vstamp);
- bfd_h_put_32 (abfd, intern->ilineMax, (bfd_byte *)ext->h_ilineMax);
- ecoff_put_off (abfd, intern->cbLine, (bfd_byte *)ext->h_cbLine);
- ecoff_put_off (abfd, intern->cbLineOffset, (bfd_byte *)ext->h_cbLineOffset);
- bfd_h_put_32 (abfd, intern->idnMax, (bfd_byte *)ext->h_idnMax);
- ecoff_put_off (abfd, intern->cbDnOffset, (bfd_byte *)ext->h_cbDnOffset);
- bfd_h_put_32 (abfd, intern->ipdMax, (bfd_byte *)ext->h_ipdMax);
- ecoff_put_off (abfd, intern->cbPdOffset, (bfd_byte *)ext->h_cbPdOffset);
- bfd_h_put_32 (abfd, intern->isymMax, (bfd_byte *)ext->h_isymMax);
- ecoff_put_off (abfd, intern->cbSymOffset, (bfd_byte *)ext->h_cbSymOffset);
- bfd_h_put_32 (abfd, intern->ioptMax, (bfd_byte *)ext->h_ioptMax);
- ecoff_put_off (abfd, intern->cbOptOffset, (bfd_byte *)ext->h_cbOptOffset);
- bfd_h_put_32 (abfd, intern->iauxMax, (bfd_byte *)ext->h_iauxMax);
- ecoff_put_off (abfd, intern->cbAuxOffset, (bfd_byte *)ext->h_cbAuxOffset);
- bfd_h_put_32 (abfd, intern->issMax, (bfd_byte *)ext->h_issMax);
- ecoff_put_off (abfd, intern->cbSsOffset, (bfd_byte *)ext->h_cbSsOffset);
- bfd_h_put_32 (abfd, intern->issExtMax, (bfd_byte *)ext->h_issExtMax);
- ecoff_put_off (abfd, intern->cbSsExtOffset, (bfd_byte *)ext->h_cbSsExtOffset);
- bfd_h_put_32 (abfd, intern->ifdMax, (bfd_byte *)ext->h_ifdMax);
- ecoff_put_off (abfd, intern->cbFdOffset, (bfd_byte *)ext->h_cbFdOffset);
- bfd_h_put_32 (abfd, intern->crfd, (bfd_byte *)ext->h_crfd);
- ecoff_put_off (abfd, intern->cbRfdOffset, (bfd_byte *)ext->h_cbRfdOffset);
- bfd_h_put_32 (abfd, intern->iextMax, (bfd_byte *)ext->h_iextMax);
- ecoff_put_off (abfd, intern->cbExtOffset, (bfd_byte *)ext->h_cbExtOffset);
+ H_PUT_S16 (abfd, intern->magic, ext->h_magic);
+ H_PUT_S16 (abfd, intern->vstamp, ext->h_vstamp);
+ H_PUT_32 (abfd, intern->ilineMax, ext->h_ilineMax);
+ ECOFF_PUT_OFF (abfd, intern->cbLine, ext->h_cbLine);
+ ECOFF_PUT_OFF (abfd, intern->cbLineOffset, ext->h_cbLineOffset);
+ H_PUT_32 (abfd, intern->idnMax, ext->h_idnMax);
+ ECOFF_PUT_OFF (abfd, intern->cbDnOffset, ext->h_cbDnOffset);
+ H_PUT_32 (abfd, intern->ipdMax, ext->h_ipdMax);
+ ECOFF_PUT_OFF (abfd, intern->cbPdOffset, ext->h_cbPdOffset);
+ H_PUT_32 (abfd, intern->isymMax, ext->h_isymMax);
+ ECOFF_PUT_OFF (abfd, intern->cbSymOffset, ext->h_cbSymOffset);
+ H_PUT_32 (abfd, intern->ioptMax, ext->h_ioptMax);
+ ECOFF_PUT_OFF (abfd, intern->cbOptOffset, ext->h_cbOptOffset);
+ H_PUT_32 (abfd, intern->iauxMax, ext->h_iauxMax);
+ ECOFF_PUT_OFF (abfd, intern->cbAuxOffset, ext->h_cbAuxOffset);
+ H_PUT_32 (abfd, intern->issMax, ext->h_issMax);
+ ECOFF_PUT_OFF (abfd, intern->cbSsOffset, ext->h_cbSsOffset);
+ H_PUT_32 (abfd, intern->issExtMax, ext->h_issExtMax);
+ ECOFF_PUT_OFF (abfd, intern->cbSsExtOffset, ext->h_cbSsExtOffset);
+ H_PUT_32 (abfd, intern->ifdMax, ext->h_ifdMax);
+ ECOFF_PUT_OFF (abfd, intern->cbFdOffset, ext->h_cbFdOffset);
+ H_PUT_32 (abfd, intern->crfd, ext->h_crfd);
+ ECOFF_PUT_OFF (abfd, intern->cbRfdOffset, ext->h_cbRfdOffset);
+ H_PUT_32 (abfd, intern->iextMax, ext->h_iextMax);
+ ECOFF_PUT_OFF (abfd, intern->cbExtOffset, ext->h_cbExtOffset);
#ifdef TEST
- if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
+ if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0)
abort ();
#endif
}
@@ -193,55 +193,58 @@ ecoff_swap_fdr_in (abfd, ext_copy, intern)
*ext = *(struct fdr_ext *) ext_copy;
- intern->adr = ecoff_get_off (abfd, (bfd_byte *)ext->f_adr);
- intern->rss = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_rss);
+ intern->adr = ECOFF_GET_OFF (abfd, ext->f_adr);
+ intern->rss = H_GET_32 (abfd, ext->f_rss);
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
if (intern->rss == (signed long) 0xffffffff)
intern->rss = -1;
#endif
- intern->issBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_issBase);
- intern->cbSs = ecoff_get_off (abfd, (bfd_byte *)ext->f_cbSs);
- intern->isymBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_isymBase);
- intern->csym = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_csym);
- intern->ilineBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ilineBase);
- intern->cline = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cline);
- intern->ioptBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ioptBase);
- intern->copt = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_copt);
+ intern->issBase = H_GET_32 (abfd, ext->f_issBase);
+ intern->cbSs = ECOFF_GET_OFF (abfd, ext->f_cbSs);
+ intern->isymBase = H_GET_32 (abfd, ext->f_isymBase);
+ intern->csym = H_GET_32 (abfd, ext->f_csym);
+ intern->ilineBase = H_GET_32 (abfd, ext->f_ilineBase);
+ intern->cline = H_GET_32 (abfd, ext->f_cline);
+ intern->ioptBase = H_GET_32 (abfd, ext->f_ioptBase);
+ intern->copt = H_GET_32 (abfd, ext->f_copt);
#if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
- intern->ipdFirst = bfd_h_get_16 (abfd, (bfd_byte *)ext->f_ipdFirst);
- intern->cpd = bfd_h_get_16 (abfd, (bfd_byte *)ext->f_cpd);
+ intern->ipdFirst = H_GET_16 (abfd, ext->f_ipdFirst);
+ intern->cpd = H_GET_16 (abfd, ext->f_cpd);
#endif
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
- intern->ipdFirst = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ipdFirst);
- intern->cpd = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cpd);
+ intern->ipdFirst = H_GET_32 (abfd, ext->f_ipdFirst);
+ intern->cpd = H_GET_32 (abfd, ext->f_cpd);
#endif
- intern->iauxBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_iauxBase);
- intern->caux = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_caux);
- intern->rfdBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_rfdBase);
- intern->crfd = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_crfd);
+ intern->iauxBase = H_GET_32 (abfd, ext->f_iauxBase);
+ intern->caux = H_GET_32 (abfd, ext->f_caux);
+ intern->rfdBase = H_GET_32 (abfd, ext->f_rfdBase);
+ intern->crfd = H_GET_32 (abfd, ext->f_crfd);
/* now the fun stuff... */
- if (bfd_header_big_endian (abfd)) {
- intern->lang = (ext->f_bits1[0] & FDR_BITS1_LANG_BIG)
- >> FDR_BITS1_LANG_SH_BIG;
- intern->fMerge = 0 != (ext->f_bits1[0] & FDR_BITS1_FMERGE_BIG);
- intern->fReadin = 0 != (ext->f_bits1[0] & FDR_BITS1_FREADIN_BIG);
- intern->fBigendian = 0 != (ext->f_bits1[0] & FDR_BITS1_FBIGENDIAN_BIG);
- intern->glevel = (ext->f_bits2[0] & FDR_BITS2_GLEVEL_BIG)
- >> FDR_BITS2_GLEVEL_SH_BIG;
- } else {
- intern->lang = (ext->f_bits1[0] & FDR_BITS1_LANG_LITTLE)
- >> FDR_BITS1_LANG_SH_LITTLE;
- intern->fMerge = 0 != (ext->f_bits1[0] & FDR_BITS1_FMERGE_LITTLE);
- intern->fReadin = 0 != (ext->f_bits1[0] & FDR_BITS1_FREADIN_LITTLE);
- intern->fBigendian = 0 != (ext->f_bits1[0] & FDR_BITS1_FBIGENDIAN_LITTLE);
- intern->glevel = (ext->f_bits2[0] & FDR_BITS2_GLEVEL_LITTLE)
- >> FDR_BITS2_GLEVEL_SH_LITTLE;
- }
+ if (bfd_header_big_endian (abfd))
+ {
+ intern->lang = ((ext->f_bits1[0] & FDR_BITS1_LANG_BIG)
+ >> FDR_BITS1_LANG_SH_BIG);
+ intern->fMerge = 0 != (ext->f_bits1[0] & FDR_BITS1_FMERGE_BIG);
+ intern->fReadin = 0 != (ext->f_bits1[0] & FDR_BITS1_FREADIN_BIG);
+ intern->fBigendian = 0 != (ext->f_bits1[0] & FDR_BITS1_FBIGENDIAN_BIG);
+ intern->glevel = ((ext->f_bits2[0] & FDR_BITS2_GLEVEL_BIG)
+ >> FDR_BITS2_GLEVEL_SH_BIG);
+ }
+ else
+ {
+ intern->lang = ((ext->f_bits1[0] & FDR_BITS1_LANG_LITTLE)
+ >> FDR_BITS1_LANG_SH_LITTLE);
+ intern->fMerge = 0 != (ext->f_bits1[0] & FDR_BITS1_FMERGE_LITTLE);
+ intern->fReadin = 0 != (ext->f_bits1[0] & FDR_BITS1_FREADIN_LITTLE);
+ intern->fBigendian = 0 != (ext->f_bits1[0] & FDR_BITS1_FBIGENDIAN_LITTLE);
+ intern->glevel = ((ext->f_bits2[0] & FDR_BITS2_GLEVEL_LITTLE)
+ >> FDR_BITS2_GLEVEL_SH_LITTLE);
+ }
intern->reserved = 0;
- intern->cbLineOffset = ecoff_get_off (abfd, (bfd_byte *)ext->f_cbLineOffset);
- intern->cbLine = ecoff_get_off (abfd, (bfd_byte *)ext->f_cbLine);
+ intern->cbLineOffset = ECOFF_GET_OFF (abfd, ext->f_cbLineOffset);
+ intern->cbLine = ECOFF_GET_OFF (abfd, ext->f_cbLine);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
@@ -262,54 +265,57 @@ ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr)
*intern = *intern_copy; /* Make it reasonable to do in-place. */
- ecoff_put_off (abfd, intern->adr, (bfd_byte *)ext->f_adr);
- bfd_h_put_32 (abfd, intern->rss, (bfd_byte *)ext->f_rss);
- bfd_h_put_32 (abfd, intern->issBase, (bfd_byte *)ext->f_issBase);
- ecoff_put_off (abfd, intern->cbSs, (bfd_byte *)ext->f_cbSs);
- bfd_h_put_32 (abfd, intern->isymBase, (bfd_byte *)ext->f_isymBase);
- bfd_h_put_32 (abfd, intern->csym, (bfd_byte *)ext->f_csym);
- bfd_h_put_32 (abfd, intern->ilineBase, (bfd_byte *)ext->f_ilineBase);
- bfd_h_put_32 (abfd, intern->cline, (bfd_byte *)ext->f_cline);
- bfd_h_put_32 (abfd, intern->ioptBase, (bfd_byte *)ext->f_ioptBase);
- bfd_h_put_32 (abfd, intern->copt, (bfd_byte *)ext->f_copt);
+ ECOFF_PUT_OFF (abfd, intern->adr, ext->f_adr);
+ H_PUT_32 (abfd, intern->rss, ext->f_rss);
+ H_PUT_32 (abfd, intern->issBase, ext->f_issBase);
+ ECOFF_PUT_OFF (abfd, intern->cbSs, ext->f_cbSs);
+ H_PUT_32 (abfd, intern->isymBase, ext->f_isymBase);
+ H_PUT_32 (abfd, intern->csym, ext->f_csym);
+ H_PUT_32 (abfd, intern->ilineBase, ext->f_ilineBase);
+ H_PUT_32 (abfd, intern->cline, ext->f_cline);
+ H_PUT_32 (abfd, intern->ioptBase, ext->f_ioptBase);
+ H_PUT_32 (abfd, intern->copt, ext->f_copt);
#if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
- bfd_h_put_16 (abfd, intern->ipdFirst, (bfd_byte *)ext->f_ipdFirst);
- bfd_h_put_16 (abfd, intern->cpd, (bfd_byte *)ext->f_cpd);
+ H_PUT_16 (abfd, intern->ipdFirst, ext->f_ipdFirst);
+ H_PUT_16 (abfd, intern->cpd, ext->f_cpd);
#endif
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
- bfd_h_put_32 (abfd, intern->ipdFirst, (bfd_byte *)ext->f_ipdFirst);
- bfd_h_put_32 (abfd, intern->cpd, (bfd_byte *)ext->f_cpd);
+ H_PUT_32 (abfd, intern->ipdFirst, ext->f_ipdFirst);
+ H_PUT_32 (abfd, intern->cpd, ext->f_cpd);
#endif
- bfd_h_put_32 (abfd, intern->iauxBase, (bfd_byte *)ext->f_iauxBase);
- bfd_h_put_32 (abfd, intern->caux, (bfd_byte *)ext->f_caux);
- bfd_h_put_32 (abfd, intern->rfdBase, (bfd_byte *)ext->f_rfdBase);
- bfd_h_put_32 (abfd, intern->crfd, (bfd_byte *)ext->f_crfd);
+ H_PUT_32 (abfd, intern->iauxBase, ext->f_iauxBase);
+ H_PUT_32 (abfd, intern->caux, ext->f_caux);
+ H_PUT_32 (abfd, intern->rfdBase, ext->f_rfdBase);
+ H_PUT_32 (abfd, intern->crfd, ext->f_crfd);
/* now the fun stuff... */
- if (bfd_header_big_endian (abfd)) {
- ext->f_bits1[0] = (((intern->lang << FDR_BITS1_LANG_SH_BIG)
- & FDR_BITS1_LANG_BIG)
- | (intern->fMerge ? FDR_BITS1_FMERGE_BIG : 0)
- | (intern->fReadin ? FDR_BITS1_FREADIN_BIG : 0)
- | (intern->fBigendian ? FDR_BITS1_FBIGENDIAN_BIG : 0));
- ext->f_bits2[0] = ((intern->glevel << FDR_BITS2_GLEVEL_SH_BIG)
- & FDR_BITS2_GLEVEL_BIG);
- ext->f_bits2[1] = 0;
- ext->f_bits2[2] = 0;
- } else {
- ext->f_bits1[0] = (((intern->lang << FDR_BITS1_LANG_SH_LITTLE)
- & FDR_BITS1_LANG_LITTLE)
- | (intern->fMerge ? FDR_BITS1_FMERGE_LITTLE : 0)
- | (intern->fReadin ? FDR_BITS1_FREADIN_LITTLE : 0)
- | (intern->fBigendian ? FDR_BITS1_FBIGENDIAN_LITTLE : 0));
- ext->f_bits2[0] = ((intern->glevel << FDR_BITS2_GLEVEL_SH_LITTLE)
- & FDR_BITS2_GLEVEL_LITTLE);
- ext->f_bits2[1] = 0;
- ext->f_bits2[2] = 0;
- }
+ if (bfd_header_big_endian (abfd))
+ {
+ ext->f_bits1[0] = (((intern->lang << FDR_BITS1_LANG_SH_BIG)
+ & FDR_BITS1_LANG_BIG)
+ | (intern->fMerge ? FDR_BITS1_FMERGE_BIG : 0)
+ | (intern->fReadin ? FDR_BITS1_FREADIN_BIG : 0)
+ | (intern->fBigendian ? FDR_BITS1_FBIGENDIAN_BIG : 0));
+ ext->f_bits2[0] = ((intern->glevel << FDR_BITS2_GLEVEL_SH_BIG)
+ & FDR_BITS2_GLEVEL_BIG);
+ ext->f_bits2[1] = 0;
+ ext->f_bits2[2] = 0;
+ }
+ else
+ {
+ ext->f_bits1[0] = (((intern->lang << FDR_BITS1_LANG_SH_LITTLE)
+ & FDR_BITS1_LANG_LITTLE)
+ | (intern->fMerge ? FDR_BITS1_FMERGE_LITTLE : 0)
+ | (intern->fReadin ? FDR_BITS1_FREADIN_LITTLE : 0)
+ | (intern->fBigendian ? FDR_BITS1_FBIGENDIAN_LITTLE : 0));
+ ext->f_bits2[0] = ((intern->glevel << FDR_BITS2_GLEVEL_SH_LITTLE)
+ & FDR_BITS2_GLEVEL_LITTLE);
+ ext->f_bits2[1] = 0;
+ ext->f_bits2[2] = 0;
+ }
- ecoff_put_off (abfd, intern->cbLineOffset, (bfd_byte *)ext->f_cbLineOffset);
- ecoff_put_off (abfd, intern->cbLine, (bfd_byte *)ext->f_cbLine);
+ ECOFF_PUT_OFF (abfd, intern->cbLineOffset, ext->f_cbLineOffset);
+ ECOFF_PUT_OFF (abfd, intern->cbLine, ext->f_cbLine);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
@@ -333,26 +339,23 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern)
memset ((PTR) intern, 0, sizeof (*intern));
- intern->adr = ecoff_get_off (abfd, (bfd_byte *)ext->p_adr);
- intern->isym = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_isym);
- intern->iline = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_iline);
- intern->regmask = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_regmask);
- intern->regoffset = bfd_h_get_signed_32 (abfd,
- (bfd_byte *)ext->p_regoffset);
- intern->iopt = bfd_h_get_signed_32 (abfd, (bfd_byte *)ext->p_iopt);
- intern->fregmask = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_fregmask);
- intern->fregoffset = bfd_h_get_signed_32 (abfd,
- (bfd_byte *)ext->p_fregoffset);
- intern->frameoffset = bfd_h_get_signed_32 (abfd,
- (bfd_byte *)ext->p_frameoffset);
- intern->framereg = bfd_h_get_16 (abfd, (bfd_byte *)ext->p_framereg);
- intern->pcreg = bfd_h_get_16 (abfd, (bfd_byte *)ext->p_pcreg);
- intern->lnLow = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnLow);
- intern->lnHigh = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnHigh);
- intern->cbLineOffset = ecoff_get_off (abfd, (bfd_byte *)ext->p_cbLineOffset);
+ intern->adr = ECOFF_GET_OFF (abfd, ext->p_adr);
+ intern->isym = H_GET_32 (abfd, ext->p_isym);
+ intern->iline = H_GET_32 (abfd, ext->p_iline);
+ intern->regmask = H_GET_32 (abfd, ext->p_regmask);
+ intern->regoffset = H_GET_S32 (abfd, ext->p_regoffset);
+ intern->iopt = H_GET_S32 (abfd, ext->p_iopt);
+ intern->fregmask = H_GET_32 (abfd, ext->p_fregmask);
+ intern->fregoffset = H_GET_S32 (abfd, ext->p_fregoffset);
+ intern->frameoffset = H_GET_S32 (abfd, ext->p_frameoffset);
+ intern->framereg = H_GET_16 (abfd, ext->p_framereg);
+ intern->pcreg = H_GET_16 (abfd, ext->p_pcreg);
+ intern->lnLow = H_GET_32 (abfd, ext->p_lnLow);
+ intern->lnHigh = H_GET_32 (abfd, ext->p_lnHigh);
+ intern->cbLineOffset = ECOFF_GET_OFF (abfd, ext->p_cbLineOffset);
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
- intern->gp_prologue = bfd_h_get_8 (abfd, (bfd_byte *) ext->p_gp_prologue);
+ intern->gp_prologue = H_GET_8 (abfd, ext->p_gp_prologue);
if (bfd_header_big_endian (abfd))
{
intern->gp_used = 0 != (ext->p_bits1[0] & PDR_BITS1_GP_USED_BIG);
@@ -373,7 +376,7 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern)
| ((ext->p_bits2[0] & PDR_BITS2_RESERVED_LITTLE)
<< PDR_BITS2_RESERVED_SH_LEFT_LITTLE));
}
- intern->localoff = bfd_h_get_8 (abfd, (bfd_byte *) ext->p_localoff);
+ intern->localoff = H_GET_8 (abfd, ext->p_localoff);
#endif
#ifdef TEST
@@ -395,23 +398,24 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
*intern = *intern_copy; /* Make it reasonable to do in-place. */
- ecoff_put_off (abfd, intern->adr, (bfd_byte *)ext->p_adr);
- bfd_h_put_32 (abfd, intern->isym, (bfd_byte *)ext->p_isym);
- bfd_h_put_32 (abfd, intern->iline, (bfd_byte *)ext->p_iline);
- bfd_h_put_32 (abfd, intern->regmask, (bfd_byte *)ext->p_regmask);
- bfd_h_put_32 (abfd, intern->regoffset, (bfd_byte *)ext->p_regoffset);
- bfd_h_put_32 (abfd, intern->iopt, (bfd_byte *)ext->p_iopt);
- bfd_h_put_32 (abfd, intern->fregmask, (bfd_byte *)ext->p_fregmask);
- bfd_h_put_32 (abfd, intern->fregoffset, (bfd_byte *)ext->p_fregoffset);
- bfd_h_put_32 (abfd, intern->frameoffset, (bfd_byte *)ext->p_frameoffset);
- bfd_h_put_16 (abfd, intern->framereg, (bfd_byte *)ext->p_framereg);
- bfd_h_put_16 (abfd, intern->pcreg, (bfd_byte *)ext->p_pcreg);
- bfd_h_put_32 (abfd, intern->lnLow, (bfd_byte *)ext->p_lnLow);
- bfd_h_put_32 (abfd, intern->lnHigh, (bfd_byte *)ext->p_lnHigh);
- ecoff_put_off (abfd, intern->cbLineOffset, (bfd_byte *)ext->p_cbLineOffset);
+ ECOFF_PUT_OFF (abfd, intern->adr, ext->p_adr);
+ H_PUT_32 (abfd, intern->isym, ext->p_isym);
+ H_PUT_32 (abfd, intern->iline, ext->p_iline);
+ H_PUT_32 (abfd, intern->regmask, ext->p_regmask);
+ H_PUT_32 (abfd, intern->regoffset, ext->p_regoffset);
+ H_PUT_32 (abfd, intern->iopt, ext->p_iopt);
+ H_PUT_32 (abfd, intern->fregmask, ext->p_fregmask);
+ H_PUT_32 (abfd, intern->fregoffset, ext->p_fregoffset);
+ H_PUT_32 (abfd, intern->frameoffset, ext->p_frameoffset);
+ H_PUT_16 (abfd, intern->framereg, ext->p_framereg);
+ H_PUT_16 (abfd, intern->pcreg, ext->p_pcreg);
+ H_PUT_32 (abfd, intern->lnLow, ext->p_lnLow);
+ H_PUT_32 (abfd, intern->lnHigh, ext->p_lnHigh);
+ ECOFF_PUT_OFF (abfd, intern->cbLineOffset, ext->p_cbLineOffset);
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
- bfd_h_put_8 (abfd, intern->gp_prologue, (bfd_byte *) ext->p_gp_prologue);
+ H_PUT_8 (abfd, intern->gp_prologue, ext->p_gp_prologue);
+
if (bfd_header_big_endian (abfd))
{
ext->p_bits1[0] = ((intern->gp_used ? PDR_BITS1_GP_USED_BIG : 0)
@@ -434,7 +438,7 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
PDR_BITS2_RESERVED_SH_LEFT_LITTLE)
& PDR_BITS2_RESERVED_LITTLE);
}
- bfd_h_put_8 (abfd, intern->localoff, (bfd_byte *) ext->p_localoff);
+ H_PUT_8 (abfd, intern->localoff, ext->p_localoff);
#endif
#ifdef TEST
@@ -458,23 +462,20 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern)
*ext = *(struct pdr_ext *) ext_copy;
- intern->adr = ecoff_get_off (abfd, (bfd_byte *)ext->p_adr);
- intern->isym = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_isym);
- intern->iline = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_iline);
- intern->regmask = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_regmask);
- intern->regoffset = bfd_h_get_signed_32 (abfd,
- (bfd_byte *)ext->p_regoffset);
- intern->iopt = bfd_h_get_signed_32 (abfd, (bfd_byte *)ext->p_iopt);
- intern->fregmask = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_fregmask);
- intern->fregoffset = bfd_h_get_signed_32 (abfd,
- (bfd_byte *)ext->p_fregoffset);
- intern->frameoffset = bfd_h_get_signed_32 (abfd,
- (bfd_byte *)ext->p_frameoffset);
- intern->framereg = bfd_h_get_16 (abfd, (bfd_byte *)ext->p_framereg);
- intern->pcreg = bfd_h_get_16 (abfd, (bfd_byte *)ext->p_pcreg);
- intern->lnLow = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnLow);
- intern->lnHigh = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnHigh);
- intern->cbLineOffset = ecoff_get_off (abfd, (bfd_byte *)ext->p_cbLineOffset);
+ intern->adr = ECOFF_GET_OFF (abfd, ext->p_adr);
+ intern->isym = H_GET_32 (abfd, ext->p_isym);
+ intern->iline = H_GET_32 (abfd, ext->p_iline);
+ intern->regmask = H_GET_32 (abfd, ext->p_regmask);
+ intern->regoffset = H_GET_S32 (abfd, ext->p_regoffset);
+ intern->iopt = H_GET_S32 (abfd, ext->p_iopt);
+ intern->fregmask = H_GET_32 (abfd, ext->p_fregmask);
+ intern->fregoffset = H_GET_S32 (abfd, ext->p_fregoffset);
+ intern->frameoffset = H_GET_S32 (abfd, ext->p_frameoffset);
+ intern->framereg = H_GET_16 (abfd, ext->p_framereg);
+ intern->pcreg = H_GET_16 (abfd, ext->p_pcreg);
+ intern->lnLow = H_GET_32 (abfd, ext->p_lnLow);
+ intern->lnHigh = H_GET_32 (abfd, ext->p_lnHigh);
+ intern->cbLineOffset = ECOFF_GET_OFF (abfd, ext->p_cbLineOffset);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
@@ -495,20 +496,20 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr)
*intern = *intern_copy; /* Make it reasonable to do in-place. */
- ecoff_put_off (abfd, intern->adr, (bfd_byte *)ext->p_adr);
- bfd_h_put_32 (abfd, intern->isym, (bfd_byte *)ext->p_isym);
- bfd_h_put_32 (abfd, intern->iline, (bfd_byte *)ext->p_iline);
- bfd_h_put_32 (abfd, intern->regmask, (bfd_byte *)ext->p_regmask);
- bfd_h_put_32 (abfd, intern->regoffset, (bfd_byte *)ext->p_regoffset);
- bfd_h_put_32 (abfd, intern->iopt, (bfd_byte *)ext->p_iopt);
- bfd_h_put_32 (abfd, intern->fregmask, (bfd_byte *)ext->p_fregmask);
- bfd_h_put_32 (abfd, intern->fregoffset, (bfd_byte *)ext->p_fregoffset);
- bfd_h_put_32 (abfd, intern->frameoffset, (bfd_byte *)ext->p_frameoffset);
- bfd_h_put_16 (abfd, intern->framereg, (bfd_byte *)ext->p_framereg);
- bfd_h_put_16 (abfd, intern->pcreg, (bfd_byte *)ext->p_pcreg);
- bfd_h_put_32 (abfd, intern->lnLow, (bfd_byte *)ext->p_lnLow);
- bfd_h_put_32 (abfd, intern->lnHigh, (bfd_byte *)ext->p_lnHigh);
- ecoff_put_off (abfd, intern->cbLineOffset, (bfd_byte *)ext->p_cbLineOffset);
+ ECOFF_PUT_OFF (abfd, intern->adr, ext->p_adr);
+ H_PUT_32 (abfd, intern->isym, ext->p_isym);
+ H_PUT_32 (abfd, intern->iline, ext->p_iline);
+ H_PUT_32 (abfd, intern->regmask, ext->p_regmask);
+ H_PUT_32 (abfd, intern->regoffset, ext->p_regoffset);
+ H_PUT_32 (abfd, intern->iopt, ext->p_iopt);
+ H_PUT_32 (abfd, intern->fregmask, ext->p_fregmask);
+ H_PUT_32 (abfd, intern->fregoffset, ext->p_fregoffset);
+ H_PUT_32 (abfd, intern->frameoffset, ext->p_frameoffset);
+ H_PUT_16 (abfd, intern->framereg, ext->p_framereg);
+ H_PUT_16 (abfd, intern->pcreg, ext->p_pcreg);
+ H_PUT_32 (abfd, intern->lnLow, ext->p_lnLow);
+ H_PUT_32 (abfd, intern->lnHigh, ext->p_lnHigh);
+ ECOFF_PUT_OFF (abfd, intern->cbLineOffset, ext->p_cbLineOffset);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
@@ -529,8 +530,8 @@ ecoff_swap_sym_in (abfd, ext_copy, intern)
*ext = *(struct sym_ext *) ext_copy;
- intern->iss = bfd_h_get_32 (abfd, (bfd_byte *)ext->s_iss);
- intern->value = ecoff_get_off (abfd, (bfd_byte *)ext->s_value);
+ intern->iss = H_GET_32 (abfd, ext->s_iss);
+ intern->value = ECOFF_GET_OFF (abfd, ext->s_value);
/* now the fun stuff... */
if (bfd_header_big_endian (abfd)) {
@@ -579,8 +580,8 @@ ecoff_swap_sym_out (abfd, intern_copy, ext_ptr)
*intern = *intern_copy; /* Make it reasonable to do in-place. */
- bfd_h_put_32 (abfd, intern->iss, (bfd_byte *)ext->s_iss);
- ecoff_put_off (abfd, intern->value, (bfd_byte *)ext->s_value);
+ H_PUT_32 (abfd, intern->iss, ext->s_iss);
+ ECOFF_PUT_OFF (abfd, intern->value, ext->s_value);
/* now the fun stuff... */
if (bfd_header_big_endian (abfd)) {
@@ -640,10 +641,10 @@ ecoff_swap_ext_in (abfd, ext_copy, intern)
intern->reserved = 0;
#if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
- intern->ifd = bfd_h_get_signed_16 (abfd, (bfd_byte *)ext->es_ifd);
+ intern->ifd = H_GET_S16 (abfd, ext->es_ifd);
#endif
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
- intern->ifd = bfd_h_get_signed_32 (abfd, (bfd_byte *)ext->es_ifd);
+ intern->ifd = H_GET_S32 (abfd, ext->es_ifd);
#endif
ecoff_swap_sym_in (abfd, &ext->es_asym, &intern->asym);
@@ -689,10 +690,10 @@ ecoff_swap_ext_out (abfd, intern_copy, ext_ptr)
}
#if defined (ECOFF_32) || defined (ECOFF_SIGNED_32)
- bfd_h_put_signed_16 (abfd, intern->ifd, (bfd_byte *)ext->es_ifd);
+ H_PUT_S16 (abfd, intern->ifd, ext->es_ifd);
#endif
#if defined (ECOFF_64) || defined (ECOFF_SIGNED_64)
- bfd_h_put_signed_32 (abfd, intern->ifd, (bfd_byte *)ext->es_ifd);
+ H_PUT_S32 (abfd, intern->ifd, ext->es_ifd);
#endif
ecoff_swap_sym_out (abfd, &intern->asym, &ext->es_asym);
@@ -713,7 +714,7 @@ ecoff_swap_rfd_in (abfd, ext_ptr, intern)
{
struct rfd_ext *ext = (struct rfd_ext *) ext_ptr;
- *intern = bfd_h_get_32 (abfd, (bfd_byte *)ext->rfd);
+ *intern = H_GET_32 (abfd, ext->rfd);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
@@ -731,7 +732,7 @@ ecoff_swap_rfd_out (abfd, intern, ext_ptr)
{
struct rfd_ext *ext = (struct rfd_ext *) ext_ptr;
- bfd_h_put_32 (abfd, *intern, (bfd_byte *)ext->rfd);
+ H_PUT_32 (abfd, *intern, ext->rfd);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
@@ -772,7 +773,7 @@ ecoff_swap_opt_in (abfd, ext_copy, intern)
_bfd_ecoff_swap_rndx_in (bfd_header_big_endian (abfd),
&ext->o_rndx, &intern->rndx);
- intern->offset = bfd_h_get_32 (abfd, (bfd_byte *) ext->o_offset);
+ intern->offset = H_GET_32 (abfd, ext->o_offset);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
@@ -811,7 +812,7 @@ ecoff_swap_opt_out (abfd, intern_copy, ext_ptr)
_bfd_ecoff_swap_rndx_out (bfd_header_big_endian (abfd),
&intern->rndx, &ext->o_rndx);
- bfd_h_put_32 (abfd, intern->value, (bfd_byte *) ext->o_offset);
+ H_PUT_32 (abfd, intern->value, ext->o_offset);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
@@ -831,8 +832,8 @@ ecoff_swap_dnr_in (abfd, ext_copy, intern)
*ext = *(struct dnr_ext *) ext_copy;
- intern->rfd = bfd_h_get_32 (abfd, (bfd_byte *) ext->d_rfd);
- intern->index = bfd_h_get_32 (abfd, (bfd_byte *) ext->d_index);
+ intern->rfd = H_GET_32 (abfd, ext->d_rfd);
+ intern->index = H_GET_32 (abfd, ext->d_index);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
@@ -853,8 +854,8 @@ ecoff_swap_dnr_out (abfd, intern_copy, ext_ptr)
*intern = *intern_copy; /* Make it reasonable to do in-place. */
- bfd_h_put_32 (abfd, intern->rfd, (bfd_byte *) ext->d_rfd);
- bfd_h_put_32 (abfd, intern->index, (bfd_byte *) ext->d_index);
+ H_PUT_32 (abfd, intern->rfd, ext->d_rfd);
+ H_PUT_32 (abfd, intern->index, ext->d_index);
#ifdef TEST
if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0)
diff --git a/contrib/binutils/bfd/elf-bfd.h b/contrib/binutils/bfd/elf-bfd.h
index b162290..0bd559f 100644
--- a/contrib/binutils/bfd/elf-bfd.h
+++ b/contrib/binutils/bfd/elf-bfd.h
@@ -1,6 +1,6 @@
/* BFD back-end data structures for ELF files.
- Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
- Free Software Foundation, Inc.
+ Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+ 2002 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -28,22 +28,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfdlink.h"
/* The number of entries in a section is its size divided by the size
- of a single entry. This is normally only applicaable to reloc and
+ of a single entry. This is normally only applicable to reloc and
symbol table sections. */
#define NUM_SHDR_ENTRIES(shdr) ((shdr)->sh_size / (shdr)->sh_entsize)
/* If size isn't specified as 64 or 32, NAME macro should fail. */
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
#ifndef NAME
#if ARCH_SIZE==64
-#define NAME(x,y) CAT4(x,64,_,y)
+#define NAME(x,y) CONCAT4 (x,64,_,y)
#endif
#if ARCH_SIZE==32
-#define NAME(x,y) CAT4(x,32,_,y)
+#define NAME(x,y) CONCAT4 (x,32,_,y)
#endif
#endif
#ifndef NAME
-#define NAME(x,y) CAT4(x,NOSIZE,_,y)
+#define NAME(x,y) CONCAT4 (x,NOSIZE,_,y)
#endif
#define ElfNAME(X) NAME(Elf,X)
@@ -76,6 +79,8 @@ typedef struct
} elf_symbol_type;
+struct elf_strtab_hash;
+
/* ELF linker hash table entries. */
struct elf_link_hash_entry
@@ -86,9 +91,6 @@ struct elf_link_hash_entry
set to -2 if the symbol is used by a reloc. */
long indx;
- /* Symbol size. */
- bfd_size_type size;
-
/* Symbol index as a dynamic symbol. Initialized to -1, and remains
-1 if this is not a dynamic symbol. */
/* ??? Note that this is consistently used as a synonym for tests
@@ -106,31 +108,14 @@ struct elf_link_hash_entry
/* String table index in .dynstr if this is a dynamic symbol. */
unsigned long dynstr_index;
+ /* Hash value of the name computed using the ELF hash function. */
+ unsigned long elf_hash_value;
+
/* If this is a weak defined symbol from a dynamic object, this
field points to a defined symbol with the same value, if there is
one. Otherwise it is NULL. */
struct elf_link_hash_entry *weakdef;
- /* If this symbol requires an entry in the global offset table, the
- processor specific backend uses this field to track usage and
- final offset. We use a union and two names primarily to document
- the intent of any particular piece of code. The field should be
- used as a count until size_dynamic_sections, at which point the
- contents of the .got is fixed. Afterward, if this field is -1,
- then the symbol does not require a global offset table entry. */
- union
- {
- bfd_signed_vma refcount;
- bfd_vma offset;
- } got;
-
- /* Same, but tracks a procedure linkage table entry. */
- union
- {
- bfd_signed_vma refcount;
- bfd_vma offset;
- } plt;
-
/* If this symbol is used in the linker created sections, the processor
specific backend uses this field to map the field into the offset
from the beginning of the section. */
@@ -159,15 +144,35 @@ struct elf_link_hash_entry
/* Virtual table derivation info. */
struct elf_link_hash_entry *vtable_parent;
+ /* If this symbol requires an entry in the global offset table, the
+ processor specific backend uses this field to track usage and
+ final offset. We use a union and two names primarily to document
+ the intent of any particular piece of code. The field should be
+ used as a count until size_dynamic_sections, at which point the
+ contents of the .got is fixed. Afterward, if this field is -1,
+ then the symbol does not require a global offset table entry. */
+ union
+ {
+ bfd_signed_vma refcount;
+ bfd_vma offset;
+ } got;
+
+ /* Same, but tracks a procedure linkage table entry. */
+ union
+ {
+ bfd_signed_vma refcount;
+ bfd_vma offset;
+ } plt;
+
+ /* Symbol size. */
+ bfd_size_type size;
+
/* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */
char type;
/* Symbol st_other value, symbol visibility. */
unsigned char other;
- /* Hash value of the name computed using the ELF hash function. */
- unsigned long elf_hash_value;
-
/* Some flags; legal values follow. */
unsigned short elf_link_hash_flags;
/* Symbol is referenced by a non-shared object. */
@@ -218,36 +223,65 @@ struct elf_link_local_dynamic_entry
Elf_Internal_Sym isym;
};
+enum elf_link_info_type
+{
+ ELF_INFO_TYPE_NONE,
+ ELF_INFO_TYPE_STABS,
+ ELF_INFO_TYPE_MERGE,
+ ELF_INFO_TYPE_EH_FRAME,
+ ELF_INFO_TYPE_EH_FRAME_HDR,
+ ELF_INFO_TYPE_LAST
+};
+
/* ELF linker hash table. */
struct elf_link_hash_table
{
struct bfd_link_hash_table root;
+
/* Whether we have created the special dynamic sections required
when linking against or generating a shared object. */
boolean dynamic_sections_created;
+
/* The BFD used to hold special sections created by the linker.
This will be the first BFD found which requires these sections to
be created. */
bfd *dynobj;
+
+ /* The value to use when initialising got.refcount/offset and
+ plt.refcount/offset in an elf_link_hash_entry. Set to zero when
+ the values are refcounts. Set to -1 in size_dynamic_sections
+ when the values may be offsets. */
+ bfd_signed_vma init_refcount;
+
/* The number of symbols found in the link which must be put into
the .dynsym section. */
bfd_size_type dynsymcount;
+
/* The string table of dynamic symbols, which becomes the .dynstr
section. */
- struct bfd_strtab_hash *dynstr;
+ struct elf_strtab_hash *dynstr;
+
/* The number of buckets in the hash table in the .hash section.
This is based on the number of dynamic symbols. */
bfd_size_type bucketcount;
+
/* A linked list of DT_NEEDED names found in dynamic objects
included in the link. */
struct bfd_link_needed_list *needed;
+
/* The _GLOBAL_OFFSET_TABLE_ symbol. */
struct elf_link_hash_entry *hgot;
+
/* A pointer to information used to link stabs in sections. */
PTR stab_info;
+
+ /* A pointer to information used to merge SEC_MERGE sections. */
+ PTR merge_info;
+
/* A linked list of local symbols to be added to .dynsym. */
struct elf_link_local_dynamic_entry *dynlocal;
+
/* A linked list of DT_RPATH/DT_RUNPATH names found in dynamic
objects included in the link. */
struct bfd_link_needed_list *runpath;
@@ -271,6 +305,20 @@ struct elf_link_hash_table
/* Get the ELF linker hash table from a link_info structure. */
#define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
+
+/* Returns true if the hash table is a struct elf_link_hash_table. */
+#define is_elf_hash_table(p) \
+ ((p)->hash->type == bfd_link_elf_hash_table)
+
+/* Used by bfd_section_from_r_symndx to cache a small number of local
+ symbol to section mappings. */
+#define LOCAL_SYM_CACHE_SIZE 32
+struct sym_sec_cache
+{
+ bfd *abfd;
+ unsigned long indx[LOCAL_SYM_CACHE_SIZE];
+ asection *sec[LOCAL_SYM_CACHE_SIZE];
+};
/* Constant information held for an ELF backend. */
@@ -287,15 +335,22 @@ struct elf_size_info {
unsigned char arch_size, file_align;
unsigned char elfclass, ev_current;
- int (*write_out_phdrs) PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
- boolean (*write_shdrs_and_ehdr) PARAMS ((bfd *));
- void (*write_relocs) PARAMS ((bfd *, asection *, PTR));
- void (*swap_symbol_out) PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));
+ int (*write_out_phdrs)
+ PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int));
+ boolean (*write_shdrs_and_ehdr)
+ PARAMS ((bfd *));
+ void (*write_relocs)
+ PARAMS ((bfd *, asection *, PTR));
+ void (*swap_symbol_out)
+ PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
boolean (*slurp_reloc_table)
PARAMS ((bfd *, asection *, asymbol **, boolean));
- long (*slurp_symbol_table) PARAMS ((bfd *, asymbol **, boolean));
- void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
- void (*swap_dyn_out) PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
+ long (*slurp_symbol_table)
+ PARAMS ((bfd *, asymbol **, boolean));
+ void (*swap_dyn_in)
+ PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
+ void (*swap_dyn_out)
+ PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
/* This function, if defined, is called to swap in a REL
relocation. If an external relocation corresponds to more than
@@ -329,6 +384,25 @@ struct elf_size_info {
? (elf_symbol_type *) (S) \
: 0)
+enum elf_reloc_type_class {
+ reloc_class_normal,
+ reloc_class_relative,
+ reloc_class_plt,
+ reloc_class_copy
+};
+
+struct elf_reloc_cookie
+{
+ Elf_Internal_Rela *rels, *rel, *relend;
+ PTR locsyms;
+ PTR locsym_shndx;
+ bfd *abfd;
+ size_t locsymcount;
+ size_t extsymoff;
+ struct elf_link_hash_entry **sym_hashes;
+ boolean bad_symtab;
+};
+
struct elf_backend_data
{
/* The architecture for this backend. */
@@ -342,20 +416,21 @@ struct elf_backend_data
/* A function to translate an ELF RELA relocation to a BFD arelent
structure. */
- void (*elf_info_to_howto) PARAMS ((bfd *, arelent *,
- Elf_Internal_Rela *));
+ void (*elf_info_to_howto)
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
/* A function to translate an ELF REL relocation to a BFD arelent
structure. */
- void (*elf_info_to_howto_rel) PARAMS ((bfd *, arelent *,
- Elf_Internal_Rel *));
+ void (*elf_info_to_howto_rel)
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rel *));
/* A function to determine whether a symbol is global when
partitioning the symbol table into local and global symbols.
This should be NULL for most targets, in which case the correct
thing will be done. MIPS ELF, at least on the Irix 5, has
special requirements. */
- boolean (*elf_backend_sym_is_global) PARAMS ((bfd *, asymbol *));
+ boolean (*elf_backend_sym_is_global)
+ PARAMS ((bfd *, asymbol *));
/* The remaining functions are hooks which are called only if they
are not NULL. */
@@ -366,59 +441,59 @@ struct elf_backend_data
this is called elf_elfheader is set, but anything else should be
used with caution. If this returns false, the check_format
routine will return a bfd_error_wrong_format error. */
- boolean (*elf_backend_object_p) PARAMS ((bfd *));
+ boolean (*elf_backend_object_p)
+ PARAMS ((bfd *));
/* A function to do additional symbol processing when reading the
ELF symbol table. This is where any processor-specific special
section indices are handled. */
- void (*elf_backend_symbol_processing) PARAMS ((bfd *, asymbol *));
+ void (*elf_backend_symbol_processing)
+ PARAMS ((bfd *, asymbol *));
/* A function to do additional symbol processing after reading the
entire ELF symbol table. */
- boolean (*elf_backend_symbol_table_processing) PARAMS ((bfd *,
- elf_symbol_type *,
- unsigned int));
+ boolean (*elf_backend_symbol_table_processing)
+ PARAMS ((bfd *, elf_symbol_type *, unsigned int));
/* A function to set the type of the info field. Processor-specific
types should be handled here. */
- int (*elf_backend_get_symbol_type) PARAMS (( Elf_Internal_Sym *, int));
+ int (*elf_backend_get_symbol_type)
+ PARAMS (( Elf_Internal_Sym *, int));
/* A function to do additional processing on the ELF section header
just before writing it out. This is used to set the flags and
type fields for some sections, or to actually write out data for
unusual sections. */
- boolean (*elf_backend_section_processing) PARAMS ((bfd *,
- Elf32_Internal_Shdr *));
+ boolean (*elf_backend_section_processing)
+ PARAMS ((bfd *, Elf32_Internal_Shdr *));
/* A function to handle unusual section types when creating BFD
sections from ELF sections. */
- boolean (*elf_backend_section_from_shdr) PARAMS ((bfd *,
- Elf32_Internal_Shdr *,
- char *));
+ boolean (*elf_backend_section_from_shdr)
+ PARAMS ((bfd *, Elf32_Internal_Shdr *, char *));
/* A function to convert machine dependent section header flags to
BFD internal section header flags. */
- boolean (*elf_backend_section_flags) PARAMS ((flagword *,
- Elf32_Internal_Shdr *));
+ boolean (*elf_backend_section_flags)
+ PARAMS ((flagword *, Elf32_Internal_Shdr *));
/* A function to handle unusual program segment types when creating BFD
sections from ELF program segments. */
- boolean (*elf_backend_section_from_phdr) PARAMS ((bfd *,
- Elf32_Internal_Phdr *,
- int));
+ boolean (*elf_backend_section_from_phdr)
+ PARAMS ((bfd *, Elf32_Internal_Phdr *, int));
/* A function to set up the ELF section header for a BFD section in
preparation for writing it out. This is where the flags and type
fields are set for unusual sections. */
- boolean (*elf_backend_fake_sections) PARAMS ((bfd *, Elf32_Internal_Shdr *,
- asection *));
+ boolean (*elf_backend_fake_sections)
+ PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
/* A function to get the ELF section index for a BFD section. If
this returns true, the section was found. If it is a normal ELF
section, *RETVAL should be left unchanged. If it is not a normal
ELF section *RETVAL should be set to the SHN_xxxx index. */
boolean (*elf_backend_section_from_bfd_section)
- PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *retval));
+ PARAMS ((bfd *, asection *, int *retval));
/* If this field is not NULL, it is called by the add_symbols phase
of a link just before adding a symbol to the global linker hash
@@ -565,11 +640,13 @@ struct elf_backend_data
/* This function is called by get_program_header_size. It should
return the number of additional program segments which this BFD
will need. It should return -1 on error. */
- int (*elf_backend_additional_program_headers) PARAMS ((bfd *));
+ int (*elf_backend_additional_program_headers)
+ PARAMS ((bfd *));
/* This function is called to modify an existing segment map in a
backend specific fashion. */
- boolean (*elf_backend_modify_segment_map) PARAMS ((bfd *));
+ boolean (*elf_backend_modify_segment_map)
+ PARAMS ((bfd *));
/* This function is called during section gc to discover the section a
particular relocation refers to. It need not be defined for hosts
@@ -603,18 +680,65 @@ struct elf_backend_data
not handled in the hash table. */
boolean (*elf_backend_output_arch_syms)
PARAMS ((bfd *, struct bfd_link_info *, PTR,
- boolean (*) PARAMS ((PTR, const char *,
- Elf_Internal_Sym *, asection *))));
+ boolean (*) (PTR, const char *, Elf_Internal_Sym *, asection *)));
- /* Copy any information related to dynamic linking from a pre-existing
- symbol IND to a newly created symbol DIR. */
+ /* Copy any information related to dynamic linking from a pre-existing
+ symbol to a newly created symbol. Also called to copy flags and
+ other back-end info to a weakdef, in which case the symbol is not
+ newly created and plt/got refcounts and dynamic indices should not
+ be copied. */
void (*elf_backend_copy_indirect_symbol)
PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
/* Modify any information related to dynamic linking such that the
symbol is not exported. */
void (*elf_backend_hide_symbol)
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+ PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
+
+ /* Emit relocations. Overrides default routine for emitting relocs,
+ except during a relocatable link, or if all relocs are being emitted. */
+ void (*elf_backend_emit_relocs)
+ PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *));
+
+ /* Count relocations. Not called for relocatable links
+ or if all relocs are being preserved in the output. */
+ unsigned int (*elf_backend_count_relocs)
+ PARAMS ((asection *, Elf_Internal_Rela *));
+
+ /* This function, if defined, is called when an NT_PRSTATUS note is found
+ in a core file. */
+ boolean (*elf_backend_grok_prstatus)
+ PARAMS ((bfd *, Elf_Internal_Note *));
+
+ /* This function, if defined, is called when an NT_PSINFO or NT_PRPSINFO
+ note is found in a core file. */
+ boolean (*elf_backend_grok_psinfo)
+ PARAMS ((bfd *, Elf_Internal_Note *));
+
+ /* Functions to print VMAs. Special code to handle 64 bit ELF files. */
+ void (* elf_backend_sprintf_vma)
+ PARAMS ((bfd *, char *, bfd_vma));
+ void (* elf_backend_fprintf_vma)
+ PARAMS ((bfd *, PTR, bfd_vma));
+
+ /* This function returns class of a reloc type. */
+ enum elf_reloc_type_class (*elf_backend_reloc_type_class)
+ PARAMS ((const Elf_Internal_Rela *));
+
+ /* This function, if defined, removes information about discarded functions
+ from other sections which mention them. */
+ boolean (*elf_backend_discard_info)
+ PARAMS ((bfd *, struct elf_reloc_cookie *, struct bfd_link_info *));
+
+ /* This function, if defined, signals that the function above has removed
+ the discarded relocations for this section. */
+ boolean (*elf_backend_ignore_discarded_relocs)
+ PARAMS ((asection *));
+
+ /* This function, if defined, may write out the given section.
+ Returns true if it did so and false if the caller should. */
+ boolean (*elf_backend_write_section)
+ PARAMS ((bfd *, asection *, bfd_byte *));
/* The swapping table to use when dealing with ECOFF information.
Used for the MIPS ELF .mdebug section. */
@@ -674,6 +798,8 @@ struct elf_backend_data
unsigned plt_not_loaded : 1;
unsigned plt_alignment : 4;
unsigned can_gc_sections : 1;
+ unsigned can_refcount : 1;
+ unsigned want_got_sym : 1;
unsigned want_dynbss : 1;
};
@@ -684,46 +810,84 @@ struct bfd_elf_section_data
{
/* The ELF header for this section. */
Elf_Internal_Shdr this_hdr;
+
/* The ELF header for the reloc section associated with this
section, if any. */
Elf_Internal_Shdr rel_hdr;
+
/* If there is a second reloc section associated with this section,
as can happen on Irix 6, this field points to the header. */
Elf_Internal_Shdr *rel_hdr2;
+
/* The number of relocations currently assigned to REL_HDR. */
unsigned int rel_count;
+
/* The number of relocations currently assigned to REL_HDR2. */
unsigned int rel_count2;
+
+ /* A pointer to a linked list tracking dynamic relocs copied for
+ local symbols. */
+ PTR local_dynrel;
+
+ /* A pointer to the bfd section used for dynamic relocs. */
+ asection *sreloc;
+
/* The ELF section number of this section. Only used for an output
file. */
int this_idx;
+
/* The ELF section number of the reloc section indicated by
REL_HDR if any. Only used for an output file. */
int rel_idx;
+
/* The ELF section number of the reloc section indicated by
REL_HDR2 if any. Only used for an output file. */
int rel_idx2;
+
/* Used by the backend linker to store the symbol hash table entries
associated with relocs against global symbols. */
struct elf_link_hash_entry **rel_hashes;
+
/* A pointer to the swapped relocs. If the section uses REL relocs,
rather than RELA, all the r_addend fields will be zero. This
pointer may be NULL. It is used by the backend linker. */
Elf_Internal_Rela *relocs;
+
/* Used by the backend linker when generating a shared library to
record the dynamic symbol index for a section symbol
corresponding to this section. A value of 0 means that there is
no dynamic symbol for this section. */
long dynindx;
- /* A pointer used for .stab linking optimizations. */
- PTR stab_info;
+
+ /* A pointer used for various section optimizations. */
+ PTR sec_info;
+
+ /* Type of that information. */
+ enum elf_link_info_type sec_info_type;
+
+ /* Group name, if this section is part of a group. */
+ const char *group_name;
+
+ /* A linked list of sections in the group. Circular when used by
+ the linker. */
+ asection *next_in_group;
+
/* A pointer available for the processor specific ELF backend. */
PTR tdata;
+
/* Nonzero if this section uses RELA relocations, rather than REL. */
unsigned int use_rela_p:1;
};
#define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
+#define elf_group_name(sec) (elf_section_data(sec)->group_name)
+#define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group)
+
+/* Return true if section has been discarded. */
+#define elf_discarded_section(sec) \
+ (!bfd_is_abs_section(sec) \
+ && bfd_is_abs_section((sec)->output_section) \
+ && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE)
#define get_elf_backend_data(abfd) \
((struct elf_backend_data *) (abfd)->xvec->backend_data)
@@ -769,7 +933,7 @@ typedef struct elf_linker_section_pointers
{
struct elf_linker_section_pointers *next; /* next allocated pointer for this symbol */
bfd_vma offset; /* offset of pointer from beginning of section */
- bfd_signed_vma addend; /* addend used */
+ bfd_vma addend; /* addend used */
elf_linker_section_enum_t which; /* which linker section this is */
boolean written_address_p; /* whether address was written yet */
} elf_linker_section_pointers_t;
@@ -783,9 +947,11 @@ struct elf_obj_tdata
Elf_Internal_Shdr **elf_sect_ptr;
Elf_Internal_Phdr *phdr;
struct elf_segment_map *segment_map;
- struct bfd_strtab_hash *strtab_ptr;
+ struct elf_strtab_hash *strtab_ptr;
int num_locals;
int num_globals;
+ unsigned int num_elf_sections; /* elf_sect_ptr size */
+ int num_section_syms;
asymbol **section_syms; /* STT_SECTION symbols for each section */
Elf_Internal_Shdr symtab_hdr;
Elf_Internal_Shdr shstrtab_hdr;
@@ -795,8 +961,10 @@ struct elf_obj_tdata
Elf_Internal_Shdr dynversym_hdr;
Elf_Internal_Shdr dynverref_hdr;
Elf_Internal_Shdr dynverdef_hdr;
+ Elf_Internal_Shdr symtab_shndx_hdr;
unsigned int symtab_section, shstrtab_section;
unsigned int strtab_section, dynsymtab_section;
+ unsigned int symtab_shndx_section;
unsigned int dynversym_section, dynverdef_section, dynverref_section;
file_ptr next_file_pos;
#if 0
@@ -805,8 +973,11 @@ struct elf_obj_tdata
void *prstatus; /* The raw /proc prstatus structure */
void *prpsinfo; /* The raw /proc prpsinfo structure */
#endif
- bfd_vma gp; /* The gp value (MIPS only, for now) */
- unsigned int gp_size; /* The gp size (MIPS only, for now) */
+ bfd_vma gp; /* The gp value */
+ unsigned int gp_size; /* The gp size */
+
+ Elf_Internal_Shdr **group_sect_ptr;
+ int num_group;
/* Information grabbed from an elf core file. */
int core_signal;
@@ -892,6 +1063,10 @@ struct elf_obj_tdata
/* Used to determine if the e_flags field has been initialized */
boolean flags_init;
+ /* Used to determine if PT_GNU_EH_FRAME segment header should be
+ created. */
+ boolean eh_frame_hdr;
+
/* Number of symbol version definitions we are about to emit. */
unsigned int cverdefs;
@@ -918,8 +1093,10 @@ struct elf_obj_tdata
#define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
#define elf_elfheader(bfd) (elf_tdata(bfd) -> elf_header)
#define elf_elfsections(bfd) (elf_tdata(bfd) -> elf_sect_ptr)
+#define elf_numsections(bfd) (elf_tdata(bfd) -> num_elf_sections)
#define elf_shstrtab(bfd) (elf_tdata(bfd) -> strtab_ptr)
#define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section)
+#define elf_symtab_shndx(bfd) (elf_tdata(bfd) -> symtab_shndx_section)
#define elf_dynsymtab(bfd) (elf_tdata(bfd) -> dynsymtab_section)
#define elf_dynversym(bfd) (elf_tdata(bfd) -> dynversym_section)
#define elf_dynverdef(bfd) (elf_tdata(bfd) -> dynverdef_section)
@@ -927,6 +1104,7 @@ struct elf_obj_tdata
#define elf_num_locals(bfd) (elf_tdata(bfd) -> num_locals)
#define elf_num_globals(bfd) (elf_tdata(bfd) -> num_globals)
#define elf_section_syms(bfd) (elf_tdata(bfd) -> section_syms)
+#define elf_num_section_syms(bfd) (elf_tdata(bfd) -> num_section_syms)
#define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo)
#define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus)
#define elf_gp(bfd) (elf_tdata(bfd) -> gp)
@@ -962,36 +1140,56 @@ extern void _bfd_elf_swap_versym_in
extern void _bfd_elf_swap_versym_out
PARAMS ((bfd *, const Elf_Internal_Versym *, Elf_External_Versym *));
-extern int _bfd_elf_section_from_bfd_section PARAMS ((bfd *, asection *));
+extern int _bfd_elf_section_from_bfd_section
+ PARAMS ((bfd *, asection *));
extern char *bfd_elf_string_from_elf_section
PARAMS ((bfd *, unsigned, unsigned));
-extern char *bfd_elf_get_str_section PARAMS ((bfd *, unsigned));
+extern char *bfd_elf_get_str_section
+ PARAMS ((bfd *, unsigned));
+
+extern boolean _bfd_elf_copy_private_bfd_data
+ PARAMS ((bfd *, bfd *));
+extern boolean _bfd_elf_print_private_bfd_data
+ PARAMS ((bfd *, PTR));
+extern void bfd_elf_print_symbol
+ PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
-extern boolean _bfd_elf_print_private_bfd_data PARAMS ((bfd *, PTR));
-extern void bfd_elf_print_symbol PARAMS ((bfd *, PTR, asymbol *,
- bfd_print_symbol_type));
-#define elf_string_from_elf_strtab(abfd,strindex) \
- bfd_elf_string_from_elf_section(abfd,elf_elfheader(abfd)->e_shstrndx,strindex)
+#define elf_string_from_elf_strtab(abfd, strindex) \
+ bfd_elf_string_from_elf_section(abfd, elf_elfheader(abfd)->e_shstrndx, \
+ strindex)
#define bfd_elf32_print_symbol bfd_elf_print_symbol
#define bfd_elf64_print_symbol bfd_elf_print_symbol
-extern unsigned long bfd_elf_hash PARAMS ((const char *));
-
-extern bfd_reloc_status_type bfd_elf_generic_reloc PARAMS ((bfd *,
- arelent *,
- asymbol *,
- PTR,
- asection *,
- bfd *,
- char **));
-extern boolean bfd_elf_mkobject PARAMS ((bfd *));
-extern boolean bfd_elf_mkcorefile PARAMS ((bfd *));
-extern Elf_Internal_Shdr *bfd_elf_find_section PARAMS ((bfd *, char *));
+extern void _bfd_elf_sprintf_vma
+ PARAMS ((bfd *, char *, bfd_vma));
+extern void _bfd_elf_fprintf_vma
+ PARAMS ((bfd *, PTR, bfd_vma));
+
+extern enum elf_reloc_type_class _bfd_elf_reloc_type_class
+ PARAMS ((const Elf_Internal_Rela *));
+extern bfd_vma _bfd_elf_rela_local_sym
+ PARAMS ((bfd *, Elf_Internal_Sym *, asection *, Elf_Internal_Rela *));
+extern bfd_vma _bfd_elf_rel_local_sym
+ PARAMS ((bfd *, Elf_Internal_Sym *, asection **, bfd_vma));
+extern bfd_vma _bfd_elf_section_offset
+ PARAMS ((bfd *, struct bfd_link_info *, asection *, bfd_vma));
+
+extern unsigned long bfd_elf_hash
+ PARAMS ((const char *));
+
+extern bfd_reloc_status_type bfd_elf_generic_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+extern boolean bfd_elf_mkobject
+ PARAMS ((bfd *));
+extern boolean bfd_elf_mkcorefile
+ PARAMS ((bfd *));
+extern Elf_Internal_Shdr *bfd_elf_find_section
+ PARAMS ((bfd *, char *));
extern boolean _bfd_elf_make_section_from_shdr
- PARAMS ((bfd *abfd, Elf_Internal_Shdr *hdr, const char *name));
+ PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
extern boolean _bfd_elf_make_section_from_phdr
- PARAMS ((bfd *abfd, Elf_Internal_Phdr *hdr, int index, const char *typename));
+ PARAMS ((bfd *, Elf_Internal_Phdr *, int, const char *));
extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
@@ -999,147 +1197,187 @@ extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
extern void _bfd_elf_link_hash_copy_indirect
PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
extern void _bfd_elf_link_hash_hide_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+ PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
extern boolean _bfd_elf_link_hash_table_init
PARAMS ((struct elf_link_hash_table *, bfd *,
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
struct bfd_hash_table *,
const char *)));
-extern boolean _bfd_elf_slurp_version_tables PARAMS ((bfd *));
+extern boolean _bfd_elf_slurp_version_tables
+ PARAMS ((bfd *));
+
+extern boolean _bfd_elf_merge_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
extern boolean _bfd_elf_copy_private_symbol_data
PARAMS ((bfd *, asymbol *, bfd *, asymbol *));
extern boolean _bfd_elf_copy_private_section_data
PARAMS ((bfd *, asection *, bfd *, asection *));
-extern boolean _bfd_elf_write_object_contents PARAMS ((bfd *));
-extern boolean _bfd_elf_write_corefile_contents PARAMS ((bfd *));
-extern boolean _bfd_elf_set_section_contents PARAMS ((bfd *, sec_ptr, PTR,
- file_ptr,
- bfd_size_type));
-extern long _bfd_elf_get_symtab_upper_bound PARAMS ((bfd *));
-extern long _bfd_elf_get_symtab PARAMS ((bfd *, asymbol **));
-extern long _bfd_elf_get_dynamic_symtab_upper_bound PARAMS ((bfd *));
-extern long _bfd_elf_canonicalize_dynamic_symtab PARAMS ((bfd *, asymbol **));
-extern long _bfd_elf_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
-extern long _bfd_elf_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
- arelent **, asymbol **));
-extern long _bfd_elf_get_dynamic_reloc_upper_bound PARAMS ((bfd *));
-extern long _bfd_elf_canonicalize_dynamic_reloc PARAMS ((bfd *, arelent **,
- asymbol **));
-extern asymbol *_bfd_elf_make_empty_symbol PARAMS ((bfd *));
-extern void _bfd_elf_get_symbol_info PARAMS ((bfd *, asymbol *,
- symbol_info *));
-extern boolean _bfd_elf_is_local_label_name PARAMS ((bfd *, const char *));
-extern alent *_bfd_elf_get_lineno PARAMS ((bfd *, asymbol *));
-extern boolean _bfd_elf_set_arch_mach PARAMS ((bfd *, enum bfd_architecture,
- unsigned long));
-extern boolean _bfd_elf_find_nearest_line PARAMS ((bfd *, asection *,
- asymbol **,
- bfd_vma, const char **,
- const char **,
- unsigned int *));
+extern boolean _bfd_elf_write_object_contents
+ PARAMS ((bfd *));
+extern boolean _bfd_elf_write_corefile_contents
+ PARAMS ((bfd *));
+extern boolean _bfd_elf_set_section_contents
+ PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
+extern long _bfd_elf_get_symtab_upper_bound
+ PARAMS ((bfd *));
+extern long _bfd_elf_get_symtab
+ PARAMS ((bfd *, asymbol **));
+extern long _bfd_elf_get_dynamic_symtab_upper_bound
+ PARAMS ((bfd *));
+extern long _bfd_elf_canonicalize_dynamic_symtab
+ PARAMS ((bfd *, asymbol **));
+extern long _bfd_elf_get_reloc_upper_bound
+ PARAMS ((bfd *, sec_ptr));
+extern long _bfd_elf_canonicalize_reloc
+ PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
+extern long _bfd_elf_get_dynamic_reloc_upper_bound
+ PARAMS ((bfd *));
+extern long _bfd_elf_canonicalize_dynamic_reloc
+ PARAMS ((bfd *, arelent **, asymbol **));
+extern asymbol *_bfd_elf_make_empty_symbol
+ PARAMS ((bfd *));
+extern void _bfd_elf_get_symbol_info
+ PARAMS ((bfd *, asymbol *, symbol_info *));
+extern boolean _bfd_elf_is_local_label_name
+ PARAMS ((bfd *, const char *));
+extern alent *_bfd_elf_get_lineno
+ PARAMS ((bfd *, asymbol *));
+extern boolean _bfd_elf_set_arch_mach
+ PARAMS ((bfd *, enum bfd_architecture, unsigned long));
+extern boolean _bfd_elf_find_nearest_line
+ PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
+ const char **, unsigned int *));
#define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
#define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-extern int _bfd_elf_sizeof_headers PARAMS ((bfd *, boolean));
-extern boolean _bfd_elf_new_section_hook PARAMS ((bfd *, asection *));
+extern int _bfd_elf_sizeof_headers
+ PARAMS ((bfd *, boolean));
+extern boolean _bfd_elf_new_section_hook
+ PARAMS ((bfd *, asection *));
extern boolean _bfd_elf_init_reloc_shdr
PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, boolean));
/* If the target doesn't have reloc handling written yet: */
-extern void _bfd_elf_no_info_to_howto PARAMS ((bfd *, arelent *,
- Elf_Internal_Rela *));
-
-extern boolean bfd_section_from_shdr PARAMS ((bfd *, unsigned int shindex));
-extern boolean bfd_section_from_phdr PARAMS ((bfd *, Elf_Internal_Phdr *, int));
-
-extern int _bfd_elf_symbol_from_bfd_symbol PARAMS ((bfd *, asymbol **));
-
-asection *bfd_section_from_elf_index PARAMS ((bfd *, unsigned int));
-boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *,
- struct bfd_link_info *));
-struct bfd_strtab_hash *_bfd_elf_stringtab_init PARAMS ((void));
-boolean
-_bfd_elf_link_record_dynamic_symbol PARAMS ((struct bfd_link_info *,
- struct elf_link_hash_entry *));
-long
-_bfd_elf_link_lookup_local_dynindx PARAMS ((struct bfd_link_info *,
- bfd *, long));
-boolean
-_bfd_elf_compute_section_file_positions PARAMS ((bfd *,
- struct bfd_link_info *));
-void _bfd_elf_assign_file_positions_for_relocs PARAMS ((bfd *));
-file_ptr _bfd_elf_assign_file_position_for_section PARAMS ((Elf_Internal_Shdr *,
- file_ptr,
- boolean));
-
-extern boolean _bfd_elf_validate_reloc PARAMS ((bfd *, arelent *));
-
-boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *,
- struct bfd_link_info *));
-boolean _bfd_elf_create_got_section PARAMS ((bfd *,
- struct bfd_link_info *));
-unsigned long _bfd_elf_link_renumber_dynsyms PARAMS ((bfd *,
- struct bfd_link_info *));
-
-elf_linker_section_t *_bfd_elf_create_linker_section
- PARAMS ((bfd *abfd,
- struct bfd_link_info *info,
- enum elf_linker_section_enum,
- elf_linker_section_t *defaults));
-
-elf_linker_section_pointers_t *_bfd_elf_find_pointer_linker_section
- PARAMS ((elf_linker_section_pointers_t *linker_pointers,
- bfd_signed_vma addend,
- elf_linker_section_enum_t which));
-
-boolean bfd_elf32_create_pointer_linker_section
- PARAMS ((bfd *abfd,
- struct bfd_link_info *info,
- elf_linker_section_t *lsect,
- struct elf_link_hash_entry *h,
- const Elf32_Internal_Rela *rel));
-
-bfd_vma bfd_elf32_finish_pointer_linker_section
- PARAMS ((bfd *output_abfd,
- bfd *input_bfd,
- struct bfd_link_info *info,
- elf_linker_section_t *lsect,
- struct elf_link_hash_entry *h,
- bfd_vma relocation,
- const Elf32_Internal_Rela *rel,
- int relative_reloc));
-
-boolean bfd_elf64_create_pointer_linker_section
- PARAMS ((bfd *abfd,
- struct bfd_link_info *info,
- elf_linker_section_t *lsect,
- struct elf_link_hash_entry *h,
- const Elf64_Internal_Rela *rel));
-
-bfd_vma bfd_elf64_finish_pointer_linker_section
- PARAMS ((bfd *output_abfd,
- bfd *input_bfd,
- struct bfd_link_info *info,
- elf_linker_section_t *lsect,
- struct elf_link_hash_entry *h,
- bfd_vma relocation,
- const Elf64_Internal_Rela *rel,
- int relative_reloc));
-
-boolean _bfd_elf_make_linker_section_rela
- PARAMS ((bfd *dynobj,
- elf_linker_section_t *lsect,
- int alignment));
-
-boolean _bfd_elfcore_section_from_phdr
+extern void _bfd_elf_no_info_to_howto
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
+
+extern boolean bfd_section_from_shdr
+ PARAMS ((bfd *, unsigned int shindex));
+extern boolean bfd_section_from_phdr
PARAMS ((bfd *, Elf_Internal_Phdr *, int));
-extern const bfd_target *bfd_elf32_object_p PARAMS ((bfd *));
-extern const bfd_target *bfd_elf32_core_file_p PARAMS ((bfd *));
-extern char *bfd_elf32_core_file_failing_command PARAMS ((bfd *));
-extern int bfd_elf32_core_file_failing_signal PARAMS ((bfd *));
-extern boolean bfd_elf32_core_file_matches_executable_p PARAMS ((bfd *,
- bfd *));
+extern int _bfd_elf_symbol_from_bfd_symbol
+ PARAMS ((bfd *, asymbol **));
+
+extern asection *bfd_section_from_r_symndx
+ PARAMS ((bfd *, struct sym_sec_cache *, asection *, unsigned long));
+extern asection *bfd_section_from_elf_index
+ PARAMS ((bfd *, unsigned int));
+extern boolean _bfd_elf_create_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
+extern struct bfd_strtab_hash *_bfd_elf_stringtab_init
+ PARAMS ((void));
+
+extern struct elf_strtab_hash * _bfd_elf_strtab_init
+ PARAMS ((void));
+extern void _bfd_elf_strtab_free
+ PARAMS ((struct elf_strtab_hash *));
+extern bfd_size_type _bfd_elf_strtab_add
+ PARAMS ((struct elf_strtab_hash *, const char *, boolean));
+extern void _bfd_elf_strtab_addref
+ PARAMS ((struct elf_strtab_hash *, bfd_size_type));
+extern void _bfd_elf_strtab_delref
+ PARAMS ((struct elf_strtab_hash *, bfd_size_type));
+extern void _bfd_elf_strtab_clear_all_refs
+ PARAMS ((struct elf_strtab_hash *));
+extern bfd_size_type _bfd_elf_strtab_size
+ PARAMS ((struct elf_strtab_hash *));
+extern bfd_size_type _bfd_elf_strtab_offset
+ PARAMS ((struct elf_strtab_hash *, bfd_size_type));
+extern boolean _bfd_elf_strtab_emit
+ PARAMS ((bfd *, struct elf_strtab_hash *));
+extern void _bfd_elf_strtab_finalize
+ PARAMS ((struct elf_strtab_hash *));
+
+extern boolean _bfd_elf_discard_section_eh_frame
+ PARAMS ((bfd *, struct bfd_link_info *, asection *, asection *,
+ boolean (*) (bfd_vma, PTR), struct elf_reloc_cookie *));
+extern boolean _bfd_elf_discard_section_eh_frame_hdr
+ PARAMS ((bfd *, struct bfd_link_info *, asection *));
+extern bfd_vma _bfd_elf_eh_frame_section_offset
+ PARAMS ((bfd *, asection *, bfd_vma));
+extern boolean _bfd_elf_write_section_eh_frame
+ PARAMS ((bfd *, asection *, asection *, bfd_byte *));
+extern boolean _bfd_elf_write_section_eh_frame_hdr
+ PARAMS ((bfd *, asection *));
+extern boolean _bfd_elf_maybe_strip_eh_frame_hdr
+ PARAMS ((struct bfd_link_info *));
+
+extern boolean _bfd_elf_link_record_dynamic_symbol
+ PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+extern long _bfd_elf_link_lookup_local_dynindx
+ PARAMS ((struct bfd_link_info *, bfd *, long));
+extern boolean _bfd_elf_compute_section_file_positions
+ PARAMS ((bfd *, struct bfd_link_info *));
+extern void _bfd_elf_assign_file_positions_for_relocs
+ PARAMS ((bfd *));
+extern file_ptr _bfd_elf_assign_file_position_for_section
+ PARAMS ((Elf_Internal_Shdr *, file_ptr, boolean));
+
+extern boolean _bfd_elf_validate_reloc
+ PARAMS ((bfd *, arelent *));
+
+extern boolean _bfd_elf_create_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean _bfd_elf_create_got_section
+ PARAMS ((bfd *, struct bfd_link_info *));
+extern unsigned long _bfd_elf_link_renumber_dynsyms
+ PARAMS ((bfd *, struct bfd_link_info *));
+
+extern boolean _bfd_elfcore_make_pseudosection
+ PARAMS ((bfd *, char *, size_t, ufile_ptr));
+extern char *_bfd_elfcore_strndup
+ PARAMS ((bfd *, char *, size_t));
+
+extern elf_linker_section_t *_bfd_elf_create_linker_section
+ PARAMS ((bfd *, struct bfd_link_info *, enum elf_linker_section_enum,
+ elf_linker_section_t *));
+
+extern elf_linker_section_pointers_t *_bfd_elf_find_pointer_linker_section
+ PARAMS ((elf_linker_section_pointers_t *, bfd_vma,
+ elf_linker_section_enum_t));
+
+extern boolean bfd_elf32_create_pointer_linker_section
+ PARAMS ((bfd *, struct bfd_link_info *, elf_linker_section_t *,
+ struct elf_link_hash_entry *, const Elf32_Internal_Rela *));
+
+extern bfd_vma bfd_elf32_finish_pointer_linker_section
+ PARAMS ((bfd *, bfd *, struct bfd_link_info *, elf_linker_section_t *,
+ struct elf_link_hash_entry *, bfd_vma,
+ const Elf32_Internal_Rela *, int));
+
+extern boolean bfd_elf64_create_pointer_linker_section
+ PARAMS ((bfd *, struct bfd_link_info *, elf_linker_section_t *,
+ struct elf_link_hash_entry *, const Elf64_Internal_Rela *));
+
+extern bfd_vma bfd_elf64_finish_pointer_linker_section
+ PARAMS ((bfd *, bfd *, struct bfd_link_info *, elf_linker_section_t *,
+ struct elf_link_hash_entry *, bfd_vma,
+ const Elf64_Internal_Rela *, int));
+
+extern boolean _bfd_elf_make_linker_section_rela
+ PARAMS ((bfd *, elf_linker_section_t *, int));
+
+extern const bfd_target *bfd_elf32_object_p
+ PARAMS ((bfd *));
+extern const bfd_target *bfd_elf32_core_file_p
+ PARAMS ((bfd *));
+extern char *bfd_elf32_core_file_failing_command
+ PARAMS ((bfd *));
+extern int bfd_elf32_core_file_failing_signal
+ PARAMS ((bfd *));
+extern boolean bfd_elf32_core_file_matches_executable_p
+ PARAMS ((bfd *, bfd *));
extern boolean bfd_elf32_bfd_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
@@ -1147,9 +1385,10 @@ extern boolean bfd_elf32_bfd_final_link
PARAMS ((bfd *, struct bfd_link_info *));
extern void bfd_elf32_swap_symbol_in
- PARAMS ((bfd *, const Elf32_External_Sym *, Elf_Internal_Sym *));
+ PARAMS ((bfd *, const Elf32_External_Sym *, const Elf_External_Sym_Shndx *,
+ Elf_Internal_Sym *));
extern void bfd_elf32_swap_symbol_out
- PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));
+ PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
extern void bfd_elf32_swap_reloc_in
PARAMS ((bfd *, const Elf32_External_Rel *, Elf_Internal_Rel *));
extern void bfd_elf32_swap_reloc_out
@@ -1168,9 +1407,10 @@ extern void bfd_elf32_swap_dyn_out
PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
extern long bfd_elf32_slurp_symbol_table
PARAMS ((bfd *, asymbol **, boolean));
-extern boolean bfd_elf32_write_shdrs_and_ehdr PARAMS ((bfd *));
+extern boolean bfd_elf32_write_shdrs_and_ehdr
+ PARAMS ((bfd *));
extern int bfd_elf32_write_out_phdrs
- PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
+ PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int));
extern void bfd_elf32_write_relocs
PARAMS ((bfd *, asection *, PTR));
extern boolean bfd_elf32_slurp_reloc_table
@@ -1182,21 +1422,26 @@ extern boolean bfd_elf32_link_create_dynamic_sections
extern Elf_Internal_Rela *_bfd_elf32_link_read_relocs
PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean));
-extern const bfd_target *bfd_elf64_object_p PARAMS ((bfd *));
-extern const bfd_target *bfd_elf64_core_file_p PARAMS ((bfd *));
-extern char *bfd_elf64_core_file_failing_command PARAMS ((bfd *));
-extern int bfd_elf64_core_file_failing_signal PARAMS ((bfd *));
-extern boolean bfd_elf64_core_file_matches_executable_p PARAMS ((bfd *,
- bfd *));
+extern const bfd_target *bfd_elf64_object_p
+ PARAMS ((bfd *));
+extern const bfd_target *bfd_elf64_core_file_p
+ PARAMS ((bfd *));
+extern char *bfd_elf64_core_file_failing_command
+ PARAMS ((bfd *));
+extern int bfd_elf64_core_file_failing_signal
+ PARAMS ((bfd *));
+extern boolean bfd_elf64_core_file_matches_executable_p
+ PARAMS ((bfd *, bfd *));
extern boolean bfd_elf64_bfd_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
extern boolean bfd_elf64_bfd_final_link
PARAMS ((bfd *, struct bfd_link_info *));
extern void bfd_elf64_swap_symbol_in
- PARAMS ((bfd *, const Elf64_External_Sym *, Elf_Internal_Sym *));
+ PARAMS ((bfd *, const Elf64_External_Sym *, const Elf_External_Sym_Shndx *,
+ Elf_Internal_Sym *));
extern void bfd_elf64_swap_symbol_out
- PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));
+ PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
extern void bfd_elf64_swap_reloc_in
PARAMS ((bfd *, const Elf64_External_Rel *, Elf_Internal_Rel *));
extern void bfd_elf64_swap_reloc_out
@@ -1215,9 +1460,10 @@ extern void bfd_elf64_swap_dyn_out
PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
extern long bfd_elf64_slurp_symbol_table
PARAMS ((bfd *, asymbol **, boolean));
-extern boolean bfd_elf64_write_shdrs_and_ehdr PARAMS ((bfd *));
+extern boolean bfd_elf64_write_shdrs_and_ehdr
+ PARAMS ((bfd *));
extern int bfd_elf64_write_out_phdrs
- PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
+ PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int));
extern void bfd_elf64_write_relocs
PARAMS ((bfd *, asection *, PTR));
extern boolean bfd_elf64_slurp_reloc_table
@@ -1234,53 +1480,76 @@ extern Elf_Internal_Rela *_bfd_elf64_link_read_relocs
#define bfd_elf64_link_record_dynamic_symbol \
_bfd_elf_link_record_dynamic_symbol
-boolean _bfd_elf32_link_record_local_dynamic_symbol
+extern boolean _bfd_elf32_link_record_local_dynamic_symbol
PARAMS ((struct bfd_link_info *, bfd *, long));
-boolean _bfd_elf64_link_record_local_dynamic_symbol
+extern boolean _bfd_elf64_link_record_local_dynamic_symbol
PARAMS ((struct bfd_link_info *, bfd *, long));
-extern boolean _bfd_elf_close_and_cleanup PARAMS ((bfd *));
+extern boolean _bfd_elf_close_and_cleanup
+ PARAMS ((bfd *));
extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR,
asection *, bfd *, char **));
-boolean _bfd_elf32_gc_sections
- PARAMS ((bfd *abfd, struct bfd_link_info *info));
-boolean _bfd_elf32_gc_common_finalize_got_offsets
- PARAMS ((bfd *abfd, struct bfd_link_info *info));
-boolean _bfd_elf32_gc_common_final_link
+extern boolean _bfd_elf32_gc_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean _bfd_elf32_gc_common_finalize_got_offsets
+ PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean _bfd_elf32_gc_common_final_link
PARAMS ((bfd *, struct bfd_link_info *));
-boolean _bfd_elf32_gc_record_vtinherit
+extern boolean _bfd_elf32_gc_record_vtinherit
PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
-boolean _bfd_elf32_gc_record_vtentry
+extern boolean _bfd_elf32_gc_record_vtentry
PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
-boolean _bfd_elf64_gc_sections
- PARAMS ((bfd *abfd, struct bfd_link_info *info));
-boolean _bfd_elf64_gc_common_finalize_got_offsets
- PARAMS ((bfd *abfd, struct bfd_link_info *info));
-boolean _bfd_elf64_gc_common_final_link
+extern boolean _bfd_elf64_gc_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean _bfd_elf64_gc_common_finalize_got_offsets
+ PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean _bfd_elf64_gc_common_final_link
PARAMS ((bfd *, struct bfd_link_info *));
-boolean _bfd_elf64_gc_record_vtinherit
+extern boolean _bfd_elf64_gc_record_vtinherit
PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
-boolean _bfd_elf64_gc_record_vtentry
+extern boolean _bfd_elf64_gc_record_vtentry
PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
+extern boolean _bfd_elf32_reloc_symbol_deleted_p
+ PARAMS ((bfd_vma, PTR));
+extern boolean _bfd_elf64_reloc_symbol_deleted_p
+ PARAMS ((bfd_vma, PTR));
+
+/* Exported interface for writing elf corefile notes. */
+extern char *elfcore_write_note
+ PARAMS ((bfd *, char *, int *, char *, int, void *, int));
+extern char *elfcore_write_prpsinfo
+ PARAMS ((bfd *, char *, int *, char *, char *));
+extern char *elfcore_write_prstatus
+ PARAMS ((bfd *, char *, int *, long, int, void *));
+extern char * elfcore_write_pstatus
+ PARAMS ((bfd *, char *, int *, long, int, void *));
+extern char *elfcore_write_prfpreg
+ PARAMS ((bfd *, char *, int *, void *, int));
+extern char *elfcore_write_prxfpreg
+ PARAMS ((bfd *, char *, int *, void *, int));
+
/* MIPS ELF specific routines. */
-extern boolean _bfd_mips_elf_object_p PARAMS ((bfd *));
+extern boolean _bfd_mips_elf_object_p
+ PARAMS ((bfd *));
extern boolean _bfd_mips_elf_section_from_shdr
PARAMS ((bfd *, Elf_Internal_Shdr *, char *));
extern boolean _bfd_mips_elf_fake_sections
PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
extern boolean _bfd_mips_elf_section_from_bfd_section
- PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, int *));
+ PARAMS ((bfd *, asection *, int *));
extern boolean _bfd_mips_elf_section_processing
PARAMS ((bfd *, Elf_Internal_Shdr *));
-extern void _bfd_mips_elf_symbol_processing PARAMS ((bfd *, asymbol *));
+extern void _bfd_mips_elf_symbol_processing
+ PARAMS ((bfd *, asymbol *));
extern boolean _bfd_mips_elf_read_ecoff_info
PARAMS ((bfd *, asection *, struct ecoff_debug_info *));
-extern void _bfd_mips_elf_final_write_processing PARAMS ((bfd *, boolean));
+extern void _bfd_mips_elf_final_write_processing
+ PARAMS ((bfd *, boolean));
extern bfd_reloc_status_type _bfd_mips_elf_hi16_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
extern bfd_reloc_status_type _bfd_mips_elf_lo16_reloc
@@ -1291,9 +1560,10 @@ extern bfd_reloc_status_type _bfd_mips_elf_got16_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
extern bfd_reloc_status_type _bfd_mips_elf_gprel32_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
-extern boolean _bfd_mips_elf_set_private_flags PARAMS ((bfd *, flagword));
-extern boolean _bfd_mips_elf_copy_private_bfd_data PARAMS ((bfd *, bfd *));
-extern boolean _bfd_mips_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *));
+extern boolean _bfd_mips_elf_set_private_flags
+ PARAMS ((bfd *, flagword));
+extern boolean _bfd_mips_elf_merge_private_bfd_data
+ PARAMS ((bfd *, bfd *));
extern boolean _bfd_mips_elf_find_nearest_line
PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
const char **, unsigned int *));
@@ -1333,14 +1603,17 @@ extern boolean _bfd_mips_elf_link_output_symbol_hook
asection *));
extern boolean _bfd_mips_elf_final_link
PARAMS ((bfd *, struct bfd_link_info *));
-extern int _bfd_mips_elf_additional_program_headers PARAMS ((bfd *));
-extern boolean _bfd_mips_elf_modify_segment_map PARAMS ((bfd *));
+extern int _bfd_mips_elf_additional_program_headers
+ PARAMS ((bfd *));
+extern boolean _bfd_mips_elf_modify_segment_map
+ PARAMS ((bfd *));
extern boolean _bfd_mips_elf_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
/* SH ELF specific routine. */
-extern boolean _sh_elf_set_mach_from_flags PARAMS ((bfd *));
+extern boolean _sh_elf_set_mach_from_flags
+ PARAMS ((bfd *));
#endif /* _LIBELF_H_ */
diff --git a/contrib/binutils/bfd/elf-eh-frame.c b/contrib/binutils/bfd/elf-eh-frame.c
new file mode 100644
index 0000000..b479c00
--- /dev/null
+++ b/contrib/binutils/bfd/elf-eh-frame.c
@@ -0,0 +1,1212 @@
+/* .eh_frame section optimization.
+ Copyright 2001, 2002 Free Software Foundation, Inc.
+ Written by Jakub Jelinek <jakub@redhat.com>.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "elf/dwarf2.h"
+
+#define EH_FRAME_HDR_SIZE 8
+
+struct cie_header
+{
+ unsigned int length;
+ unsigned int id;
+};
+
+struct cie
+{
+ struct cie_header hdr;
+ unsigned char version;
+ unsigned char augmentation[20];
+ unsigned int code_align;
+ int data_align;
+ unsigned int ra_column;
+ unsigned int augmentation_size;
+ struct elf_link_hash_entry *personality;
+ unsigned char per_encoding;
+ unsigned char lsda_encoding;
+ unsigned char fde_encoding;
+ unsigned char initial_insn_length;
+ unsigned char make_relative;
+ unsigned char make_lsda_relative;
+ unsigned char initial_instructions[50];
+};
+
+struct eh_cie_fde
+{
+ unsigned int offset;
+ unsigned int size;
+ asection *sec;
+ unsigned int new_offset;
+ unsigned char fde_encoding;
+ unsigned char lsda_encoding;
+ unsigned char lsda_offset;
+ unsigned char cie : 1;
+ unsigned char removed : 1;
+ unsigned char make_relative : 1;
+ unsigned char make_lsda_relative : 1;
+};
+
+struct eh_frame_sec_info
+{
+ unsigned int count;
+ unsigned int alloced;
+ struct eh_cie_fde entry[1];
+};
+
+struct eh_frame_array_ent
+{
+ bfd_vma initial_loc;
+ bfd_vma fde;
+};
+
+struct eh_frame_hdr_info
+{
+ struct cie last_cie;
+ asection *last_cie_sec;
+ unsigned int last_cie_offset;
+ unsigned int fde_count, array_count;
+ struct eh_frame_array_ent *array;
+ /* TRUE if .eh_frame_hdr should contain the sorted search table.
+ We build it if we successfully read all .eh_frame input sections
+ and recognize them. */
+ boolean table;
+ boolean strip;
+};
+
+static bfd_vma read_unsigned_leb128
+ PARAMS ((bfd *, char *, unsigned int *));
+static bfd_signed_vma read_signed_leb128
+ PARAMS ((bfd *, char *, unsigned int *));
+static int get_DW_EH_PE_width
+ PARAMS ((int, int));
+static bfd_vma read_value
+ PARAMS ((bfd *, bfd_byte *, int));
+static void write_value
+ PARAMS ((bfd *, bfd_byte *, bfd_vma, int));
+static int cie_compare
+ PARAMS ((struct cie *, struct cie *));
+static int vma_compare
+ PARAMS ((const PTR a, const PTR b));
+
+/* Helper function for reading uleb128 encoded data. */
+
+static bfd_vma
+read_unsigned_leb128 (abfd, buf, bytes_read_ptr)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ char *buf;
+ unsigned int *bytes_read_ptr;
+{
+ bfd_vma result;
+ unsigned int num_read;
+ int shift;
+ unsigned char byte;
+
+ result = 0;
+ shift = 0;
+ num_read = 0;
+ do
+ {
+ byte = bfd_get_8 (abfd, (bfd_byte *) buf);
+ buf ++;
+ num_read ++;
+ result |= (((bfd_vma) byte & 0x7f) << shift);
+ shift += 7;
+ }
+ while (byte & 0x80);
+ * bytes_read_ptr = num_read;
+ return result;
+}
+
+/* Helper function for reading sleb128 encoded data. */
+
+static bfd_signed_vma
+read_signed_leb128 (abfd, buf, bytes_read_ptr)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ char *buf;
+ unsigned int * bytes_read_ptr;
+{
+ bfd_vma result;
+ int shift;
+ int num_read;
+ unsigned char byte;
+
+ result = 0;
+ shift = 0;
+ num_read = 0;
+ do
+ {
+ byte = bfd_get_8 (abfd, (bfd_byte *) buf);
+ buf ++;
+ num_read ++;
+ result |= (((bfd_vma) byte & 0x7f) << shift);
+ shift += 7;
+ }
+ while (byte & 0x80);
+ if (byte & 0x40)
+ result |= (((bfd_vma) -1) << (shift - 7)) << 7;
+ * bytes_read_ptr = num_read;
+ return result;
+}
+
+#define read_uleb128(VAR, BUF) \
+do \
+ { \
+ (VAR) = read_unsigned_leb128 (abfd, buf, &leb128_tmp); \
+ (BUF) += leb128_tmp; \
+ } \
+while (0)
+
+#define read_sleb128(VAR, BUF) \
+do \
+ { \
+ (VAR) = read_signed_leb128 (abfd, buf, &leb128_tmp); \
+ (BUF) += leb128_tmp; \
+ } \
+while (0)
+
+/* Return 0 if either encoding is variable width, or not yet known to bfd. */
+
+static
+int get_DW_EH_PE_width (encoding, ptr_size)
+ int encoding, ptr_size;
+{
+ /* DW_EH_PE_ values of 0x60 and 0x70 weren't defined at the time .eh_frame
+ was added to bfd. */
+ if ((encoding & 0x60) == 0x60)
+ return 0;
+
+ switch (encoding & 7)
+ {
+ case DW_EH_PE_udata2: return 2;
+ case DW_EH_PE_udata4: return 4;
+ case DW_EH_PE_udata8: return 8;
+ case DW_EH_PE_absptr: return ptr_size;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+/* Read a width sized value from memory. */
+
+static bfd_vma
+read_value (abfd, buf, width)
+ bfd *abfd;
+ bfd_byte *buf;
+ int width;
+{
+ bfd_vma value;
+
+ switch (width)
+ {
+ case 2: value = bfd_get_16 (abfd, buf); break;
+ case 4: value = bfd_get_32 (abfd, buf); break;
+ case 8: value = bfd_get_64 (abfd, buf); break;
+ default: BFD_FAIL (); return 0;
+ }
+
+ return value;
+}
+
+/* Store a width sized value to memory. */
+
+static void
+write_value (abfd, buf, value, width)
+ bfd *abfd;
+ bfd_byte *buf;
+ bfd_vma value;
+ int width;
+{
+ switch (width)
+ {
+ case 2: bfd_put_16 (abfd, value, buf); break;
+ case 4: bfd_put_32 (abfd, value, buf); break;
+ case 8: bfd_put_64 (abfd, value, buf); break;
+ default: BFD_FAIL ();
+ }
+}
+
+/* Return zero if C1 and C2 CIEs can be merged. */
+
+static
+int cie_compare (c1, c2)
+ struct cie *c1, *c2;
+{
+ if (c1->hdr.length == c2->hdr.length
+ && c1->version == c2->version
+ && strcmp (c1->augmentation, c2->augmentation) == 0
+ && strcmp (c1->augmentation, "eh") != 0
+ && c1->code_align == c2->code_align
+ && c1->data_align == c2->data_align
+ && c1->ra_column == c2->ra_column
+ && c1->augmentation_size == c2->augmentation_size
+ && c1->personality == c2->personality
+ && c1->per_encoding == c2->per_encoding
+ && c1->lsda_encoding == c2->lsda_encoding
+ && c1->fde_encoding == c2->fde_encoding
+ && (c1->initial_insn_length
+ == c2->initial_insn_length)
+ && memcmp (c1->initial_instructions,
+ c2->initial_instructions,
+ c1->initial_insn_length) == 0)
+ return 0;
+
+ return 1;
+}
+
+/* This function is called for each input file before the .eh_frame
+ section is relocated. It discards duplicate CIEs and FDEs for discarded
+ functions. The function returns true iff any entries have been
+ deleted. */
+
+boolean
+_bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec,
+ reloc_symbol_deleted_p, cookie)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ asection *sec, *ehdrsec;
+ boolean (*reloc_symbol_deleted_p) (bfd_vma, PTR);
+ struct elf_reloc_cookie *cookie;
+{
+ bfd_byte *ehbuf = NULL, *buf;
+ bfd_byte *last_cie, *last_fde;
+ struct cie_header hdr;
+ struct cie cie;
+ struct eh_frame_hdr_info *hdr_info;
+ struct eh_frame_sec_info *sec_info = NULL;
+ unsigned int leb128_tmp;
+ unsigned int cie_usage_count, last_cie_ndx, i, offset;
+ unsigned int make_relative, make_lsda_relative;
+ Elf_Internal_Rela *rel;
+ bfd_size_type new_size;
+ unsigned int ptr_size;
+
+ if (sec->_raw_size == 0)
+ {
+ /* This file does not contain .eh_frame information. */
+ return false;
+ }
+
+ if ((sec->output_section != NULL
+ && bfd_is_abs_section (sec->output_section)))
+ {
+ /* At least one of the sections is being discarded from the
+ link, so we should just ignore them. */
+ return false;
+ }
+
+ BFD_ASSERT (elf_section_data (ehdrsec)->sec_info_type
+ == ELF_INFO_TYPE_EH_FRAME_HDR);
+ hdr_info = (struct eh_frame_hdr_info *)
+ elf_section_data (ehdrsec)->sec_info;
+
+ /* Read the frame unwind information from abfd. */
+
+ ehbuf = (bfd_byte *) bfd_malloc (sec->_raw_size);
+ if (ehbuf == NULL)
+ goto free_no_table;
+
+ if (! bfd_get_section_contents (abfd, sec, ehbuf, (bfd_vma) 0,
+ sec->_raw_size))
+ goto free_no_table;
+
+ if (sec->_raw_size >= 4
+ && bfd_get_32 (abfd, ehbuf) == 0
+ && cookie->rel == cookie->relend)
+ {
+ /* Empty .eh_frame section. */
+ free (ehbuf);
+ return false;
+ }
+
+ /* If .eh_frame section size doesn't fit into int, we cannot handle
+ it (it would need to use 64-bit .eh_frame format anyway). */
+ if (sec->_raw_size != (unsigned int) sec->_raw_size)
+ goto free_no_table;
+
+ ptr_size = (elf_elfheader (abfd)->e_ident[EI_CLASS]
+ == ELFCLASS64) ? 8 : 4;
+ buf = ehbuf;
+ last_cie = NULL;
+ last_cie_ndx = 0;
+ memset (&cie, 0, sizeof (cie));
+ cie_usage_count = 0;
+ new_size = sec->_raw_size;
+ make_relative = hdr_info->last_cie.make_relative;
+ make_lsda_relative = hdr_info->last_cie.make_lsda_relative;
+ sec_info = bfd_zmalloc (sizeof (struct eh_frame_sec_info)
+ + 99 * sizeof (struct eh_cie_fde));
+ if (sec_info == NULL)
+ goto free_no_table;
+ sec_info->alloced = 100;
+
+#define ENSURE_NO_RELOCS(buf) \
+ if (cookie->rel < cookie->relend \
+ && (cookie->rel->r_offset \
+ < (bfd_size_type) ((buf) - ehbuf))) \
+ goto free_no_table
+
+#define SKIP_RELOCS(buf) \
+ while (cookie->rel < cookie->relend \
+ && (cookie->rel->r_offset \
+ < (bfd_size_type) ((buf) - ehbuf))) \
+ cookie->rel++
+
+#define GET_RELOC(buf) \
+ ((cookie->rel < cookie->relend \
+ && (cookie->rel->r_offset \
+ == (bfd_size_type) ((buf) - ehbuf))) \
+ ? cookie->rel : NULL)
+
+ for (;;)
+ {
+ unsigned char *aug;
+
+ if (sec_info->count == sec_info->alloced)
+ {
+ sec_info = bfd_realloc (sec_info,
+ sizeof (struct eh_frame_sec_info)
+ + (sec_info->alloced + 99)
+ * sizeof (struct eh_cie_fde));
+ if (sec_info == NULL)
+ goto free_no_table;
+
+ memset (&sec_info->entry[sec_info->alloced], 0,
+ 100 * sizeof (struct eh_cie_fde));
+ sec_info->alloced += 100;
+ }
+
+ last_fde = buf;
+ /* If we are at the end of the section, we still need to decide
+ on whether to output or discard last encountered CIE (if any). */
+ if ((bfd_size_type) (buf - ehbuf) == sec->_raw_size)
+ hdr.id = (unsigned int) -1;
+ else
+ {
+ if ((bfd_size_type) (buf + 4 - ehbuf) > sec->_raw_size)
+ /* No space for CIE/FDE header length. */
+ goto free_no_table;
+
+ hdr.length = bfd_get_32 (abfd, buf);
+ if (hdr.length == 0xffffffff)
+ /* 64-bit .eh_frame is not supported. */
+ goto free_no_table;
+ buf += 4;
+ if ((buf - ehbuf) + hdr.length > sec->_raw_size)
+ /* CIE/FDE not contained fully in this .eh_frame input section. */
+ goto free_no_table;
+
+ sec_info->entry[sec_info->count].offset = last_fde - ehbuf;
+ sec_info->entry[sec_info->count].size = 4 + hdr.length;
+
+ if (hdr.length == 0)
+ {
+ /* CIE with length 0 must be only the last in the section. */
+ if ((bfd_size_type) (buf - ehbuf) < sec->_raw_size)
+ goto free_no_table;
+ ENSURE_NO_RELOCS (buf);
+ sec_info->count++;
+ /* Now just finish last encountered CIE processing and break
+ the loop. */
+ hdr.id = (unsigned int) -1;
+ }
+ else
+ {
+ hdr.id = bfd_get_32 (abfd, buf);
+ buf += 4;
+ if (hdr.id == (unsigned int) -1)
+ goto free_no_table;
+ }
+ }
+
+ if (hdr.id == 0 || hdr.id == (unsigned int) -1)
+ {
+ unsigned int initial_insn_length;
+
+ /* CIE */
+ if (last_cie != NULL)
+ {
+ /* Now check if this CIE is identical to last CIE, in which case
+ we can remove it, provided we adjust all FDEs.
+ Also, it can be removed if we have removed all FDEs using
+ that. */
+ if (cie_compare (&cie, &hdr_info->last_cie) == 0
+ || cie_usage_count == 0)
+ {
+ new_size -= cie.hdr.length + 4;
+ sec_info->entry[last_cie_ndx].removed = 1;
+ sec_info->entry[last_cie_ndx].sec = hdr_info->last_cie_sec;
+ sec_info->entry[last_cie_ndx].new_offset
+ = hdr_info->last_cie_offset;
+ }
+ else
+ {
+ hdr_info->last_cie = cie;
+ hdr_info->last_cie_sec = sec;
+ hdr_info->last_cie_offset = last_cie - ehbuf;
+ sec_info->entry[last_cie_ndx].make_relative
+ = cie.make_relative;
+ sec_info->entry[last_cie_ndx].make_lsda_relative
+ = cie.make_lsda_relative;
+ }
+ }
+
+ if (hdr.id == (unsigned int) -1)
+ break;
+
+ last_cie_ndx = sec_info->count;
+ sec_info->entry[sec_info->count].cie = 1;
+
+ cie_usage_count = 0;
+ memset (&cie, 0, sizeof (cie));
+ cie.hdr = hdr;
+ cie.version = *buf++;
+
+ /* Cannot handle unknown versions. */
+ if (cie.version != 1)
+ goto free_no_table;
+ if (strlen (buf) > sizeof (cie.augmentation) - 1)
+ goto free_no_table;
+
+ strcpy (cie.augmentation, buf);
+ buf = strchr (buf, '\0') + 1;
+ ENSURE_NO_RELOCS (buf);
+ if (buf[0] == 'e' && buf[1] == 'h')
+ {
+ /* GCC < 3.0 .eh_frame CIE */
+ /* We cannot merge "eh" CIEs because __EXCEPTION_TABLE__
+ is private to each CIE, so we don't need it for anything.
+ Just skip it. */
+ buf += ptr_size;
+ SKIP_RELOCS (buf);
+ }
+ read_uleb128 (cie.code_align, buf);
+ read_sleb128 (cie.data_align, buf);
+ read_uleb128 (cie.ra_column, buf);
+ ENSURE_NO_RELOCS (buf);
+ cie.lsda_encoding = DW_EH_PE_omit;
+ cie.fde_encoding = DW_EH_PE_omit;
+ cie.per_encoding = DW_EH_PE_omit;
+ aug = cie.augmentation;
+ if (aug[0] != 'e' || aug[1] != 'h')
+ {
+ if (*aug == 'z')
+ {
+ aug++;
+ read_uleb128 (cie.augmentation_size, buf);
+ ENSURE_NO_RELOCS (buf);
+ }
+
+ while (*aug != '\0')
+ switch (*aug++)
+ {
+ case 'L':
+ cie.lsda_encoding = *buf++;
+ ENSURE_NO_RELOCS (buf);
+ if (get_DW_EH_PE_width (cie.lsda_encoding, ptr_size) == 0)
+ goto free_no_table;
+ break;
+ case 'R':
+ cie.fde_encoding = *buf++;
+ ENSURE_NO_RELOCS (buf);
+ if (get_DW_EH_PE_width (cie.fde_encoding, ptr_size) == 0)
+ goto free_no_table;
+ break;
+ case 'P':
+ {
+ int per_width;
+
+ cie.per_encoding = *buf++;
+ per_width = get_DW_EH_PE_width (cie.per_encoding,
+ ptr_size);
+ if (per_width == 0)
+ goto free_no_table;
+ if ((cie.per_encoding & 0xf0) == DW_EH_PE_aligned)
+ buf = (ehbuf
+ + ((buf - ehbuf + per_width - 1)
+ & ~((bfd_size_type) per_width - 1)));
+ ENSURE_NO_RELOCS (buf);
+ rel = GET_RELOC (buf);
+ /* Ensure we have a reloc here, against
+ a global symbol. */
+ if (rel != NULL)
+ {
+ unsigned long r_symndx;
+
+#ifdef BFD64
+ if (ptr_size == 8)
+ r_symndx = ELF64_R_SYM (cookie->rel->r_info);
+ else
+#endif
+ r_symndx = ELF32_R_SYM (cookie->rel->r_info);
+ if (r_symndx >= cookie->locsymcount)
+ {
+ struct elf_link_hash_entry *h;
+
+ r_symndx -= cookie->extsymoff;
+ h = cookie->sym_hashes[r_symndx];
+
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *)
+ h->root.u.i.link;
+
+ cie.personality = h;
+ }
+ cookie->rel++;
+ }
+ buf += per_width;
+ }
+ break;
+ default:
+ /* Unrecognized augmentation. Better bail out. */
+ goto free_no_table;
+ }
+ }
+
+ /* For shared libraries, try to get rid of as many RELATIVE relocs
+ as possible.
+ FIXME: For this to work, ELF backends need to perform the
+ relocation if omitting dynamic relocs, not skip it. */
+ if (0
+ && info->shared
+ && (cie.fde_encoding & 0xf0) == DW_EH_PE_absptr)
+ cie.make_relative = 1;
+
+ if (0
+ && info->shared
+ && (cie.lsda_encoding & 0xf0) == DW_EH_PE_absptr)
+ cie.make_lsda_relative = 1;
+
+ /* If FDE encoding was not specified, it defaults to
+ DW_EH_absptr. */
+ if (cie.fde_encoding == DW_EH_PE_omit)
+ cie.fde_encoding = DW_EH_PE_absptr;
+
+ initial_insn_length = cie.hdr.length - (buf - last_fde - 4);
+ if (initial_insn_length <= 50)
+ {
+ cie.initial_insn_length = initial_insn_length;
+ memcpy (cie.initial_instructions, buf, initial_insn_length);
+ }
+ buf += initial_insn_length;
+ ENSURE_NO_RELOCS (buf);
+ last_cie = last_fde;
+ }
+ else
+ {
+ /* Ensure this FDE uses the last CIE encountered. */
+ if (last_cie == NULL
+ || hdr.id != (unsigned int) (buf - 4 - last_cie))
+ goto free_no_table;
+
+ ENSURE_NO_RELOCS (buf);
+ rel = GET_RELOC (buf);
+ if (rel == NULL)
+ /* This should not happen. */
+ goto free_no_table;
+ if ((*reloc_symbol_deleted_p) (buf - ehbuf, cookie))
+ {
+ cookie->rel = rel;
+ /* This is a FDE against discarded section, it should
+ be deleted. */
+ new_size -= hdr.length + 4;
+ sec_info->entry[sec_info->count].removed = 1;
+ }
+ else
+ {
+ cie_usage_count++;
+ hdr_info->fde_count++;
+ }
+ cookie->rel = rel;
+ if (cie.lsda_encoding != DW_EH_PE_omit)
+ {
+ unsigned int dummy;
+
+ aug = buf;
+ buf += 2 * get_DW_EH_PE_width (cie.fde_encoding, ptr_size);
+ if (cie.augmentation[0] == 'z')
+ read_uleb128 (dummy, buf);
+ /* If some new augmentation data is added before LSDA
+ in FDE augmentation area, this need to be adjusted. */
+ sec_info->entry[sec_info->count].lsda_offset = (buf - aug);
+ }
+ buf = last_fde + 4 + hdr.length;
+ SKIP_RELOCS (buf);
+ }
+
+ sec_info->entry[sec_info->count].fde_encoding = cie.fde_encoding;
+ sec_info->entry[sec_info->count].lsda_encoding = cie.lsda_encoding;
+ sec_info->count++;
+ }
+
+ elf_section_data (sec)->sec_info = sec_info;
+ elf_section_data (sec)->sec_info_type = ELF_INFO_TYPE_EH_FRAME;
+
+ /* Ok, now we can assign new offsets. */
+ offset = 0;
+ last_cie_ndx = 0;
+ for (i = 0; i < sec_info->count; i++)
+ {
+ if (! sec_info->entry[i].removed)
+ {
+ sec_info->entry[i].new_offset = offset;
+ offset += sec_info->entry[i].size;
+ if (sec_info->entry[i].cie)
+ {
+ last_cie_ndx = i;
+ make_relative = sec_info->entry[i].make_relative;
+ make_lsda_relative = sec_info->entry[i].make_lsda_relative;
+ }
+ else
+ {
+ sec_info->entry[i].make_relative = make_relative;
+ sec_info->entry[i].make_lsda_relative = make_lsda_relative;
+ }
+ }
+ else if (sec_info->entry[i].cie && sec_info->entry[i].sec == sec)
+ {
+ /* Need to adjust new_offset too. */
+ BFD_ASSERT (sec_info->entry[last_cie_ndx].offset
+ == sec_info->entry[i].new_offset);
+ sec_info->entry[i].new_offset
+ = sec_info->entry[last_cie_ndx].new_offset;
+ }
+ }
+ if (hdr_info->last_cie_sec == sec)
+ {
+ BFD_ASSERT (sec_info->entry[last_cie_ndx].offset
+ == hdr_info->last_cie_offset);
+ hdr_info->last_cie_offset = sec_info->entry[last_cie_ndx].new_offset;
+ }
+
+ /* FIXME: Currently it is not possible to shrink sections to zero size at
+ this point, so build a fake minimal CIE. */
+ if (new_size == 0)
+ new_size = 16;
+
+ /* Shrink the sec as needed. */
+ sec->_cooked_size = new_size;
+ if (sec->_cooked_size == 0)
+ sec->flags |= SEC_EXCLUDE;
+
+ free (ehbuf);
+ return new_size != sec->_raw_size;
+
+free_no_table:
+ if (ehbuf)
+ free (ehbuf);
+ if (sec_info)
+ free (sec_info);
+ hdr_info->table = false;
+ hdr_info->last_cie.hdr.length = 0;
+ return false;
+}
+
+/* This function is called for .eh_frame_hdr section after
+ _bfd_elf_discard_section_eh_frame has been called on all .eh_frame
+ input sections. It finalizes the size of .eh_frame_hdr section. */
+
+boolean
+_bfd_elf_discard_section_eh_frame_hdr (abfd, info, sec)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ asection *sec;
+{
+ struct eh_frame_hdr_info *hdr_info;
+ unsigned int ptr_size;
+
+ ptr_size = (elf_elfheader (abfd)->e_ident[EI_CLASS]
+ == ELFCLASS64) ? 8 : 4;
+
+ if ((elf_section_data (sec)->sec_info_type
+ != ELF_INFO_TYPE_EH_FRAME_HDR)
+ || ! info->eh_frame_hdr)
+ {
+ _bfd_strip_section_from_output (info, sec);
+ return false;
+ }
+
+ hdr_info = (struct eh_frame_hdr_info *)
+ elf_section_data (sec)->sec_info;
+ if (hdr_info->strip)
+ return false;
+ sec->_cooked_size = EH_FRAME_HDR_SIZE;
+ if (hdr_info->table)
+ sec->_cooked_size += 4 + hdr_info->fde_count * 8;
+
+ /* Request program headers to be recalculated. */
+ elf_tdata (abfd)->program_header_size = 0;
+ elf_tdata (abfd)->eh_frame_hdr = true;
+ return true;
+}
+
+/* This function is called from size_dynamic_sections.
+ It needs to decide whether .eh_frame_hdr should be output or not,
+ because later on it is too late for calling _bfd_strip_section_from_output,
+ since dynamic symbol table has been sized. */
+
+boolean
+_bfd_elf_maybe_strip_eh_frame_hdr (info)
+ struct bfd_link_info *info;
+{
+ asection *sec, *o;
+ bfd *abfd;
+ struct eh_frame_hdr_info *hdr_info;
+
+ sec = bfd_get_section_by_name (elf_hash_table (info)->dynobj, ".eh_frame_hdr");
+ if (sec == NULL)
+ return true;
+
+ hdr_info
+ = bfd_zmalloc (sizeof (struct eh_frame_hdr_info));
+ if (hdr_info == NULL)
+ return false;
+
+ elf_section_data (sec)->sec_info = hdr_info;
+ elf_section_data (sec)->sec_info_type = ELF_INFO_TYPE_EH_FRAME_HDR;
+
+ abfd = NULL;
+ if (info->eh_frame_hdr)
+ for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next)
+ {
+ /* Count only sections which have at least a single CIE or FDE.
+ There cannot be any CIE or FDE <= 8 bytes. */
+ o = bfd_get_section_by_name (abfd, ".eh_frame");
+ if (o && o->_raw_size > 8)
+ break;
+ }
+
+ if (abfd == NULL)
+ {
+ _bfd_strip_section_from_output (info, sec);
+ hdr_info->strip = true;
+ }
+ else
+ hdr_info->table = true;
+ return true;
+}
+
+/* Adjust an address in the .eh_frame section. Given OFFSET within
+ SEC, this returns the new offset in the adjusted .eh_frame section,
+ or -1 if the address refers to a CIE/FDE which has been removed
+ or to offset with dynamic relocation which is no longer needed. */
+
+bfd_vma
+_bfd_elf_eh_frame_section_offset (output_bfd, sec, offset)
+ bfd *output_bfd ATTRIBUTE_UNUSED;
+ asection *sec;
+ bfd_vma offset;
+{
+ struct eh_frame_sec_info *sec_info;
+ unsigned int lo, hi, mid;
+
+ if (elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
+ return offset;
+ sec_info = (struct eh_frame_sec_info *)
+ elf_section_data (sec)->sec_info;
+
+ if (offset >= sec->_raw_size)
+ return offset - (sec->_cooked_size - sec->_raw_size);
+
+ lo = 0;
+ hi = sec_info->count;
+ mid = 0;
+ while (lo < hi)
+ {
+ mid = (lo + hi) / 2;
+ if (offset < sec_info->entry[mid].offset)
+ hi = mid;
+ else if (offset
+ >= sec_info->entry[mid].offset + sec_info->entry[mid].size)
+ lo = mid + 1;
+ else
+ break;
+ }
+
+ BFD_ASSERT (lo < hi);
+
+ /* FDE or CIE was removed. */
+ if (sec_info->entry[mid].removed)
+ return (bfd_vma) -1;
+
+ /* If converting to DW_EH_PE_pcrel, there will be no need for run-time
+ relocation against FDE's initial_location field. */
+ if (sec_info->entry[mid].make_relative
+ && ! sec_info->entry[mid].cie
+ && offset == sec_info->entry[mid].offset + 8)
+ return (bfd_vma) -1;
+
+ /* If converting LSDA pointers to DW_EH_PE_pcrel, there will be no need
+ for run-time relocation against LSDA field. */
+ if (sec_info->entry[mid].make_lsda_relative
+ && ! sec_info->entry[mid].cie
+ && (offset
+ == (sec_info->entry[mid].offset + 8
+ + sec_info->entry[mid].lsda_offset)))
+ return (bfd_vma) -1;
+
+ return (offset + sec_info->entry[mid].new_offset
+ - sec_info->entry[mid].offset);
+}
+
+/* Write out .eh_frame section. This is called with the relocated
+ contents. */
+
+boolean
+_bfd_elf_write_section_eh_frame (abfd, sec, ehdrsec, contents)
+ bfd *abfd;
+ asection *sec, *ehdrsec;
+ bfd_byte *contents;
+{
+ struct eh_frame_sec_info *sec_info;
+ struct eh_frame_hdr_info *hdr_info;
+ unsigned int i;
+ bfd_byte *p, *buf;
+ unsigned int leb128_tmp;
+ unsigned int cie_offset = 0;
+ unsigned int ptr_size;
+
+ ptr_size = (elf_elfheader (sec->owner)->e_ident[EI_CLASS]
+ == ELFCLASS64) ? 8 : 4;
+
+ if (elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
+ return bfd_set_section_contents (abfd, sec->output_section,
+ contents,
+ (file_ptr) sec->output_offset,
+ sec->_raw_size);
+ sec_info = (struct eh_frame_sec_info *)
+ elf_section_data (sec)->sec_info;
+ hdr_info = NULL;
+ if (ehdrsec
+ && (elf_section_data (ehdrsec)->sec_info_type
+ == ELF_INFO_TYPE_EH_FRAME_HDR))
+ {
+ hdr_info = (struct eh_frame_hdr_info *)
+ elf_section_data (ehdrsec)->sec_info;
+ if (hdr_info->table && hdr_info->array == NULL)
+ hdr_info->array
+ = bfd_malloc (hdr_info->fde_count * sizeof(*hdr_info->array));
+ if (hdr_info->array == NULL)
+ hdr_info = NULL;
+ }
+
+ p = contents;
+ for (i = 0; i < sec_info->count; ++i)
+ {
+ if (sec_info->entry[i].removed)
+ {
+ if (sec_info->entry[i].cie)
+ {
+ /* If CIE is removed due to no remaining FDEs referencing it
+ and there were no CIEs kept before it, sec_info->entry[i].sec
+ will be zero. */
+ if (sec_info->entry[i].sec == NULL)
+ cie_offset = 0;
+ else
+ {
+ cie_offset = sec_info->entry[i].new_offset;
+ cie_offset += (sec_info->entry[i].sec->output_section->vma
+ + sec_info->entry[i].sec->output_offset
+ - sec->output_section->vma
+ - sec->output_offset);
+ }
+ }
+ continue;
+ }
+
+ if (sec_info->entry[i].cie)
+ {
+ /* CIE */
+ cie_offset = sec_info->entry[i].new_offset;
+ if (sec_info->entry[i].make_relative
+ || sec_info->entry[i].make_lsda_relative)
+ {
+ unsigned char *aug;
+ unsigned int action;
+ unsigned int dummy, per_width, per_encoding;
+
+ /* Need to find 'R' or 'L' augmentation's argument and modify
+ DW_EH_PE_* value. */
+ action = (sec_info->entry[i].make_relative ? 1 : 0)
+ | (sec_info->entry[i].make_lsda_relative ? 2 : 0);
+ buf = contents + sec_info->entry[i].offset;
+ /* Skip length, id and version. */
+ buf += 9;
+ aug = buf;
+ buf = strchr (buf, '\0') + 1;
+ read_uleb128 (dummy, buf);
+ read_sleb128 (dummy, buf);
+ read_uleb128 (dummy, buf);
+ if (*aug == 'z')
+ {
+ read_uleb128 (dummy, buf);
+ aug++;
+ }
+
+ while (action)
+ switch (*aug++)
+ {
+ case 'L':
+ if (action & 2)
+ {
+ BFD_ASSERT (*buf == sec_info->entry[i].lsda_encoding);
+ *buf |= DW_EH_PE_pcrel;
+ action &= ~2;
+ }
+ buf++;
+ break;
+ case 'P':
+ per_encoding = *buf++;
+ per_width = get_DW_EH_PE_width (per_encoding,
+ ptr_size);
+ BFD_ASSERT (per_width != 0);
+ if ((per_encoding & 0xf0) == DW_EH_PE_aligned)
+ buf = (contents
+ + ((buf - contents + per_width - 1)
+ & ~((bfd_size_type) per_width - 1)));
+ buf += per_width;
+ break;
+ case 'R':
+ if (action & 1)
+ {
+ BFD_ASSERT (*buf == sec_info->entry[i].fde_encoding);
+ *buf |= DW_EH_PE_pcrel;
+ action &= ~1;
+ }
+ buf++;
+ break;
+ default:
+ BFD_FAIL ();
+ }
+ }
+ }
+ else
+ {
+ /* FDE */
+ bfd_vma value = 0, address;
+ unsigned int width;
+
+ buf = contents + sec_info->entry[i].offset;
+ /* Skip length. */
+ buf += 4;
+ bfd_put_32 (abfd,
+ sec_info->entry[i].new_offset + 4 - cie_offset, buf);
+ buf += 4;
+ width = get_DW_EH_PE_width (sec_info->entry[i].fde_encoding,
+ ptr_size);
+ address = value = read_value (abfd, buf, width);
+ if (value)
+ {
+ switch (sec_info->entry[i].fde_encoding & 0xf0)
+ {
+ case DW_EH_PE_indirect:
+ case DW_EH_PE_textrel:
+ BFD_ASSERT (hdr_info == NULL);
+ break;
+ case DW_EH_PE_datarel:
+ {
+ asection *got = bfd_get_section_by_name (abfd, ".got");
+
+ BFD_ASSERT (got != NULL);
+ address += got->vma;
+ }
+ break;
+ case DW_EH_PE_pcrel:
+ value += (sec_info->entry[i].offset
+ - sec_info->entry[i].new_offset);
+ address += (sec->output_section->vma + sec->output_offset
+ + sec_info->entry[i].offset + 8);
+ break;
+ }
+ if (sec_info->entry[i].make_relative)
+ value -= (sec->output_section->vma + sec->output_offset
+ + sec_info->entry[i].new_offset + 8);
+ write_value (abfd, buf, value, width);
+ }
+
+ if (hdr_info)
+ {
+ hdr_info->array[hdr_info->array_count].initial_loc = address;
+ hdr_info->array[hdr_info->array_count++].fde
+ = (sec->output_section->vma + sec->output_offset
+ + sec_info->entry[i].new_offset);
+ }
+
+ if ((sec_info->entry[i].lsda_encoding & 0xf0) == DW_EH_PE_pcrel
+ || sec_info->entry[i].make_lsda_relative)
+ {
+ buf += sec_info->entry[i].lsda_offset;
+ width = get_DW_EH_PE_width (sec_info->entry[i].lsda_encoding,
+ ptr_size);
+ value = read_value (abfd, buf, width);
+ if (value)
+ {
+ if ((sec_info->entry[i].lsda_encoding & 0xf0)
+ == DW_EH_PE_pcrel)
+ value += (sec_info->entry[i].offset
+ - sec_info->entry[i].new_offset);
+ else if (sec_info->entry[i].make_lsda_relative)
+ value -= (sec->output_section->vma + sec->output_offset
+ + sec_info->entry[i].new_offset + 8
+ + sec_info->entry[i].lsda_offset);
+ write_value (abfd, buf, value, width);
+ }
+ }
+ }
+
+ BFD_ASSERT (p == contents + sec_info->entry[i].new_offset);
+ memmove (p, contents + sec_info->entry[i].offset,
+ sec_info->entry[i].size);
+ p += sec_info->entry[i].size;
+ }
+
+ /* FIXME: Once _bfd_elf_discard_section_eh_frame will be able to
+ shrink sections to zero size, this won't be needed any more. */
+ if (p == contents && sec->_cooked_size == 16)
+ {
+ bfd_put_32 (abfd, 12, p); /* Fake CIE length */
+ bfd_put_32 (abfd, 0, p + 4); /* Fake CIE id */
+ p[8] = 1; /* Fake CIE version */
+ memset (p + 9, 0, 7); /* Fake CIE augmentation, 3xleb128
+ and 3xDW_CFA_nop as pad */
+ p += 16;
+ }
+
+ BFD_ASSERT ((bfd_size_type) (p - contents) == sec->_cooked_size);
+
+ return bfd_set_section_contents (abfd, sec->output_section,
+ contents, (file_ptr) sec->output_offset,
+ sec->_cooked_size);
+}
+
+/* Helper function used to sort .eh_frame_hdr search table by increasing
+ VMA of FDE initial location. */
+
+static int
+vma_compare (a, b)
+ const PTR a;
+ const PTR b;
+{
+ struct eh_frame_array_ent *p = (struct eh_frame_array_ent *) a;
+ struct eh_frame_array_ent *q = (struct eh_frame_array_ent *) b;
+ if (p->initial_loc > q->initial_loc)
+ return 1;
+ if (p->initial_loc < q->initial_loc)
+ return -1;
+ return 0;
+}
+
+/* Write out .eh_frame_hdr section. This must be called after
+ _bfd_elf_write_section_eh_frame has been called on all input
+ .eh_frame sections.
+ .eh_frame_hdr format:
+ ubyte version (currently 1)
+ ubyte eh_frame_ptr_enc (DW_EH_PE_* encoding of pointer to start of
+ .eh_frame section)
+ ubyte fde_count_enc (DW_EH_PE_* encoding of total FDE count
+ number (or DW_EH_PE_omit if there is no
+ binary search table computed))
+ ubyte table_enc (DW_EH_PE_* encoding of binary search table,
+ or DW_EH_PE_omit if not present.
+ DW_EH_PE_datarel is using address of
+ .eh_frame_hdr section start as base)
+ [encoded] eh_frame_ptr (pointer to start of .eh_frame section)
+ optionally followed by:
+ [encoded] fde_count (total number of FDEs in .eh_frame section)
+ fde_count x [encoded] initial_loc, fde
+ (array of encoded pairs containing
+ FDE initial_location field and FDE address,
+ sorted by increasing initial_loc) */
+
+boolean
+_bfd_elf_write_section_eh_frame_hdr (abfd, sec)
+ bfd *abfd;
+ asection *sec;
+{
+ struct eh_frame_hdr_info *hdr_info;
+ unsigned int ptr_size;
+ bfd_byte *contents;
+ asection *eh_frame_sec;
+ bfd_size_type size;
+
+ ptr_size = (elf_elfheader (sec->owner)->e_ident[EI_CLASS]
+ == ELFCLASS64) ? 8 : 4;
+
+ BFD_ASSERT (elf_section_data (sec)->sec_info_type
+ == ELF_INFO_TYPE_EH_FRAME_HDR);
+ hdr_info = (struct eh_frame_hdr_info *)
+ elf_section_data (sec)->sec_info;
+ if (hdr_info->strip)
+ return true;
+
+ size = EH_FRAME_HDR_SIZE;
+ if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
+ size += 4 + hdr_info->fde_count * 8;
+ contents = bfd_malloc (size);
+ if (contents == NULL)
+ return false;
+
+ eh_frame_sec = bfd_get_section_by_name (abfd, ".eh_frame");
+ if (eh_frame_sec == NULL)
+ return false;
+
+ memset (contents, 0, EH_FRAME_HDR_SIZE);
+ contents[0] = 1; /* Version */
+ contents[1] = DW_EH_PE_pcrel | DW_EH_PE_sdata4; /* .eh_frame offset */
+ if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
+ {
+ contents[2] = DW_EH_PE_udata4; /* FDE count encoding */
+ contents[3] = DW_EH_PE_datarel | DW_EH_PE_sdata4; /* search table enc */
+ }
+ else
+ {
+ contents[2] = DW_EH_PE_omit;
+ contents[3] = DW_EH_PE_omit;
+ }
+ bfd_put_32 (abfd, eh_frame_sec->vma - sec->output_section->vma - 4,
+ contents + 4);
+ if (contents[2] != DW_EH_PE_omit)
+ {
+ unsigned int i;
+
+ bfd_put_32 (abfd, hdr_info->fde_count, contents + EH_FRAME_HDR_SIZE);
+ qsort (hdr_info->array, hdr_info->fde_count, sizeof (*hdr_info->array),
+ vma_compare);
+ for (i = 0; i < hdr_info->fde_count; i++)
+ {
+ bfd_put_32 (abfd,
+ hdr_info->array[i].initial_loc
+ - sec->output_section->vma,
+ contents + EH_FRAME_HDR_SIZE + i * 8 + 4);
+ bfd_put_32 (abfd,
+ hdr_info->array[i].fde - sec->output_section->vma,
+ contents + EH_FRAME_HDR_SIZE + i * 8 + 8);
+ }
+ }
+
+ return bfd_set_section_contents (abfd, sec->output_section,
+ contents, (file_ptr) sec->output_offset,
+ sec->_cooked_size);
+}
diff --git a/contrib/binutils/bfd/elf-strtab.c b/contrib/binutils/bfd/elf-strtab.c
new file mode 100644
index 0000000..ff7d9a4
--- /dev/null
+++ b/contrib/binutils/bfd/elf-strtab.c
@@ -0,0 +1,449 @@
+/* ELF strtab with GC and suffix merging support.
+ Copyright 2001 Free Software Foundation, Inc.
+ Written by Jakub Jelinek <jakub@redhat.com>.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "hashtab.h"
+
+/* An entry in the strtab hash table. */
+
+struct elf_strtab_hash_entry
+{
+ struct bfd_hash_entry root;
+ /* Length of this entry. */
+ unsigned int len;
+ unsigned int refcount;
+ union {
+ /* Index within the merged section. */
+ bfd_size_type index;
+ /* Entry this is a suffix of (if len is 0). */
+ struct elf_strtab_hash_entry *suffix;
+ struct elf_strtab_hash_entry *next;
+ } u;
+};
+
+/* The strtab hash table. */
+
+struct elf_strtab_hash
+{
+ struct bfd_hash_table table;
+ /* Next available index. */
+ bfd_size_type size;
+ /* Number of array entries alloced. */
+ bfd_size_type alloced;
+ /* Final strtab size. */
+ bfd_size_type sec_size;
+ /* Array of pointers to strtab entries. */
+ struct elf_strtab_hash_entry **array;
+};
+
+static struct bfd_hash_entry *elf_strtab_hash_newfunc
+ PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+static int cmplengthentry PARAMS ((const PTR, const PTR));
+static int last4_eq PARAMS ((const PTR, const PTR));
+
+/* Routine to create an entry in a section merge hashtab. */
+
+static struct bfd_hash_entry *
+elf_strtab_hash_newfunc (entry, table, string)
+ struct bfd_hash_entry *entry;
+ struct bfd_hash_table *table;
+ const char *string;
+{
+ struct elf_strtab_hash_entry *ret = (struct elf_strtab_hash_entry *) entry;
+
+ /* Allocate the structure if it has not already been allocated by a
+ subclass. */
+ if (ret == (struct elf_strtab_hash_entry *) NULL)
+ ret = ((struct elf_strtab_hash_entry *)
+ bfd_hash_allocate (table, sizeof (struct elf_strtab_hash_entry)));
+ if (ret == (struct elf_strtab_hash_entry *) NULL)
+ return NULL;
+
+ /* Call the allocation method of the superclass. */
+ ret = ((struct elf_strtab_hash_entry *)
+ bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
+
+ if (ret)
+ {
+ /* Initialize the local fields. */
+ ret->u.index = -1;
+ ret->refcount = 0;
+ ret->len = 0;
+ }
+
+ return (struct bfd_hash_entry *)ret;
+}
+
+/* Create a new hash table. */
+
+struct elf_strtab_hash *
+_bfd_elf_strtab_init ()
+{
+ struct elf_strtab_hash *table;
+ bfd_size_type amt = sizeof (struct elf_strtab_hash);
+
+ table = (struct elf_strtab_hash *) bfd_malloc (amt);
+ if (table == NULL)
+ return NULL;
+
+ if (! bfd_hash_table_init (&table->table, elf_strtab_hash_newfunc))
+ {
+ free (table);
+ return NULL;
+ }
+
+ table->sec_size = 0;
+ table->size = 1;
+ table->alloced = 64;
+ amt = sizeof (struct elf_strtab_hasn_entry *);
+ table->array = (struct elf_strtab_hash_entry **)
+ bfd_malloc (table->alloced * amt);
+ if (table->array == NULL)
+ {
+ free (table);
+ return NULL;
+ }
+
+ table->array[0] = NULL;
+
+ return table;
+}
+
+/* Free a strtab. */
+
+void
+_bfd_elf_strtab_free (tab)
+ struct elf_strtab_hash *tab;
+{
+ bfd_hash_table_free (&tab->table);
+ free (tab->array);
+ free (tab);
+}
+
+/* Get the index of an entity in a hash table, adding it if it is not
+ already present. */
+
+bfd_size_type
+_bfd_elf_strtab_add (tab, str, copy)
+ struct elf_strtab_hash *tab;
+ const char *str;
+ boolean copy;
+{
+ register struct elf_strtab_hash_entry *entry;
+
+ /* We handle this specially, since we don't want to do refcounting
+ on it. */
+ if (*str == '\0')
+ return 0;
+
+ BFD_ASSERT (tab->sec_size == 0);
+ entry = (struct elf_strtab_hash_entry *)
+ bfd_hash_lookup (&tab->table, str, true, copy);
+
+ if (entry == NULL)
+ return (bfd_size_type) -1;
+
+ entry->refcount++;
+ if (entry->len == 0)
+ {
+ entry->len = strlen (str) + 1;
+ if (tab->size == tab->alloced)
+ {
+ bfd_size_type amt = sizeof (struct elf_strtab_hash_entry *);
+ tab->alloced *= 2;
+ tab->array = (struct elf_strtab_hash_entry **)
+ bfd_realloc (tab->array, tab->alloced * amt);
+ if (tab->array == NULL)
+ return (bfd_size_type) -1;
+ }
+
+ entry->u.index = tab->size++;
+ tab->array[entry->u.index] = entry;
+ }
+ return entry->u.index;
+}
+
+void
+_bfd_elf_strtab_addref (tab, idx)
+ struct elf_strtab_hash *tab;
+ bfd_size_type idx;
+{
+ if (idx == 0 || idx == (bfd_size_type) -1)
+ return;
+ BFD_ASSERT (tab->sec_size == 0);
+ BFD_ASSERT (idx < tab->size);
+ ++tab->array[idx]->refcount;
+}
+
+void
+_bfd_elf_strtab_delref (tab, idx)
+ struct elf_strtab_hash *tab;
+ bfd_size_type idx;
+{
+ if (idx == 0 || idx == (bfd_size_type) -1)
+ return;
+ BFD_ASSERT (tab->sec_size == 0);
+ BFD_ASSERT (idx < tab->size);
+ BFD_ASSERT (tab->array[idx]->refcount > 0);
+ --tab->array[idx]->refcount;
+}
+
+void
+_bfd_elf_strtab_clear_all_refs (tab)
+ struct elf_strtab_hash *tab;
+{
+ bfd_size_type idx;
+
+ for (idx = 1; idx < tab->size; ++idx)
+ tab->array[idx]->refcount = 0;
+}
+
+bfd_size_type
+_bfd_elf_strtab_size (tab)
+ struct elf_strtab_hash *tab;
+{
+ return tab->sec_size ? tab->sec_size : tab->size;
+}
+
+bfd_size_type
+_bfd_elf_strtab_offset (tab, idx)
+ struct elf_strtab_hash *tab;
+ bfd_size_type idx;
+{
+ struct elf_strtab_hash_entry *entry;
+
+ if (idx == 0)
+ return 0;
+ BFD_ASSERT (idx < tab->size);
+ BFD_ASSERT (tab->sec_size);
+ entry = tab->array[idx];
+ BFD_ASSERT (entry->refcount > 0);
+ entry->refcount--;
+ return tab->array[idx]->u.index;
+}
+
+boolean
+_bfd_elf_strtab_emit (abfd, tab)
+ register bfd *abfd;
+ struct elf_strtab_hash *tab;
+{
+ bfd_size_type off = 1, i;
+
+ if (bfd_bwrite ("", 1, abfd) != 1)
+ return false;
+
+ for (i = 1; i < tab->size; ++i)
+ {
+ register const char *str;
+ register size_t len;
+
+ str = tab->array[i]->root.string;
+ len = tab->array[i]->len;
+ BFD_ASSERT (tab->array[i]->refcount == 0);
+ if (len == 0)
+ continue;
+
+ if (bfd_bwrite ((PTR) str, (bfd_size_type) len, abfd) != len)
+ return false;
+
+ off += len;
+ }
+
+ BFD_ASSERT (off == tab->sec_size);
+ return true;
+}
+
+/* Compare two elf_strtab_hash_entry structures. This is called via qsort. */
+
+static int
+cmplengthentry (a, b)
+ const PTR a;
+ const PTR b;
+{
+ struct elf_strtab_hash_entry * A = *(struct elf_strtab_hash_entry **) a;
+ struct elf_strtab_hash_entry * B = *(struct elf_strtab_hash_entry **) b;
+
+ if (A->len < B->len)
+ return 1;
+ else if (A->len > B->len)
+ return -1;
+
+ return memcmp (A->root.string, B->root.string, A->len);
+}
+
+static int
+last4_eq (a, b)
+ const PTR a;
+ const PTR b;
+{
+ struct elf_strtab_hash_entry * A = (struct elf_strtab_hash_entry *) a;
+ struct elf_strtab_hash_entry * B = (struct elf_strtab_hash_entry *) b;
+
+ if (memcmp (A->root.string + A->len - 5, B->root.string + B->len - 5, 4)
+ != 0)
+ /* This was a hashtable collision. */
+ return 0;
+
+ if (A->len <= B->len)
+ /* B cannot be a suffix of A unless A is equal to B, which is guaranteed
+ not to be equal by the hash table. */
+ return 0;
+
+ return memcmp (A->root.string + (A->len - B->len),
+ B->root.string, B->len - 5) == 0;
+}
+
+/* This function assigns final string table offsets for used strings,
+ merging strings matching suffixes of longer strings if possible. */
+
+void
+_bfd_elf_strtab_finalize (tab)
+ struct elf_strtab_hash *tab;
+{
+ struct elf_strtab_hash_entry **array, **a, **end, *e;
+ htab_t last4tab = NULL;
+ bfd_size_type size, amt;
+ struct elf_strtab_hash_entry *last[256], **last_ptr[256];
+
+ /* GCC 2.91.66 (egcs-1.1.2) on i386 miscompiles this function when i is
+ a 64-bit bfd_size_type: a 64-bit target or --enable-64-bit-bfd.
+ Besides, indexing with a long long wouldn't give anything but extra
+ cycles. */
+ size_t i;
+
+ /* Now sort the strings by length, longest first. */
+ array = NULL;
+ amt = tab->size * sizeof (struct elf_strtab_hash_entry *);
+ array = (struct elf_strtab_hash_entry **) bfd_malloc (amt);
+ if (array == NULL)
+ goto alloc_failure;
+
+ memset (last, 0, sizeof (last));
+ for (i = 0; i < 256; ++i)
+ last_ptr[i] = &last[i];
+ for (i = 1, a = array; i < tab->size; ++i)
+ if (tab->array[i]->refcount)
+ *a++ = tab->array[i];
+ else
+ tab->array[i]->len = 0;
+
+ size = a - array;
+
+ qsort (array, size, sizeof (struct elf_strtab_hash_entry *), cmplengthentry);
+
+ last4tab = htab_create (size * 4, NULL, last4_eq, NULL);
+ if (last4tab == NULL)
+ goto alloc_failure;
+
+ /* Now insert the strings into hash tables (strings with last 4 characters
+ and strings with last character equal), look for longer strings which
+ we're suffix of. */
+ for (a = array, end = array + size; a < end; a++)
+ {
+ register hashval_t hash;
+ unsigned int c;
+ unsigned int j;
+ const unsigned char *s;
+ PTR *p;
+
+ e = *a;
+ if (e->len > 4)
+ {
+ s = e->root.string + e->len - 1;
+ hash = 0;
+ for (j = 0; j < 4; j++)
+ {
+ c = *--s;
+ hash += c + (c << 17);
+ hash ^= hash >> 2;
+ }
+ p = htab_find_slot_with_hash (last4tab, e, hash, INSERT);
+ if (p == NULL)
+ goto alloc_failure;
+ if (*p)
+ {
+ struct elf_strtab_hash_entry *ent;
+
+ ent = (struct elf_strtab_hash_entry *) *p;
+ e->u.suffix = ent;
+ e->len = 0;
+ continue;
+ }
+ else
+ *p = (PTR) e;
+ }
+ else
+ {
+ struct elf_strtab_hash_entry *tem;
+
+ c = e->root.string[e->len - 2] & 0xff;
+
+ for (tem = last[c]; tem; tem = tem->u.next)
+ if (tem->len > e->len
+ && memcmp (tem->root.string + (tem->len - e->len),
+ e->root.string, e->len - 1) == 0)
+ break;
+ if (tem)
+ {
+ e->u.suffix = tem;
+ e->len = 0;
+ continue;
+ }
+ }
+
+ c = e->root.string[e->len - 2] & 0xff;
+ /* Put longest strings first. */
+ *last_ptr[c] = e;
+ last_ptr[c] = &e->u.next;
+ e->u.next = NULL;
+ }
+
+alloc_failure:
+ if (array)
+ free (array);
+ if (last4tab)
+ htab_delete (last4tab);
+
+ /* Now assign positions to the strings we want to keep. */
+ size = 1;
+ for (i = 1; i < tab->size; ++i)
+ {
+ e = tab->array[i];
+ if (e->refcount && e->len)
+ {
+ e->u.index = size;
+ size += e->len;
+ }
+ }
+
+ tab->sec_size = size;
+
+ /* And now adjust the rest. */
+ for (i = 1; i < tab->size; ++i)
+ {
+ e = tab->array[i];
+ if (e->refcount && ! e->len)
+ e->u.index = e->u.suffix->u.index
+ + (e->u.suffix->len - strlen (e->root.string) - 1);
+ }
+}
diff --git a/contrib/binutils/bfd/elf.c b/contrib/binutils/bfd/elf.c
index f98b49c..29c08d7 100644
--- a/contrib/binutils/bfd/elf.c
+++ b/contrib/binutils/bfd/elf.c
@@ -1,5 +1,5 @@
/* ELF executable support for BFD.
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -40,6 +40,7 @@ SECTION
#include "libbfd.h"
#define ARCH_SIZE 0
#include "elf-bfd.h"
+#include "libiberty.h"
static INLINE struct elf_segment_map *make_mapping
PARAMS ((bfd *, asection **, unsigned int, unsigned int, boolean));
@@ -50,17 +51,31 @@ static boolean assign_file_positions_except_relocs PARAMS ((bfd *));
static boolean prep_headers PARAMS ((bfd *));
static boolean swap_out_syms PARAMS ((bfd *, struct bfd_strtab_hash **, int));
static boolean copy_private_bfd_data PARAMS ((bfd *, bfd *));
-static char *elf_read PARAMS ((bfd *, long, unsigned int));
+static char *elf_read PARAMS ((bfd *, file_ptr, bfd_size_type));
+static boolean setup_group PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
+static void merge_sections_remove_hook PARAMS ((bfd *, asection *));
static void elf_fake_sections PARAMS ((bfd *, asection *, PTR));
+static void set_group_contents PARAMS ((bfd *, asection *, PTR));
static boolean assign_section_numbers PARAMS ((bfd *));
static INLINE int sym_is_global PARAMS ((bfd *, asymbol *));
static boolean elf_map_symbols PARAMS ((bfd *));
static bfd_size_type get_program_header_size PARAMS ((bfd *));
-static boolean elfcore_read_notes PARAMS ((bfd *, bfd_vma, bfd_vma));
-static boolean elf_find_function PARAMS ((bfd *, asection *,
- asymbol **,
- bfd_vma, const char **,
- const char **));
+static boolean elfcore_read_notes PARAMS ((bfd *, file_ptr, bfd_size_type));
+static boolean elf_find_function PARAMS ((bfd *, asection *, asymbol **,
+ bfd_vma, const char **,
+ const char **));
+static int elfcore_make_pid PARAMS ((bfd *));
+static boolean elfcore_maybe_make_sect PARAMS ((bfd *, char *, asection *));
+static boolean elfcore_make_note_pseudosection PARAMS ((bfd *, char *,
+ Elf_Internal_Note *));
+static boolean elfcore_grok_prfpreg PARAMS ((bfd *, Elf_Internal_Note *));
+static boolean elfcore_grok_prxfpreg PARAMS ((bfd *, Elf_Internal_Note *));
+static boolean elfcore_grok_note PARAMS ((bfd *, Elf_Internal_Note *));
+
+static boolean elfcore_netbsd_get_lwpid PARAMS ((Elf_Internal_Note *, int *));
+static boolean elfcore_grok_netbsd_procinfo PARAMS ((bfd *,
+ Elf_Internal_Note *));
+static boolean elfcore_grok_netbsd_note PARAMS ((bfd *, Elf_Internal_Note *));
/* Swap version information in and out. The version information is
currently size independent. If that ever changes, this code will
@@ -74,13 +89,13 @@ _bfd_elf_swap_verdef_in (abfd, src, dst)
const Elf_External_Verdef *src;
Elf_Internal_Verdef *dst;
{
- dst->vd_version = bfd_h_get_16 (abfd, src->vd_version);
- dst->vd_flags = bfd_h_get_16 (abfd, src->vd_flags);
- dst->vd_ndx = bfd_h_get_16 (abfd, src->vd_ndx);
- dst->vd_cnt = bfd_h_get_16 (abfd, src->vd_cnt);
- dst->vd_hash = bfd_h_get_32 (abfd, src->vd_hash);
- dst->vd_aux = bfd_h_get_32 (abfd, src->vd_aux);
- dst->vd_next = bfd_h_get_32 (abfd, src->vd_next);
+ dst->vd_version = H_GET_16 (abfd, src->vd_version);
+ dst->vd_flags = H_GET_16 (abfd, src->vd_flags);
+ dst->vd_ndx = H_GET_16 (abfd, src->vd_ndx);
+ dst->vd_cnt = H_GET_16 (abfd, src->vd_cnt);
+ dst->vd_hash = H_GET_32 (abfd, src->vd_hash);
+ dst->vd_aux = H_GET_32 (abfd, src->vd_aux);
+ dst->vd_next = H_GET_32 (abfd, src->vd_next);
}
/* Swap out a Verdef structure. */
@@ -91,13 +106,13 @@ _bfd_elf_swap_verdef_out (abfd, src, dst)
const Elf_Internal_Verdef *src;
Elf_External_Verdef *dst;
{
- bfd_h_put_16 (abfd, src->vd_version, dst->vd_version);
- bfd_h_put_16 (abfd, src->vd_flags, dst->vd_flags);
- bfd_h_put_16 (abfd, src->vd_ndx, dst->vd_ndx);
- bfd_h_put_16 (abfd, src->vd_cnt, dst->vd_cnt);
- bfd_h_put_32 (abfd, src->vd_hash, dst->vd_hash);
- bfd_h_put_32 (abfd, src->vd_aux, dst->vd_aux);
- bfd_h_put_32 (abfd, src->vd_next, dst->vd_next);
+ H_PUT_16 (abfd, src->vd_version, dst->vd_version);
+ H_PUT_16 (abfd, src->vd_flags, dst->vd_flags);
+ H_PUT_16 (abfd, src->vd_ndx, dst->vd_ndx);
+ H_PUT_16 (abfd, src->vd_cnt, dst->vd_cnt);
+ H_PUT_32 (abfd, src->vd_hash, dst->vd_hash);
+ H_PUT_32 (abfd, src->vd_aux, dst->vd_aux);
+ H_PUT_32 (abfd, src->vd_next, dst->vd_next);
}
/* Swap in a Verdaux structure. */
@@ -108,8 +123,8 @@ _bfd_elf_swap_verdaux_in (abfd, src, dst)
const Elf_External_Verdaux *src;
Elf_Internal_Verdaux *dst;
{
- dst->vda_name = bfd_h_get_32 (abfd, src->vda_name);
- dst->vda_next = bfd_h_get_32 (abfd, src->vda_next);
+ dst->vda_name = H_GET_32 (abfd, src->vda_name);
+ dst->vda_next = H_GET_32 (abfd, src->vda_next);
}
/* Swap out a Verdaux structure. */
@@ -120,8 +135,8 @@ _bfd_elf_swap_verdaux_out (abfd, src, dst)
const Elf_Internal_Verdaux *src;
Elf_External_Verdaux *dst;
{
- bfd_h_put_32 (abfd, src->vda_name, dst->vda_name);
- bfd_h_put_32 (abfd, src->vda_next, dst->vda_next);
+ H_PUT_32 (abfd, src->vda_name, dst->vda_name);
+ H_PUT_32 (abfd, src->vda_next, dst->vda_next);
}
/* Swap in a Verneed structure. */
@@ -132,11 +147,11 @@ _bfd_elf_swap_verneed_in (abfd, src, dst)
const Elf_External_Verneed *src;
Elf_Internal_Verneed *dst;
{
- dst->vn_version = bfd_h_get_16 (abfd, src->vn_version);
- dst->vn_cnt = bfd_h_get_16 (abfd, src->vn_cnt);
- dst->vn_file = bfd_h_get_32 (abfd, src->vn_file);
- dst->vn_aux = bfd_h_get_32 (abfd, src->vn_aux);
- dst->vn_next = bfd_h_get_32 (abfd, src->vn_next);
+ dst->vn_version = H_GET_16 (abfd, src->vn_version);
+ dst->vn_cnt = H_GET_16 (abfd, src->vn_cnt);
+ dst->vn_file = H_GET_32 (abfd, src->vn_file);
+ dst->vn_aux = H_GET_32 (abfd, src->vn_aux);
+ dst->vn_next = H_GET_32 (abfd, src->vn_next);
}
/* Swap out a Verneed structure. */
@@ -147,11 +162,11 @@ _bfd_elf_swap_verneed_out (abfd, src, dst)
const Elf_Internal_Verneed *src;
Elf_External_Verneed *dst;
{
- bfd_h_put_16 (abfd, src->vn_version, dst->vn_version);
- bfd_h_put_16 (abfd, src->vn_cnt, dst->vn_cnt);
- bfd_h_put_32 (abfd, src->vn_file, dst->vn_file);
- bfd_h_put_32 (abfd, src->vn_aux, dst->vn_aux);
- bfd_h_put_32 (abfd, src->vn_next, dst->vn_next);
+ H_PUT_16 (abfd, src->vn_version, dst->vn_version);
+ H_PUT_16 (abfd, src->vn_cnt, dst->vn_cnt);
+ H_PUT_32 (abfd, src->vn_file, dst->vn_file);
+ H_PUT_32 (abfd, src->vn_aux, dst->vn_aux);
+ H_PUT_32 (abfd, src->vn_next, dst->vn_next);
}
/* Swap in a Vernaux structure. */
@@ -162,11 +177,11 @@ _bfd_elf_swap_vernaux_in (abfd, src, dst)
const Elf_External_Vernaux *src;
Elf_Internal_Vernaux *dst;
{
- dst->vna_hash = bfd_h_get_32 (abfd, src->vna_hash);
- dst->vna_flags = bfd_h_get_16 (abfd, src->vna_flags);
- dst->vna_other = bfd_h_get_16 (abfd, src->vna_other);
- dst->vna_name = bfd_h_get_32 (abfd, src->vna_name);
- dst->vna_next = bfd_h_get_32 (abfd, src->vna_next);
+ dst->vna_hash = H_GET_32 (abfd, src->vna_hash);
+ dst->vna_flags = H_GET_16 (abfd, src->vna_flags);
+ dst->vna_other = H_GET_16 (abfd, src->vna_other);
+ dst->vna_name = H_GET_32 (abfd, src->vna_name);
+ dst->vna_next = H_GET_32 (abfd, src->vna_next);
}
/* Swap out a Vernaux structure. */
@@ -177,11 +192,11 @@ _bfd_elf_swap_vernaux_out (abfd, src, dst)
const Elf_Internal_Vernaux *src;
Elf_External_Vernaux *dst;
{
- bfd_h_put_32 (abfd, src->vna_hash, dst->vna_hash);
- bfd_h_put_16 (abfd, src->vna_flags, dst->vna_flags);
- bfd_h_put_16 (abfd, src->vna_other, dst->vna_other);
- bfd_h_put_32 (abfd, src->vna_name, dst->vna_name);
- bfd_h_put_32 (abfd, src->vna_next, dst->vna_next);
+ H_PUT_32 (abfd, src->vna_hash, dst->vna_hash);
+ H_PUT_16 (abfd, src->vna_flags, dst->vna_flags);
+ H_PUT_16 (abfd, src->vna_other, dst->vna_other);
+ H_PUT_32 (abfd, src->vna_name, dst->vna_name);
+ H_PUT_32 (abfd, src->vna_next, dst->vna_next);
}
/* Swap in a Versym structure. */
@@ -192,7 +207,7 @@ _bfd_elf_swap_versym_in (abfd, src, dst)
const Elf_External_Versym *src;
Elf_Internal_Versym *dst;
{
- dst->vs_vers = bfd_h_get_16 (abfd, src->vs_vers);
+ dst->vs_vers = H_GET_16 (abfd, src->vs_vers);
}
/* Swap out a Versym structure. */
@@ -203,7 +218,7 @@ _bfd_elf_swap_versym_out (abfd, src, dst)
const Elf_Internal_Versym *src;
Elf_External_Versym *dst;
{
- bfd_h_put_16 (abfd, src->vs_vers, dst->vs_vers);
+ H_PUT_16 (abfd, src->vs_vers, dst->vs_vers);
}
/* Standard ELF hash function. Do not change this function; you will
@@ -239,16 +254,16 @@ bfd_elf_hash (namearg)
static char *
elf_read (abfd, offset, size)
bfd *abfd;
- long offset;
- unsigned int size;
+ file_ptr offset;
+ bfd_size_type size;
{
char *buf;
if ((buf = bfd_alloc (abfd, size)) == NULL)
return NULL;
- if (bfd_seek (abfd, offset, SEEK_SET) == -1)
+ if (bfd_seek (abfd, offset, SEEK_SET) != 0)
return NULL;
- if (bfd_read ((PTR) buf, size, 1, abfd) != size)
+ if (bfd_bread ((PTR) buf, size, abfd) != size)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_file_truncated);
@@ -263,8 +278,8 @@ bfd_elf_mkobject (abfd)
{
/* This just does initialization. */
/* coff_mkobject zalloc's space for tdata.coff_obj_data ... */
- elf_tdata (abfd) = (struct elf_obj_tdata *)
- bfd_zalloc (abfd, sizeof (struct elf_obj_tdata));
+ bfd_size_type amt = sizeof (struct elf_obj_tdata);
+ elf_tdata (abfd) = (struct elf_obj_tdata *) bfd_zalloc (abfd, amt);
if (elf_tdata (abfd) == 0)
return false;
/* Since everything is done at close time, do we need any
@@ -288,8 +303,8 @@ bfd_elf_get_str_section (abfd, shindex)
{
Elf_Internal_Shdr **i_shdrp;
char *shstrtab = NULL;
- unsigned int offset;
- unsigned int shstrtabsize;
+ file_ptr offset;
+ bfd_size_type shstrtabsize;
i_shdrp = elf_elfsections (abfd);
if (i_shdrp == 0 || i_shdrp[shindex] == 0)
@@ -328,7 +343,7 @@ bfd_elf_string_from_elf_section (abfd, shindex, strindex)
{
(*_bfd_error_handler)
(_("%s: invalid string offset %u >= %lu for section `%s'"),
- bfd_get_filename (abfd), strindex, (unsigned long) hdr->sh_size,
+ bfd_archive_filename (abfd), strindex, (unsigned long) hdr->sh_size,
((shindex == elf_elfheader(abfd)->e_shstrndx
&& strindex == hdr->sh_name)
? ".shstrtab"
@@ -339,6 +354,186 @@ bfd_elf_string_from_elf_section (abfd, shindex, strindex)
return ((char *) hdr->contents) + strindex;
}
+/* Elf_Internal_Shdr->contents is an array of these for SHT_GROUP
+ sections. The first element is the flags, the rest are section
+ pointers. */
+
+typedef union elf_internal_group {
+ Elf_Internal_Shdr *shdr;
+ unsigned int flags;
+} Elf_Internal_Group;
+
+/* Set next_in_group list pointer, and group name for NEWSECT. */
+
+static boolean
+setup_group (abfd, hdr, newsect)
+ bfd *abfd;
+ Elf_Internal_Shdr *hdr;
+ asection *newsect;
+{
+ unsigned int num_group = elf_tdata (abfd)->num_group;
+
+ /* If num_group is zero, read in all SHT_GROUP sections. The count
+ is set to -1 if there are no SHT_GROUP sections. */
+ if (num_group == 0)
+ {
+ unsigned int i, shnum;
+
+ /* First count the number of groups. If we have a SHT_GROUP
+ section with just a flag word (ie. sh_size is 4), ignore it. */
+ shnum = elf_numsections (abfd);
+ num_group = 0;
+ for (i = 0; i < shnum; i++)
+ {
+ Elf_Internal_Shdr *shdr = elf_elfsections (abfd)[i];
+ if (shdr->sh_type == SHT_GROUP && shdr->sh_size >= 8)
+ num_group += 1;
+ }
+
+ if (num_group == 0)
+ num_group = (unsigned) -1;
+ elf_tdata (abfd)->num_group = num_group;
+
+ if (num_group > 0)
+ {
+ /* We keep a list of elf section headers for group sections,
+ so we can find them quickly. */
+ bfd_size_type amt = num_group * sizeof (Elf_Internal_Shdr *);
+ elf_tdata (abfd)->group_sect_ptr = bfd_alloc (abfd, amt);
+ if (elf_tdata (abfd)->group_sect_ptr == NULL)
+ return false;
+
+ num_group = 0;
+ for (i = 0; i < shnum; i++)
+ {
+ Elf_Internal_Shdr *shdr = elf_elfsections (abfd)[i];
+ if (shdr->sh_type == SHT_GROUP && shdr->sh_size >= 8)
+ {
+ unsigned char *src;
+ Elf_Internal_Group *dest;
+
+ /* Add to list of sections. */
+ elf_tdata (abfd)->group_sect_ptr[num_group] = shdr;
+ num_group += 1;
+
+ /* Read the raw contents. */
+ BFD_ASSERT (sizeof (*dest) >= 4);
+ amt = shdr->sh_size * sizeof (*dest) / 4;
+ shdr->contents = bfd_alloc (abfd, amt);
+ if (shdr->contents == NULL
+ || bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0
+ || (bfd_bread (shdr->contents, shdr->sh_size, abfd)
+ != shdr->sh_size))
+ return false;
+
+ /* Translate raw contents, a flag word followed by an
+ array of elf section indices all in target byte order,
+ to the flag word followed by an array of elf section
+ pointers. */
+ src = shdr->contents + shdr->sh_size;
+ dest = (Elf_Internal_Group *) (shdr->contents + amt);
+ while (1)
+ {
+ unsigned int idx;
+
+ src -= 4;
+ --dest;
+ idx = H_GET_32 (abfd, src);
+ if (src == shdr->contents)
+ {
+ dest->flags = idx;
+ break;
+ }
+ if (idx >= shnum)
+ {
+ ((*_bfd_error_handler)
+ (_("%s: invalid SHT_GROUP entry"),
+ bfd_archive_filename (abfd)));
+ idx = 0;
+ }
+ dest->shdr = elf_elfsections (abfd)[idx];
+ }
+ }
+ }
+ }
+ }
+
+ if (num_group != (unsigned) -1)
+ {
+ unsigned int i;
+
+ for (i = 0; i < num_group; i++)
+ {
+ Elf_Internal_Shdr *shdr = elf_tdata (abfd)->group_sect_ptr[i];
+ Elf_Internal_Group *idx = (Elf_Internal_Group *) shdr->contents;
+ unsigned int n_elt = shdr->sh_size / 4;
+
+ /* Look through this group's sections to see if current
+ section is a member. */
+ while (--n_elt != 0)
+ if ((++idx)->shdr == hdr)
+ {
+ asection *s = NULL;
+
+ /* We are a member of this group. Go looking through
+ other members to see if any others are linked via
+ next_in_group. */
+ idx = (Elf_Internal_Group *) shdr->contents;
+ n_elt = shdr->sh_size / 4;
+ while (--n_elt != 0)
+ if ((s = (++idx)->shdr->bfd_section) != NULL
+ && elf_next_in_group (s) != NULL)
+ break;
+ if (n_elt != 0)
+ {
+ /* Snarf the group name from other member, and
+ insert current section in circular list. */
+ elf_group_name (newsect) = elf_group_name (s);
+ elf_next_in_group (newsect) = elf_next_in_group (s);
+ elf_next_in_group (s) = newsect;
+ }
+ else
+ {
+ struct elf_backend_data *bed;
+ file_ptr pos;
+ unsigned char ename[4];
+ unsigned long iname;
+ const char *gname;
+
+ /* Humbug. Get the name from the group signature
+ symbol. Why isn't the signature just a string?
+ Fortunately, the name index is at the same
+ place in the external symbol for both 32 and 64
+ bit ELF. */
+ bed = get_elf_backend_data (abfd);
+ pos = elf_tdata (abfd)->symtab_hdr.sh_offset;
+ pos += shdr->sh_info * bed->s->sizeof_sym;
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0
+ || bfd_bread (ename, (bfd_size_type) 4, abfd) != 4)
+ return false;
+ iname = H_GET_32 (abfd, ename);
+ gname = elf_string_from_elf_strtab (abfd, iname);
+ elf_group_name (newsect) = gname;
+
+ /* Start a circular list with one element. */
+ elf_next_in_group (newsect) = newsect;
+ }
+ if (shdr->bfd_section != NULL)
+ elf_next_in_group (shdr->bfd_section) = newsect;
+ i = num_group - 1;
+ break;
+ }
+ }
+ }
+
+ if (elf_group_name (newsect) == NULL)
+ {
+ (*_bfd_error_handler) (_("%s: no group info for section %s"),
+ bfd_archive_filename (abfd), newsect->name);
+ }
+ return true;
+}
+
/* Make a BFD section from an ELF section. We store a pointer to the
BFD section in the bfd_section field of the header. */
@@ -368,12 +563,14 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
if (! bfd_set_section_vma (abfd, newsect, hdr->sh_addr)
|| ! bfd_set_section_size (abfd, newsect, hdr->sh_size)
|| ! bfd_set_section_alignment (abfd, newsect,
- bfd_log2 (hdr->sh_addralign)))
+ bfd_log2 ((bfd_vma) hdr->sh_addralign)))
return false;
flags = SEC_NO_FLAGS;
if (hdr->sh_type != SHT_NOBITS)
flags |= SEC_HAS_CONTENTS;
+ if (hdr->sh_type == SHT_GROUP)
+ flags |= SEC_GROUP | SEC_EXCLUDE;
if ((hdr->sh_flags & SHF_ALLOC) != 0)
{
flags |= SEC_ALLOC;
@@ -386,6 +583,16 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
flags |= SEC_CODE;
else if ((flags & SEC_LOAD) != 0)
flags |= SEC_DATA;
+ if ((hdr->sh_flags & SHF_MERGE) != 0)
+ {
+ flags |= SEC_MERGE;
+ newsect->entsize = hdr->sh_entsize;
+ if ((hdr->sh_flags & SHF_STRINGS) != 0)
+ flags |= SEC_STRINGS;
+ }
+ if (hdr->sh_flags & SHF_GROUP)
+ if (!setup_group (abfd, hdr, newsect))
+ return false;
/* The debugging sections appear to be recognized only by name, not
any sort of flag. */
@@ -399,7 +606,7 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
};
int i;
- for (i = sizeof (debug_sec_names) / sizeof (debug_sec_names[0]); i--;)
+ for (i = ARRAY_SIZE (debug_sec_names); i--;)
if (strncmp (name, debug_sec_names[i], strlen (debug_sec_names[i])) == 0)
break;
@@ -443,17 +650,30 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
phdr = elf_tdata (abfd)->phdr;
for (i = 0; i < elf_elfheader (abfd)->e_phnum; i++, phdr++)
{
+ /* This section is part of this segment if its file
+ offset plus size lies within the segment's memory
+ span and, if the section is loaded, the extent of the
+ loaded data lies within the extent of the segment.
+ If the p_paddr field is not set, we don't alter the
+ LMA. */
if (phdr->p_type == PT_LOAD
- && phdr->p_vaddr != phdr->p_paddr
- && phdr->p_vaddr <= hdr->sh_addr
- && (phdr->p_vaddr + phdr->p_memsz
- >= hdr->sh_addr + hdr->sh_size)
+ && phdr->p_paddr
+ && (bfd_vma) hdr->sh_offset >= phdr->p_offset
+ && (hdr->sh_offset + hdr->sh_size
+ <= phdr->p_offset + phdr->p_memsz)
&& ((flags & SEC_LOAD) == 0
- || (phdr->p_offset <= (bfd_vma) hdr->sh_offset
- && (phdr->p_offset + phdr->p_filesz
- >= hdr->sh_offset + hdr->sh_size))))
+ || (phdr->p_offset + phdr->p_filesz
+ >= hdr->sh_offset + hdr->sh_size)))
{
- newsect->lma += phdr->p_paddr - phdr->p_vaddr;
+ /* We used to do a relative adjustment here, but
+ that doesn't work if the segment is packed with
+ code from multiple VMAs. Instead we calculate
+ the LMA absoultely, based on the LMA of the
+ segment (it is assumed that the segment will
+ contain sections with contiguous LMAs, even if
+ the VMAs are not). */
+ newsect->lma = phdr->p_paddr
+ + hdr->sh_offset - phdr->p_offset;
break;
}
}
@@ -494,11 +714,11 @@ bfd_elf_find_section (abfd, name)
i_shdrp = elf_elfsections (abfd);
if (i_shdrp != NULL)
{
- shstrtab = bfd_elf_get_str_section
- (abfd, elf_elfheader (abfd)->e_shstrndx);
+ shstrtab = bfd_elf_get_str_section (abfd,
+ elf_elfheader (abfd)->e_shstrndx);
if (shstrtab != NULL)
{
- max = elf_elfheader (abfd)->e_shnum;
+ max = elf_numsections (abfd);
for (i = 1; i < max; i++)
if (!strcmp (&shstrtab[i_shdrp[i]->sh_name], name))
return i_shdrp[i];
@@ -551,6 +771,57 @@ bfd_elf_generic_reloc (abfd,
return bfd_reloc_continue;
}
+/* Make sure sec_info_type is cleared if sec_info is cleared too. */
+
+static void
+merge_sections_remove_hook (abfd, sec)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ asection *sec;
+{
+ struct bfd_elf_section_data *sec_data;
+
+ sec_data = elf_section_data (sec);
+ BFD_ASSERT (sec_data->sec_info_type == ELF_INFO_TYPE_MERGE);
+ sec_data->sec_info_type = ELF_INFO_TYPE_NONE;
+}
+
+/* Finish SHF_MERGE section merging. */
+
+boolean
+_bfd_elf_merge_sections (abfd, info)
+ bfd *abfd;
+ struct bfd_link_info *info;
+{
+ if (!is_elf_hash_table (info))
+ return false;
+ if (elf_hash_table (info)->merge_info)
+ _bfd_merge_sections (abfd, elf_hash_table (info)->merge_info,
+ merge_sections_remove_hook);
+ return true;
+}
+
+/* Copy the program header and other data from one object module to
+ another. */
+
+boolean
+_bfd_elf_copy_private_bfd_data (ibfd, obfd)
+ bfd *ibfd;
+ bfd *obfd;
+{
+ if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
+ || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
+ return true;
+
+ BFD_ASSERT (!elf_flags_init (obfd)
+ || (elf_elfheader (obfd)->e_flags
+ == elf_elfheader (ibfd)->e_flags));
+
+ elf_gp (obfd) = elf_gp (ibfd);
+ elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
+ elf_flags_init (obfd) = true;
+ return true;
+}
+
/* Print out the program headers. */
boolean
@@ -572,37 +843,38 @@ _bfd_elf_print_private_bfd_data (abfd, farg)
c = elf_elfheader (abfd)->e_phnum;
for (i = 0; i < c; i++, p++)
{
- const char *s;
+ const char *pt;
char buf[20];
switch (p->p_type)
{
- case PT_NULL: s = "NULL"; break;
- case PT_LOAD: s = "LOAD"; break;
- case PT_DYNAMIC: s = "DYNAMIC"; break;
- case PT_INTERP: s = "INTERP"; break;
- case PT_NOTE: s = "NOTE"; break;
- case PT_SHLIB: s = "SHLIB"; break;
- case PT_PHDR: s = "PHDR"; break;
- default: sprintf (buf, "0x%lx", p->p_type); s = buf; break;
+ case PT_NULL: pt = "NULL"; break;
+ case PT_LOAD: pt = "LOAD"; break;
+ case PT_DYNAMIC: pt = "DYNAMIC"; break;
+ case PT_INTERP: pt = "INTERP"; break;
+ case PT_NOTE: pt = "NOTE"; break;
+ case PT_SHLIB: pt = "SHLIB"; break;
+ case PT_PHDR: pt = "PHDR"; break;
+ case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break;
+ default: sprintf (buf, "0x%lx", p->p_type); pt = buf; break;
}
- fprintf (f, "%8s off 0x", s);
- fprintf_vma (f, p->p_offset);
+ fprintf (f, "%8s off 0x", pt);
+ bfd_fprintf_vma (abfd, f, p->p_offset);
fprintf (f, " vaddr 0x");
- fprintf_vma (f, p->p_vaddr);
+ bfd_fprintf_vma (abfd, f, p->p_vaddr);
fprintf (f, " paddr 0x");
- fprintf_vma (f, p->p_paddr);
+ bfd_fprintf_vma (abfd, f, p->p_paddr);
fprintf (f, " align 2**%u\n", bfd_log2 (p->p_align));
fprintf (f, " filesz 0x");
- fprintf_vma (f, p->p_filesz);
+ bfd_fprintf_vma (abfd, f, p->p_filesz);
fprintf (f, " memsz 0x");
- fprintf_vma (f, p->p_memsz);
+ bfd_fprintf_vma (abfd, f, p->p_memsz);
fprintf (f, " flags %c%c%c",
(p->p_flags & PF_R) != 0 ? 'r' : '-',
(p->p_flags & PF_W) != 0 ? 'w' : '-',
(p->p_flags & PF_X) != 0 ? 'x' : '-');
- if ((p->p_flags &~ (PF_R | PF_W | PF_X)) != 0)
- fprintf (f, " %lx", p->p_flags &~ (PF_R | PF_W | PF_X));
+ if ((p->p_flags &~ (unsigned) (PF_R | PF_W | PF_X)) != 0)
+ fprintf (f, " %lx", p->p_flags &~ (unsigned) (PF_R | PF_W | PF_X));
fprintf (f, "\n");
}
}
@@ -611,7 +883,7 @@ _bfd_elf_print_private_bfd_data (abfd, farg)
if (s != NULL)
{
int elfsec;
- unsigned long link;
+ unsigned long shlink;
bfd_byte *extdyn, *extdynend;
size_t extdynsize;
void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
@@ -628,7 +900,7 @@ _bfd_elf_print_private_bfd_data (abfd, farg)
elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
if (elfsec == -1)
goto error_return;
- link = elf_elfsections (abfd)[elfsec]->sh_link;
+ shlink = elf_elfsections (abfd)[elfsec]->sh_link;
extdynsize = get_elf_backend_data (abfd)->s->sizeof_dyn;
swap_dyn_in = get_elf_backend_data (abfd)->s->swap_dyn_in;
@@ -720,9 +992,9 @@ _bfd_elf_print_private_bfd_data (abfd, farg)
else
{
const char *string;
+ unsigned int tagv = dyn.d_un.d_val;
- string = bfd_elf_string_from_elf_section (abfd, link,
- dyn.d_un.d_val);
+ string = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
if (string == NULL)
goto error_return;
fprintf (f, "%s", string);
@@ -805,7 +1077,7 @@ bfd_elf_print_symbol (abfd, filep, symbol, how)
break;
case bfd_print_symbol_more:
fprintf (file, "elf ");
- fprintf_vma (file, symbol->value);
+ bfd_fprintf_vma (abfd, file, symbol->value);
fprintf (file, " %lx", (long) symbol->flags);
break;
case bfd_print_symbol_all:
@@ -814,6 +1086,7 @@ bfd_elf_print_symbol (abfd, filep, symbol, how)
const char *name = NULL;
struct elf_backend_data *bed;
unsigned char st_other;
+ bfd_vma val;
section_name = symbol->section ? symbol->section->name : "(*none*)";
@@ -824,7 +1097,7 @@ bfd_elf_print_symbol (abfd, filep, symbol, how)
if (name == NULL)
{
name = symbol->name;
- bfd_print_symbol_vandf ((PTR) file, symbol);
+ bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
}
fprintf (file, " %s\t", section_name);
@@ -832,10 +1105,11 @@ bfd_elf_print_symbol (abfd, filep, symbol, how)
we've already printed the size; now print the alignment.
For other symbols, we have no specified alignment, and
we've printed the address; now print the size. */
- fprintf_vma (file,
- (bfd_is_com_section (symbol->section)
- ? ((elf_symbol_type *) symbol)->internal_elf_sym.st_value
- : ((elf_symbol_type *) symbol)->internal_elf_sym.st_size));
+ if (bfd_is_com_section (symbol->section))
+ val = ((elf_symbol_type *) symbol)->internal_elf_sym.st_value;
+ else
+ val = ((elf_symbol_type *) symbol)->internal_elf_sym.st_size;
+ bfd_fprintf_vma (abfd, file, val);
/* If we have version information, print it. */
if (elf_tdata (abfd)->dynversym_section != 0
@@ -917,31 +1191,31 @@ _bfd_elf_link_hash_newfunc (entry, table, string)
struct bfd_hash_table *table;
const char *string;
{
- struct elf_link_hash_entry *ret = (struct elf_link_hash_entry *) entry;
-
/* Allocate the structure if it has not already been allocated by a
subclass. */
- if (ret == (struct elf_link_hash_entry *) NULL)
- ret = ((struct elf_link_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct elf_link_hash_entry)));
- if (ret == (struct elf_link_hash_entry *) NULL)
- return (struct bfd_hash_entry *) ret;
+ if (entry == NULL)
+ {
+ entry = bfd_hash_allocate (table, sizeof (struct elf_link_hash_entry));
+ if (entry == NULL)
+ return entry;
+ }
/* Call the allocation method of the superclass. */
- ret = ((struct elf_link_hash_entry *)
- _bfd_link_hash_newfunc ((struct bfd_hash_entry *) ret,
- table, string));
- if (ret != (struct elf_link_hash_entry *) NULL)
+ entry = _bfd_link_hash_newfunc (entry, table, string);
+ if (entry != NULL)
{
+ struct elf_link_hash_entry *ret = (struct elf_link_hash_entry *) entry;
+ struct elf_link_hash_table *htab = (struct elf_link_hash_table *) table;
+
/* Set local fields. */
ret->indx = -1;
ret->size = 0;
ret->dynindx = -1;
ret->dynstr_index = 0;
ret->weakdef = NULL;
- ret->got.offset = (bfd_vma) -1;
- ret->plt.offset = (bfd_vma) -1;
- ret->linker_section_pointer = (elf_linker_section_pointers_t *)0;
+ ret->got.refcount = htab->init_refcount;
+ ret->plt.refcount = htab->init_refcount;
+ ret->linker_section_pointer = NULL;
ret->verinfo.verdef = NULL;
ret->vtable_entries_used = NULL;
ret->vtable_entries_size = 0;
@@ -955,16 +1229,18 @@ _bfd_elf_link_hash_newfunc (entry, table, string)
ret->elf_link_hash_flags = ELF_LINK_NON_ELF;
}
- return (struct bfd_hash_entry *) ret;
+ return entry;
}
/* Copy data from an indirect symbol to its direct symbol, hiding the
- old indirect symbol. */
+ old indirect symbol. Also used for copying flags to a weakdef. */
void
_bfd_elf_link_hash_copy_indirect (dir, ind)
struct elf_link_hash_entry *dir, *ind;
{
+ bfd_signed_vma tmp;
+
/* Copy down any references that we may have already seen to the
symbol which just became indirect. */
@@ -975,21 +1251,28 @@ _bfd_elf_link_hash_copy_indirect (dir, ind)
| ELF_LINK_HASH_REF_REGULAR_NONWEAK
| ELF_LINK_NON_GOT_REF));
- /* Copy over the global and procedure linkage table offset entries.
+ if (ind->root.type != bfd_link_hash_indirect)
+ return;
+
+ /* Copy over the global and procedure linkage table refcount entries.
These may have been already set up by a check_relocs routine. */
- if (dir->got.offset == (bfd_vma) -1)
+ tmp = dir->got.refcount;
+ if (tmp <= 0)
{
- dir->got.offset = ind->got.offset;
- ind->got.offset = (bfd_vma) -1;
+ dir->got.refcount = ind->got.refcount;
+ ind->got.refcount = tmp;
}
- BFD_ASSERT (ind->got.offset == (bfd_vma) -1);
+ else
+ BFD_ASSERT (ind->got.refcount <= 0);
- if (dir->plt.offset == (bfd_vma) -1)
+ tmp = dir->plt.refcount;
+ if (tmp <= 0)
{
- dir->plt.offset = ind->plt.offset;
- ind->plt.offset = (bfd_vma) -1;
+ dir->plt.refcount = ind->plt.refcount;
+ ind->plt.refcount = tmp;
}
- BFD_ASSERT (ind->plt.offset == (bfd_vma) -1);
+ else
+ BFD_ASSERT (ind->plt.refcount <= 0);
if (dir->dynindx == -1)
{
@@ -998,18 +1281,28 @@ _bfd_elf_link_hash_copy_indirect (dir, ind)
ind->dynindx = -1;
ind->dynstr_index = 0;
}
- BFD_ASSERT (ind->dynindx == -1);
+ else
+ BFD_ASSERT (ind->dynindx == -1);
}
void
-_bfd_elf_link_hash_hide_symbol (info, h)
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
+_bfd_elf_link_hash_hide_symbol (info, h, force_local)
+ struct bfd_link_info *info;
struct elf_link_hash_entry *h;
+ boolean force_local;
{
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
h->plt.offset = (bfd_vma) -1;
- if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
- h->dynindx = -1;
+ h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ if (force_local)
+ {
+ h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
+ if (h->dynindx != -1)
+ {
+ h->dynindx = -1;
+ _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
+ h->dynstr_index);
+ }
+ }
}
/* Initialize an ELF linker hash table. */
@@ -1022,8 +1315,11 @@ _bfd_elf_link_hash_table_init (table, abfd, newfunc)
struct bfd_hash_table *,
const char *));
{
+ boolean ret;
+
table->dynamic_sections_created = false;
table->dynobj = NULL;
+ table->init_refcount = get_elf_backend_data (abfd)->can_refcount - 1;
/* The first dynamic symbol is a dummy. */
table->dynsymcount = 1;
table->dynstr = NULL;
@@ -1032,8 +1328,12 @@ _bfd_elf_link_hash_table_init (table, abfd, newfunc)
table->runpath = NULL;
table->hgot = NULL;
table->stab_info = NULL;
+ table->merge_info = NULL;
table->dynlocal = NULL;
- return _bfd_link_hash_table_init (&table->root, abfd, newfunc);
+ ret = _bfd_link_hash_table_init (& table->root, abfd, newfunc);
+ table->root.type = bfd_link_elf_hash_table;
+
+ return ret;
}
/* Create an ELF linker hash table. */
@@ -1043,9 +1343,9 @@ _bfd_elf_link_hash_table_create (abfd)
bfd *abfd;
{
struct elf_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct elf_link_hash_table);
- ret = ((struct elf_link_hash_table *)
- bfd_alloc (abfd, sizeof (struct elf_link_hash_table)));
+ ret = (struct elf_link_hash_table *) bfd_alloc (abfd, amt);
if (ret == (struct elf_link_hash_table *) NULL)
return NULL;
@@ -1134,7 +1434,7 @@ bfd_elf_get_bfd_needed_list (abfd, pneeded)
asection *s;
bfd_byte *dynbuf = NULL;
int elfsec;
- unsigned long link;
+ unsigned long shlink;
bfd_byte *extdyn, *extdynend;
size_t extdynsize;
void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
@@ -1161,7 +1461,7 @@ bfd_elf_get_bfd_needed_list (abfd, pneeded)
if (elfsec == -1)
goto error_return;
- link = elf_elfsections (abfd)[elfsec]->sh_link;
+ shlink = elf_elfsections (abfd)[elfsec]->sh_link;
extdynsize = get_elf_backend_data (abfd)->s->sizeof_dyn;
swap_dyn_in = get_elf_backend_data (abfd)->s->swap_dyn_in;
@@ -1181,13 +1481,15 @@ bfd_elf_get_bfd_needed_list (abfd, pneeded)
{
const char *string;
struct bfd_link_needed_list *l;
+ unsigned int tagv = dyn.d_un.d_val;
+ bfd_size_type amt;
- string = bfd_elf_string_from_elf_section (abfd, link,
- dyn.d_un.d_val);
+ string = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
if (string == NULL)
goto error_return;
- l = (struct bfd_link_needed_list *) bfd_alloc (abfd, sizeof *l);
+ amt = sizeof *l;
+ l = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
if (l == NULL)
goto error_return;
@@ -1299,6 +1601,20 @@ bfd_section_from_shdr (abfd, shindex)
section, so that objcopy can handle it. */
return _bfd_elf_make_section_from_shdr (abfd, hdr, name);
+ case SHT_SYMTAB_SHNDX: /* Symbol section indices when >64k sections */
+ if (elf_symtab_shndx (abfd) == shindex)
+ return true;
+
+ /* Get the associated symbol table. */
+ if (! bfd_section_from_shdr (abfd, hdr->sh_link)
+ || hdr->sh_link != elf_onesymtab (abfd))
+ return false;
+
+ elf_symtab_shndx (abfd) = shindex;
+ elf_tdata (abfd)->symtab_shndx_hdr = *hdr;
+ elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->symtab_shndx_hdr;
+ return true;
+
case SHT_STRTAB: /* A string table */
if (hdr->bfd_section != NULL)
return true;
@@ -1309,9 +1625,10 @@ bfd_section_from_shdr (abfd, shindex)
return true;
}
{
- unsigned int i;
+ unsigned int i, num_sec;
- for (i = 1; i < ehdr->e_shnum; i++)
+ num_sec = elf_numsections (abfd);
+ for (i = 1; i < num_sec; i++)
{
Elf_Internal_Shdr *hdr2 = elf_elfsections (abfd)[i];
if (hdr2->sh_link == shindex)
@@ -1357,13 +1674,15 @@ bfd_section_from_shdr (abfd, shindex)
{
asection *target_sect;
Elf_Internal_Shdr *hdr2;
+ unsigned int num_sec = elf_numsections (abfd);
/* Check for a bogus link to avoid crashing. */
- if (hdr->sh_link >= ehdr->e_shnum)
+ if ((hdr->sh_link >= SHN_LORESERVE && hdr->sh_link <= SHN_HIRESERVE)
+ || hdr->sh_link >= num_sec)
{
((*_bfd_error_handler)
(_("%s: invalid link %lu for reloc section %s (index %u)"),
- bfd_get_filename (abfd), hdr->sh_link, name, shindex));
+ bfd_archive_filename (abfd), hdr->sh_link, name, shindex));
return _bfd_elf_make_section_from_shdr (abfd, hdr, name);
}
@@ -1377,11 +1696,11 @@ bfd_section_from_shdr (abfd, shindex)
if (elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_SYMTAB
&& elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_DYNSYM)
{
- int scan;
+ unsigned int scan;
int found;
found = 0;
- for (scan = 1; scan < ehdr->e_shnum; scan++)
+ for (scan = 1; scan < num_sec; scan++)
{
if (elf_elfsections (abfd)[scan]->sh_type == SHT_SYMTAB
|| elf_elfsections (abfd)[scan]->sh_type == SHT_DYNSYM)
@@ -1423,8 +1742,10 @@ bfd_section_from_shdr (abfd, shindex)
hdr2 = &elf_section_data (target_sect)->rel_hdr;
else
{
+ bfd_size_type amt;
BFD_ASSERT (elf_section_data (target_sect)->rel_hdr2 == NULL);
- hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, sizeof (*hdr2));
+ amt = sizeof (*hdr2);
+ hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt);
elf_section_data (target_sect)->rel_hdr2 = hdr2;
}
*hdr2 = *hdr;
@@ -1464,6 +1785,26 @@ bfd_section_from_shdr (abfd, shindex)
case SHT_SHLIB:
return true;
+ case SHT_GROUP:
+ /* Make a section for objcopy and relocatable links. */
+ if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name))
+ return false;
+ if (hdr->contents != NULL)
+ {
+ Elf_Internal_Group *idx = (Elf_Internal_Group *) hdr->contents;
+ unsigned int n_elt = hdr->sh_size / 4;
+ asection *s;
+
+ while (--n_elt != 0)
+ if ((s = (++idx)->shdr->bfd_section) != NULL
+ && elf_next_in_group (s) != NULL)
+ {
+ elf_next_in_group (hdr->bfd_section) = s;
+ break;
+ }
+ }
+ break;
+
default:
/* Check for any processor-specific section types. */
{
@@ -1476,6 +1817,78 @@ bfd_section_from_shdr (abfd, shindex)
return true;
}
+/* Return the section for the local symbol specified by ABFD, R_SYMNDX.
+ Return SEC for sections that have no elf section, and NULL on error. */
+
+asection *
+bfd_section_from_r_symndx (abfd, cache, sec, r_symndx)
+ bfd *abfd;
+ struct sym_sec_cache *cache;
+ asection *sec;
+ unsigned long r_symndx;
+{
+ unsigned char esym_shndx[4];
+ unsigned int isym_shndx;
+ Elf_Internal_Shdr *symtab_hdr;
+ file_ptr pos;
+ bfd_size_type amt;
+ unsigned int ent = r_symndx % LOCAL_SYM_CACHE_SIZE;
+
+ if (cache->abfd == abfd && cache->indx[ent] == r_symndx)
+ return cache->sec[ent];
+
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ pos = symtab_hdr->sh_offset;
+ if (get_elf_backend_data (abfd)->s->sizeof_sym
+ == sizeof (Elf64_External_Sym))
+ {
+ pos += r_symndx * sizeof (Elf64_External_Sym);
+ pos += offsetof (Elf64_External_Sym, st_shndx);
+ amt = sizeof (((Elf64_External_Sym *) 0)->st_shndx);
+ }
+ else
+ {
+ pos += r_symndx * sizeof (Elf32_External_Sym);
+ pos += offsetof (Elf32_External_Sym, st_shndx);
+ amt = sizeof (((Elf32_External_Sym *) 0)->st_shndx);
+ }
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0
+ || bfd_bread ((PTR) esym_shndx, amt, abfd) != amt)
+ return NULL;
+ isym_shndx = H_GET_16 (abfd, esym_shndx);
+
+ if (isym_shndx == SHN_XINDEX)
+ {
+ Elf_Internal_Shdr *shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
+ if (shndx_hdr->sh_size != 0)
+ {
+ pos = shndx_hdr->sh_offset;
+ pos += r_symndx * sizeof (Elf_External_Sym_Shndx);
+ amt = sizeof (Elf_External_Sym_Shndx);
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0
+ || bfd_bread ((PTR) esym_shndx, amt, abfd) != amt)
+ return NULL;
+ isym_shndx = H_GET_32 (abfd, esym_shndx);
+ }
+ }
+
+ if (cache->abfd != abfd)
+ {
+ memset (cache->indx, -1, sizeof (cache->indx));
+ cache->abfd = abfd;
+ }
+ cache->indx[ent] = r_symndx;
+ cache->sec[ent] = sec;
+ if (isym_shndx < SHN_LORESERVE || isym_shndx > SHN_HIRESERVE)
+ {
+ asection *s;
+ s = bfd_section_from_elf_index (abfd, isym_shndx);
+ if (s != NULL)
+ cache->sec[ent] = s;
+ }
+ return cache->sec[ent];
+}
+
/* Given an ELF section number, retrieve the corresponding BFD
section. */
@@ -1484,8 +1897,7 @@ bfd_section_from_elf_index (abfd, index)
bfd *abfd;
unsigned int index;
{
- BFD_ASSERT (index > 0 && index < SHN_LORESERVE);
- if (index >= elf_elfheader (abfd)->e_shnum)
+ if (index >= elf_numsections (abfd))
return NULL;
return elf_elfsections (abfd)[index]->bfd_section;
}
@@ -1496,8 +1908,9 @@ _bfd_elf_new_section_hook (abfd, sec)
asection *sec;
{
struct bfd_elf_section_data *sdata;
+ bfd_size_type amt = sizeof (*sdata);
- sdata = (struct bfd_elf_section_data *) bfd_zalloc (abfd, sizeof (*sdata));
+ sdata = (struct bfd_elf_section_data *) bfd_zalloc (abfd, amt);
if (!sdata)
return false;
sec->used_by_bfd = (PTR) sdata;
@@ -1547,7 +1960,7 @@ _bfd_elf_make_section_from_phdr (abfd, hdr, index, typename)
&& (hdr->p_filesz > 0)
&& (hdr->p_memsz > hdr->p_filesz));
sprintf (namebuf, "%s%d%s", typename, index, split ? "a" : "");
- name = bfd_alloc (abfd, strlen (namebuf) + 1);
+ name = bfd_alloc (abfd, (bfd_size_type) strlen (namebuf) + 1);
if (!name)
return false;
strcpy (name, namebuf);
@@ -1578,7 +1991,7 @@ _bfd_elf_make_section_from_phdr (abfd, hdr, index, typename)
if (split)
{
sprintf (namebuf, "%s%db", typename, index);
- name = bfd_alloc (abfd, strlen (namebuf) + 1);
+ name = bfd_alloc (abfd, (bfd_size_type) strlen (namebuf) + 1);
if (!name)
return false;
strcpy (name, namebuf);
@@ -1626,7 +2039,7 @@ bfd_section_from_phdr (abfd, hdr, index)
case PT_NOTE:
if (! _bfd_elf_make_section_from_phdr (abfd, hdr, index, "note"))
return false;
- if (! elfcore_read_notes (abfd, hdr->p_offset, hdr->p_filesz))
+ if (! elfcore_read_notes (abfd, (file_ptr) hdr->p_offset, hdr->p_filesz))
return false;
return true;
@@ -1659,16 +2072,16 @@ _bfd_elf_init_reloc_shdr (abfd, rel_hdr, asect, use_rela_p)
boolean use_rela_p;
{
char *name;
- struct elf_backend_data *bed;
+ struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ bfd_size_type amt = sizeof ".rela" + strlen (asect->name);
- bed = get_elf_backend_data (abfd);
- name = bfd_alloc (abfd, sizeof ".rela" + strlen (asect->name));
+ name = bfd_alloc (abfd, amt);
if (name == NULL)
return false;
sprintf (name, "%s%s", use_rela_p ? ".rela" : ".rel", asect->name);
rel_hdr->sh_name =
- (unsigned int) _bfd_stringtab_add (elf_shstrtab (abfd), name,
- true, false);
+ (unsigned int) _bfd_elf_strtab_add (elf_shstrtab (abfd), name,
+ false);
if (rel_hdr->sh_name == (unsigned int) -1)
return false;
rel_hdr->sh_type = use_rela_p ? SHT_RELA : SHT_REL;
@@ -1705,9 +2118,8 @@ elf_fake_sections (abfd, asect, failedptrarg)
this_hdr = &elf_section_data (asect)->this_hdr;
- this_hdr->sh_name = (unsigned long) _bfd_stringtab_add (elf_shstrtab (abfd),
- asect->name,
- true, false);
+ this_hdr->sh_name = (unsigned long) _bfd_elf_strtab_add (elf_shstrtab (abfd),
+ asect->name, false);
if (this_hdr->sh_name == (unsigned long) -1)
{
*failedptr = true;
@@ -1798,6 +2210,11 @@ elf_fake_sections (abfd, asect, failedptrarg)
BFD_ASSERT (elf_tdata (abfd)->cverrefs == 0
|| this_hdr->sh_info == elf_tdata (abfd)->cverrefs);
}
+ else if ((asect->flags & SEC_GROUP) != 0)
+ {
+ this_hdr->sh_type = SHT_GROUP;
+ this_hdr->sh_entsize = 4;
+ }
else if ((asect->flags & SEC_ALLOC) != 0
&& ((asect->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0))
this_hdr->sh_type = SHT_NOBITS;
@@ -1810,10 +2227,20 @@ elf_fake_sections (abfd, asect, failedptrarg)
this_hdr->sh_flags |= SHF_WRITE;
if ((asect->flags & SEC_CODE) != 0)
this_hdr->sh_flags |= SHF_EXECINSTR;
+ if ((asect->flags & SEC_MERGE) != 0)
+ {
+ this_hdr->sh_flags |= SHF_MERGE;
+ this_hdr->sh_entsize = asect->entsize;
+ if ((asect->flags & SEC_STRINGS) != 0)
+ this_hdr->sh_flags |= SHF_STRINGS;
+ }
+ if (elf_group_name (asect) != NULL)
+ this_hdr->sh_flags |= SHF_GROUP;
/* Check for processor-specific section types. */
- if (bed->elf_backend_fake_sections)
- (*bed->elf_backend_fake_sections) (abfd, this_hdr, asect);
+ if (bed->elf_backend_fake_sections
+ && !(*bed->elf_backend_fake_sections) (abfd, this_hdr, asect))
+ *failedptr = true;
/* If the section has relocs, set up a section header for the
SHT_REL[A] section. If two relocation sections are required for
@@ -1827,6 +2254,83 @@ elf_fake_sections (abfd, asect, failedptrarg)
*failedptr = true;
}
+/* Fill in the contents of a SHT_GROUP section. */
+
+static void
+set_group_contents (abfd, sec, failedptrarg)
+ bfd *abfd;
+ asection *sec;
+ PTR failedptrarg ATTRIBUTE_UNUSED;
+{
+ boolean *failedptr = (boolean *) failedptrarg;
+ unsigned long symindx;
+ asection *elt;
+ unsigned char *loc;
+ struct bfd_link_order *l;
+
+ if (elf_section_data (sec)->this_hdr.sh_type != SHT_GROUP
+ || *failedptr)
+ return;
+
+ /* If called from the assembler, swap_out_syms will have set up
+ elf_section_syms; If called for "ld -r", the symbols won't yet
+ be mapped, so emulate elf_bfd_final_link. */
+ if (elf_section_syms (abfd) != NULL)
+ symindx = elf_section_syms (abfd)[sec->index]->udata.i;
+ else
+ symindx = elf_section_data (sec)->this_idx;
+ elf_section_data (sec)->this_hdr.sh_info = symindx;
+
+ /* Nor will the contents be allocated for "ld -r". */
+ if (sec->contents == NULL)
+ {
+ sec->contents = bfd_alloc (abfd, sec->_raw_size);
+ if (sec->contents == NULL)
+ {
+ *failedptr = true;
+ return;
+ }
+ }
+
+ loc = sec->contents + sec->_raw_size;
+
+ /* Get the pointer to the first section in the group that we
+ squirreled away here. */
+ elt = elf_next_in_group (sec);
+
+ /* First element is a flag word. Rest of section is elf section
+ indices for all the sections of the group. Write them backwards
+ just to keep the group in the same order as given in .section
+ directives, not that it matters. */
+ while (elt != NULL)
+ {
+ loc -= 4;
+ H_PUT_32 (abfd, elf_section_data (elt)->this_idx, loc);
+ elt = elf_next_in_group (elt);
+ }
+
+ /* If this is a relocatable link, then the above did nothing because
+ SEC is the output section. Look through the input sections
+ instead. */
+ for (l = sec->link_order_head; l != NULL; l = l->next)
+ if (l->type == bfd_indirect_link_order
+ && (elt = elf_next_in_group (l->u.indirect.section)) != NULL)
+ do
+ {
+ loc -= 4;
+ H_PUT_32 (abfd,
+ elf_section_data (elt->output_section)->this_idx, loc);
+ elt = elf_next_in_group (elt);
+ /* During a relocatable link, the lists are circular. */
+ }
+ while (elt != elf_next_in_group (l->u.indirect.section));
+
+ loc -= 4;
+ H_PUT_32 (abfd, 0, loc);
+
+ BFD_ASSERT (loc == sec->contents);
+}
+
/* Assign all ELF section numbers. The dummy first section is handled here
too. The link/info pointers for the standard section types are filled
in here too, while we're at it. */
@@ -1837,48 +2341,89 @@ assign_section_numbers (abfd)
{
struct elf_obj_tdata *t = elf_tdata (abfd);
asection *sec;
- unsigned int section_number;
+ unsigned int section_number, secn;
Elf_Internal_Shdr **i_shdrp;
+ bfd_size_type amt;
section_number = 1;
+ _bfd_elf_strtab_clear_all_refs (elf_shstrtab (abfd));
+
for (sec = abfd->sections; sec; sec = sec->next)
{
struct bfd_elf_section_data *d = elf_section_data (sec);
+ if (section_number == SHN_LORESERVE)
+ section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
d->this_idx = section_number++;
+ _bfd_elf_strtab_addref (elf_shstrtab (abfd), d->this_hdr.sh_name);
if ((sec->flags & SEC_RELOC) == 0)
d->rel_idx = 0;
else
- d->rel_idx = section_number++;
+ {
+ if (section_number == SHN_LORESERVE)
+ section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
+ d->rel_idx = section_number++;
+ _bfd_elf_strtab_addref (elf_shstrtab (abfd), d->rel_hdr.sh_name);
+ }
if (d->rel_hdr2)
- d->rel_idx2 = section_number++;
+ {
+ if (section_number == SHN_LORESERVE)
+ section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
+ d->rel_idx2 = section_number++;
+ _bfd_elf_strtab_addref (elf_shstrtab (abfd), d->rel_hdr2->sh_name);
+ }
else
d->rel_idx2 = 0;
}
+ if (section_number == SHN_LORESERVE)
+ section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
t->shstrtab_section = section_number++;
+ _bfd_elf_strtab_addref (elf_shstrtab (abfd), t->shstrtab_hdr.sh_name);
elf_elfheader (abfd)->e_shstrndx = t->shstrtab_section;
- t->shstrtab_hdr.sh_size = _bfd_stringtab_size (elf_shstrtab (abfd));
if (bfd_get_symcount (abfd) > 0)
{
+ if (section_number == SHN_LORESERVE)
+ section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
t->symtab_section = section_number++;
+ _bfd_elf_strtab_addref (elf_shstrtab (abfd), t->symtab_hdr.sh_name);
+ if (section_number > SHN_LORESERVE - 2)
+ {
+ if (section_number == SHN_LORESERVE)
+ section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
+ t->symtab_shndx_section = section_number++;
+ t->symtab_shndx_hdr.sh_name
+ = (unsigned int) _bfd_elf_strtab_add (elf_shstrtab (abfd),
+ ".symtab_shndx", false);
+ if (t->symtab_shndx_hdr.sh_name == (unsigned int) -1)
+ return false;
+ }
+ if (section_number == SHN_LORESERVE)
+ section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
t->strtab_section = section_number++;
+ _bfd_elf_strtab_addref (elf_shstrtab (abfd), t->strtab_hdr.sh_name);
}
+ _bfd_elf_strtab_finalize (elf_shstrtab (abfd));
+ t->shstrtab_hdr.sh_size = _bfd_elf_strtab_size (elf_shstrtab (abfd));
+
+ elf_numsections (abfd) = section_number;
elf_elfheader (abfd)->e_shnum = section_number;
+ if (section_number > SHN_LORESERVE)
+ elf_elfheader (abfd)->e_shnum -= SHN_HIRESERVE + 1 - SHN_LORESERVE;
/* Set up the list of section header pointers, in agreement with the
indices. */
- i_shdrp = ((Elf_Internal_Shdr **)
- bfd_alloc (abfd, section_number * sizeof (Elf_Internal_Shdr *)));
+ amt = section_number * sizeof (Elf_Internal_Shdr *);
+ i_shdrp = (Elf_Internal_Shdr **) bfd_alloc (abfd, amt);
if (i_shdrp == NULL)
return false;
- i_shdrp[0] = ((Elf_Internal_Shdr *)
- bfd_alloc (abfd, sizeof (Elf_Internal_Shdr)));
+ amt = sizeof (Elf_Internal_Shdr);
+ i_shdrp[0] = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt);
if (i_shdrp[0] == NULL)
{
bfd_release (abfd, i_shdrp);
@@ -1892,6 +2437,11 @@ assign_section_numbers (abfd)
if (bfd_get_symcount (abfd) > 0)
{
i_shdrp[t->symtab_section] = &t->symtab_hdr;
+ if (elf_numsections (abfd) > SHN_LORESERVE)
+ {
+ i_shdrp[t->symtab_shndx_section] = &t->symtab_shndx_hdr;
+ t->symtab_shndx_hdr.sh_link = t->symtab_section;
+ }
i_shdrp[t->strtab_section] = &t->strtab_hdr;
t->symtab_hdr.sh_link = t->strtab_section;
}
@@ -1960,7 +2510,7 @@ assign_section_numbers (abfd)
char *alc;
len = strlen (sec->name);
- alc = (char *) bfd_malloc (len - 2);
+ alc = (char *) bfd_malloc ((bfd_size_type) len - 2);
if (alc == NULL)
return false;
strncpy (alc, sec->name, len - 3);
@@ -1998,9 +2548,18 @@ assign_section_numbers (abfd)
if (s != NULL)
d->this_hdr.sh_link = elf_section_data (s)->this_idx;
break;
+
+ case SHT_GROUP:
+ d->this_hdr.sh_link = t->symtab_section;
}
}
+ for (secn = 1; secn < section_number; ++secn)
+ if (i_shdrp[secn] == NULL)
+ i_shdrp[secn] = i_shdrp[0];
+ else
+ i_shdrp[secn]->sh_name = _bfd_elf_strtab_offset (elf_shstrtab (abfd),
+ i_shdrp[secn]->sh_name);
return true;
}
@@ -2026,27 +2585,24 @@ static boolean
elf_map_symbols (abfd)
bfd *abfd;
{
- int symcount = bfd_get_symcount (abfd);
+ unsigned int symcount = bfd_get_symcount (abfd);
asymbol **syms = bfd_get_outsymbols (abfd);
asymbol **sect_syms;
- int num_locals = 0;
- int num_globals = 0;
- int num_locals2 = 0;
- int num_globals2 = 0;
+ unsigned int num_locals = 0;
+ unsigned int num_globals = 0;
+ unsigned int num_locals2 = 0;
+ unsigned int num_globals2 = 0;
int max_index = 0;
- int num_sections = 0;
- int idx;
+ unsigned int idx;
asection *asect;
asymbol **new_syms;
- asymbol *sym;
+ bfd_size_type amt;
#ifdef DEBUG
fprintf (stderr, "elf_map_symbols\n");
fflush (stderr);
#endif
- /* Add a section symbol for each BFD section. FIXME: Is this really
- necessary? */
for (asect = abfd->sections; asect; asect = asect->next)
{
if (max_index < asect->index)
@@ -2054,14 +2610,18 @@ elf_map_symbols (abfd)
}
max_index++;
- sect_syms = (asymbol **) bfd_zalloc (abfd, max_index * sizeof (asymbol *));
+ amt = max_index * sizeof (asymbol *);
+ sect_syms = (asymbol **) bfd_zalloc (abfd, amt);
if (sect_syms == NULL)
return false;
elf_section_syms (abfd) = sect_syms;
+ elf_num_section_syms (abfd) = max_index;
+ /* Init sect_syms entries for any section symbols we have already
+ decided to output. */
for (idx = 0; idx < symcount; idx++)
{
- sym = syms[idx];
+ asymbol *sym = syms[idx];
if ((sym->flags & BSF_SECTION_SYM) != 0
&& sym->value == 0)
@@ -2079,15 +2639,16 @@ elf_map_symbols (abfd)
sec = sec->output_section;
- /* Empty sections in the input files may have had a section
- symbol created for them. (See the comment near the end of
- _bfd_generic_link_output_symbols in linker.c). If the linker
- script discards such sections then we will reach this point.
- Since we know that we cannot avoid this case, we detect it
- and skip the abort and the assignment to the sect_syms array.
- To reproduce this particular case try running the linker
- testsuite test ld-scripts/weak.exp for an ELF port that uses
- the generic linker. */
+ /* Empty sections in the input files may have had a
+ section symbol created for them. (See the comment
+ near the end of _bfd_generic_link_output_symbols in
+ linker.c). If the linker script discards such
+ sections then we will reach this point. Since we know
+ that we cannot avoid this case, we detect it and skip
+ the abort and the assignment to the sect_syms array.
+ To reproduce this particular case try running the
+ linker testsuite test ld-scripts/weak.exp for an ELF
+ port that uses the generic linker. */
if (sec->owner == NULL)
continue;
@@ -2098,29 +2659,6 @@ elf_map_symbols (abfd)
}
}
- for (asect = abfd->sections; asect; asect = asect->next)
- {
- if (sect_syms[asect->index] != NULL)
- continue;
-
- sym = bfd_make_empty_symbol (abfd);
- if (sym == NULL)
- return false;
- sym->the_bfd = abfd;
- sym->name = asect->name;
- sym->value = 0;
- /* Set the flags to 0 to indicate that this one was newly added. */
- sym->flags = 0;
- sym->section = asect;
- sect_syms[asect->index] = sym;
- num_sections++;
-#ifdef DEBUG
- fprintf (stderr,
- _("creating section symbol, name = %s, value = 0x%.8lx, index = %d, section = 0x%.8lx\n"),
- asect->name, (long) asect->vma, asect->index, (long) asect);
-#endif
- }
-
/* Classify all of the symbols. */
for (idx = 0; idx < symcount; idx++)
{
@@ -2129,31 +2667,33 @@ elf_map_symbols (abfd)
else
num_globals++;
}
+
+ /* We will be adding a section symbol for each BFD section. Most normal
+ sections will already have a section symbol in outsymbols, but
+ eg. SHT_GROUP sections will not, and we need the section symbol mapped
+ at least in that case. */
for (asect = abfd->sections; asect; asect = asect->next)
{
- if (sect_syms[asect->index] != NULL
- && sect_syms[asect->index]->flags == 0)
+ if (sect_syms[asect->index] == NULL)
{
- sect_syms[asect->index]->flags = BSF_SECTION_SYM;
- if (!sym_is_global (abfd, sect_syms[asect->index]))
+ if (!sym_is_global (abfd, asect->symbol))
num_locals++;
else
num_globals++;
- sect_syms[asect->index]->flags = 0;
}
}
/* Now sort the symbols so the local symbols are first. */
- new_syms = ((asymbol **)
- bfd_alloc (abfd,
- (num_locals + num_globals) * sizeof (asymbol *)));
+ amt = (num_locals + num_globals) * sizeof (asymbol *);
+ new_syms = (asymbol **) bfd_alloc (abfd, amt);
+
if (new_syms == NULL)
return false;
for (idx = 0; idx < symcount; idx++)
{
asymbol *sym = syms[idx];
- int i;
+ unsigned int i;
if (!sym_is_global (abfd, sym))
i = num_locals2++;
@@ -2164,13 +2704,12 @@ elf_map_symbols (abfd)
}
for (asect = abfd->sections; asect; asect = asect->next)
{
- if (sect_syms[asect->index] != NULL
- && sect_syms[asect->index]->flags == 0)
+ if (sect_syms[asect->index] == NULL)
{
- asymbol *sym = sect_syms[asect->index];
- int i;
+ asymbol *sym = asect->symbol;
+ unsigned int i;
- sym->flags = BSF_SECTION_SYM;
+ sect_syms[asect->index] = sym;
if (!sym_is_global (abfd, sym))
i = num_locals2++;
else
@@ -2270,12 +2809,19 @@ _bfd_elf_compute_section_file_positions (abfd, link_info)
return false;
}
+ if (link_info == NULL || link_info->relocateable)
+ {
+ bfd_map_over_sections (abfd, set_group_contents, &failed);
+ if (failed)
+ return false;
+ }
+
shstrtab_hdr = &elf_tdata (abfd)->shstrtab_hdr;
/* sh_name was set in prep_headers. */
shstrtab_hdr->sh_type = SHT_STRTAB;
shstrtab_hdr->sh_flags = 0;
shstrtab_hdr->sh_addr = 0;
- shstrtab_hdr->sh_size = _bfd_stringtab_size (elf_shstrtab (abfd));
+ shstrtab_hdr->sh_size = _bfd_elf_strtab_size (elf_shstrtab (abfd));
shstrtab_hdr->sh_entsize = 0;
shstrtab_hdr->sh_link = 0;
shstrtab_hdr->sh_info = 0;
@@ -2295,6 +2841,10 @@ _bfd_elf_compute_section_file_positions (abfd, link_info)
hdr = &elf_tdata (abfd)->symtab_hdr;
off = _bfd_elf_assign_file_position_for_section (hdr, off, true);
+ hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
+ if (hdr->sh_size != 0)
+ off = _bfd_elf_assign_file_position_for_section (hdr, off, true);
+
hdr = &elf_tdata (abfd)->strtab_hdr;
off = _bfd_elf_assign_file_position_for_section (hdr, off, true);
@@ -2326,11 +2876,11 @@ make_mapping (abfd, sections, from, to, phdr)
struct elf_segment_map *m;
unsigned int i;
asection **hdrpp;
+ bfd_size_type amt;
- m = ((struct elf_segment_map *)
- bfd_zalloc (abfd,
- (sizeof (struct elf_segment_map)
- + (to - from - 1) * sizeof (asection *))));
+ amt = sizeof (struct elf_segment_map);
+ amt += (to - from - 1) * sizeof (asection *);
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
if (m == NULL)
return NULL;
m->next = NULL;
@@ -2368,7 +2918,8 @@ map_sections_to_segments (abfd)
asection **hdrpp;
boolean phdr_in_segment = true;
boolean writable;
- asection *dynsec;
+ asection *dynsec, *eh_frame_hdr;
+ bfd_size_type amt;
if (elf_tdata (abfd)->segment_map != NULL)
return true;
@@ -2378,8 +2929,8 @@ map_sections_to_segments (abfd)
/* Select the allocated sections, and sort them. */
- sections = (asection **) bfd_malloc (bfd_count_sections (abfd)
- * sizeof (asection *));
+ amt = bfd_count_sections (abfd) * sizeof (asection *);
+ sections = (asection **) bfd_malloc (amt);
if (sections == NULL)
goto error_return;
@@ -2408,8 +2959,8 @@ map_sections_to_segments (abfd)
s = bfd_get_section_by_name (abfd, ".interp");
if (s != NULL && (s->flags & SEC_LOAD) != 0)
{
- m = ((struct elf_segment_map *)
- bfd_zalloc (abfd, sizeof (struct elf_segment_map)));
+ amt = sizeof (struct elf_segment_map);
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
if (m == NULL)
goto error_return;
m->next = NULL;
@@ -2422,8 +2973,8 @@ map_sections_to_segments (abfd)
*pm = m;
pm = &m->next;
- m = ((struct elf_segment_map *)
- bfd_zalloc (abfd, sizeof (struct elf_segment_map)));
+ amt = sizeof (struct elf_segment_map);
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
if (m == NULL)
goto error_return;
m->next = NULL;
@@ -2570,8 +3121,8 @@ map_sections_to_segments (abfd)
/* If there is a .dynamic section, throw in a PT_DYNAMIC segment. */
if (dynsec != NULL)
{
- m = ((struct elf_segment_map *)
- bfd_zalloc (abfd, sizeof (struct elf_segment_map)));
+ amt = sizeof (struct elf_segment_map);
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
if (m == NULL)
goto error_return;
m->next = NULL;
@@ -2593,8 +3144,8 @@ map_sections_to_segments (abfd)
if ((s->flags & SEC_LOAD) != 0
&& strncmp (s->name, ".note", 5) == 0)
{
- m = ((struct elf_segment_map *)
- bfd_zalloc (abfd, sizeof (struct elf_segment_map)));
+ amt = sizeof (struct elf_segment_map);
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
if (m == NULL)
goto error_return;
m->next = NULL;
@@ -2607,6 +3158,26 @@ map_sections_to_segments (abfd)
}
}
+ /* If there is a .eh_frame_hdr section, throw in a PT_GNU_EH_FRAME
+ segment. */
+ eh_frame_hdr = NULL;
+ if (elf_tdata (abfd)->eh_frame_hdr)
+ eh_frame_hdr = bfd_get_section_by_name (abfd, ".eh_frame_hdr");
+ if (eh_frame_hdr != NULL && (eh_frame_hdr->flags & SEC_LOAD))
+ {
+ amt = sizeof (struct elf_segment_map);
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
+ if (m == NULL)
+ goto error_return;
+ m->next = NULL;
+ m->p_type = PT_GNU_EH_FRAME;
+ m->count = 1;
+ m->sections[0] = eh_frame_hdr;
+
+ *pm = m;
+ pm = &m->next;
+ }
+
free (sections);
sections = NULL;
@@ -2650,18 +3221,22 @@ elf_sort_sections (arg1, arg2)
if (TOEND (sec1))
{
if (TOEND (sec2))
- return sec1->target_index - sec2->target_index;
+ {
+ /* If the indicies are the same, do not return 0
+ here, but continue to try the next comparison. */
+ if (sec1->target_index - sec2->target_index != 0)
+ return sec1->target_index - sec2->target_index;
+ }
else
return 1;
}
-
- if (TOEND (sec2))
+ else if (TOEND (sec2))
return -1;
#undef TOEND
- /* Sort by size, to put zero sized sections before others at the
- same address. */
+ /* Sort by size, to put zero sized sections
+ before others at the same address. */
if (sec1->_raw_size < sec2->_raw_size)
return -1;
@@ -2688,6 +3263,7 @@ assign_file_positions_for_segments (abfd)
bfd_vma filehdr_vaddr, filehdr_paddr;
bfd_vma phdrs_vaddr, phdrs_paddr;
Elf_Internal_Phdr *p;
+ bfd_size_type amt;
if (elf_tdata (abfd)->segment_map == NULL)
{
@@ -2728,8 +3304,8 @@ assign_file_positions_for_segments (abfd)
if (alloc == 0)
alloc = count;
- phdrs = ((Elf_Internal_Phdr *)
- bfd_alloc (abfd, alloc * sizeof (Elf_Internal_Phdr)));
+ amt = alloc * sizeof (Elf_Internal_Phdr);
+ phdrs = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
if (phdrs == NULL)
return false;
@@ -2749,8 +3325,13 @@ assign_file_positions_for_segments (abfd)
asection **secpp;
/* If elf_segment_map is not from map_sections_to_segments, the
- sections may not be correctly ordered. */
- if (m->count > 0)
+ sections may not be correctly ordered. NOTE: sorting should
+ not be done to the PT_NOTE section of a corefile, which may
+ contain several pseudo-sections artificially created by bfd.
+ Sorting these pseudo-sections breaks things badly. */
+ if (m->count > 1
+ && !(elf_elfheader (abfd)->e_type == ET_CORE
+ && m->p_type == PT_NOTE))
qsort (m->sections, (size_t) m->count, sizeof (asection *),
elf_sort_sections);
@@ -2902,10 +3483,10 @@ assign_file_positions_for_segments (abfd)
/* The section may have artificial alignment forced by a
link script. Notice this case by the gap between the
- cumulative phdr vma and the section's vma. */
- if (p->p_vaddr + p->p_memsz < sec->vma)
+ cumulative phdr lma and the section's lma. */
+ if (p->p_paddr + p->p_memsz < sec->lma)
{
- bfd_vma adjust = sec->vma - (p->p_vaddr + p->p_memsz);
+ bfd_vma adjust = sec->lma - (p->p_paddr + p->p_memsz);
p->p_memsz += adjust;
off += adjust;
@@ -2943,13 +3524,11 @@ assign_file_positions_for_segments (abfd)
{
if (i == 0)
{
- (* _bfd_error_handler)
- (_("Error: First section in segment (%s) starts at 0x%x"),
- bfd_section_name (abfd, sec), sec->lma);
- (* _bfd_error_handler)
- (_(" whereas segment starts at 0x%x"),
- p->p_paddr);
-
+ (* _bfd_error_handler) (_("\
+Error: First section in segment (%s) starts at 0x%x whereas the segment starts at 0x%x"),
+ bfd_section_name (abfd, sec),
+ sec->lma,
+ p->p_paddr);
return false;
}
p->p_memsz += adjust;
@@ -3057,7 +3636,7 @@ assign_file_positions_for_segments (abfd)
elf_tdata (abfd)->next_file_pos = off;
/* Write out the program headers. */
- if (bfd_seek (abfd, bed->s->sizeof_ehdr, SEEK_SET) != 0
+ if (bfd_seek (abfd, (bfd_signed_vma) bed->s->sizeof_ehdr, SEEK_SET) != 0
|| bed->s->write_out_phdrs (abfd, phdrs, alloc) != 0)
return false;
@@ -3118,6 +3697,13 @@ get_program_header_size (abfd)
++segs;
}
+ if (elf_tdata (abfd)->eh_frame_hdr
+ && bfd_get_section_by_name (abfd, ".eh_frame_hdr") != NULL)
+ {
+ /* We need a PT_GNU_EH_FRAME segment. */
+ ++segs;
+ }
+
for (s = abfd->sections; s != NULL; s = s->next)
{
if ((s->flags & SEC_LOAD) != 0
@@ -3161,6 +3747,7 @@ assign_file_positions_except_relocs (abfd)
struct elf_obj_tdata * const tdata = elf_tdata (abfd);
Elf_Internal_Ehdr * const i_ehdrp = elf_elfheader (abfd);
Elf_Internal_Shdr ** const i_shdrpp = elf_elfsections (abfd);
+ unsigned int num_sec = elf_numsections (abfd);
file_ptr off;
struct elf_backend_data *bed = get_elf_backend_data (abfd);
@@ -3176,24 +3763,27 @@ assign_file_positions_except_relocs (abfd)
/* We are not creating an executable, which means that we are
not creating a program header, and that the actual order of
the sections in the file is unimportant. */
- for (i = 1, hdrpp = i_shdrpp + 1; i < i_ehdrp->e_shnum; i++, hdrpp++)
+ for (i = 1, hdrpp = i_shdrpp + 1; i < num_sec; i++, hdrpp++)
{
Elf_Internal_Shdr *hdr;
hdr = *hdrpp;
- if (hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA)
- {
- hdr->sh_offset = -1;
- continue;
- }
- if (i == tdata->symtab_section
+ if (hdr->sh_type == SHT_REL
+ || hdr->sh_type == SHT_RELA
+ || i == tdata->symtab_section
+ || i == tdata->symtab_shndx_section
|| i == tdata->strtab_section)
{
hdr->sh_offset = -1;
- continue;
}
+ else
+ off = _bfd_elf_assign_file_position_for_section (hdr, off, true);
- off = _bfd_elf_assign_file_position_for_section (hdr, off, true);
+ if (i == SHN_LORESERVE - 1)
+ {
+ i += SHN_HIRESERVE + 1 - SHN_LORESERVE;
+ hdrpp += SHN_HIRESERVE + 1 - SHN_LORESERVE;
+ }
}
}
else
@@ -3209,7 +3799,7 @@ assign_file_positions_except_relocs (abfd)
/* Assign file positions for the other sections. */
off = elf_tdata (abfd)->next_file_pos;
- for (i = 1, hdrpp = i_shdrpp + 1; i < i_ehdrp->e_shnum; i++, hdrpp++)
+ for (i = 1, hdrpp = i_shdrpp + 1; i < num_sec; i++, hdrpp++)
{
Elf_Internal_Shdr *hdr;
@@ -3235,10 +3825,17 @@ assign_file_positions_except_relocs (abfd)
else if (hdr->sh_type == SHT_REL
|| hdr->sh_type == SHT_RELA
|| hdr == i_shdrpp[tdata->symtab_section]
+ || hdr == i_shdrpp[tdata->symtab_shndx_section]
|| hdr == i_shdrpp[tdata->strtab_section])
hdr->sh_offset = -1;
else
off = _bfd_elf_assign_file_position_for_section (hdr, off, true);
+
+ if (i == SHN_LORESERVE - 1)
+ {
+ i += SHN_HIRESERVE + 1 - SHN_LORESERVE;
+ hdrpp += SHN_HIRESERVE + 1 - SHN_LORESERVE;
+ }
}
}
@@ -3260,13 +3857,13 @@ prep_headers (abfd)
Elf_Internal_Phdr *i_phdrp = 0; /* Program header table, internal form */
Elf_Internal_Shdr **i_shdrp; /* Section header table, internal form */
int count;
- struct bfd_strtab_hash *shstrtab;
+ struct elf_strtab_hash *shstrtab;
struct elf_backend_data *bed = get_elf_backend_data (abfd);
i_ehdrp = elf_elfheader (abfd);
i_shdrp = elf_elfsections (abfd);
- shstrtab = _bfd_elf_stringtab_init ();
+ shstrtab = _bfd_elf_strtab_init ();
if (shstrtab == NULL)
return false;
@@ -3302,104 +3899,22 @@ prep_headers (abfd)
case bfd_arch_unknown:
i_ehdrp->e_machine = EM_NONE;
break;
- case bfd_arch_sparc:
- if (bfd_get_arch_size (abfd) == 64)
- i_ehdrp->e_machine = EM_SPARCV9;
- else
- i_ehdrp->e_machine = EM_SPARC;
- break;
- case bfd_arch_i370:
- i_ehdrp->e_machine = EM_S370;
- break;
- case bfd_arch_i386:
- if (bfd_get_arch_size (abfd) == 64)
- i_ehdrp->e_machine = EM_X86_64;
- else
- i_ehdrp->e_machine = EM_386;
- break;
- case bfd_arch_ia64:
- i_ehdrp->e_machine = EM_IA_64;
- break;
- case bfd_arch_m68hc11:
- i_ehdrp->e_machine = EM_68HC11;
- break;
- case bfd_arch_m68hc12:
- i_ehdrp->e_machine = EM_68HC12;
- break;
- case bfd_arch_m68k:
- i_ehdrp->e_machine = EM_68K;
- break;
- case bfd_arch_m88k:
- i_ehdrp->e_machine = EM_88K;
- break;
- case bfd_arch_i860:
- i_ehdrp->e_machine = EM_860;
- break;
- case bfd_arch_i960:
- i_ehdrp->e_machine = EM_960;
- break;
- case bfd_arch_mips: /* MIPS Rxxxx */
- i_ehdrp->e_machine = EM_MIPS; /* only MIPS R3000 */
- break;
- case bfd_arch_hppa:
- i_ehdrp->e_machine = EM_PARISC;
- break;
- case bfd_arch_powerpc:
- i_ehdrp->e_machine = EM_PPC;
- break;
- case bfd_arch_alpha:
- i_ehdrp->e_machine = EM_ALPHA;
- break;
- case bfd_arch_sh:
- i_ehdrp->e_machine = EM_SH;
- break;
- case bfd_arch_d10v:
- i_ehdrp->e_machine = EM_CYGNUS_D10V;
- break;
- case bfd_arch_d30v:
- i_ehdrp->e_machine = EM_CYGNUS_D30V;
- break;
- case bfd_arch_fr30:
- i_ehdrp->e_machine = EM_CYGNUS_FR30;
- break;
- case bfd_arch_mcore:
- i_ehdrp->e_machine = EM_MCORE;
- break;
- case bfd_arch_avr:
- i_ehdrp->e_machine = EM_AVR;
- break;
- case bfd_arch_v850:
- switch (bfd_get_mach (abfd))
- {
- default:
- case 0: i_ehdrp->e_machine = EM_CYGNUS_V850; break;
- }
- break;
- case bfd_arch_arc:
- i_ehdrp->e_machine = EM_CYGNUS_ARC;
- break;
- case bfd_arch_arm:
- i_ehdrp->e_machine = EM_ARM;
- break;
- case bfd_arch_m32r:
- i_ehdrp->e_machine = EM_CYGNUS_M32R;
- break;
- case bfd_arch_mn10200:
- i_ehdrp->e_machine = EM_CYGNUS_MN10200;
- break;
- case bfd_arch_mn10300:
- i_ehdrp->e_machine = EM_CYGNUS_MN10300;
- break;
- case bfd_arch_pj:
- i_ehdrp->e_machine = EM_PJ;
- break;
- case bfd_arch_cris:
- i_ehdrp->e_machine = EM_CRIS;
- break;
- /* Also note that EM_M32, AT&T WE32100 is unknown to bfd. */
+
+ /* There used to be a long list of cases here, each one setting
+ e_machine to the same EM_* macro #defined as ELF_MACHINE_CODE
+ in the corresponding bfd definition. To avoid duplication,
+ the switch was removed. Machines that need special handling
+ can generally do it in elf_backend_final_write_processing(),
+ unless they need the information earlier than the final write.
+ Such need can generally be supplied by replacing the tests for
+ e_machine with the conditions used to determine it. */
default:
- i_ehdrp->e_machine = EM_NONE;
- }
+ if (get_elf_backend_data (abfd) != NULL)
+ i_ehdrp->e_machine = get_elf_backend_data (abfd)->elf_machine_code;
+ else
+ i_ehdrp->e_machine = EM_NONE;
+ }
+
i_ehdrp->e_version = bed->s->ev_current;
i_ehdrp->e_ehsize = bed->s->sizeof_ehdr;
@@ -3434,11 +3949,11 @@ prep_headers (abfd)
}
elf_tdata (abfd)->symtab_hdr.sh_name =
- (unsigned int) _bfd_stringtab_add (shstrtab, ".symtab", true, false);
+ (unsigned int) _bfd_elf_strtab_add (shstrtab, ".symtab", false);
elf_tdata (abfd)->strtab_hdr.sh_name =
- (unsigned int) _bfd_stringtab_add (shstrtab, ".strtab", true, false);
+ (unsigned int) _bfd_elf_strtab_add (shstrtab, ".strtab", false);
elf_tdata (abfd)->shstrtab_hdr.sh_name =
- (unsigned int) _bfd_stringtab_add (shstrtab, ".shstrtab", true, false);
+ (unsigned int) _bfd_elf_strtab_add (shstrtab, ".shstrtab", false);
if (elf_tdata (abfd)->symtab_hdr.sh_name == (unsigned int) -1
|| elf_tdata (abfd)->symtab_hdr.sh_name == (unsigned int) -1
|| elf_tdata (abfd)->shstrtab_hdr.sh_name == (unsigned int) -1)
@@ -3455,14 +3970,13 @@ _bfd_elf_assign_file_positions_for_relocs (abfd)
bfd *abfd;
{
file_ptr off;
- unsigned int i;
+ unsigned int i, num_sec;
Elf_Internal_Shdr **shdrpp;
off = elf_tdata (abfd)->next_file_pos;
- for (i = 1, shdrpp = elf_elfsections (abfd) + 1;
- i < elf_elfheader (abfd)->e_shnum;
- i++, shdrpp++)
+ num_sec = elf_numsections (abfd);
+ for (i = 1, shdrpp = elf_elfsections (abfd) + 1; i < num_sec; i++, shdrpp++)
{
Elf_Internal_Shdr *shdrp;
@@ -3483,7 +3997,7 @@ _bfd_elf_write_object_contents (abfd)
Elf_Internal_Ehdr *i_ehdrp;
Elf_Internal_Shdr **i_shdrp;
boolean failed;
- unsigned int count;
+ unsigned int count, num_sec;
if (! abfd->output_has_begun
&& ! _bfd_elf_compute_section_file_positions
@@ -3501,23 +4015,26 @@ _bfd_elf_write_object_contents (abfd)
_bfd_elf_assign_file_positions_for_relocs (abfd);
/* After writing the headers, we need to write the sections too... */
- for (count = 1; count < i_ehdrp->e_shnum; count++)
+ num_sec = elf_numsections (abfd);
+ for (count = 1; count < num_sec; count++)
{
if (bed->elf_backend_section_processing)
(*bed->elf_backend_section_processing) (abfd, i_shdrp[count]);
if (i_shdrp[count]->contents)
{
+ bfd_size_type amt = i_shdrp[count]->sh_size;
+
if (bfd_seek (abfd, i_shdrp[count]->sh_offset, SEEK_SET) != 0
- || (bfd_write (i_shdrp[count]->contents, i_shdrp[count]->sh_size,
- 1, abfd)
- != i_shdrp[count]->sh_size))
+ || bfd_bwrite (i_shdrp[count]->contents, amt, abfd) != amt)
return false;
}
+ if (count == SHN_LORESERVE - 1)
+ count += SHN_HIRESERVE + 1 - SHN_LORESERVE;
}
/* Write out the section header names. */
if (bfd_seek (abfd, elf_tdata (abfd)->shstrtab_hdr.sh_offset, SEEK_SET) != 0
- || ! _bfd_stringtab_emit (abfd, elf_shstrtab (abfd)))
+ || ! _bfd_elf_strtab_emit (abfd, elf_shstrtab (abfd)))
return false;
if (bed->elf_backend_final_write_processing)
@@ -3542,43 +4059,47 @@ _bfd_elf_section_from_bfd_section (abfd, asect)
bfd *abfd;
struct sec *asect;
{
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
- Elf_Internal_Shdr **i_shdrp = elf_elfsections (abfd);
+ struct elf_backend_data *bed;
int index;
- Elf_Internal_Shdr *hdr;
- int maxindex = elf_elfheader (abfd)->e_shnum;
- for (index = 0; index < maxindex; index++)
- {
- hdr = i_shdrp[index];
- if (hdr->bfd_section == asect)
- return index;
- }
+ if (elf_section_data (asect) != NULL
+ && elf_section_data (asect)->this_idx != 0)
+ return elf_section_data (asect)->this_idx;
- if (bed->elf_backend_section_from_bfd_section)
+ if (bfd_is_abs_section (asect))
+ index = SHN_ABS;
+ else if (bfd_is_com_section (asect))
+ index = SHN_COMMON;
+ else if (bfd_is_und_section (asect))
+ index = SHN_UNDEF;
+ else
{
- for (index = 0; index < maxindex; index++)
+ Elf_Internal_Shdr **i_shdrp = elf_elfsections (abfd);
+ int maxindex = elf_numsections (abfd);
+
+ for (index = 1; index < maxindex; index++)
{
- int retval;
+ Elf_Internal_Shdr *hdr = i_shdrp[index];
- hdr = i_shdrp[index];
- retval = index;
- if ((*bed->elf_backend_section_from_bfd_section)
- (abfd, hdr, asect, &retval))
- return retval;
+ if (hdr != NULL && hdr->bfd_section == asect)
+ return index;
}
+ index = -1;
}
- if (bfd_is_abs_section (asect))
- return SHN_ABS;
- if (bfd_is_com_section (asect))
- return SHN_COMMON;
- if (bfd_is_und_section (asect))
- return SHN_UNDEF;
+ bed = get_elf_backend_data (abfd);
+ if (bed->elf_backend_section_from_bfd_section)
+ {
+ int retval = index;
- bfd_set_error (bfd_error_nonrepresentable_section);
+ if ((*bed->elf_backend_section_from_bfd_section) (abfd, asect, &retval))
+ return retval;
+ }
+
+ if (index == -1)
+ bfd_set_error (bfd_error_nonrepresentable_section);
- return -1;
+ return index;
}
/* Given a BFD symbol, return the index in the ELF symbol table, or -1
@@ -3608,7 +4129,8 @@ _bfd_elf_symbol_from_bfd_symbol (abfd, asym_ptr_ptr)
indx = asym_ptr->section->output_section->index;
else
indx = asym_ptr->section->index;
- if (elf_section_syms (abfd)[indx])
+ if (indx < elf_num_section_syms (abfd)
+ && elf_section_syms (abfd)[indx] != NULL)
asym_ptr->udata.i = elf_section_syms (abfd)[indx]->udata.i;
}
@@ -3620,7 +4142,7 @@ _bfd_elf_symbol_from_bfd_symbol (abfd, asym_ptr_ptr)
which is used in a relocation entry. */
(*_bfd_error_handler)
(_("%s: symbol `%s' required but not present"),
- bfd_get_filename (abfd), bfd_asymbol_name (asym_ptr));
+ bfd_archive_filename (abfd), bfd_asymbol_name (asym_ptr));
bfd_set_error (bfd_error_no_symbols);
return -1;
}
@@ -3715,16 +4237,19 @@ copy_private_bfd_data (ibfd, obfd)
/* Decide if the given section should be included in the given segment.
A section will be included if:
- 1. It is within the address space of the segment,
+ 1. It is within the address space of the segment -- we use the LMA
+ if that is set for the segment and the VMA otherwise,
2. It is an allocated segment,
3. There is an output section associated with it,
4. The section has not already been allocated to a previous segment. */
-#define INCLUDE_SECTION_IN_SEGMENT(section, segment) \
- ((((IS_CONTAINED_BY_VMA (section, segment) \
- || IS_SOLARIS_PT_INTERP (segment, section)) \
- && (section->flags & SEC_ALLOC) != 0) \
- || IS_COREFILE_NOTE (segment, section)) \
- && section->output_section != NULL \
+#define INCLUDE_SECTION_IN_SEGMENT(section, segment) \
+ (((((segment->p_paddr \
+ ? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \
+ : IS_CONTAINED_BY_VMA (section, segment)) \
+ || IS_SOLARIS_PT_INTERP (segment, section)) \
+ && (section->flags & SEC_ALLOC) != 0) \
+ || IS_COREFILE_NOTE (segment, section)) \
+ && section->output_section != NULL \
&& section->segment_mark == false)
/* Returns true iff seg1 starts after the end of seg2. */
@@ -3741,7 +4266,7 @@ copy_private_bfd_data (ibfd, obfd)
/* Scan through the segments specified in the program header
of the input BFD. For this first scan we look for overlaps
- in the loadable segments. These can be created by wierd
+ in the loadable segments. These can be created by weird
parameters to objcopy. */
for (i = 0, segment = elf_tdata (ibfd)->phdr;
i < num_segments;
@@ -3815,6 +4340,7 @@ copy_private_bfd_data (ibfd, obfd)
bfd_vma matching_lma;
bfd_vma suggested_lma;
unsigned int j;
+ bfd_size_type amt;
if (segment->p_type == PT_NULL)
continue;
@@ -3827,10 +4353,9 @@ copy_private_bfd_data (ibfd, obfd)
/* Allocate a segment map big enough to contain all of the
sections we have selected. */
- map = ((struct elf_segment_map *)
- bfd_alloc (obfd,
- (sizeof (struct elf_segment_map)
- + ((size_t) section_count - 1) * sizeof (asection *))));
+ amt = sizeof (struct elf_segment_map);
+ amt += ((bfd_size_type) section_count - 1) * sizeof (asection *);
+ map = (struct elf_segment_map *) bfd_alloc (obfd, amt);
if (map == NULL)
return false;
@@ -3870,7 +4395,7 @@ copy_private_bfd_data (ibfd, obfd)
if (segment->p_type == PT_LOAD)
_bfd_error_handler
(_("%s: warning: Empty loadable segment detected\n"),
- bfd_get_filename (ibfd));
+ bfd_archive_filename (ibfd));
map->count = 0;
*pointer_to_map = map;
@@ -3907,8 +4432,8 @@ copy_private_bfd_data (ibfd, obfd)
pointers that we are interested in. As these sections get assigned
to a segment, they are removed from this array. */
- sections = (asection **) bfd_malloc
- (sizeof (asection *) * section_count);
+ amt = (bfd_size_type) section_count * sizeof (asection *);
+ sections = (asection **) bfd_malloc (amt);
if (sections == NULL)
return false;
@@ -3944,7 +4469,8 @@ copy_private_bfd_data (ibfd, obfd)
? iehdr->e_ehsize
: 0)
+ (map->includes_phdrs
- ? iehdr->e_phnum * iehdr->e_phentsize
+ ? (iehdr->e_phnum
+ * iehdr->e_phentsize)
: 0))))
map->p_paddr = segment->p_vaddr;
@@ -4069,9 +4595,11 @@ copy_private_bfd_data (ibfd, obfd)
/* If the gap between the end of the previous section
and the start of this section is more than
maxpagesize then we need to start a new segment. */
- if ((BFD_ALIGN (prev_sec->lma + prev_sec->_raw_size, maxpagesize)
+ if ((BFD_ALIGN (prev_sec->lma + prev_sec->_raw_size,
+ maxpagesize)
< BFD_ALIGN (output_section->lma, maxpagesize))
- || ((prev_sec->lma + prev_sec->_raw_size) > output_section->lma))
+ || ((prev_sec->lma + prev_sec->_raw_size)
+ > output_section->lma))
{
if (suggested_lma == 0)
suggested_lma = output_section->lma;
@@ -4100,11 +4628,9 @@ copy_private_bfd_data (ibfd, obfd)
/* We still have not allocated all of the sections to
segments. Create a new segment here, initialise it
and carry on looping. */
- map = ((struct elf_segment_map *)
- bfd_alloc (obfd,
- (sizeof (struct elf_segment_map)
- + ((size_t) section_count - 1)
- * sizeof (asection *))));
+ amt = sizeof (struct elf_segment_map);
+ amt += ((bfd_size_type) section_count - 1) * sizeof (asection *);
+ map = (struct elf_segment_map *) bfd_alloc (obfd, amt);
if (map == NULL)
return false;
@@ -4142,7 +4668,7 @@ copy_private_bfd_data (ibfd, obfd)
elf_tdata (obfd)->segment_map = map_first;
/* If we had to estimate the number of program headers that were
- going to be needed, then check our estimate know and adjust
+ going to be needed, then check our estimate now and adjust
the offset if necessary. */
if (phdr_adjust_seg != NULL)
{
@@ -4255,10 +4781,11 @@ _bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec)
section indices; these definitions are interpreted by the
swap_out_syms function. */
-#define MAP_ONESYMTAB (SHN_LORESERVE - 1)
-#define MAP_DYNSYMTAB (SHN_LORESERVE - 2)
-#define MAP_STRTAB (SHN_LORESERVE - 3)
-#define MAP_SHSTRTAB (SHN_LORESERVE - 4)
+#define MAP_ONESYMTAB (SHN_HIOS + 1)
+#define MAP_DYNSYMTAB (SHN_HIOS + 2)
+#define MAP_STRTAB (SHN_HIOS + 3)
+#define MAP_SHSTRTAB (SHN_HIOS + 4)
+#define MAP_SYM_SHNDX (SHN_HIOS + 5)
boolean
_bfd_elf_copy_private_symbol_data (ibfd, isymarg, obfd, osymarg)
@@ -4291,6 +4818,8 @@ _bfd_elf_copy_private_symbol_data (ibfd, isymarg, obfd, osymarg)
shndx = MAP_STRTAB;
else if (shndx == elf_tdata (ibfd)->shstrtab_section)
shndx = MAP_SHSTRTAB;
+ else if (shndx == elf_tdata (ibfd)->symtab_shndx_section)
+ shndx = MAP_SYM_SHNDX;
osym->internal_elf_sym.st_shndx = shndx;
}
@@ -4305,217 +4834,250 @@ swap_out_syms (abfd, sttp, relocatable_p)
struct bfd_strtab_hash **sttp;
int relocatable_p;
{
- struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ struct elf_backend_data *bed;
+ int symcount;
+ asymbol **syms;
+ struct bfd_strtab_hash *stt;
+ Elf_Internal_Shdr *symtab_hdr;
+ Elf_Internal_Shdr *symtab_shndx_hdr;
+ Elf_Internal_Shdr *symstrtab_hdr;
+ char *outbound_syms;
+ char *outbound_shndx;
+ int idx;
+ bfd_size_type amt;
if (!elf_map_symbols (abfd))
return false;
/* Dump out the symtabs. */
- {
- int symcount = bfd_get_symcount (abfd);
- asymbol **syms = bfd_get_outsymbols (abfd);
- struct bfd_strtab_hash *stt;
- Elf_Internal_Shdr *symtab_hdr;
- Elf_Internal_Shdr *symstrtab_hdr;
- char *outbound_syms;
- int idx;
-
- stt = _bfd_elf_stringtab_init ();
- if (stt == NULL)
- return false;
+ stt = _bfd_elf_stringtab_init ();
+ if (stt == NULL)
+ return false;
- symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- symtab_hdr->sh_type = SHT_SYMTAB;
- symtab_hdr->sh_entsize = bed->s->sizeof_sym;
- symtab_hdr->sh_size = symtab_hdr->sh_entsize * (symcount + 1);
- symtab_hdr->sh_info = elf_num_locals (abfd) + 1;
- symtab_hdr->sh_addralign = bed->s->file_align;
+ bed = get_elf_backend_data (abfd);
+ symcount = bfd_get_symcount (abfd);
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ symtab_hdr->sh_type = SHT_SYMTAB;
+ symtab_hdr->sh_entsize = bed->s->sizeof_sym;
+ symtab_hdr->sh_size = symtab_hdr->sh_entsize * (symcount + 1);
+ symtab_hdr->sh_info = elf_num_locals (abfd) + 1;
+ symtab_hdr->sh_addralign = bed->s->file_align;
+
+ symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr;
+ symstrtab_hdr->sh_type = SHT_STRTAB;
+
+ amt = (bfd_size_type) (1 + symcount) * bed->s->sizeof_sym;
+ outbound_syms = bfd_alloc (abfd, amt);
+ if (outbound_syms == NULL)
+ return false;
+ symtab_hdr->contents = (PTR) outbound_syms;
- symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr;
- symstrtab_hdr->sh_type = SHT_STRTAB;
+ outbound_shndx = NULL;
+ symtab_shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
+ if (symtab_shndx_hdr->sh_name != 0)
+ {
+ amt = (bfd_size_type) (1 + symcount) * sizeof (Elf_External_Sym_Shndx);
+ outbound_shndx = bfd_alloc (abfd, amt);
+ if (outbound_shndx == NULL)
+ return false;
+ memset (outbound_shndx, 0, (unsigned long) amt);
+ symtab_shndx_hdr->contents = outbound_shndx;
+ symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX;
+ symtab_shndx_hdr->sh_size = amt;
+ symtab_shndx_hdr->sh_addralign = sizeof (Elf_External_Sym_Shndx);
+ symtab_shndx_hdr->sh_entsize = sizeof (Elf_External_Sym_Shndx);
+ }
- outbound_syms = bfd_alloc (abfd,
- (1 + symcount) * bed->s->sizeof_sym);
- if (outbound_syms == NULL)
- return false;
- symtab_hdr->contents = (PTR) outbound_syms;
+ /* now generate the data (for "contents") */
+ {
+ /* Fill in zeroth symbol and swap it out. */
+ Elf_Internal_Sym sym;
+ sym.st_name = 0;
+ sym.st_value = 0;
+ sym.st_size = 0;
+ sym.st_info = 0;
+ sym.st_other = 0;
+ sym.st_shndx = SHN_UNDEF;
+ bed->s->swap_symbol_out (abfd, &sym, outbound_syms, outbound_shndx);
+ outbound_syms += bed->s->sizeof_sym;
+ if (outbound_shndx != NULL)
+ outbound_shndx += sizeof (Elf_External_Sym_Shndx);
+ }
- /* now generate the data (for "contents") */
+ syms = bfd_get_outsymbols (abfd);
+ for (idx = 0; idx < symcount; idx++)
{
- /* Fill in zeroth symbol and swap it out. */
Elf_Internal_Sym sym;
- sym.st_name = 0;
- sym.st_value = 0;
- sym.st_size = 0;
- sym.st_info = 0;
- sym.st_other = 0;
- sym.st_shndx = SHN_UNDEF;
- bed->s->swap_symbol_out (abfd, &sym, (PTR) outbound_syms);
- outbound_syms += bed->s->sizeof_sym;
- }
- for (idx = 0; idx < symcount; idx++)
- {
- Elf_Internal_Sym sym;
- bfd_vma value = syms[idx]->value;
- elf_symbol_type *type_ptr;
- flagword flags = syms[idx]->flags;
- int type;
+ bfd_vma value = syms[idx]->value;
+ elf_symbol_type *type_ptr;
+ flagword flags = syms[idx]->flags;
+ int type;
- if ((flags & BSF_SECTION_SYM) != 0)
- {
- /* Section symbols have no name. */
- sym.st_name = 0;
- }
- else
- {
- sym.st_name = (unsigned long) _bfd_stringtab_add (stt,
- syms[idx]->name,
- true, false);
- if (sym.st_name == (unsigned long) -1)
- return false;
- }
+ if ((flags & (BSF_SECTION_SYM | BSF_GLOBAL)) == BSF_SECTION_SYM)
+ {
+ /* Local section symbols have no name. */
+ sym.st_name = 0;
+ }
+ else
+ {
+ sym.st_name = (unsigned long) _bfd_stringtab_add (stt,
+ syms[idx]->name,
+ true, false);
+ if (sym.st_name == (unsigned long) -1)
+ return false;
+ }
- type_ptr = elf_symbol_from (abfd, syms[idx]);
+ type_ptr = elf_symbol_from (abfd, syms[idx]);
- if ((flags & BSF_SECTION_SYM) == 0
- && bfd_is_com_section (syms[idx]->section))
- {
- /* ELF common symbols put the alignment into the `value' field,
- and the size into the `size' field. This is backwards from
- how BFD handles it, so reverse it here. */
- sym.st_size = value;
- if (type_ptr == NULL
- || type_ptr->internal_elf_sym.st_value == 0)
- sym.st_value = value >= 16 ? 16 : (1 << bfd_log2 (value));
- else
- sym.st_value = type_ptr->internal_elf_sym.st_value;
- sym.st_shndx = _bfd_elf_section_from_bfd_section
- (abfd, syms[idx]->section);
- }
- else
- {
- asection *sec = syms[idx]->section;
- int shndx;
+ if ((flags & BSF_SECTION_SYM) == 0
+ && bfd_is_com_section (syms[idx]->section))
+ {
+ /* ELF common symbols put the alignment into the `value' field,
+ and the size into the `size' field. This is backwards from
+ how BFD handles it, so reverse it here. */
+ sym.st_size = value;
+ if (type_ptr == NULL
+ || type_ptr->internal_elf_sym.st_value == 0)
+ sym.st_value = value >= 16 ? 16 : (1 << bfd_log2 (value));
+ else
+ sym.st_value = type_ptr->internal_elf_sym.st_value;
+ sym.st_shndx = _bfd_elf_section_from_bfd_section
+ (abfd, syms[idx]->section);
+ }
+ else
+ {
+ asection *sec = syms[idx]->section;
+ int shndx;
- if (sec->output_section)
- {
- value += sec->output_offset;
- sec = sec->output_section;
- }
- /* Don't add in the section vma for relocatable output. */
- if (! relocatable_p)
- value += sec->vma;
- sym.st_value = value;
- sym.st_size = type_ptr ? type_ptr->internal_elf_sym.st_size : 0;
-
- if (bfd_is_abs_section (sec)
- && type_ptr != NULL
- && type_ptr->internal_elf_sym.st_shndx != 0)
- {
- /* This symbol is in a real ELF section which we did
- not create as a BFD section. Undo the mapping done
- by copy_private_symbol_data. */
- shndx = type_ptr->internal_elf_sym.st_shndx;
- switch (shndx)
- {
- case MAP_ONESYMTAB:
- shndx = elf_onesymtab (abfd);
- break;
- case MAP_DYNSYMTAB:
- shndx = elf_dynsymtab (abfd);
- break;
- case MAP_STRTAB:
- shndx = elf_tdata (abfd)->strtab_section;
- break;
- case MAP_SHSTRTAB:
- shndx = elf_tdata (abfd)->shstrtab_section;
- break;
- default:
- break;
- }
- }
- else
- {
- shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
+ if (sec->output_section)
+ {
+ value += sec->output_offset;
+ sec = sec->output_section;
+ }
+ /* Don't add in the section vma for relocatable output. */
+ if (! relocatable_p)
+ value += sec->vma;
+ sym.st_value = value;
+ sym.st_size = type_ptr ? type_ptr->internal_elf_sym.st_size : 0;
+
+ if (bfd_is_abs_section (sec)
+ && type_ptr != NULL
+ && type_ptr->internal_elf_sym.st_shndx != 0)
+ {
+ /* This symbol is in a real ELF section which we did
+ not create as a BFD section. Undo the mapping done
+ by copy_private_symbol_data. */
+ shndx = type_ptr->internal_elf_sym.st_shndx;
+ switch (shndx)
+ {
+ case MAP_ONESYMTAB:
+ shndx = elf_onesymtab (abfd);
+ break;
+ case MAP_DYNSYMTAB:
+ shndx = elf_dynsymtab (abfd);
+ break;
+ case MAP_STRTAB:
+ shndx = elf_tdata (abfd)->strtab_section;
+ break;
+ case MAP_SHSTRTAB:
+ shndx = elf_tdata (abfd)->shstrtab_section;
+ break;
+ case MAP_SYM_SHNDX:
+ shndx = elf_tdata (abfd)->symtab_shndx_section;
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
- if (shndx == -1)
- {
- asection *sec2;
-
- /* Writing this would be a hell of a lot easier if
- we had some decent documentation on bfd, and
- knew what to expect of the library, and what to
- demand of applications. For example, it
- appears that `objcopy' might not set the
- section of a symbol to be a section that is
- actually in the output file. */
- sec2 = bfd_get_section_by_name (abfd, sec->name);
- BFD_ASSERT (sec2 != 0);
- shndx = _bfd_elf_section_from_bfd_section (abfd, sec2);
- BFD_ASSERT (shndx != -1);
- }
- }
+ if (shndx == -1)
+ {
+ asection *sec2;
+
+ /* Writing this would be a hell of a lot easier if
+ we had some decent documentation on bfd, and
+ knew what to expect of the library, and what to
+ demand of applications. For example, it
+ appears that `objcopy' might not set the
+ section of a symbol to be a section that is
+ actually in the output file. */
+ sec2 = bfd_get_section_by_name (abfd, sec->name);
+ BFD_ASSERT (sec2 != 0);
+ shndx = _bfd_elf_section_from_bfd_section (abfd, sec2);
+ BFD_ASSERT (shndx != -1);
+ }
+ }
- sym.st_shndx = shndx;
- }
+ sym.st_shndx = shndx;
+ }
- if ((flags & BSF_FUNCTION) != 0)
- type = STT_FUNC;
- else if ((flags & BSF_OBJECT) != 0)
- type = STT_OBJECT;
- else
- type = STT_NOTYPE;
-
- /* Processor-specific types */
- if (type_ptr != NULL
- && bed->elf_backend_get_symbol_type)
- type = (*bed->elf_backend_get_symbol_type) (&type_ptr->internal_elf_sym, type);
-
- if (flags & BSF_SECTION_SYM)
- sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
- else if (bfd_is_com_section (syms[idx]->section))
- sym.st_info = ELF_ST_INFO (STB_GLOBAL, type);
- else if (bfd_is_und_section (syms[idx]->section))
- sym.st_info = ELF_ST_INFO (((flags & BSF_WEAK)
- ? STB_WEAK
- : STB_GLOBAL),
- type);
- else if (flags & BSF_FILE)
- sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE);
- else
- {
- int bind = STB_LOCAL;
+ if ((flags & BSF_FUNCTION) != 0)
+ type = STT_FUNC;
+ else if ((flags & BSF_OBJECT) != 0)
+ type = STT_OBJECT;
+ else
+ type = STT_NOTYPE;
- if (flags & BSF_LOCAL)
- bind = STB_LOCAL;
- else if (flags & BSF_WEAK)
- bind = STB_WEAK;
- else if (flags & BSF_GLOBAL)
- bind = STB_GLOBAL;
+ /* Processor-specific types */
+ if (type_ptr != NULL
+ && bed->elf_backend_get_symbol_type)
+ type = ((*bed->elf_backend_get_symbol_type)
+ (&type_ptr->internal_elf_sym, type));
- sym.st_info = ELF_ST_INFO (bind, type);
- }
+ if (flags & BSF_SECTION_SYM)
+ {
+ if (flags & BSF_GLOBAL)
+ sym.st_info = ELF_ST_INFO (STB_GLOBAL, STT_SECTION);
+ else
+ sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
+ }
+ else if (bfd_is_com_section (syms[idx]->section))
+ sym.st_info = ELF_ST_INFO (STB_GLOBAL, type);
+ else if (bfd_is_und_section (syms[idx]->section))
+ sym.st_info = ELF_ST_INFO (((flags & BSF_WEAK)
+ ? STB_WEAK
+ : STB_GLOBAL),
+ type);
+ else if (flags & BSF_FILE)
+ sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE);
+ else
+ {
+ int bind = STB_LOCAL;
- if (type_ptr != NULL)
- sym.st_other = type_ptr->internal_elf_sym.st_other;
- else
- sym.st_other = 0;
+ if (flags & BSF_LOCAL)
+ bind = STB_LOCAL;
+ else if (flags & BSF_WEAK)
+ bind = STB_WEAK;
+ else if (flags & BSF_GLOBAL)
+ bind = STB_GLOBAL;
- bed->s->swap_symbol_out (abfd, &sym, (PTR) outbound_syms);
- outbound_syms += bed->s->sizeof_sym;
- }
+ sym.st_info = ELF_ST_INFO (bind, type);
+ }
- *sttp = stt;
- symstrtab_hdr->sh_size = _bfd_stringtab_size (stt);
- symstrtab_hdr->sh_type = SHT_STRTAB;
+ if (type_ptr != NULL)
+ sym.st_other = type_ptr->internal_elf_sym.st_other;
+ else
+ sym.st_other = 0;
- symstrtab_hdr->sh_flags = 0;
- symstrtab_hdr->sh_addr = 0;
- symstrtab_hdr->sh_entsize = 0;
- symstrtab_hdr->sh_link = 0;
- symstrtab_hdr->sh_info = 0;
- symstrtab_hdr->sh_addralign = 1;
- }
+ bed->s->swap_symbol_out (abfd, &sym, outbound_syms, outbound_shndx);
+ outbound_syms += bed->s->sizeof_sym;
+ if (outbound_shndx != NULL)
+ outbound_shndx += sizeof (Elf_External_Sym_Shndx);
+ }
+
+ *sttp = stt;
+ symstrtab_hdr->sh_size = _bfd_stringtab_size (stt);
+ symstrtab_hdr->sh_type = SHT_STRTAB;
+
+ symstrtab_hdr->sh_flags = 0;
+ symstrtab_hdr->sh_addr = 0;
+ symstrtab_hdr->sh_entsize = 0;
+ symstrtab_hdr->sh_link = 0;
+ symstrtab_hdr->sh_info = 0;
+ symstrtab_hdr->sh_addralign = 1;
return true;
}
@@ -4579,11 +5141,9 @@ _bfd_elf_canonicalize_reloc (abfd, section, relptr, symbols)
{
arelent *tblptr;
unsigned int i;
+ struct elf_backend_data *bed = get_elf_backend_data (abfd);
- if (! get_elf_backend_data (abfd)->s->slurp_reloc_table (abfd,
- section,
- symbols,
- false))
+ if (! bed->s->slurp_reloc_table (abfd, section, symbols, false))
return -1;
tblptr = section->relocation;
@@ -4600,8 +5160,8 @@ _bfd_elf_get_symtab (abfd, alocation)
bfd *abfd;
asymbol **alocation;
{
- long symcount = get_elf_backend_data (abfd)->s->slurp_symbol_table
- (abfd, alocation, false);
+ struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ long symcount = bed->s->slurp_symbol_table (abfd, alocation, false);
if (symcount >= 0)
bfd_get_symcount (abfd) = symcount;
@@ -4613,8 +5173,8 @@ _bfd_elf_canonicalize_dynamic_symtab (abfd, alocation)
bfd *abfd;
asymbol **alocation;
{
- return get_elf_backend_data (abfd)->s->slurp_symbol_table
- (abfd, alocation, true);
+ struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ return bed->s->slurp_symbol_table (abfd, alocation, true);
}
/* Return the size required for the dynamic reloc entries. Any
@@ -4704,6 +5264,7 @@ _bfd_elf_slurp_version_tables (abfd)
bfd *abfd;
{
bfd_byte *contents = NULL;
+ bfd_size_type amt;
if (elf_dynverdef (abfd) != 0)
{
@@ -4721,7 +5282,7 @@ _bfd_elf_slurp_version_tables (abfd)
if (contents == NULL)
goto error_return;
if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
- || bfd_read ((PTR) contents, 1, hdr->sh_size, abfd) != hdr->sh_size)
+ || bfd_bread ((PTR) contents, hdr->sh_size, abfd) != hdr->sh_size)
goto error_return;
/* We know the number of entries in the section but not the maximum
@@ -4740,9 +5301,8 @@ _bfd_elf_slurp_version_tables (abfd)
((bfd_byte *) everdef + iverdefmem.vd_next));
}
- elf_tdata (abfd)->verdef =
- ((Elf_Internal_Verdef *)
- bfd_zalloc (abfd, maxidx * sizeof (Elf_Internal_Verdef)));
+ amt = (bfd_size_type) maxidx * sizeof (Elf_Internal_Verdef);
+ elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *) bfd_zalloc (abfd, amt);
if (elf_tdata (abfd)->verdef == NULL)
goto error_return;
@@ -4763,10 +5323,8 @@ _bfd_elf_slurp_version_tables (abfd)
iverdef->vd_bfd = abfd;
- iverdef->vd_auxptr = ((Elf_Internal_Verdaux *)
- bfd_alloc (abfd,
- (iverdef->vd_cnt
- * sizeof (Elf_Internal_Verdaux))));
+ amt = (bfd_size_type) iverdef->vd_cnt * sizeof (Elf_Internal_Verdaux);
+ iverdef->vd_auxptr = (Elf_Internal_Verdaux *) bfd_alloc (abfd, amt);
if (iverdef->vd_auxptr == NULL)
goto error_return;
@@ -4816,9 +5374,9 @@ _bfd_elf_slurp_version_tables (abfd)
hdr = &elf_tdata (abfd)->dynverref_hdr;
+ amt = (bfd_size_type) hdr->sh_info * sizeof (Elf_Internal_Verneed);
elf_tdata (abfd)->verref =
- ((Elf_Internal_Verneed *)
- bfd_zalloc (abfd, hdr->sh_info * sizeof (Elf_Internal_Verneed)));
+ (Elf_Internal_Verneed *) bfd_zalloc (abfd, amt);
if (elf_tdata (abfd)->verref == NULL)
goto error_return;
@@ -4828,7 +5386,7 @@ _bfd_elf_slurp_version_tables (abfd)
if (contents == NULL)
goto error_return;
if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
- || bfd_read ((PTR) contents, 1, hdr->sh_size, abfd) != hdr->sh_size)
+ || bfd_bread ((PTR) contents, hdr->sh_size, abfd) != hdr->sh_size)
goto error_return;
everneed = (Elf_External_Verneed *) contents;
@@ -4849,10 +5407,9 @@ _bfd_elf_slurp_version_tables (abfd)
if (iverneed->vn_filename == NULL)
goto error_return;
- iverneed->vn_auxptr =
- ((Elf_Internal_Vernaux *)
- bfd_alloc (abfd,
- iverneed->vn_cnt * sizeof (Elf_Internal_Vernaux)));
+ amt = iverneed->vn_cnt;
+ amt *= sizeof (Elf_Internal_Vernaux);
+ iverneed->vn_auxptr = (Elf_Internal_Vernaux *) bfd_alloc (abfd, amt);
evernaux = ((Elf_External_Vernaux *)
((bfd_byte *) everneed + iverneed->vn_aux));
@@ -4902,8 +5459,9 @@ _bfd_elf_make_empty_symbol (abfd)
bfd *abfd;
{
elf_symbol_type *newsym;
+ bfd_size_type amt = sizeof (elf_symbol_type);
- newsym = (elf_symbol_type *) bfd_zalloc (abfd, sizeof (elf_symbol_type));
+ newsym = (elf_symbol_type *) bfd_zalloc (abfd, amt);
if (!newsym)
return NULL;
else
@@ -5121,6 +5679,7 @@ _bfd_elf_set_section_contents (abfd, section, location, offset, count)
bfd_size_type count;
{
Elf_Internal_Shdr *hdr;
+ bfd_signed_vma pos;
if (! abfd->output_has_begun
&& ! _bfd_elf_compute_section_file_positions
@@ -5128,10 +5687,9 @@ _bfd_elf_set_section_contents (abfd, section, location, offset, count)
return false;
hdr = &elf_section_data (section)->this_hdr;
-
- if (bfd_seek (abfd, hdr->sh_offset + offset, SEEK_SET) == -1)
- return false;
- if (bfd_write (location, 1, count, abfd) != count)
+ pos = hdr->sh_offset + offset;
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0
+ || bfd_bwrite (location, count, abfd) != count)
return false;
return true;
@@ -5250,7 +5808,7 @@ _bfd_elf_validate_reloc (abfd, areloc)
fail:
(*_bfd_error_handler)
(_("%s: unsupported relocation type %s"),
- bfd_get_filename (abfd), areloc->howto->name);
+ bfd_archive_filename (abfd), areloc->howto->name);
bfd_set_error (bfd_error_bad_value);
return false;
}
@@ -5262,7 +5820,7 @@ _bfd_elf_close_and_cleanup (abfd)
if (bfd_get_format (abfd) == bfd_object)
{
if (elf_shstrtab (abfd) != NULL)
- _bfd_stringtab_free (elf_shstrtab (abfd));
+ _bfd_elf_strtab_free (elf_shstrtab (abfd));
}
return _bfd_generic_close_and_cleanup (abfd);
@@ -5295,12 +5853,6 @@ _bfd_elf_rel_vtable_reloc_fn (abfd, re, symbol, data, is, obfd, errmsg)
# include <sys/procfs.h>
#endif
-/* Define offsetof for those systems which lack it. */
-
-#ifndef offsetof
-# define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
-#endif
-
/* FIXME: this is kinda wrong, but it's what gdb wants. */
static int
@@ -5338,6 +5890,43 @@ elfcore_maybe_make_sect (abfd, name, sect)
return true;
}
+/* Create a pseudosection containing SIZE bytes at FILEPOS. This
+ actually creates up to two pseudosections:
+ - For the single-threaded case, a section named NAME, unless
+ such a section already exists.
+ - For the multi-threaded case, a section named "NAME/PID", where
+ PID is elfcore_make_pid (abfd).
+ Both pseudosections have identical contents. */
+boolean
+_bfd_elfcore_make_pseudosection (abfd, name, size, filepos)
+ bfd *abfd;
+ char *name;
+ size_t size;
+ ufile_ptr filepos;
+{
+ char buf[100];
+ char *threaded_name;
+ asection *sect;
+
+ /* Build the section name. */
+
+ sprintf (buf, "%s/%d", name, elfcore_make_pid (abfd));
+ threaded_name = bfd_alloc (abfd, (bfd_size_type) strlen (buf) + 1);
+ if (threaded_name == NULL)
+ return false;
+ strcpy (threaded_name, buf);
+
+ sect = bfd_make_section (abfd, threaded_name);
+ if (sect == NULL)
+ return false;
+ sect->_raw_size = size;
+ sect->filepos = filepos;
+ sect->flags = SEC_HAS_CONTENTS;
+ sect->alignment_power = 2;
+
+ return elfcore_maybe_make_sect (abfd, name, sect);
+}
+
/* prstatus_t exists on:
solaris 2.5+
linux 2.[01] + glibc
@@ -5345,15 +5934,14 @@ elfcore_maybe_make_sect (abfd, name, sect)
*/
#if defined (HAVE_PRSTATUS_T)
+static boolean elfcore_grok_prstatus PARAMS ((bfd *, Elf_Internal_Note *));
+
static boolean
elfcore_grok_prstatus (abfd, note)
bfd *abfd;
Elf_Internal_Note *note;
{
- char buf[100];
- char *name;
- asection *sect;
- int raw_size;
+ size_t raw_size;
int offset;
if (note->descsz == sizeof (prstatus_t))
@@ -5364,7 +5952,10 @@ elfcore_grok_prstatus (abfd, note)
offset = offsetof (prstatus_t, pr_reg);
memcpy (&prstat, note->descdata, sizeof (prstat));
- elf_tdata (abfd)->core_signal = prstat.pr_cursig;
+ /* Do not overwrite the core signal if it
+ has already been set by another thread. */
+ if (elf_tdata (abfd)->core_signal == 0)
+ elf_tdata (abfd)->core_signal = prstat.pr_cursig;
elf_tdata (abfd)->core_pid = prstat.pr_pid;
/* pr_who exists on:
@@ -5387,7 +5978,10 @@ elfcore_grok_prstatus (abfd, note)
offset = offsetof (prstatus32_t, pr_reg);
memcpy (&prstat, note->descdata, sizeof (prstat));
- elf_tdata (abfd)->core_signal = prstat.pr_cursig;
+ /* Do not overwrite the core signal if it
+ has already been set by another thread. */
+ if (elf_tdata (abfd)->core_signal == 0)
+ elf_tdata (abfd)->core_signal = prstat.pr_cursig;
elf_tdata (abfd)->core_pid = prstat.pr_pid;
/* pr_who exists on:
@@ -5408,69 +6002,21 @@ elfcore_grok_prstatus (abfd, note)
return true;
}
- /* Make a ".reg/999" section. */
-
- sprintf (buf, ".reg/%d", elfcore_make_pid (abfd));
- name = bfd_alloc (abfd, strlen (buf) + 1);
- if (name == NULL)
- return false;
- strcpy (name, buf);
-
- sect = bfd_make_section (abfd, name);
- if (sect == NULL)
- return false;
-
- sect->_raw_size = raw_size;
- sect->filepos = note->descpos + offset;
-
- sect->flags = SEC_HAS_CONTENTS;
- sect->alignment_power = 2;
-
- if (! elfcore_maybe_make_sect (abfd, ".reg", sect))
- return false;
-
- return true;
+ /* Make a ".reg/999" section and a ".reg" section. */
+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ raw_size, note->descpos + offset);
}
#endif /* defined (HAVE_PRSTATUS_T) */
-/* Create a pseudosection containing the exact contents of NOTE. This
- actually creates up to two pseudosections:
- - For the single-threaded case, a section named NAME, unless
- such a section already exists.
- - For the multi-threaded case, a section named "NAME/PID", where
- PID is elfcore_make_pid (abfd).
- Both pseudosections have identical contents: the contents of NOTE. */
-
+/* Create a pseudosection containing the exact contents of NOTE. */
static boolean
elfcore_make_note_pseudosection (abfd, name, note)
bfd *abfd;
char *name;
Elf_Internal_Note *note;
{
- char buf[100];
- char *threaded_name;
- asection *sect;
-
- /* Build the section name. */
-
- sprintf (buf, "%s/%d", name, elfcore_make_pid (abfd));
- threaded_name = bfd_alloc (abfd, strlen (buf) + 1);
- if (threaded_name == NULL)
- return false;
- strcpy (threaded_name, buf);
-
- sect = bfd_make_section (abfd, threaded_name);
- if (sect == NULL)
- return false;
- sect->_raw_size = note->descsz;
- sect->filepos = note->descpos;
- sect->flags = SEC_HAS_CONTENTS;
- sect->alignment_power = 2;
-
- if (! elfcore_maybe_make_sect (abfd, name, sect))
- return false;
-
- return true;
+ return _bfd_elfcore_make_pseudosection (abfd, name,
+ note->descsz, note->descpos);
}
/* There isn't a consistent prfpregset_t across platforms,
@@ -5511,37 +6057,38 @@ typedef psinfo32_t elfcore_psinfo32_t;
#endif
#endif
-#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
-
/* return a malloc'ed copy of a string at START which is at
most MAX bytes long, possibly without a terminating '\0'.
the copy will always have a terminating '\0'. */
-static char*
-elfcore_strndup (abfd, start, max)
+char *
+_bfd_elfcore_strndup (abfd, start, max)
bfd *abfd;
char *start;
- int max;
+ size_t max;
{
- char *dup;
+ char *dups;
char *end = memchr (start, '\0', max);
- int len;
+ size_t len;
if (end == NULL)
len = max;
else
len = end - start;
- dup = bfd_alloc (abfd, len + 1);
- if (dup == NULL)
+ dups = bfd_alloc (abfd, (bfd_size_type) len + 1);
+ if (dups == NULL)
return NULL;
- memcpy (dup, start, len);
- dup[len] = '\0';
+ memcpy (dups, start, len);
+ dups[len] = '\0';
- return dup;
+ return dups;
}
+#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
+static boolean elfcore_grok_psinfo PARAMS ((bfd *, Elf_Internal_Note *));
+
static boolean
elfcore_grok_psinfo (abfd, note)
bfd *abfd;
@@ -5554,10 +6101,12 @@ elfcore_grok_psinfo (abfd, note)
memcpy (&psinfo, note->descdata, sizeof (psinfo));
elf_tdata (abfd)->core_program
- = elfcore_strndup (abfd, psinfo.pr_fname, sizeof (psinfo.pr_fname));
+ = _bfd_elfcore_strndup (abfd, psinfo.pr_fname,
+ sizeof (psinfo.pr_fname));
elf_tdata (abfd)->core_command
- = elfcore_strndup (abfd, psinfo.pr_psargs, sizeof (psinfo.pr_psargs));
+ = _bfd_elfcore_strndup (abfd, psinfo.pr_psargs,
+ sizeof (psinfo.pr_psargs));
}
#if defined (HAVE_PRPSINFO32_T) || defined (HAVE_PSINFO32_T)
else if (note->descsz == sizeof (elfcore_psinfo32_t))
@@ -5568,10 +6117,12 @@ elfcore_grok_psinfo (abfd, note)
memcpy (&psinfo, note->descdata, sizeof (psinfo));
elf_tdata (abfd)->core_program
- = elfcore_strndup (abfd, psinfo.pr_fname, sizeof (psinfo.pr_fname));
+ = _bfd_elfcore_strndup (abfd, psinfo.pr_fname,
+ sizeof (psinfo.pr_fname));
elf_tdata (abfd)->core_command
- = elfcore_strndup (abfd, psinfo.pr_psargs, sizeof (psinfo.pr_psargs));
+ = _bfd_elfcore_strndup (abfd, psinfo.pr_psargs,
+ sizeof (psinfo.pr_psargs));
}
#endif
@@ -5661,7 +6212,7 @@ elfcore_grok_lwpstatus (abfd, note)
/* Make a ".reg/999" section. */
sprintf (buf, ".reg/%d", elfcore_make_pid (abfd));
- name = bfd_alloc (abfd, strlen (buf) + 1);
+ name = bfd_alloc (abfd, (bfd_size_type) strlen (buf) + 1);
if (name == NULL)
return false;
strcpy (name, buf);
@@ -5690,7 +6241,7 @@ elfcore_grok_lwpstatus (abfd, note)
/* Make a ".reg2/999" section */
sprintf (buf, ".reg2/%d", elfcore_make_pid (abfd));
- name = bfd_alloc (abfd, strlen (buf) + 1);
+ name = bfd_alloc (abfd, (bfd_size_type) strlen (buf) + 1);
if (name == NULL)
return false;
strcpy (name, buf);
@@ -5713,10 +6264,7 @@ elfcore_grok_lwpstatus (abfd, note)
sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2;
- if (!elfcore_maybe_make_sect (abfd, ".reg2", sect))
- return false;
-
- return true;
+ return elfcore_maybe_make_sect (abfd, ".reg2", sect);
}
#endif /* defined (HAVE_LWPSTATUS_T) */
@@ -5734,7 +6282,7 @@ elfcore_grok_win32pstatus (abfd, note)
if (note->descsz < sizeof (pstatus))
return true;
- memcpy (&pstatus, note->descdata, note->descsz);
+ memcpy (&pstatus, note->descdata, sizeof (pstatus));
switch (pstatus.data_type)
{
@@ -5748,7 +6296,7 @@ elfcore_grok_win32pstatus (abfd, note)
/* Make a ".reg/999" section. */
sprintf (buf, ".reg/%d", pstatus.data.thread_info.tid);
- name = bfd_alloc (abfd, strlen (buf) + 1);
+ name = bfd_alloc (abfd, (bfd_size_type) strlen (buf) + 1);
if (name == NULL)
return false;
@@ -5759,8 +6307,9 @@ elfcore_grok_win32pstatus (abfd, note)
return false;
sect->_raw_size = sizeof (pstatus.data.thread_info.thread_context);
- sect->filepos = note->descpos + offsetof (struct win32_pstatus,
- data.thread_info.thread_context);
+ sect->filepos = (note->descpos
+ + offsetof (struct win32_pstatus,
+ data.thread_info.thread_context));
sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2;
@@ -5773,7 +6322,7 @@ elfcore_grok_win32pstatus (abfd, note)
/* Make a ".module/xxxxxxxx" section. */
sprintf (buf, ".module/%08x", pstatus.data.module_info.base_address);
- name = bfd_alloc (abfd, strlen (buf) + 1);
+ name = bfd_alloc (abfd, (bfd_size_type) strlen (buf) + 1);
if (name == NULL)
return false;
@@ -5803,14 +6352,21 @@ elfcore_grok_note (abfd, note)
bfd *abfd;
Elf_Internal_Note *note;
{
+ struct elf_backend_data *bed = get_elf_backend_data (abfd);
+
switch (note->type)
{
default:
return true;
-#if defined (HAVE_PRSTATUS_T)
case NT_PRSTATUS:
+ if (bed->elf_backend_grok_prstatus)
+ if ((*bed->elf_backend_grok_prstatus) (abfd, note))
+ return true;
+#if defined (HAVE_PRSTATUS_T)
return elfcore_grok_prstatus (abfd, note);
+#else
+ return true;
#endif
#if defined (HAVE_PSTATUS_T)
@@ -5838,19 +6394,264 @@ elfcore_grok_note (abfd, note)
else
return true;
-#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
case NT_PRPSINFO:
case NT_PSINFO:
+ if (bed->elf_backend_grok_psinfo)
+ if ((*bed->elf_backend_grok_psinfo) (abfd, note))
+ return true;
+#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
return elfcore_grok_psinfo (abfd, note);
+#else
+ return true;
#endif
}
}
static boolean
+elfcore_netbsd_get_lwpid (note, lwpidp)
+ Elf_Internal_Note *note;
+ int *lwpidp;
+{
+ char *cp;
+
+ cp = strchr (note->namedata, '@');
+ if (cp != NULL)
+ {
+ *lwpidp = atoi(cp);
+ return true;
+ }
+ return false;
+}
+
+static boolean
+elfcore_grok_netbsd_procinfo (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+
+ /* Signal number at offset 0x08. */
+ elf_tdata (abfd)->core_signal
+ = bfd_h_get_32 (abfd, (bfd_byte *) note->descdata + 0x08);
+
+ /* Process ID at offset 0x50. */
+ elf_tdata (abfd)->core_pid
+ = bfd_h_get_32 (abfd, (bfd_byte *) note->descdata + 0x50);
+
+ /* Command name at 0x7c (max 32 bytes, including nul). */
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 0x7c, 31);
+
+ return true;
+}
+
+static boolean
+elfcore_grok_netbsd_note (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ int lwp;
+
+ if (elfcore_netbsd_get_lwpid (note, &lwp))
+ elf_tdata (abfd)->core_lwpid = lwp;
+
+ if (note->type == NT_NETBSDCORE_PROCINFO)
+ {
+ /* NetBSD-specific core "procinfo". Note that we expect to
+ find this note before any of the others, which is fine,
+ since the kernel writes this note out first when it
+ creates a core file. */
+
+ return elfcore_grok_netbsd_procinfo (abfd, note);
+ }
+
+ /* As of Jan 2002 there are no other machine-independent notes
+ defined for NetBSD core files. If the note type is less
+ than the start of the machine-dependent note types, we don't
+ understand it. */
+
+ if (note->type < NT_NETBSDCORE_FIRSTMACH)
+ return true;
+
+
+ switch (bfd_get_arch (abfd))
+ {
+ /* On the Alpha, SPARC (32-bit and 64-bit), PT_GETREGS == mach+0 and
+ PT_GETFPREGS == mach+2. */
+
+ case bfd_arch_alpha:
+ case bfd_arch_sparc:
+ switch (note->type)
+ {
+ case NT_NETBSDCORE_FIRSTMACH+0:
+ return elfcore_make_note_pseudosection (abfd, ".reg", note);
+
+ case NT_NETBSDCORE_FIRSTMACH+2:
+ return elfcore_make_note_pseudosection (abfd, ".reg2", note);
+
+ default:
+ return true;
+ }
+
+ /* On all other arch's, PT_GETREGS == mach+1 and
+ PT_GETFPREGS == mach+3. */
+
+ default:
+ switch (note->type)
+ {
+ case NT_NETBSDCORE_FIRSTMACH+1:
+ return elfcore_make_note_pseudosection (abfd, ".reg", note);
+
+ case NT_NETBSDCORE_FIRSTMACH+3:
+ return elfcore_make_note_pseudosection (abfd, ".reg2", note);
+
+ default:
+ return true;
+ }
+ }
+ /* NOTREACHED */
+}
+
+/* Function: elfcore_write_note
+
+ Inputs:
+ buffer to hold note
+ name of note
+ type of note
+ data for note
+ size of data for note
+
+ Return:
+ End of buffer containing note. */
+
+char *
+elfcore_write_note (abfd, buf, bufsiz, name, type, input, size)
+ bfd *abfd;
+ char *buf;
+ int *bufsiz;
+ char *name;
+ int type;
+ void *input;
+ int size;
+{
+ Elf_External_Note *xnp;
+ int namesz = strlen (name);
+ int newspace = BFD_ALIGN (sizeof (Elf_External_Note) + size + namesz - 1, 4);
+ char *p, *dest;
+
+ p = realloc (buf, *bufsiz + newspace);
+ dest = p + *bufsiz;
+ *bufsiz += newspace;
+ xnp = (Elf_External_Note *) dest;
+ H_PUT_32 (abfd, namesz, xnp->namesz);
+ H_PUT_32 (abfd, size, xnp->descsz);
+ H_PUT_32 (abfd, type, xnp->type);
+ strcpy (xnp->name, name);
+ memcpy (xnp->name + BFD_ALIGN (namesz, 4), input, size);
+ return p;
+}
+
+#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
+char *
+elfcore_write_prpsinfo (abfd, buf, bufsiz, fname, psargs)
+ bfd *abfd;
+ char *buf;
+ int *bufsiz;
+ char *fname;
+ char *psargs;
+{
+ int note_type;
+ char *note_name = "CORE";
+
+#if defined (HAVE_PSINFO_T)
+ psinfo_t data;
+ note_type = NT_PSINFO;
+#else
+ prpsinfo_t data;
+ note_type = NT_PRPSINFO;
+#endif
+
+ memset (&data, 0, sizeof (data));
+ strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
+ strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
+ return elfcore_write_note (abfd, buf, bufsiz,
+ note_name, note_type, &data, sizeof (data));
+}
+#endif /* PSINFO_T or PRPSINFO_T */
+
+#if defined (HAVE_PRSTATUS_T)
+char *
+elfcore_write_prstatus (abfd, buf, bufsiz, pid, cursig, gregs)
+ bfd *abfd;
+ char *buf;
+ int *bufsiz;
+ long pid;
+ int cursig;
+ void *gregs;
+{
+ prstatus_t prstat;
+ char *note_name = "CORE";
+
+ memset (&prstat, 0, sizeof (prstat));
+ prstat.pr_pid = pid;
+ prstat.pr_cursig = cursig;
+ memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
+ return elfcore_write_note (abfd, buf, bufsiz,
+ note_name, NT_PRSTATUS, &prstat, sizeof (prstat));
+}
+#endif /* HAVE_PRSTATUS_T */
+
+#if defined (HAVE_PSTATUS_T)
+char *
+elfcore_write_pstatus (abfd, buf, bufsiz, pid, cursig, gregs)
+ bfd *abfd;
+ char *buf;
+ int *bufsiz;
+ long pid;
+ int cursig;
+ void *gregs;
+{
+ pstatus_t pstat;
+ char *note_name = "CORE";
+
+ memset (&pstat, 0, sizeof (prstat));
+ pstat.pr_pid = pid;
+ memcpy (pstat.pr_reg, gregs, sizeof (pstat.pr_reg));
+ return elfcore_write_note (abfd, buf, bufsiz,
+ note_name, NT_PSTATUS, &pstat, sizeof (pstat));
+}
+#endif /* HAVE_PSTATUS_T */
+
+char *
+elfcore_write_prfpreg (abfd, buf, bufsiz, fpregs, size)
+ bfd *abfd;
+ char *buf;
+ int *bufsiz;
+ void *fpregs;
+ int size;
+{
+ char *note_name = "CORE";
+ return elfcore_write_note (abfd, buf, bufsiz,
+ note_name, NT_FPREGSET, fpregs, size);
+}
+
+char *
+elfcore_write_prxfpreg (abfd, buf, bufsiz, xfpregs, size)
+ bfd *abfd;
+ char *buf;
+ int *bufsiz;
+ void *xfpregs;
+ int size;
+{
+ char *note_name = "LINUX";
+ return elfcore_write_note (abfd, buf, bufsiz,
+ note_name, NT_PRXFPREG, xfpregs, size);
+}
+
+static boolean
elfcore_read_notes (abfd, offset, size)
bfd *abfd;
- bfd_vma offset;
- bfd_vma size;
+ file_ptr offset;
+ bfd_size_type size;
{
char *buf;
char *p;
@@ -5858,14 +6659,14 @@ elfcore_read_notes (abfd, offset, size)
if (size <= 0)
return true;
- if (bfd_seek (abfd, offset, SEEK_SET) == -1)
+ if (bfd_seek (abfd, offset, SEEK_SET) != 0)
return false;
- buf = bfd_malloc ((size_t) size);
+ buf = bfd_malloc (size);
if (buf == NULL)
return false;
- if (bfd_read (buf, size, 1, abfd) != size)
+ if (bfd_bread (buf, size, abfd) != size)
{
error:
free (buf);
@@ -5879,17 +6680,25 @@ elfcore_read_notes (abfd, offset, size)
Elf_External_Note *xnp = (Elf_External_Note *) p;
Elf_Internal_Note in;
- in.type = bfd_h_get_32 (abfd, (bfd_byte *) xnp->type);
+ in.type = H_GET_32 (abfd, xnp->type);
- in.namesz = bfd_h_get_32 (abfd, (bfd_byte *) xnp->namesz);
+ in.namesz = H_GET_32 (abfd, xnp->namesz);
in.namedata = xnp->name;
- in.descsz = bfd_h_get_32 (abfd, (bfd_byte *) xnp->descsz);
+ in.descsz = H_GET_32 (abfd, xnp->descsz);
in.descdata = in.namedata + BFD_ALIGN (in.namesz, 4);
in.descpos = offset + (in.descdata - buf);
- if (! elfcore_grok_note (abfd, &in))
- goto error;
+ if (strncmp (in.namedata, "NetBSD-CORE", 11) == 0)
+ {
+ if (! elfcore_grok_netbsd_note (abfd, &in))
+ goto error;
+ }
+ else
+ {
+ if (! elfcore_grok_note (abfd, &in))
+ goto error;
+ }
p = in.descdata + BFD_ALIGN (in.descsz, 4);
}
@@ -5897,21 +6706,6 @@ elfcore_read_notes (abfd, offset, size)
free (buf);
return true;
}
-
-/* FIXME: This function is now unnecessary. Callers can just call
- bfd_section_from_phdr directly. */
-
-boolean
-_bfd_elfcore_section_from_phdr (abfd, phdr, sec_num)
- bfd *abfd;
- Elf_Internal_Phdr* phdr;
- int sec_num;
-{
- if (! bfd_section_from_phdr (abfd, phdr, sec_num))
- return false;
-
- return true;
-}
/* Providing external access to the ELF program header table. */
@@ -5929,8 +6723,7 @@ bfd_get_elf_phdr_upper_bound (abfd)
return -1;
}
- return (elf_elfheader (abfd)->e_phnum
- * sizeof (Elf_Internal_Phdr));
+ return elf_elfheader (abfd)->e_phnum * sizeof (Elf_Internal_Phdr);
}
/* Copy ABFD's program header table entries to *PHDRS. The entries
@@ -5960,3 +6753,146 @@ bfd_get_elf_phdrs (abfd, phdrs)
return num_phdrs;
}
+
+void
+_bfd_elf_sprintf_vma (abfd, buf, value)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ char *buf;
+ bfd_vma value;
+{
+#ifdef BFD64
+ Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
+
+ i_ehdrp = elf_elfheader (abfd);
+ if (i_ehdrp == NULL)
+ sprintf_vma (buf, value);
+ else
+ {
+ if (i_ehdrp->e_ident[EI_CLASS] == ELFCLASS64)
+ {
+#if BFD_HOST_64BIT_LONG
+ sprintf (buf, "%016lx", value);
+#else
+ sprintf (buf, "%08lx%08lx", _bfd_int64_high (value),
+ _bfd_int64_low (value));
+#endif
+ }
+ else
+ sprintf (buf, "%08lx", (unsigned long) (value & 0xffffffff));
+ }
+#else
+ sprintf_vma (buf, value);
+#endif
+}
+
+void
+_bfd_elf_fprintf_vma (abfd, stream, value)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ PTR stream;
+ bfd_vma value;
+{
+#ifdef BFD64
+ Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
+
+ i_ehdrp = elf_elfheader (abfd);
+ if (i_ehdrp == NULL)
+ fprintf_vma ((FILE *) stream, value);
+ else
+ {
+ if (i_ehdrp->e_ident[EI_CLASS] == ELFCLASS64)
+ {
+#if BFD_HOST_64BIT_LONG
+ fprintf ((FILE *) stream, "%016lx", value);
+#else
+ fprintf ((FILE *) stream, "%08lx%08lx",
+ _bfd_int64_high (value), _bfd_int64_low (value));
+#endif
+ }
+ else
+ fprintf ((FILE *) stream, "%08lx",
+ (unsigned long) (value & 0xffffffff));
+ }
+#else
+ fprintf_vma ((FILE *) stream, value);
+#endif
+}
+
+enum elf_reloc_type_class
+_bfd_elf_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela ATTRIBUTE_UNUSED;
+{
+ return reloc_class_normal;
+}
+
+/* For RELA architectures, return what the relocation value for
+ relocation against a local symbol. */
+
+bfd_vma
+_bfd_elf_rela_local_sym (abfd, sym, sec, rel)
+ bfd *abfd;
+ Elf_Internal_Sym *sym;
+ asection *sec;
+ Elf_Internal_Rela *rel;
+{
+ bfd_vma relocation;
+
+ relocation = (sec->output_section->vma
+ + sec->output_offset
+ + sym->st_value);
+ if ((sec->flags & SEC_MERGE)
+ && ELF_ST_TYPE (sym->st_info) == STT_SECTION
+ && elf_section_data (sec)->sec_info_type == ELF_INFO_TYPE_MERGE)
+ {
+ asection *msec;
+
+ msec = sec;
+ rel->r_addend =
+ _bfd_merged_section_offset (abfd, &msec,
+ elf_section_data (sec)->sec_info,
+ sym->st_value + rel->r_addend,
+ (bfd_vma) 0)
+ - relocation;
+ rel->r_addend += msec->output_section->vma + msec->output_offset;
+ }
+ return relocation;
+}
+
+bfd_vma
+_bfd_elf_rel_local_sym (abfd, sym, psec, addend)
+ bfd *abfd;
+ Elf_Internal_Sym *sym;
+ asection **psec;
+ bfd_vma addend;
+{
+ asection *sec = *psec;
+
+ if (elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE)
+ return sym->st_value + addend;
+
+ return _bfd_merged_section_offset (abfd, psec,
+ elf_section_data (sec)->sec_info,
+ sym->st_value + addend, (bfd_vma) 0);
+}
+
+bfd_vma
+_bfd_elf_section_offset (abfd, info, sec, offset)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ asection *sec;
+ bfd_vma offset;
+{
+ struct bfd_elf_section_data *sec_data;
+
+ sec_data = elf_section_data (sec);
+ switch (sec_data->sec_info_type)
+ {
+ case ELF_INFO_TYPE_STABS:
+ return _bfd_stab_section_offset
+ (abfd, &elf_hash_table (info)->merge_info, sec, &sec_data->sec_info,
+ offset);
+ case ELF_INFO_TYPE_EH_FRAME:
+ return _bfd_elf_eh_frame_section_offset (abfd, sec, offset);
+ default:
+ return offset;
+ }
+}
diff --git a/contrib/binutils/bfd/elf32-arc.c b/contrib/binutils/bfd/elf32-arc.c
index 82b6104..ad7247a 100644
--- a/contrib/binutils/bfd/elf32-arc.c
+++ b/contrib/binutils/bfd/elf32-arc.c
@@ -23,6 +23,7 @@
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/arc.h"
+#include "libiberty.h"
static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
@@ -32,6 +33,8 @@ static boolean arc_elf_object_p
PARAMS ((bfd *));
static void arc_elf_final_write_processing
PARAMS ((bfd *, boolean));
+static bfd_reloc_status_type arc_elf_b22_pcrel
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
/* Try to minimize the amount of space occupied by relocation tables
on the ROM (not that the ROM won't be swamped by other ELF overhead). */
@@ -50,7 +53,7 @@ static reloc_howto_type elf_arc_howto_table[] =
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARC_NONE", /* name */
- false, /* partial_inplace */
+ true, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
false), /* pcrel_offset */
@@ -65,7 +68,7 @@ static reloc_howto_type elf_arc_howto_table[] =
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARC_32", /* name */
- false, /* partial_inplace */
+ true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
@@ -80,7 +83,7 @@ static reloc_howto_type elf_arc_howto_table[] =
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_ARC_B26", /* name */
- false, /* partial_inplace */
+ true, /* partial_inplace */
0x00ffffff, /* src_mask */
0x00ffffff, /* dst_mask */
false), /* pcrel_offset */
@@ -93,13 +96,12 @@ static reloc_howto_type elf_arc_howto_table[] =
true, /* pc_relative */
7, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
+ arc_elf_b22_pcrel, /* special_function */
"R_ARC_B22_PCREL", /* name */
- false, /* partial_inplace */
+ true, /* partial_inplace */
0x07ffff80, /* src_mask */
0x07ffff80, /* dst_mask */
- true), /* pcrel_offset */
-
+ false), /* pcrel_offset */
};
/* Map BFD reloc types to ARC ELF reloc types. */
@@ -126,11 +128,10 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code)
{
unsigned int i;
- for (i = 0; i < sizeof (arc_reloc_map) / sizeof (struct arc_reloc_map); i++)
- {
- if (arc_reloc_map[i].bfd_reloc_val == code)
- return &elf_arc_howto_table[arc_reloc_map[i].elf_reloc_val];
- }
+ for (i = ARRAY_SIZE (arc_reloc_map); i--;)
+ if (arc_reloc_map[i].bfd_reloc_val == code)
+ return elf_arc_howto_table + arc_reloc_map[i].elf_reloc_val;
+
return NULL;
}
@@ -155,7 +156,7 @@ static boolean
arc_elf_object_p (abfd)
bfd *abfd;
{
- int mach = bfd_mach_arc_6;
+ unsigned int mach = bfd_mach_arc_6;
if (elf_elfheader(abfd)->e_machine == EM_ARC)
{
@@ -207,11 +208,34 @@ arc_elf_final_write_processing (abfd, linker)
val = E_ARC_MACH_ARC8;
break;
}
- elf_elfheader (abfd)->e_machine = EM_ARC;
elf_elfheader (abfd)->e_flags &=~ EF_ARC_MACH;
elf_elfheader (abfd)->e_flags |= val;
}
+bfd_reloc_status_type
+arc_elf_b22_pcrel (abfd, reloc_entry, symbol, data, input_section,
+ output_bfd, error_message)
+ bfd * abfd;
+ arelent * reloc_entry;
+ asymbol * symbol;
+ PTR data;
+ asection * input_section;
+ bfd * output_bfd;
+ char ** error_message;
+{
+ /* If linking, back up the final symbol address by the address of the
+ reloc. This cannot be accomplished by setting the pcrel_offset
+ field to true, as bfd_install_relocation will detect this and refuse
+ to install the offset in the first place, but bfd_perform_relocation
+ will still insist on removing it. */
+ if (output_bfd == (bfd *) NULL)
+ reloc_entry->addend -= reloc_entry->address;
+
+ /* Fall through to the default elf reloc handler. */
+ return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+ input_section, output_bfd, error_message);
+}
+
#define TARGET_LITTLE_SYM bfd_elf32_littlearc_vec
#define TARGET_LITTLE_NAME "elf32-littlearc"
#define TARGET_BIG_SYM bfd_elf32_bigarc_vec
diff --git a/contrib/binutils/bfd/elf32-arm.h b/contrib/binutils/bfd/elf32-arm.h
index d628f1d..ab8a6b3 100644
--- a/contrib/binutils/bfd/elf32-arm.h
+++ b/contrib/binutils/bfd/elf32-arm.h
@@ -1,5 +1,5 @@
/* 32-bit ELF support for ARM
- Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -35,13 +35,13 @@ static struct bfd_link_hash_table *elf32_arm_link_hash_table_create
static bfd_reloc_status_type elf32_arm_final_link_relocate
PARAMS ((reloc_howto_type *, bfd *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, bfd_vma, struct bfd_link_info *, asection *,
- const char *, unsigned char, struct elf_link_hash_entry *));
+ const char *, int, struct elf_link_hash_entry *));
static insn32 insert_thumb_branch
PARAMS ((insn32, int));
static struct elf_link_hash_entry *find_thumb_glue
- PARAMS ((struct bfd_link_info *, CONST char *, bfd *));
+ PARAMS ((struct bfd_link_info *, const char *, bfd *));
static struct elf_link_hash_entry *find_arm_glue
- PARAMS ((struct bfd_link_info *, CONST char *, bfd *));
+ PARAMS ((struct bfd_link_info *, const char *, bfd *));
static void record_arm_to_thumb_glue
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
static void record_thumb_to_arm_glue
@@ -54,8 +54,47 @@ static int elf32_arm_to_thumb_stub
static int elf32_thumb_to_arm_stub
PARAMS ((struct bfd_link_info *, const char *, bfd *, bfd *, asection *,
bfd_byte *, asection *, bfd_vma, bfd_signed_vma, bfd_vma));
+static boolean elf32_arm_relocate_section
+ PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+ Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+static asection * elf32_arm_gc_mark_hook
+ PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry *, Elf_Internal_Sym *));
+static boolean elf32_arm_gc_sweep_hook
+ PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ const Elf_Internal_Rela *));
+static boolean elf32_arm_check_relocs
+ PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ const Elf_Internal_Rela *));
+static boolean elf32_arm_find_nearest_line
+ PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
+ const char **, unsigned int *));
+static boolean elf32_arm_adjust_dynamic_symbol
+ PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+static boolean elf32_arm_size_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
+static boolean elf32_arm_finish_dynamic_symbol
+ PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
+ Elf_Internal_Sym *));
+static boolean elf32_arm_finish_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
+static struct bfd_hash_entry * elf32_arm_link_hash_newfunc
+ PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+#ifdef USE_REL
+static void arm_add_to_rel
+ PARAMS ((bfd *, bfd_byte *, reloc_howto_type *, bfd_signed_vma));
+#endif
-#define INTERWORK_FLAG(abfd) (elf_elfheader (abfd)->e_flags & EF_INTERWORK)
+boolean bfd_elf32_arm_allocate_interworking_sections
+ PARAMS ((struct bfd_link_info *));
+boolean bfd_elf32_arm_get_bfd_for_interworking
+ PARAMS ((bfd *, struct bfd_link_info *));
+boolean bfd_elf32_arm_process_before_allocation
+ PARAMS ((bfd *, struct bfd_link_info *, int));
+static enum elf_reloc_type_class elf32_arm_reloc_type_class
+ PARAMS ((const Elf_Internal_Rela *));
+
+#define INTERWORK_FLAG(abfd) (elf_elfheader (abfd)->e_flags & EF_ARM_INTERWORK)
/* The linker script knows the section names for placement.
The entry_names are used to do simple name mangling on the stubs.
@@ -78,23 +117,23 @@ static int elf32_thumb_to_arm_stub
this. It is set up so that any shared library function that is
called before the relocation has been set up calls the dynamic
linker first. */
-static const unsigned long elf32_arm_plt0_entry [PLT_ENTRY_SIZE / 4] =
-{
- 0xe52de004, /* str lr, [sp, #-4]! */
- 0xe59fe010, /* ldr lr, [pc, #16] */
- 0xe08fe00e, /* add lr, pc, lr */
- 0xe5bef008 /* ldr pc, [lr, #8]! */
-};
+static const bfd_vma elf32_arm_plt0_entry [PLT_ENTRY_SIZE / 4] =
+ {
+ 0xe52de004, /* str lr, [sp, #-4]! */
+ 0xe59fe010, /* ldr lr, [pc, #16] */
+ 0xe08fe00e, /* add lr, pc, lr */
+ 0xe5bef008 /* ldr pc, [lr, #8]! */
+ };
/* Subsequent entries in a procedure linkage table look like
this. */
-static const unsigned long elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] =
-{
- 0xe59fc004, /* ldr ip, [pc, #4] */
- 0xe08fc00c, /* add ip, pc, ip */
- 0xe59cf000, /* ldr pc, [ip] */
- 0x00000000 /* offset to symbol in got */
-};
+static const bfd_vma elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] =
+ {
+ 0xe59fc004, /* ldr ip, [pc, #4] */
+ 0xe08fc00c, /* add ip, pc, ip */
+ 0xe59cf000, /* ldr pc, [ip] */
+ 0x00000000 /* offset to symbol in got */
+ };
/* The ARM linker needs to keep track of the number of relocs that it
decides to copy in check_relocs for each symbol. This is so that
@@ -105,23 +144,23 @@ static const unsigned long elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] =
/* This structure keeps track of the number of PC relative relocs we
have copied for a given symbol. */
struct elf32_arm_pcrel_relocs_copied
-{
- /* Next section. */
- struct elf32_arm_pcrel_relocs_copied * next;
- /* A section in dynobj. */
- asection * section;
- /* Number of relocs copied in this section. */
- bfd_size_type count;
-};
+ {
+ /* Next section. */
+ struct elf32_arm_pcrel_relocs_copied * next;
+ /* A section in dynobj. */
+ asection * section;
+ /* Number of relocs copied in this section. */
+ bfd_size_type count;
+ };
/* Arm ELF linker hash entry. */
struct elf32_arm_link_hash_entry
-{
- struct elf_link_hash_entry root;
+ {
+ struct elf_link_hash_entry root;
- /* Number of PC relative relocs copied for this symbol. */
- struct elf32_arm_pcrel_relocs_copied * pcrel_relocs_copied;
-};
+ /* Number of PC relative relocs copied for this symbol. */
+ struct elf32_arm_pcrel_relocs_copied * pcrel_relocs_copied;
+ };
/* Declare this now that the above structures are defined. */
static boolean elf32_arm_discard_copies
@@ -140,23 +179,23 @@ static boolean elf32_arm_discard_copies
/* ARM ELF linker hash table. */
struct elf32_arm_link_hash_table
-{
- /* The main hash table. */
- struct elf_link_hash_table root;
+ {
+ /* The main hash table. */
+ struct elf_link_hash_table root;
- /* The size in bytes of the section containg the Thumb-to-ARM glue. */
- long int thumb_glue_size;
+ /* The size in bytes of the section containg the Thumb-to-ARM glue. */
+ bfd_size_type thumb_glue_size;
- /* The size in bytes of the section containg the ARM-to-Thumb glue. */
- long int arm_glue_size;
+ /* The size in bytes of the section containg the ARM-to-Thumb glue. */
+ bfd_size_type arm_glue_size;
- /* An arbitary input BFD chosen to hold the glue sections. */
- bfd * bfd_of_glue_owner;
+ /* An arbitary input BFD chosen to hold the glue sections. */
+ bfd * bfd_of_glue_owner;
- /* A boolean indicating whether knowledge of the ARM's pipeline
- length should be applied by the linker. */
- int no_pipeline_knowledge;
-};
+ /* A boolean indicating whether knowledge of the ARM's pipeline
+ length should be applied by the linker. */
+ int no_pipeline_knowledge;
+ };
/* Create an entry in an ARM ELF linker hash table. */
@@ -195,9 +234,9 @@ elf32_arm_link_hash_table_create (abfd)
bfd *abfd;
{
struct elf32_arm_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct elf32_arm_link_hash_table);
- ret = ((struct elf32_arm_link_hash_table *)
- bfd_alloc (abfd, sizeof (struct elf32_arm_link_hash_table)));
+ ret = (struct elf32_arm_link_hash_table *) bfd_alloc (abfd, amt);
if (ret == (struct elf32_arm_link_hash_table *) NULL)
return NULL;
@@ -221,7 +260,7 @@ elf32_arm_link_hash_table_create (abfd)
static struct elf_link_hash_entry *
find_thumb_glue (link_info, name, input_bfd)
struct bfd_link_info *link_info;
- CONST char *name;
+ const char *name;
bfd *input_bfd;
{
char *tmp_name;
@@ -231,8 +270,8 @@ find_thumb_glue (link_info, name, input_bfd)
/* We need a pointer to the armelf specific hash table. */
hash_table = elf32_arm_hash_table (link_info);
- tmp_name = ((char *)
- bfd_malloc (strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1));
+ tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
+ + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1);
BFD_ASSERT (tmp_name);
@@ -243,8 +282,8 @@ find_thumb_glue (link_info, name, input_bfd)
if (hash == NULL)
/* xgettext:c-format */
- _bfd_error_handler (_("%s: unable to find THUMB glue '%s' for `%s'"),
- bfd_get_filename (input_bfd), tmp_name, name);
+ (*_bfd_error_handler) (_("%s: unable to find THUMB glue '%s' for `%s'"),
+ bfd_archive_filename (input_bfd), tmp_name, name);
free (tmp_name);
@@ -256,7 +295,7 @@ find_thumb_glue (link_info, name, input_bfd)
static struct elf_link_hash_entry *
find_arm_glue (link_info, name, input_bfd)
struct bfd_link_info *link_info;
- CONST char *name;
+ const char *name;
bfd *input_bfd;
{
char *tmp_name;
@@ -266,8 +305,8 @@ find_arm_glue (link_info, name, input_bfd)
/* We need a pointer to the elfarm specific hash table. */
hash_table = elf32_arm_hash_table (link_info);
- tmp_name = ((char *)
- bfd_malloc (strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1));
+ tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
+ + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
BFD_ASSERT (tmp_name);
@@ -278,8 +317,8 @@ find_arm_glue (link_info, name, input_bfd)
if (myh == NULL)
/* xgettext:c-format */
- _bfd_error_handler (_("%s: unable to find ARM glue '%s' for `%s'"),
- bfd_get_filename (input_bfd), tmp_name, name);
+ (*_bfd_error_handler) (_("%s: unable to find ARM glue '%s' for `%s'"),
+ bfd_archive_filename (input_bfd), tmp_name, name);
free (tmp_name);
@@ -344,13 +383,13 @@ bfd_elf32_arm_allocate_interworking_sections (info)
{
BFD_ASSERT (globals->bfd_of_glue_owner != NULL);
- s = bfd_get_section_by_name
- (globals->bfd_of_glue_owner, ARM2THUMB_GLUE_SECTION_NAME);
+ s = bfd_get_section_by_name (globals->bfd_of_glue_owner,
+ ARM2THUMB_GLUE_SECTION_NAME);
BFD_ASSERT (s != NULL);
- foo = (bfd_byte *) bfd_alloc
- (globals->bfd_of_glue_owner, globals->arm_glue_size);
+ foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner,
+ globals->arm_glue_size);
s->_raw_size = s->_cooked_size = globals->arm_glue_size;
s->contents = foo;
@@ -365,8 +404,8 @@ bfd_elf32_arm_allocate_interworking_sections (info)
BFD_ASSERT (s != NULL);
- foo = (bfd_byte *) bfd_alloc
- (globals->bfd_of_glue_owner, globals->thumb_glue_size);
+ foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner,
+ globals->thumb_glue_size);
s->_raw_size = s->_cooked_size = globals->thumb_glue_size;
s->contents = foo;
@@ -381,10 +420,11 @@ record_arm_to_thumb_glue (link_info, h)
struct elf_link_hash_entry * h;
{
const char * name = h->root.root.string;
- register asection * s;
+ asection * s;
char * tmp_name;
struct elf_link_hash_entry * myh;
struct elf32_arm_link_hash_table * globals;
+ bfd_vma val;
globals = elf32_arm_hash_table (link_info);
@@ -396,8 +436,8 @@ record_arm_to_thumb_glue (link_info, h)
BFD_ASSERT (s != NULL);
- tmp_name = ((char *)
- bfd_malloc (strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1));
+ tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
+ + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1);
BFD_ASSERT (tmp_name);
@@ -416,9 +456,9 @@ record_arm_to_thumb_glue (link_info, h)
/* The only trick here is using hash_table->arm_glue_size as the value. Even
though the section isn't allocated yet, this is where we will be putting
it. */
- _bfd_generic_link_add_one_symbol (link_info, globals->bfd_of_glue_owner, tmp_name,
- BSF_GLOBAL,
- s, globals->arm_glue_size + 1,
+ val = globals->arm_glue_size + 1;
+ _bfd_generic_link_add_one_symbol (link_info, globals->bfd_of_glue_owner,
+ tmp_name, BSF_GLOBAL, s, val,
NULL, true, false,
(struct bfd_link_hash_entry **) &myh);
@@ -435,11 +475,12 @@ record_thumb_to_arm_glue (link_info, h)
struct elf_link_hash_entry *h;
{
const char *name = h->root.root.string;
- register asection *s;
+ asection *s;
char *tmp_name;
struct elf_link_hash_entry *myh;
struct elf32_arm_link_hash_table *hash_table;
char bind;
+ bfd_vma val;
hash_table = elf32_arm_hash_table (link_info);
@@ -451,7 +492,8 @@ record_thumb_to_arm_glue (link_info, h)
BFD_ASSERT (s != NULL);
- tmp_name = (char *) bfd_malloc (strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1);
+ tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
+ + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1);
BFD_ASSERT (tmp_name);
@@ -467,8 +509,9 @@ record_thumb_to_arm_glue (link_info, h)
return;
}
- _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner, tmp_name,
- BSF_GLOBAL, s, hash_table->thumb_glue_size + 1,
+ val = hash_table->thumb_glue_size + 1;
+ _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner,
+ tmp_name, BSF_GLOBAL, s, val,
NULL, true, false,
(struct bfd_link_hash_entry **) &myh);
@@ -482,7 +525,8 @@ record_thumb_to_arm_glue (link_info, h)
#define BACK_FROM_ARM "__%s_back_from_arm"
/* Allocate another symbol to mark where we switch to Arm mode. */
- tmp_name = (char *) bfd_malloc (strlen (name) + strlen (CHANGE_TO_ARM) + 1);
+ tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name)
+ + strlen (CHANGE_TO_ARM) + 1);
BFD_ASSERT (tmp_name);
@@ -490,8 +534,9 @@ record_thumb_to_arm_glue (link_info, h)
myh = NULL;
- _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner, tmp_name,
- BSF_LOCAL, s, hash_table->thumb_glue_size + 4,
+ val = hash_table->thumb_glue_size + 4,
+ _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner,
+ tmp_name, BSF_LOCAL, s, val,
NULL, true, false,
(struct bfd_link_hash_entry **) &myh);
@@ -616,7 +661,7 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge)
/* Load the relocs. */
irel = (_bfd_elf32_link_read_relocs (abfd, sec, (PTR) NULL,
- (Elf_Internal_Rela *) NULL, false));
+ (Elf_Internal_Rela *) NULL, false));
BFD_ASSERT (irel != 0);
@@ -652,7 +697,7 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge)
free_contents = contents;
if (!bfd_get_section_contents (abfd, sec, contents,
- (file_ptr) 0, sec->_raw_size))
+ (file_ptr) 0, sec->_raw_size))
goto error_return;
}
}
@@ -674,7 +719,7 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge)
free_extsyms = extsyms;
if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0
- || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd)
+ || (bfd_bread (extsyms, symtab_hdr->sh_size, abfd)
!= symtab_hdr->sh_size))
goto error_return;
}
@@ -807,7 +852,7 @@ elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
bfd_vma val;
{
asection * s = 0;
- long int my_offset;
+ bfd_vma my_offset;
unsigned long int tmp;
long int ret_offset;
struct elf_link_hash_entry * myh;
@@ -837,12 +882,12 @@ elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
&& sym_sec->owner != NULL
&& !INTERWORK_FLAG (sym_sec->owner))
{
- _bfd_error_handler
+ (*_bfd_error_handler)
(_("%s(%s): warning: interworking not enabled."),
- bfd_get_filename (sym_sec->owner), name);
- _bfd_error_handler
+ bfd_archive_filename (sym_sec->owner), name);
+ (*_bfd_error_handler)
(_(" first occurrence: %s: thumb call to arm"),
- bfd_get_filename (input_bfd));
+ bfd_archive_filename (input_bfd));
return false;
}
@@ -850,10 +895,10 @@ elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
--my_offset;
myh->root.u.def.value = my_offset;
- bfd_put_16 (output_bfd, t2a1_bx_pc_insn,
+ bfd_put_16 (output_bfd, (bfd_vma) t2a1_bx_pc_insn,
s->contents + my_offset);
- bfd_put_16 (output_bfd, t2a2_noop_insn,
+ bfd_put_16 (output_bfd, (bfd_vma) t2a2_noop_insn,
s->contents + my_offset + 2);
ret_offset =
@@ -872,7 +917,7 @@ elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
+ 8);
bfd_put_32 (output_bfd,
- t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF),
+ (bfd_vma) t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF),
s->contents + my_offset + 4);
}
@@ -880,18 +925,17 @@ elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
/* Now go back and fix up the original BL insn to point
to here. */
- ret_offset =
- s->output_offset
- + my_offset
- - (input_section->output_offset
- + offset + addend)
- - 8;
+ ret_offset = (s->output_offset
+ + my_offset
+ - (input_section->output_offset
+ + offset + addend)
+ - 8);
tmp = bfd_get_32 (input_bfd, hit_data
- input_section->vma);
bfd_put_32 (output_bfd,
- insert_thumb_branch (tmp, ret_offset),
+ (bfd_vma) insert_thumb_branch (tmp, ret_offset),
hit_data - input_section->vma);
return true;
@@ -914,7 +958,7 @@ elf32_arm_to_thumb_stub (info, name, input_bfd, output_bfd, input_section,
bfd_vma val;
{
unsigned long int tmp;
- long int my_offset;
+ bfd_vma my_offset;
asection * s;
long int ret_offset;
struct elf_link_hash_entry * myh;
@@ -942,21 +986,21 @@ elf32_arm_to_thumb_stub (info, name, input_bfd, output_bfd, input_section,
&& sym_sec->owner != NULL
&& !INTERWORK_FLAG (sym_sec->owner))
{
- _bfd_error_handler
+ (*_bfd_error_handler)
(_("%s(%s): warning: interworking not enabled."),
- bfd_get_filename (sym_sec->owner), name);
- _bfd_error_handler
+ bfd_archive_filename (sym_sec->owner), name);
+ (*_bfd_error_handler)
(_(" first occurrence: %s: arm call to thumb"),
- bfd_get_filename (input_bfd));
+ bfd_archive_filename (input_bfd));
}
--my_offset;
myh->root.u.def.value = my_offset;
- bfd_put_32 (output_bfd, a2t1_ldr_insn,
+ bfd_put_32 (output_bfd, (bfd_vma) a2t1_ldr_insn,
s->contents + my_offset);
- bfd_put_32 (output_bfd, a2t2_bx_r12_insn,
+ bfd_put_32 (output_bfd, (bfd_vma) a2t2_bx_r12_insn,
s->contents + my_offset + 4);
/* It's a thumb address. Add the low order bit. */
@@ -970,18 +1014,17 @@ elf32_arm_to_thumb_stub (info, name, input_bfd, output_bfd, input_section,
tmp = tmp & 0xFF000000;
/* Somehow these are both 4 too far, so subtract 8. */
- ret_offset = s->output_offset
- + my_offset
- + s->output_section->vma
- - (input_section->output_offset
- + input_section->output_section->vma
- + offset + addend)
- - 8;
+ ret_offset = (s->output_offset
+ + my_offset
+ + s->output_section->vma
+ - (input_section->output_offset
+ + input_section->output_section->vma
+ + offset + addend)
+ - 8);
tmp = tmp | ((ret_offset >> 2) & 0x00FFFFFF);
- bfd_put_32 (output_bfd, tmp, hit_data
- - input_section->vma);
+ bfd_put_32 (output_bfd, (bfd_vma) tmp, hit_data - input_section->vma);
return true;
}
@@ -1002,7 +1045,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
struct bfd_link_info * info;
asection * sym_sec;
const char * sym_name;
- unsigned char sym_flags;
+ int sym_flags;
struct elf_link_hash_entry * h;
{
unsigned long r_type = howto->type;
@@ -1022,7 +1065,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
/* If the start address has been set, then set the EF_ARM_HASENTRY
flag. Setting this more than once is redundant, but the cost is
not too high, and it keeps the code simple.
-
+
The test is done here, rather than somewhere else, because the
start address is only set just before the final link commences.
@@ -1030,7 +1073,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
flag will not be set. */
if (bfd_get_start_address (output_bfd) != 0)
elf_elfheader (output_bfd)->e_flags |= EF_ARM_HASENTRY;
-
+
globals = elf32_arm_hash_table (info);
dynobj = elf_hash_table (info)->dynobj;
@@ -1073,8 +1116,9 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
/* When generating a shared object, these relocations are copied
into the output file to be resolved at run time. */
if (info->shared
+ && r_symndx != 0
&& (r_type != R_ARM_PC24
- || (h != NULL
+ || (h != NULL
&& h->dynindx != -1
&& (! info->symbolic
|| (h->elf_link_hash_flags
@@ -1105,22 +1149,11 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
skip = false;
- if (elf_section_data (input_section)->stab_info == NULL)
- outrel.r_offset = rel->r_offset;
- else
- {
- bfd_vma off;
-
- off = (_bfd_stab_section_offset
- (output_bfd, &elf_hash_table (info)->stab_info,
- input_section,
- & elf_section_data (input_section)->stab_info,
- rel->r_offset));
- if (off == (bfd_vma) -1)
- skip = true;
- outrel.r_offset = off;
- }
-
+ outrel.r_offset =
+ _bfd_elf_section_offset (output_bfd, info, input_section,
+ rel->r_offset);
+ if (outrel.r_offset == (bfd_vma) -1)
+ skip = true;
outrel.r_offset += (input_section->output_section->vma
+ input_section->output_offset);
@@ -1188,10 +1221,10 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
/* FIXME: Should we translate the instruction into a BL
instruction instead ? */
if (sym_flags != STT_ARM_TFUNC)
- _bfd_error_handler (_("\
+ (*_bfd_error_handler) (_("\
%s: Warning: Arm BLX instruction targets Arm function '%s'."),
- bfd_get_filename (input_bfd),
- h ? h->root.root.string : "(local)");
+ bfd_archive_filename (input_bfd),
+ h ? h->root.root.string : "(local)");
}
else
#endif
@@ -1384,10 +1417,10 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
/* FIXME: Should we translate the instruction into a BL
instruction instead ? */
if (sym_flags == STT_ARM_TFUNC)
- _bfd_error_handler (_("\
+ (*_bfd_error_handler) (_("\
%s: Warning: Thumb BLX instruction targets thumb function '%s'."),
- bfd_get_filename (input_bfd),
- h ? h->root.root.string : "(local)");
+ bfd_archive_filename (input_bfd),
+ h ? h->root.root.string : "(local)");
}
else
#endif
@@ -1457,7 +1490,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
corresponding bit one in the target address will be set from bit
one of the source address. */
lower_insn &= ~1;
-#endif
+#endif
/* Put the relocated value back in the object file: */
bfd_put_16 (input_bfd, upper_insn, hit_data);
bfd_put_16 (input_bfd, lower_insn, hit_data + 2);
@@ -1466,6 +1499,47 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
}
break;
+ case R_ARM_THM_PC11:
+ /* Thumb B (branch) instruction). */
+ {
+ bfd_vma relocation;
+ bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1;
+ bfd_signed_vma reloc_signed_min = ~ reloc_signed_max;
+ bfd_vma check;
+ bfd_signed_vma signed_check;
+
+#ifdef USE_REL
+ /* Need to refetch addend. */
+ addend = bfd_get_16 (input_bfd, hit_data) & howto->src_mask;
+ /* ??? Need to determine shift amount from operand size. */
+ addend >>= howto->rightshift;
+#endif
+ relocation = value + addend;
+
+ relocation -= (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
+
+ check = relocation >> howto->rightshift;
+
+ /* If this is a signed value, the rightshift just
+ dropped leading 1 bits (assuming twos complement). */
+ if ((bfd_signed_vma) relocation >= 0)
+ signed_check = check;
+ else
+ signed_check = check | ~((bfd_vma) -1 >> howto->rightshift);
+
+ relocation |= (bfd_get_16 (input_bfd, hit_data) & (~ howto->dst_mask));
+
+ bfd_put_16 (input_bfd, relocation, hit_data);
+
+ /* Assumes two's complement. */
+ if (signed_check > reloc_signed_max || signed_check < reloc_signed_min)
+ return bfd_reloc_overflow;
+
+ return bfd_reloc_ok;
+ }
+
case R_ARM_GNU_VTINHERIT:
case R_ARM_GNU_VTENTRY:
return bfd_reloc_ok;
@@ -1497,8 +1571,8 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
calculation. */
value -= sgot->output_section->vma;
return _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset, value,
- (bfd_vma) 0);
+ contents, rel->r_offset, value,
+ (bfd_vma) 0);
case R_ARM_GOTPC:
/* Use global offset table as symbol value. */
@@ -1509,8 +1583,8 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
value = sgot->output_section->vma;
return _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset, value,
- (bfd_vma) 0);
+ contents, rel->r_offset, value,
+ (bfd_vma) 0);
case R_ARM_GOT32:
/* Relocation is to the entry for this symbol in the
@@ -1593,8 +1667,8 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
}
return _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset, value,
- (bfd_vma) 0);
+ contents, rel->r_offset, value,
+ (bfd_vma) 0);
case R_ARM_PLT32:
/* Relocation is to the entry for this symbol in the
@@ -1604,8 +1678,8 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
without using the procedure linkage table. */
if (h == NULL)
return _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset, value,
- (bfd_vma) 0);
+ contents, rel->r_offset, value,
+ (bfd_vma) 0);
if (h->plt.offset == (bfd_vma) -1)
/* We didn't make a PLT entry for this symbol. This
@@ -1623,8 +1697,8 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
+ splt->output_offset
+ h->plt.offset);
return _bfd_final_link_relocate (howto, input_bfd, input_section,
- contents, rel->r_offset, value,
- (bfd_vma) 0);
+ contents, rel->r_offset, value,
+ (bfd_vma) 0);
case R_ARM_SBREL32:
return bfd_reloc_notsupported;
@@ -1683,8 +1757,8 @@ arm_add_to_rel (abfd, address, howto, increment)
upper_insn = (upper_insn & 0xf800) | ((addend >> 11) & 0x7ff);
lower_insn = (lower_insn & 0xf800) | (addend & 0x7ff);
- bfd_put_16 (abfd, upper_insn, address);
- bfd_put_16 (abfd, lower_insn, address + 2);
+ bfd_put_16 (abfd, (bfd_vma) upper_insn, address);
+ bfd_put_16 (abfd, (bfd_vma) lower_insn, address + 2);
}
else
{
@@ -1712,7 +1786,7 @@ arm_add_to_rel (abfd, address, howto, increment)
case R_ARM_PC24:
addend <<= howto->size;
- addend += increment;
+ addend += increment;
/* Should we check for overflow here ? */
@@ -1771,7 +1845,12 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == R_ARM_GNU_VTINHERIT)
continue;
+#ifdef USE_REL
+ elf32_arm_info_to_howto (input_bfd, & bfd_reloc,
+ (Elf_Internal_Rel *) rel);
+#else
elf32_arm_info_to_howto (input_bfd, & bfd_reloc, rel);
+#endif
howto = bfd_reloc.howto;
if (info->relocateable)
@@ -1788,10 +1867,11 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
sec = local_sections[r_symndx];
#ifdef USE_REL
arm_add_to_rel (input_bfd, contents + rel->r_offset,
- howto, sec->output_offset + sym->st_value);
+ howto,
+ (bfd_signed_vma) (sec->output_offset
+ + sym->st_value));
#else
- rel->r_addend += (sec->output_offset + sym->st_value)
- >> howto->rightshift;
+ rel->r_addend += (sec->output_offset + sym->st_value);
#endif
}
}
@@ -1808,9 +1888,49 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
+#ifdef USE_REL
relocation = (sec->output_section->vma
+ sec->output_offset
+ sym->st_value);
+ if ((sec->flags & SEC_MERGE)
+ && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ {
+ asection *msec;
+ bfd_vma addend, value;
+
+ if (howto->rightshift)
+ {
+ (*_bfd_error_handler)
+ (_("%s(%s+0x%lx): %s relocation against SEC_MERGE section"),
+ bfd_archive_filename (input_bfd),
+ bfd_get_section_name (input_bfd, input_section),
+ (long) rel->r_offset, howto->name);
+ return false;
+ }
+
+ value = bfd_get_32 (input_bfd, contents + rel->r_offset);
+
+ /* Get the (signed) value from the instruction. */
+ addend = value & howto->src_mask;
+ if (addend & ((howto->src_mask + 1) >> 1))
+ {
+ bfd_signed_vma mask;
+
+ mask = -1;
+ mask &= ~ howto->src_mask;
+ addend |= mask;
+ }
+ msec = sec;
+ addend =
+ _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend)
+ - relocation;
+ addend += msec->output_section->vma + msec->output_offset;
+ value = (value & ~ howto->dst_mask) | (addend & howto->dst_mask);
+ bfd_put_32 (input_bfd, value, contents + rel->r_offset);
+ }
+#else
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+#endif
}
else
{
@@ -1834,9 +1954,10 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
{
case R_ARM_PC24:
case R_ARM_ABS32:
+ case R_ARM_THM_PC22:
if (info->shared
&& (
- (!info->symbolic && h->dynindx != -1)
+ (!info->symbolic && h->dynindx != -1)
|| (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
)
&& ((input_section->flags & SEC_ALLOC) != 0
@@ -1874,8 +1995,10 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
if (sec->output_section == NULL)
{
(*_bfd_error_handler)
- (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
- bfd_get_filename (input_bfd), h->root.root.string,
+ (_("%s: warning: unresolvable relocation %d against symbol `%s' from %s section"),
+ bfd_archive_filename (input_bfd),
+ r_type,
+ h->root.root.string,
bfd_get_section_name (input_bfd, input_section));
relocation_needed = 0;
}
@@ -1987,14 +2110,14 @@ elf32_arm_set_private_flags (abfd, flags)
{
if (EF_ARM_EABI_VERSION (flags) == EF_ARM_EABI_UNKNOWN)
{
- if (flags & EF_INTERWORK)
- _bfd_error_handler (_("\
+ if (flags & EF_ARM_INTERWORK)
+ (*_bfd_error_handler) (_("\
Warning: Not setting interwork flag of %s since it has already been specified as non-interworking"),
- bfd_get_filename (abfd));
+ bfd_archive_filename (abfd));
else
_bfd_error_handler (_("\
Warning: Clearing the interwork flag of %s due to outside request"),
- bfd_get_filename (abfd));
+ bfd_archive_filename (abfd));
}
}
else
@@ -2028,28 +2151,29 @@ elf32_arm_copy_private_bfd_data (ibfd, obfd)
&& in_flags != out_flags)
{
/* Cannot mix APCS26 and APCS32 code. */
- if ((in_flags & EF_APCS_26) != (out_flags & EF_APCS_26))
+ if ((in_flags & EF_ARM_APCS_26) != (out_flags & EF_ARM_APCS_26))
return false;
/* Cannot mix float APCS and non-float APCS code. */
- if ((in_flags & EF_APCS_FLOAT) != (out_flags & EF_APCS_FLOAT))
+ if ((in_flags & EF_ARM_APCS_FLOAT) != (out_flags & EF_ARM_APCS_FLOAT))
return false;
/* If the src and dest have different interworking flags
then turn off the interworking bit. */
- if ((in_flags & EF_INTERWORK) != (out_flags & EF_INTERWORK))
+ if ((in_flags & EF_ARM_INTERWORK) != (out_flags & EF_ARM_INTERWORK))
{
- if (out_flags & EF_INTERWORK)
+ if (out_flags & EF_ARM_INTERWORK)
_bfd_error_handler (_("\
Warning: Clearing the interwork flag in %s because non-interworking code in %s has been linked with it"),
- bfd_get_filename (obfd), bfd_get_filename (ibfd));
+ bfd_get_filename (obfd),
+ bfd_archive_filename (ibfd));
- in_flags &= ~EF_INTERWORK;
+ in_flags &= ~EF_ARM_INTERWORK;
}
/* Likewise for PIC, though don't warn for this case. */
- if ((in_flags & EF_PIC) != (out_flags & EF_PIC))
- in_flags &= ~EF_PIC;
+ if ((in_flags & EF_ARM_PIC) != (out_flags & EF_ARM_PIC))
+ in_flags &= ~EF_ARM_PIC;
}
elf_elfheader (obfd)->e_flags = in_flags;
@@ -2136,59 +2260,104 @@ elf32_arm_merge_private_bfd_data (ibfd, obfd)
{
_bfd_error_handler (_("\
Error: %s compiled for EABI version %d, whereas %s is compiled for version %d"),
- bfd_get_filename (ibfd),
- (in_flags & EF_ARM_EABIMASK) >> 24,
- bfd_get_filename (obfd),
- (out_flags & EF_ARM_EABIMASK) >> 24);
+ bfd_archive_filename (ibfd),
+ (in_flags & EF_ARM_EABIMASK) >> 24,
+ bfd_get_filename (obfd),
+ (out_flags & EF_ARM_EABIMASK) >> 24);
return false;
}
/* Not sure what needs to be checked for EABI versions >= 1. */
if (EF_ARM_EABI_VERSION (in_flags) == EF_ARM_EABI_UNKNOWN)
{
- if ((in_flags & EF_APCS_26) != (out_flags & EF_APCS_26))
+ if ((in_flags & EF_ARM_APCS_26) != (out_flags & EF_ARM_APCS_26))
{
_bfd_error_handler (_("\
Error: %s compiled for APCS-%d, whereas %s is compiled for APCS-%d"),
- bfd_get_filename (ibfd),
- in_flags & EF_APCS_26 ? 26 : 32,
- bfd_get_filename (obfd),
- out_flags & EF_APCS_26 ? 26 : 32);
+ bfd_archive_filename (ibfd),
+ in_flags & EF_ARM_APCS_26 ? 26 : 32,
+ bfd_get_filename (obfd),
+ out_flags & EF_ARM_APCS_26 ? 26 : 32);
flags_compatible = false;
}
- if ((in_flags & EF_APCS_FLOAT) != (out_flags & EF_APCS_FLOAT))
+ if ((in_flags & EF_ARM_APCS_FLOAT) != (out_flags & EF_ARM_APCS_FLOAT))
{
- _bfd_error_handler (_("\
-Error: %s passes floats in %s registers, whereas %s passes them in %s registers"),
- bfd_get_filename (ibfd),
- in_flags & EF_APCS_FLOAT ? _("float") : _("integer"),
- bfd_get_filename (obfd),
- out_flags & EF_APCS_26 ? _("float") : _("integer"));
+ if (in_flags & EF_ARM_APCS_FLOAT)
+ _bfd_error_handler (_("\
+Error: %s passes floats in FP registers, whereas %s passes them in integer registers"),
+ bfd_archive_filename (ibfd),
+ bfd_get_filename (obfd));
+ else
+ _bfd_error_handler (_("\
+Error: %s passes floats in integer registers, whereas %s passes them in FP registers"),
+ bfd_archive_filename (ibfd),
+ bfd_get_filename (obfd));
+
flags_compatible = false;
}
-#ifdef EF_SOFT_FLOAT
- if ((in_flags & EF_SOFT_FLOAT) != (out_flags & EF_SOFT_FLOAT))
+ if ((in_flags & EF_ARM_VFP_FLOAT) != (out_flags & EF_ARM_VFP_FLOAT))
{
- _bfd_error_handler (_ ("\
-Error: %s uses %s floating point, whereas %s uses %s floating point"),
- bfd_get_filename (ibfd),
- in_flags & EF_SOFT_FLOAT ? _("soft") : _("hard"),
- bfd_get_filename (obfd),
- out_flags & EF_SOFT_FLOAT ? _("soft") : _("hard"));
+ if (in_flags & EF_ARM_VFP_FLOAT)
+ _bfd_error_handler (_("\
+Error: %s uses VFP instructions, whereas %s FPA instructions"),
+ bfd_archive_filename (ibfd),
+ bfd_get_filename (obfd));
+ else
+ _bfd_error_handler (_("\
+Error: %s uses FPA instructions, whereas %s VFP instructions"),
+ bfd_archive_filename (ibfd),
+ bfd_get_filename (obfd));
+
flags_compatible = false;
}
+
+#ifdef EF_ARM_SOFT_FLOAT
+ if ((in_flags & EF_ARM_SOFT_FLOAT) != (out_flags & EF_ARM_SOFT_FLOAT))
+ {
+ /* We can allow interworking between code that is VFP format
+ layout, and uses either soft float or integer regs for
+ passing floating point arguments and results. We already
+ know that the APCS_FLOAT flags match; similarly for VFP
+ flags. */
+ if ((in_flags & EF_ARM_APCS_FLOAT) != 0
+ || (in_flags & EF_ARM_VFP_FLOAT) == 0)
+ {
+ if (in_flags & EF_ARM_SOFT_FLOAT)
+ _bfd_error_handler (_ ("\
+Error: %s uses software FP, whereas %s uses hardware FP"),
+ bfd_archive_filename (ibfd),
+ bfd_get_filename (obfd));
+ else
+ _bfd_error_handler (_ ("\
+Error: %s uses hardware FP, whereas %s uses software FP"),
+ bfd_archive_filename (ibfd),
+ bfd_get_filename (obfd));
+
+ flags_compatible = false;
+ }
+ }
#endif
/* Interworking mismatch is only a warning. */
- if ((in_flags & EF_INTERWORK) != (out_flags & EF_INTERWORK))
- _bfd_error_handler (_("\
-Warning: %s %s interworking, whereas %s %s"),
- bfd_get_filename (ibfd),
- in_flags & EF_INTERWORK ? _("supports") : _("does not support"),
- bfd_get_filename (obfd),
- out_flags & EF_INTERWORK ? _("does") : _("does not"));
+ if ((in_flags & EF_ARM_INTERWORK) != (out_flags & EF_ARM_INTERWORK))
+ {
+ if (in_flags & EF_ARM_INTERWORK)
+ {
+ _bfd_error_handler (_("\
+Warning: %s supports interworking, whereas %s does not"),
+ bfd_archive_filename (ibfd),
+ bfd_get_filename (obfd));
+ }
+ else
+ {
+ _bfd_error_handler (_("\
+Warning: %s does not support interworking, whereas %s does"),
+ bfd_archive_filename (ibfd),
+ bfd_get_filename (obfd));
+ }
+ }
}
return flags_compatible;
@@ -2222,31 +2391,37 @@ elf32_arm_print_private_bfd_data (abfd, ptr)
/* The following flag bits are GNU extenstions and not part of the
official ARM ELF extended ABI. Hence they are only decoded if
the EABI version is not set. */
- if (flags & EF_INTERWORK)
+ if (flags & EF_ARM_INTERWORK)
fprintf (file, _(" [interworking enabled]"));
- if (flags & EF_APCS_26)
+ if (flags & EF_ARM_APCS_26)
fprintf (file, _(" [APCS-26]"));
else
fprintf (file, _(" [APCS-32]"));
- if (flags & EF_APCS_FLOAT)
+ if (flags & EF_ARM_VFP_FLOAT)
+ fprintf (file, _(" [VFP float format]"));
+ else
+ fprintf (file, _(" [FPA float format]"));
+
+ if (flags & EF_ARM_APCS_FLOAT)
fprintf (file, _(" [floats passed in float registers]"));
- if (flags & EF_PIC)
+ if (flags & EF_ARM_PIC)
fprintf (file, _(" [position independent]"));
- if (flags & EF_NEW_ABI)
+ if (flags & EF_ARM_NEW_ABI)
fprintf (file, _(" [new ABI]"));
- if (flags & EF_OLD_ABI)
+ if (flags & EF_ARM_OLD_ABI)
fprintf (file, _(" [old ABI]"));
- if (flags & EF_SOFT_FLOAT)
+ if (flags & EF_ARM_SOFT_FLOAT)
fprintf (file, _(" [software FP]"));
- flags &= ~(EF_INTERWORK | EF_APCS_26 | EF_APCS_FLOAT | EF_PIC
- | EF_NEW_ABI | EF_OLD_ABI | EF_SOFT_FLOAT);
+ flags &= ~(EF_ARM_INTERWORK | EF_ARM_APCS_26 | EF_ARM_APCS_FLOAT
+ | EF_ARM_PIC | EF_ARM_NEW_ABI | EF_ARM_OLD_ABI
+ | EF_ARM_SOFT_FLOAT | EF_ARM_VFP_FLOAT);
break;
case EF_ARM_EABI_VER1:
@@ -2260,6 +2435,24 @@ elf32_arm_print_private_bfd_data (abfd, ptr)
flags &= ~ EF_ARM_SYMSARESORTED;
break;
+ case EF_ARM_EABI_VER2:
+ fprintf (file, _(" [Version2 EABI]"));
+
+ if (flags & EF_ARM_SYMSARESORTED)
+ fprintf (file, _(" [sorted symbol table]"));
+ else
+ fprintf (file, _(" [unsorted symbol table]"));
+
+ if (flags & EF_ARM_DYNSYMSUSESEGIDX)
+ fprintf (file, _(" [dynamic symbols use segment index]"));
+
+ if (flags & EF_ARM_MAPSYMSFIRST)
+ fprintf (file, _(" [mapping symbols precede others]"));
+
+ flags &= ~(EF_ARM_SYMSARESORTED | EF_ARM_DYNSYMSUSESEGIDX
+ | EF_ARM_MAPSYMSFIRST);
+ break;
+
default:
fprintf (file, _(" <EABI version unrecognised>"));
break;
@@ -2342,14 +2535,9 @@ elf32_arm_gc_mark_hook (abfd, info, rel, h, sym)
}
else
{
- if (!(elf_bad_symtab (abfd)
- && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
- && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
- && sym->st_shndx != SHN_COMMON))
- {
- return bfd_section_from_elf_index (abfd, sym->st_shndx);
- }
- }
+ return bfd_section_from_elf_index (abfd, sym->st_shndx);
+ }
+
return NULL;
}
@@ -2452,7 +2640,7 @@ elf32_arm_check_relocs (abfd, info, sec, relocs)
srelgot = bfd_make_section (dynobj, ".rel.got");
if (srelgot == NULL
|| ! bfd_set_section_flags (dynobj, srelgot,
- (SEC_ALLOC
+ (SEC_ALLOC
| SEC_LOAD
| SEC_HAS_CONTENTS
| SEC_IN_MEMORY
@@ -2480,14 +2668,15 @@ elf32_arm_check_relocs (abfd, info, sec, relocs)
}
else
{
- /* This is a global offset table entry for a local
+ /* This is a global offset table entry for a local
symbol. */
if (local_got_offsets == NULL)
{
- size_t size;
- register unsigned int i;
+ bfd_size_type size;
+ unsigned int i;
- size = symtab_hdr->sh_info * sizeof (bfd_vma);
+ size = symtab_hdr->sh_info;
+ size *= sizeof (bfd_vma);
local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size);
if (local_got_offsets == NULL)
return false;
@@ -2512,7 +2701,7 @@ elf32_arm_check_relocs (abfd, info, sec, relocs)
sgot->_raw_size += 4;
break;
- case R_ARM_PLT32:
+ case R_ARM_PLT32:
/* This symbol requires a procedure linkage table entry. We
actually build the entry in adjust_dynamic_symbol,
because this might be a case of linking PIC code which is
@@ -2565,7 +2754,7 @@ elf32_arm_check_relocs (abfd, info, sec, relocs)
return false;
BFD_ASSERT (strncmp (name, ".rel", 4) == 0
- && strcmp (bfd_get_section_name (abfd, sec),
+ && strcmp (bfd_get_section_name (abfd, sec),
name + 4) == 0);
sreloc = bfd_get_section_by_name (dynobj, name);
@@ -2583,6 +2772,8 @@ elf32_arm_check_relocs (abfd, info, sec, relocs)
|| ! bfd_set_section_alignment (dynobj, sreloc, 2))
return false;
}
+ if (sec->flags & SEC_READONLY)
+ info->flags |= DF_TEXTREL;
}
sreloc->_raw_size += sizeof (Elf32_External_Rel);
@@ -2609,8 +2800,7 @@ elf32_arm_check_relocs (abfd, info, sec, relocs)
if (p == NULL)
{
p = ((struct elf32_arm_pcrel_relocs_copied *)
- bfd_alloc (dynobj, sizeof * p));
-
+ bfd_alloc (dynobj, (bfd_size_type) sizeof * p));
if (p == NULL)
return false;
p->next = eh->pcrel_relocs_copied;
@@ -2654,8 +2844,8 @@ elf32_arm_find_nearest_line
asection * section;
asymbol ** symbols;
bfd_vma offset;
- CONST char ** filename_ptr;
- CONST char ** functionname_ptr;
+ const char ** filename_ptr;
+ const char ** functionname_ptr;
unsigned int * line_ptr;
{
boolean found;
@@ -2897,14 +3087,13 @@ elf32_arm_adjust_dynamic_symbol (info, h)
static boolean
elf32_arm_size_dynamic_sections (output_bfd, info)
- bfd * output_bfd;
+ bfd * output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info * info;
{
bfd * dynobj;
asection * s;
boolean plt;
boolean relocs;
- boolean reltext;
dynobj = elf_hash_table (info)->dynobj;
BFD_ASSERT (dynobj != NULL);
@@ -2946,7 +3135,6 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
memory for them. */
plt = false;
relocs = false;
- reltext = false;
for (s = dynobj->sections; s != NULL; s = s->next)
{
const char * name;
@@ -2992,30 +3180,10 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
}
else
{
- asection * target;
-
/* Remember whether there are any reloc sections other
than .rel.plt. */
if (strcmp (name, ".rel.plt") != 0)
- {
- const char *outname;
-
- relocs = true;
-
- /* If this relocation section applies to a read only
- section, then we probably need a DT_TEXTREL
- entry. The entries in the .rel.plt section
- really apply to the .got section, which we
- created ourselves and so know is not readonly. */
- outname = bfd_get_section_name (output_bfd,
- s->output_section);
- target = bfd_get_section_by_name (output_bfd, outname + 4);
-
- if (target != NULL
- && (target->flags & SEC_READONLY) != 0
- && (target->flags & SEC_ALLOC) != 0)
- reltext = true;
- }
+ relocs = true;
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
@@ -3033,12 +3201,16 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
asection ** spp;
for (spp = &s->output_section->owner->sections;
- *spp != s->output_section;
+ *spp != NULL;
spp = &(*spp)->next)
- ;
- *spp = s->output_section->next;
- --s->output_section->owner->section_count;
-
+ {
+ if (*spp == s->output_section)
+ {
+ bfd_section_list_remove (s->output_section->owner, spp);
+ --s->output_section->owner->section_count;
+ break;
+ }
+ }
continue;
}
@@ -3055,37 +3227,40 @@ elf32_arm_size_dynamic_sections (output_bfd, info)
must add the entries now so that we get the correct size for
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
- if (! info->shared)
+#define add_dynamic_entry(TAG, VAL) \
+ bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+
+ if (!info->shared)
{
- if (! bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0))
+ if (!add_dynamic_entry (DT_DEBUG, 0))
return false;
}
if (plt)
{
- if ( ! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0)
- || ! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0)
- || ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_REL)
- || ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0))
+ if ( !add_dynamic_entry (DT_PLTGOT, 0)
+ || !add_dynamic_entry (DT_PLTRELSZ, 0)
+ || !add_dynamic_entry (DT_PLTREL, DT_REL)
+ || !add_dynamic_entry (DT_JMPREL, 0))
return false;
}
if (relocs)
{
- if ( ! bfd_elf32_add_dynamic_entry (info, DT_REL, 0)
- || ! bfd_elf32_add_dynamic_entry (info, DT_RELSZ, 0)
- || ! bfd_elf32_add_dynamic_entry (info, DT_RELENT,
- sizeof (Elf32_External_Rel)))
+ if ( !add_dynamic_entry (DT_REL, 0)
+ || !add_dynamic_entry (DT_RELSZ, 0)
+ || !add_dynamic_entry (DT_RELENT, sizeof (Elf32_External_Rel)))
return false;
}
- if (reltext)
+ if ((info->flags & DF_TEXTREL) != 0)
{
- if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
+ if (!add_dynamic_entry (DT_TEXTREL, 0))
return false;
info->flags |= DF_TEXTREL;
}
}
+#undef add_synamic_entry
return true;
}
@@ -3218,7 +3393,7 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
rel.r_offset = (sgot->output_section->vma
+ sgot->output_offset
- + (h->got.offset &~ 1));
+ + (h->got.offset &~ (bfd_vma) 1));
/* If this is a -Bsymbolic link, and the symbol is defined
locally, we just want to emit a RELATIVE reloc. The entry in
@@ -3403,29 +3578,48 @@ elf32_arm_post_process_headers (abfd, link_info)
i_ehdrp->e_ident[EI_ABIVERSION] = ARM_ELF_ABI_VERSION;
}
+static enum elf_reloc_type_class
+elf32_arm_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
+{
+ switch ((int) ELF32_R_TYPE (rela->r_info))
+ {
+ case R_ARM_RELATIVE:
+ return reloc_class_relative;
+ case R_ARM_JUMP_SLOT:
+ return reloc_class_plt;
+ case R_ARM_COPY:
+ return reloc_class_copy;
+ default:
+ return reloc_class_normal;
+ }
+}
+
+
#define ELF_ARCH bfd_arch_arm
#define ELF_MACHINE_CODE EM_ARM
#define ELF_MAXPAGESIZE 0x8000
-#define bfd_elf32_bfd_copy_private_bfd_data elf32_arm_copy_private_bfd_data
-#define bfd_elf32_bfd_merge_private_bfd_data elf32_arm_merge_private_bfd_data
+#define bfd_elf32_bfd_copy_private_bfd_data elf32_arm_copy_private_bfd_data
+#define bfd_elf32_bfd_merge_private_bfd_data elf32_arm_merge_private_bfd_data
#define bfd_elf32_bfd_set_private_flags elf32_arm_set_private_flags
#define bfd_elf32_bfd_print_private_bfd_data elf32_arm_print_private_bfd_data
#define bfd_elf32_bfd_link_hash_table_create elf32_arm_link_hash_table_create
-#define bfd_elf32_bfd_reloc_type_lookup elf32_arm_reloc_type_lookup
+#define bfd_elf32_bfd_reloc_type_lookup elf32_arm_reloc_type_lookup
#define bfd_elf32_find_nearest_line elf32_arm_find_nearest_line
#define elf_backend_get_symbol_type elf32_arm_get_symbol_type
#define elf_backend_gc_mark_hook elf32_arm_gc_mark_hook
#define elf_backend_gc_sweep_hook elf32_arm_gc_sweep_hook
#define elf_backend_check_relocs elf32_arm_check_relocs
-#define elf_backend_relocate_section elf32_arm_relocate_section
+#define elf_backend_relocate_section elf32_arm_relocate_section
#define elf_backend_adjust_dynamic_symbol elf32_arm_adjust_dynamic_symbol
#define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections
#define elf_backend_finish_dynamic_symbol elf32_arm_finish_dynamic_symbol
#define elf_backend_finish_dynamic_sections elf32_arm_finish_dynamic_sections
#define elf_backend_size_dynamic_sections elf32_arm_size_dynamic_sections
#define elf_backend_post_process_headers elf32_arm_post_process_headers
+#define elf_backend_reloc_type_class elf32_arm_reloc_type_class
#define elf_backend_can_gc_sections 1
#define elf_backend_plt_readonly 1
diff --git a/contrib/binutils/bfd/elf32-gen.c b/contrib/binutils/bfd/elf32-gen.c
index 7a39f47..58b5fc6 100644
--- a/contrib/binutils/bfd/elf32-gen.c
+++ b/contrib/binutils/bfd/elf32-gen.c
@@ -1,5 +1,5 @@
/* Generic support for 32-bit ELF
- Copyright 1993, 1995, 1998, 1999 Free Software Foundation, Inc.
+ Copyright 1993, 1995, 1998, 1999, 2001 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -40,6 +40,13 @@ static reloc_howto_type dummy =
0, /* dst_mask */
false); /* pcrel_offset */
+static void elf_generic_info_to_howto
+ PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+static void elf_generic_info_to_howto_rel
+ PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+static boolean elf32_generic_link_add_symbols
+ PARAMS ((bfd *, struct bfd_link_info *));
+
static void
elf_generic_info_to_howto (abfd, bfd_reloc, elf_reloc)
bfd *abfd ATTRIBUTE_UNUSED;
@@ -58,7 +65,7 @@ elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
bfd_reloc->howto = &dummy;
}
-static boolean
+static boolean
elf32_generic_link_add_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
@@ -72,15 +79,9 @@ elf32_generic_link_add_symbols (abfd, info)
Elf_Internal_Ehdr *ehdrp;
ehdrp = elf_elfheader (abfd);
- if (abfd->my_archive)
- (*_bfd_error_handler) (_("%s(%s): Relocations in generic ELF (EM: %d)"),
- bfd_get_filename (abfd->my_archive),
- bfd_get_filename (abfd),
- ehdrp->e_machine);
- else
- (*_bfd_error_handler) (_("%s: Relocations in generic ELF (EM: %d)"),
- bfd_get_filename (abfd),
- ehdrp->e_machine);
+ (*_bfd_error_handler) (_("%s: Relocations in generic ELF (EM: %d)"),
+ bfd_archive_filename (abfd),
+ ehdrp->e_machine);
bfd_set_error (bfd_error_wrong_format);
return false;
diff --git a/contrib/binutils/bfd/elf32-i386.c b/contrib/binutils/bfd/elf32-i386.c
index b838d3a..236e167 100644
--- a/contrib/binutils/bfd/elf32-i386.c
+++ b/contrib/binutils/bfd/elf32-i386.c
@@ -30,16 +30,39 @@ static void elf_i386_info_to_howto
PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
static void elf_i386_info_to_howto_rel
PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
-static boolean elf_i386_is_local_label_name PARAMS ((bfd *, const char *));
-static struct bfd_hash_entry *elf_i386_link_hash_newfunc
+static boolean elf_i386_is_local_label_name
+ PARAMS ((bfd *, const char *));
+static boolean elf_i386_grok_prstatus
+ PARAMS ((bfd *abfd, Elf_Internal_Note *note));
+static boolean elf_i386_grok_psinfo
+ PARAMS ((bfd *abfd, Elf_Internal_Note *note));
+static struct bfd_hash_entry *link_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
static struct bfd_link_hash_table *elf_i386_link_hash_table_create
PARAMS ((bfd *));
+static boolean create_got_section
+ PARAMS((bfd *, struct bfd_link_info *));
+static boolean elf_i386_create_dynamic_sections
+ PARAMS((bfd *, struct bfd_link_info *));
+static void elf_i386_copy_indirect_symbol
+ PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
static boolean elf_i386_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
+static asection *elf_i386_gc_mark_hook
+ PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry *, Elf_Internal_Sym *));
+static boolean elf_i386_gc_sweep_hook
+ PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ const Elf_Internal_Rela *));
static boolean elf_i386_adjust_dynamic_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+static boolean allocate_dynrelocs
+ PARAMS ((struct elf_link_hash_entry *, PTR));
+static boolean readonly_dynrelocs
+ PARAMS ((struct elf_link_hash_entry *, PTR));
+static boolean elf_i386_fake_sections
+ PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
static boolean elf_i386_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
static boolean elf_i386_relocate_section
@@ -48,6 +71,8 @@ static boolean elf_i386_relocate_section
static boolean elf_i386_finish_dynamic_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
Elf_Internal_Sym *));
+static enum elf_reloc_type_class elf_i386_reloc_type_class
+ PARAMS ((const Elf_Internal_Rela *));
static boolean elf_i386_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
@@ -271,7 +296,7 @@ elf_i386_info_to_howto_rel (abfd, cache_ptr, dst)
>= R_386_vt - R_386_ext))
{
(*_bfd_error_handler) (_("%s: invalid relocation type %d"),
- bfd_get_filename (abfd), (int) r_type);
+ bfd_archive_filename (abfd), (int) r_type);
indx = (unsigned int) R_386_NONE;
}
cache_ptr->howto = &elf_howto_table[indx];
@@ -294,7 +319,84 @@ elf_i386_is_local_label_name (abfd, name)
return _bfd_elf_is_local_label_name (abfd, name);
}
-/* Functions for the i386 ELF linker. */
+/* Support for core dump NOTE sections. */
+static boolean
+elf_i386_grok_prstatus (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ int offset;
+ size_t raw_size;
+
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 144: /* Linux/i386 */
+ /* pr_cursig */
+ elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+
+ /* pr_pid */
+ elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+
+ /* pr_reg */
+ offset = 72;
+ raw_size = 68;
+
+ break;
+ }
+
+ /* Make a ".reg/999" section. */
+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ raw_size, note->descpos + offset);
+}
+
+static boolean
+elf_i386_grok_psinfo (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 124: /* Linux/i386 elf_prpsinfo */
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
+ }
+
+ /* Note that for some reason, a spurious space is tacked
+ onto the end of the args in some (at least one anyway)
+ implementations, so strip it off if it exists. */
+
+ {
+ char *command = elf_tdata (abfd)->core_command;
+ int n = strlen (command);
+
+ if (0 < n && command[n - 1] == ' ')
+ command[n - 1] = '\0';
+ }
+
+ return true;
+}
+
+/* Functions for the i386 ELF linker.
+
+ In order to gain some understanding of code in this file without
+ knowing all the intricate details of the linker, note the
+ following:
+
+ Functions named elf_i386_* are called by external routines, other
+ functions are only called locally. elf_i386_* functions appear
+ in this file more or less in the order in which they are called
+ from external routines. eg. elf_i386_check_relocs is called
+ early in the link process, elf_i386_finish_dynamic_sections is
+ one of the last functions. */
+
/* The name of the dynamic interpreter. This is put in the .interp
section. */
@@ -352,53 +454,53 @@ static const bfd_byte elf_i386_pic_plt_entry[PLT_ENTRY_SIZE] =
};
/* The i386 linker needs to keep track of the number of relocs that it
- decides to copy in check_relocs for each symbol. This is so that
- it can discard PC relative relocs if it doesn't need them when
- linking with -Bsymbolic. We store the information in a field
- extending the regular ELF linker hash table. */
+ decides to copy as dynamic relocs in check_relocs for each symbol.
+ This is so that it can later discard them if they are found to be
+ unnecessary. We store the information in a field extending the
+ regular ELF linker hash table. */
-/* This structure keeps track of the number of PC relative relocs we
- have copied for a given symbol. */
-
-struct elf_i386_pcrel_relocs_copied
+struct elf_i386_dyn_relocs
{
- /* Next section. */
- struct elf_i386_pcrel_relocs_copied *next;
- /* A section in dynobj. */
- asection *section;
- /* Number of relocs copied in this section. */
+ struct elf_i386_dyn_relocs *next;
+
+ /* The input section of the reloc. */
+ asection *sec;
+
+ /* Total number of relocs copied for the input section. */
bfd_size_type count;
+
+ /* Number of pc-relative relocs copied for the input section. */
+ bfd_size_type pc_count;
};
/* i386 ELF linker hash entry. */
struct elf_i386_link_hash_entry
{
- struct elf_link_hash_entry root;
+ struct elf_link_hash_entry elf;
- /* Number of PC relative relocs copied for this symbol. */
- struct elf_i386_pcrel_relocs_copied *pcrel_relocs_copied;
+ /* Track dynamic relocs copied for this symbol. */
+ struct elf_i386_dyn_relocs *dyn_relocs;
};
/* i386 ELF linker hash table. */
struct elf_i386_link_hash_table
{
- struct elf_link_hash_table root;
-};
-
-/* Declare this now that the above structures are defined. */
+ struct elf_link_hash_table elf;
-static boolean elf_i386_discard_copies
- PARAMS ((struct elf_i386_link_hash_entry *, PTR));
-
-/* Traverse an i386 ELF linker hash table. */
+ /* Short-cuts to get to dynamic linker sections. */
+ asection *sgot;
+ asection *sgotplt;
+ asection *srelgot;
+ asection *splt;
+ asection *srelplt;
+ asection *sdynbss;
+ asection *srelbss;
-#define elf_i386_link_hash_traverse(table, func, info) \
- (elf_link_hash_traverse \
- (&(table)->root, \
- (boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \
- (info)))
+ /* Small local sym to section mapping cache. */
+ struct sym_sec_cache sym_sec;
+};
/* Get the i386 ELF linker hash table from a link_info structure. */
@@ -408,33 +510,32 @@ static boolean elf_i386_discard_copies
/* Create an entry in an i386 ELF linker hash table. */
static struct bfd_hash_entry *
-elf_i386_link_hash_newfunc (entry, table, string)
+link_hash_newfunc (entry, table, string)
struct bfd_hash_entry *entry;
struct bfd_hash_table *table;
const char *string;
{
- struct elf_i386_link_hash_entry *ret =
- (struct elf_i386_link_hash_entry *) entry;
-
/* Allocate the structure if it has not already been allocated by a
subclass. */
- if (ret == (struct elf_i386_link_hash_entry *) NULL)
- ret = ((struct elf_i386_link_hash_entry *)
- bfd_hash_allocate (table,
- sizeof (struct elf_i386_link_hash_entry)));
- if (ret == (struct elf_i386_link_hash_entry *) NULL)
- return (struct bfd_hash_entry *) ret;
+ if (entry == NULL)
+ {
+ entry = bfd_hash_allocate (table,
+ sizeof (struct elf_i386_link_hash_entry));
+ if (entry == NULL)
+ return entry;
+ }
/* Call the allocation method of the superclass. */
- ret = ((struct elf_i386_link_hash_entry *)
- _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
- table, string));
- if (ret != (struct elf_i386_link_hash_entry *) NULL)
+ entry = _bfd_elf_link_hash_newfunc (entry, table, string);
+ if (entry != NULL)
{
- ret->pcrel_relocs_copied = NULL;
+ struct elf_i386_link_hash_entry *eh;
+
+ eh = (struct elf_i386_link_hash_entry *) entry;
+ eh->dyn_relocs = NULL;
}
- return (struct bfd_hash_entry *) ret;
+ return entry;
}
/* Create an i386 ELF linker hash table. */
@@ -444,25 +545,142 @@ elf_i386_link_hash_table_create (abfd)
bfd *abfd;
{
struct elf_i386_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct elf_i386_link_hash_table);
- ret = ((struct elf_i386_link_hash_table *)
- bfd_alloc (abfd, sizeof (struct elf_i386_link_hash_table)));
- if (ret == (struct elf_i386_link_hash_table *) NULL)
+ ret = (struct elf_i386_link_hash_table *) bfd_alloc (abfd, amt);
+ if (ret == NULL)
return NULL;
- if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
- elf_i386_link_hash_newfunc))
+ if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
{
bfd_release (abfd, ret);
return NULL;
}
- return &ret->root.root;
+ ret->sgot = NULL;
+ ret->sgotplt = NULL;
+ ret->srelgot = NULL;
+ ret->splt = NULL;
+ ret->srelplt = NULL;
+ ret->sdynbss = NULL;
+ ret->srelbss = NULL;
+ ret->sym_sec.abfd = NULL;
+
+ return &ret->elf.root;
+}
+
+/* Create .got, .gotplt, and .rel.got sections in DYNOBJ, and set up
+ shortcuts to them in our hash table. */
+
+static boolean
+create_got_section (dynobj, info)
+ bfd *dynobj;
+ struct bfd_link_info *info;
+{
+ struct elf_i386_link_hash_table *htab;
+
+ if (! _bfd_elf_create_got_section (dynobj, info))
+ return false;
+
+ htab = elf_i386_hash_table (info);
+ htab->sgot = bfd_get_section_by_name (dynobj, ".got");
+ htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
+ if (!htab->sgot || !htab->sgotplt)
+ abort ();
+
+ htab->srelgot = bfd_make_section (dynobj, ".rel.got");
+ if (htab->srelgot == NULL
+ || ! bfd_set_section_flags (dynobj, htab->srelgot,
+ (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED
+ | SEC_READONLY))
+ || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
+ return false;
+ return true;
+}
+
+/* Create .plt, .rel.plt, .got, .got.plt, .rel.got, .dynbss, and
+ .rel.bss sections in DYNOBJ, and set up shortcuts to them in our
+ hash table. */
+
+static boolean
+elf_i386_create_dynamic_sections (dynobj, info)
+ bfd *dynobj;
+ struct bfd_link_info *info;
+{
+ struct elf_i386_link_hash_table *htab;
+
+ htab = elf_i386_hash_table (info);
+ if (!htab->sgot && !create_got_section (dynobj, info))
+ return false;
+
+ if (!_bfd_elf_create_dynamic_sections (dynobj, info))
+ return false;
+
+ htab->splt = bfd_get_section_by_name (dynobj, ".plt");
+ htab->srelplt = bfd_get_section_by_name (dynobj, ".rel.plt");
+ htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
+ if (!info->shared)
+ htab->srelbss = bfd_get_section_by_name (dynobj, ".rel.bss");
+
+ if (!htab->splt || !htab->srelplt || !htab->sdynbss
+ || (!info->shared && !htab->srelbss))
+ abort ();
+
+ return true;
+}
+
+/* Copy the extra info we tack onto an elf_link_hash_entry. */
+
+static void
+elf_i386_copy_indirect_symbol (dir, ind)
+ struct elf_link_hash_entry *dir, *ind;
+{
+ struct elf_i386_link_hash_entry *edir, *eind;
+
+ edir = (struct elf_i386_link_hash_entry *) dir;
+ eind = (struct elf_i386_link_hash_entry *) ind;
+
+ if (eind->dyn_relocs != NULL)
+ {
+ if (edir->dyn_relocs != NULL)
+ {
+ struct elf_i386_dyn_relocs **pp;
+ struct elf_i386_dyn_relocs *p;
+
+ if (ind->root.type == bfd_link_hash_indirect)
+ abort ();
+
+ /* Add reloc counts against the weak sym to the strong sym
+ list. Merge any entries against the same section. */
+ for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
+ {
+ struct elf_i386_dyn_relocs *q;
+
+ for (q = edir->dyn_relocs; q != NULL; q = q->next)
+ if (q->sec == p->sec)
+ {
+ q->pc_count += p->pc_count;
+ q->count += p->count;
+ *pp = p->next;
+ break;
+ }
+ if (q == NULL)
+ pp = &p->next;
+ }
+ *pp = edir->dyn_relocs;
+ }
+
+ edir->dyn_relocs = eind->dyn_relocs;
+ eind->dyn_relocs = NULL;
+ }
+
+ _bfd_elf_link_hash_copy_indirect (dir, ind);
}
/* Look through the relocs for a section during the first phase, and
- allocate space in the global offset table or procedure linkage
- table. */
+ calculate needed space in the global offset table, procedure linkage
+ table, and dynamic reloc sections. */
static boolean
elf_i386_check_relocs (abfd, info, sec, relocs)
@@ -471,26 +689,20 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
asection *sec;
const Elf_Internal_Rela *relocs;
{
- bfd *dynobj;
+ struct elf_i386_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
- bfd_signed_vma *local_got_refcounts;
const Elf_Internal_Rela *rel;
const Elf_Internal_Rela *rel_end;
- asection *sgot;
- asection *srelgot;
asection *sreloc;
if (info->relocateable)
return true;
- dynobj = elf_hash_table (info)->dynobj;
+ htab = elf_i386_hash_table (info);
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
- local_got_refcounts = elf_local_got_refcounts (abfd);
- sgot = NULL;
- srelgot = NULL;
sreloc = NULL;
rel_end = relocs + sec->reloc_count;
@@ -503,15 +715,9 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
{
- if (abfd->my_archive)
- (*_bfd_error_handler) (_("%s(%s): bad symbol index: %d"),
- bfd_get_filename (abfd->my_archive),
- bfd_get_filename (abfd),
- r_symndx);
- else
- (*_bfd_error_handler) (_("%s: bad symbol index: %d"),
- bfd_get_filename (abfd),
- r_symndx);
+ (*_bfd_error_handler) (_("%s: bad symbol index: %d"),
+ bfd_archive_filename (abfd),
+ r_symndx);
return false;
}
@@ -520,133 +726,80 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
else
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- /* Some relocs require a global offset table. */
- if (dynobj == NULL)
- {
- switch (ELF32_R_TYPE (rel->r_info))
- {
- case R_386_GOT32:
- case R_386_GOTOFF:
- case R_386_GOTPC:
- elf_hash_table (info)->dynobj = dynobj = abfd;
- if (! _bfd_elf_create_got_section (dynobj, info))
- return false;
- break;
-
- default:
- break;
- }
- }
-
switch (ELF32_R_TYPE (rel->r_info))
{
case R_386_GOT32:
/* This symbol requires a global offset table entry. */
-
- if (sgot == NULL)
- {
- sgot = bfd_get_section_by_name (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- }
-
- if (srelgot == NULL
- && (h != NULL || info->shared))
- {
- srelgot = bfd_get_section_by_name (dynobj, ".rel.got");
- if (srelgot == NULL)
- {
- srelgot = bfd_make_section (dynobj, ".rel.got");
- if (srelgot == NULL
- || ! bfd_set_section_flags (dynobj, srelgot,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
- || ! bfd_set_section_alignment (dynobj, srelgot, 2))
- return false;
- }
- }
-
if (h != NULL)
{
- if (h->got.refcount == -1)
- {
- h->got.refcount = 1;
-
- /* Make sure this symbol is output as a dynamic symbol. */
- if (h->dynindx == -1)
- {
- if (! bfd_elf32_link_record_dynamic_symbol (info, h))
- return false;
- }
-
- sgot->_raw_size += 4;
- srelgot->_raw_size += sizeof (Elf32_External_Rel);
- }
- else
- h->got.refcount += 1;
+ h->got.refcount += 1;
}
else
{
- /* This is a global offset table entry for a local symbol. */
+ bfd_signed_vma *local_got_refcounts;
+
+ /* This is a global offset table entry for a local symbol. */
+ local_got_refcounts = elf_local_got_refcounts (abfd);
if (local_got_refcounts == NULL)
{
- size_t size;
+ bfd_size_type size;
- size = symtab_hdr->sh_info * sizeof (bfd_signed_vma);
+ size = symtab_hdr->sh_info;
+ size *= sizeof (bfd_signed_vma);
local_got_refcounts = ((bfd_signed_vma *)
- bfd_alloc (abfd, size));
+ bfd_zalloc (abfd, size));
if (local_got_refcounts == NULL)
return false;
elf_local_got_refcounts (abfd) = local_got_refcounts;
- memset (local_got_refcounts, -1, size);
}
- if (local_got_refcounts[r_symndx] == -1)
- {
- local_got_refcounts[r_symndx] = 1;
+ local_got_refcounts[r_symndx] += 1;
+ }
+ /* Fall through */
- sgot->_raw_size += 4;
- if (info->shared)
- {
- /* If we are generating a shared object, we need to
- output a R_386_RELATIVE reloc so that the dynamic
- linker can adjust this GOT entry. */
- srelgot->_raw_size += sizeof (Elf32_External_Rel);
- }
- }
- else
- local_got_refcounts[r_symndx] += 1;
+ case R_386_GOTOFF:
+ case R_386_GOTPC:
+ if (htab->sgot == NULL)
+ {
+ if (htab->elf.dynobj == NULL)
+ htab->elf.dynobj = abfd;
+ if (!create_got_section (htab->elf.dynobj, info))
+ return false;
}
break;
case R_386_PLT32:
/* This symbol requires a procedure linkage table entry. We
- actually build the entry in adjust_dynamic_symbol,
- because this might be a case of linking PIC code which is
- never referenced by a dynamic object, in which case we
- don't need to generate a procedure linkage table entry
- after all. */
+ actually build the entry in adjust_dynamic_symbol,
+ because this might be a case of linking PIC code which is
+ never referenced by a dynamic object, in which case we
+ don't need to generate a procedure linkage table entry
+ after all. */
/* If this is a local symbol, we resolve it directly without
- creating a procedure linkage table entry. */
+ creating a procedure linkage table entry. */
if (h == NULL)
continue;
- if (h->plt.refcount == -1)
- {
- h->plt.refcount = 1;
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- }
- else
- h->plt.refcount += 1;
+ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->plt.refcount += 1;
break;
case R_386_32:
case R_386_PC32:
- if (h != NULL)
- h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+ if (h != NULL && !info->shared)
+ {
+ /* If this reloc is in a read-only section, we might
+ need a copy reloc. We can't check reliably at this
+ stage whether the section is read-only, as input
+ sections have not yet been mapped to output sections.
+ Tentatively set the flag for now, and correct in
+ adjust_dynamic_symbol. */
+ h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+
+ /* We may need a .plt entry if the function this reloc
+ refers to is in a shared lib. */
+ h->plt.refcount += 1;
+ }
/* If we are creating a shared library, and this is a reloc
against a global symbol, or a non PC relative reloc
@@ -659,26 +812,41 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
possible that DEF_REGULAR is not set now but will be set
later (it is never cleared). In case of a weak definition,
DEF_REGULAR may be cleared later by a strong definition in
- a shared library. We account for that possibility below by
+ a shared library. We account for that possibility below by
storing information in the relocs_copied field of the hash
table entry. A similar situation occurs when creating
shared libraries and symbol visibility changes render the
- symbol local. */
- if (info->shared
- && (sec->flags & SEC_ALLOC) != 0
- && (ELF32_R_TYPE (rel->r_info) != R_386_PC32
- || (h != NULL
- && (! info->symbolic
- || h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ symbol local.
+
+ If on the other hand, we are creating an executable, we
+ may need to keep relocations for symbols satisfied by a
+ dynamic library if we manage to avoid copy relocs for the
+ symbol. */
+ if ((info->shared
+ && (sec->flags & SEC_ALLOC) != 0
+ && (ELF32_R_TYPE (rel->r_info) != R_386_PC32
+ || (h != NULL
+ && (! info->symbolic
+ || h->root.type == bfd_link_hash_defweak
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ || (!info->shared
+ && (sec->flags & SEC_ALLOC) != 0
+ && h != NULL
+ && (h->root.type == bfd_link_hash_defweak
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0)))
{
- /* When creating a shared object, we must copy these
- reloc types into the output file. We create a reloc
- section in dynobj and make room for this reloc. */
+ struct elf_i386_dyn_relocs *p;
+ struct elf_i386_dyn_relocs **head;
+
+ /* We must copy these reloc types into the output file.
+ Create a reloc section in dynobj and make room for
+ this reloc. */
if (sreloc == NULL)
{
const char *name;
+ bfd *dynobj;
name = (bfd_elf_string_from_elf_section
(abfd,
@@ -691,17 +859,15 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
|| strcmp (bfd_get_section_name (abfd, sec),
name + 4) != 0)
{
- if (abfd->my_archive)
- (*_bfd_error_handler) (_("%s(%s): bad relocation section name `%s\'"),
- bfd_get_filename (abfd->my_archive),
- bfd_get_filename (abfd),
- name);
- else
- (*_bfd_error_handler) (_("%s: bad relocation section name `%s\'"),
- bfd_get_filename (abfd),
- name);
+ (*_bfd_error_handler)
+ (_("%s: bad relocation section name `%s\'"),
+ bfd_archive_filename (abfd), name);
}
+ if (htab->elf.dynobj == NULL)
+ htab->elf.dynobj = abfd;
+
+ dynobj = htab->elf.dynobj;
sreloc = bfd_get_section_by_name (dynobj, name);
if (sreloc == NULL)
{
@@ -717,44 +883,50 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
|| ! bfd_set_section_alignment (dynobj, sreloc, 2))
return false;
}
+ elf_section_data (sec)->sreloc = sreloc;
}
- sreloc->_raw_size += sizeof (Elf32_External_Rel);
-
- /* If this is a global symbol, we count the number of PC
- relative relocations we have entered for this symbol,
- so that we can discard them later as necessary. Note
- that this function is only called if we are using an
- elf_i386 linker hash table, which means that h is
- really a pointer to an elf_i386_link_hash_entry. */
- if (h != NULL
- && ELF32_R_TYPE (rel->r_info) == R_386_PC32)
+ /* If this is a global symbol, we count the number of
+ relocations we need for this symbol. */
+ if (h != NULL)
{
- struct elf_i386_link_hash_entry *eh;
- struct elf_i386_pcrel_relocs_copied *p;
-
- eh = (struct elf_i386_link_hash_entry *) h;
+ head = &((struct elf_i386_link_hash_entry *) h)->dyn_relocs;
+ }
+ else
+ {
+ /* Track dynamic relocs needed for local syms too.
+ We really need local syms available to do this
+ easily. Oh well. */
+
+ asection *s;
+ s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
+ sec, r_symndx);
+ if (s == NULL)
+ return false;
- for (p = eh->pcrel_relocs_copied; p != NULL; p = p->next)
- if (p->section == sreloc)
- break;
+ head = ((struct elf_i386_dyn_relocs **)
+ &elf_section_data (s)->local_dynrel);
+ }
+ p = *head;
+ if (p == NULL || p->sec != sec)
+ {
+ bfd_size_type amt = sizeof *p;
+ p = ((struct elf_i386_dyn_relocs *)
+ bfd_alloc (htab->elf.dynobj, amt));
if (p == NULL)
- {
- p = ((struct elf_i386_pcrel_relocs_copied *)
- bfd_alloc (dynobj, sizeof *p));
- if (p == NULL)
- return false;
- p->next = eh->pcrel_relocs_copied;
- eh->pcrel_relocs_copied = p;
- p->section = sreloc;
- p->count = 0;
- }
-
- ++p->count;
+ return false;
+ p->next = *head;
+ *head = p;
+ p->sec = sec;
+ p->count = 0;
+ p->pc_count = 0;
}
- }
+ p->count += 1;
+ if (ELF32_R_TYPE (rel->r_info) == R_386_PC32)
+ p->pc_count += 1;
+ }
break;
/* This relocation describes the C++ object vtable hierarchy.
@@ -815,13 +987,7 @@ elf_i386_gc_mark_hook (abfd, info, rel, h, sym)
}
else
{
- if (!(elf_bad_symtab (abfd)
- && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
- && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
- && sym->st_shndx != SHN_COMMON))
- {
- return bfd_section_from_elf_index (abfd, sym->st_shndx);
- }
+ return bfd_section_from_elf_index (abfd, sym->st_shndx);
}
return NULL;
@@ -842,21 +1008,13 @@ elf_i386_gc_sweep_hook (abfd, info, sec, relocs)
const Elf_Internal_Rela *rel, *relend;
unsigned long r_symndx;
struct elf_link_hash_entry *h;
- bfd *dynobj;
- asection *sgot;
- asection *srelgot;
+
+ elf_section_data (sec)->local_dynrel = NULL;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
local_got_refcounts = elf_local_got_refcounts (abfd);
- dynobj = elf_hash_table (info)->dynobj;
- if (dynobj == NULL)
- return true;
-
- sgot = bfd_get_section_by_name (dynobj, ".got");
- srelgot = bfd_get_section_by_name (dynobj, ".rel.got");
-
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
switch (ELF32_R_TYPE (rel->r_info))
@@ -869,27 +1027,41 @@ elf_i386_gc_sweep_hook (abfd, info, sec, relocs)
{
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
if (h->got.refcount > 0)
- {
- h->got.refcount -= 1;
- if (h->got.refcount == 0)
- {
- sgot->_raw_size -= 4;
- srelgot->_raw_size -= sizeof (Elf32_External_Rel);
- }
- }
+ h->got.refcount -= 1;
}
else if (local_got_refcounts != NULL)
{
if (local_got_refcounts[r_symndx] > 0)
- {
- local_got_refcounts[r_symndx] -= 1;
- if (local_got_refcounts[r_symndx] == 0)
- {
- sgot->_raw_size -= 4;
- if (info->shared)
- srelgot->_raw_size -= sizeof (Elf32_External_Rel);
- }
- }
+ local_got_refcounts[r_symndx] -= 1;
+ }
+ break;
+
+ case R_386_32:
+ case R_386_PC32:
+ r_symndx = ELF32_R_SYM (rel->r_info);
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ struct elf_i386_link_hash_entry *eh;
+ struct elf_i386_dyn_relocs **pp;
+ struct elf_i386_dyn_relocs *p;
+
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+
+ if (!info->shared && h->plt.refcount > 0)
+ h->plt.refcount -= 1;
+
+ eh = (struct elf_i386_link_hash_entry *) h;
+
+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+ if (p->sec == sec)
+ {
+ if (ELF32_R_TYPE (rel->r_info) == R_386_PC32)
+ p->pc_count -= 1;
+ p->count -= 1;
+ if (p->count == 0)
+ *pp = p->next;
+ break;
+ }
}
break;
@@ -921,33 +1093,22 @@ elf_i386_adjust_dynamic_symbol (info, h)
struct bfd_link_info *info;
struct elf_link_hash_entry *h;
{
- bfd *dynobj;
+ struct elf_i386_link_hash_table *htab;
+ struct elf_i386_link_hash_entry * eh;
+ struct elf_i386_dyn_relocs *p;
asection *s;
unsigned int power_of_two;
- dynobj = elf_hash_table (info)->dynobj;
-
- /* Make sure we know what is going on here. */
- BFD_ASSERT (dynobj != NULL
- && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
- || h->weakdef != NULL
- || ((h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_REF_REGULAR) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)));
-
/* If this is a function, put it in the procedure linkage table. We
will fill in the contents of the procedure linkage table later,
when we know the address of the .got section. */
if (h->type == STT_FUNC
|| (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
{
- if ((! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0)
- || (info->shared && h->plt.refcount <= 0))
+ if (h->plt.refcount <= 0
+ || (! info->shared
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0))
{
/* This case can occur if we saw a PLT32 reloc in an input
file, but the symbol was never referred to by a dynamic
@@ -956,54 +1117,17 @@ elf_i386_adjust_dynamic_symbol (info, h)
linkage table, and we can just do a PC32 reloc instead. */
h->plt.offset = (bfd_vma) -1;
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- return true;
- }
-
- /* Make sure this symbol is output as a dynamic symbol. */
- if (h->dynindx == -1)
- {
- if (! bfd_elf32_link_record_dynamic_symbol (info, h))
- return false;
}
- s = bfd_get_section_by_name (dynobj, ".plt");
- BFD_ASSERT (s != NULL);
-
- /* If this is the first .plt entry, make room for the special
- first entry. */
- if (s->_raw_size == 0)
- s->_raw_size += PLT_ENTRY_SIZE;
-
- /* If this symbol is not defined in a regular file, and we are
- not generating a shared library, then set the symbol to this
- location in the .plt. This is required to make function
- pointers compare as equal between the normal executable and
- the shared library. */
- if (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- {
- h->root.u.def.section = s;
- h->root.u.def.value = s->_raw_size;
- }
-
- h->plt.offset = s->_raw_size;
-
- /* Make room for this entry. */
- s->_raw_size += PLT_ENTRY_SIZE;
-
- /* We also need to make an entry in the .got.plt section, which
- will be placed in the .got section by the linker script. */
- s = bfd_get_section_by_name (dynobj, ".got.plt");
- BFD_ASSERT (s != NULL);
- s->_raw_size += 4;
-
- /* We also need to make an entry in the .rel.plt section. */
- s = bfd_get_section_by_name (dynobj, ".rel.plt");
- BFD_ASSERT (s != NULL);
- s->_raw_size += sizeof (Elf32_External_Rel);
-
return true;
}
+ else
+ /* It's possible that we incorrectly decided a .plt reloc was
+ needed for an R_386_PC32 reloc to a non-function sym in
+ check_relocs. We can't decide accurately between function and
+ non-function syms in check-relocs; Objects loaded later in
+ the link may change h->type. So fix it now. */
+ h->plt.offset = (bfd_vma) -1;
/* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the
@@ -1032,6 +1156,29 @@ elf_i386_adjust_dynamic_symbol (info, h)
if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
return true;
+ /* If -z nocopyreloc was given, we won't generate them either. */
+ if (info->nocopyreloc)
+ {
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
+ return true;
+ }
+
+ eh = (struct elf_i386_link_hash_entry *) h;
+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ {
+ s = p->sec->output_section;
+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
+ break;
+ }
+
+ /* If we didn't find any dynamic relocs in read-only sections, then
+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */
+ if (p == NULL)
+ {
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
+ return true;
+ }
+
/* We must allocate the symbol in our .dynbss section, which will
become part of the .bss section of the executable. There will be
an entry for this symbol in the .dynsym section. The dynamic
@@ -1042,20 +1189,14 @@ elf_i386_adjust_dynamic_symbol (info, h)
both the dynamic object and the regular object will refer to the
same memory location for the variable. */
- s = bfd_get_section_by_name (dynobj, ".dynbss");
- BFD_ASSERT (s != NULL);
+ htab = elf_i386_hash_table (info);
/* We must generate a R_386_COPY reloc to tell the dynamic linker to
copy the initial value out of the dynamic object and into the
- runtime process image. We need to remember the offset into the
- .rel.bss section we are going to use. */
+ runtime process image. */
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
{
- asection *srel;
-
- srel = bfd_get_section_by_name (dynobj, ".rel.bss");
- BFD_ASSERT (srel != NULL);
- srel->_raw_size += sizeof (Elf32_External_Rel);
+ htab->srelbss->_raw_size += sizeof (Elf32_External_Rel);
h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
}
@@ -1066,11 +1207,11 @@ elf_i386_adjust_dynamic_symbol (info, h)
power_of_two = 3;
/* Apply the required alignment. */
- s->_raw_size = BFD_ALIGN (s->_raw_size,
- (bfd_size_type) (1 << power_of_two));
- if (power_of_two > bfd_get_section_alignment (dynobj, s))
+ s = htab->sdynbss;
+ s->_raw_size = BFD_ALIGN (s->_raw_size, (bfd_size_type) (1 << power_of_two));
+ if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s))
{
- if (! bfd_set_section_alignment (dynobj, s, power_of_two))
+ if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two))
return false;
}
@@ -1084,142 +1225,356 @@ elf_i386_adjust_dynamic_symbol (info, h)
return true;
}
+/* This is the condition under which elf_i386_finish_dynamic_symbol
+ will be called from elflink.h. If elflink.h doesn't call our
+ finish_dynamic_symbol routine, we'll need to do something about
+ initializing any .plt and .got entries in elf_i386_relocate_section. */
+#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \
+ ((DYN) \
+ && ((INFO)->shared \
+ || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \
+ && ((H)->dynindx != -1 \
+ || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
+
+/* Allocate space in .plt, .got and associated reloc sections for
+ dynamic relocs. */
+
+static boolean
+allocate_dynrelocs (h, inf)
+ struct elf_link_hash_entry *h;
+ PTR inf;
+{
+ struct bfd_link_info *info;
+ struct elf_i386_link_hash_table *htab;
+ struct elf_i386_link_hash_entry *eh;
+ struct elf_i386_dyn_relocs *p;
+
+ if (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ return true;
+
+ info = (struct bfd_link_info *) inf;
+ htab = elf_i386_hash_table (info);
+
+ if (htab->elf.dynamic_sections_created
+ && h->plt.refcount > 0)
+ {
+ /* Make sure this symbol is output as a dynamic symbol.
+ Undefined weak syms won't yet be marked as dynamic. */
+ if (h->dynindx == -1
+ && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ {
+ if (! bfd_elf32_link_record_dynamic_symbol (info, h))
+ return false;
+ }
+
+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
+ {
+ asection *s = htab->splt;
+
+ /* If this is the first .plt entry, make room for the special
+ first entry. */
+ if (s->_raw_size == 0)
+ s->_raw_size += PLT_ENTRY_SIZE;
+
+ h->plt.offset = s->_raw_size;
+
+ /* If this symbol is not defined in a regular file, and we are
+ not generating a shared library, then set the symbol to this
+ location in the .plt. This is required to make function
+ pointers compare as equal between the normal executable and
+ the shared library. */
+ if (! info->shared
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ {
+ h->root.u.def.section = s;
+ h->root.u.def.value = h->plt.offset;
+ }
+
+ /* Make room for this entry. */
+ s->_raw_size += PLT_ENTRY_SIZE;
+
+ /* We also need to make an entry in the .got.plt section, which
+ will be placed in the .got section by the linker script. */
+ htab->sgotplt->_raw_size += 4;
+
+ /* We also need to make an entry in the .rel.plt section. */
+ htab->srelplt->_raw_size += sizeof (Elf32_External_Rel);
+ }
+ else
+ {
+ h->plt.offset = (bfd_vma) -1;
+ h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ }
+ }
+ else
+ {
+ h->plt.offset = (bfd_vma) -1;
+ h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ }
+
+ if (h->got.refcount > 0)
+ {
+ asection *s;
+ boolean dyn;
+
+ /* Make sure this symbol is output as a dynamic symbol.
+ Undefined weak syms won't yet be marked as dynamic. */
+ if (h->dynindx == -1
+ && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ {
+ if (! bfd_elf32_link_record_dynamic_symbol (info, h))
+ return false;
+ }
+
+ s = htab->sgot;
+ h->got.offset = s->_raw_size;
+ s->_raw_size += 4;
+ dyn = htab->elf.dynamic_sections_created;
+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h))
+ htab->srelgot->_raw_size += sizeof (Elf32_External_Rel);
+ }
+ else
+ h->got.offset = (bfd_vma) -1;
+
+ eh = (struct elf_i386_link_hash_entry *) h;
+ if (eh->dyn_relocs == NULL)
+ return true;
+
+ /* In the shared -Bsymbolic case, discard space allocated for
+ dynamic pc-relative relocs against symbols which turn out to be
+ defined in regular objects. For the normal shared case, discard
+ space for pc-relative relocs that have become local due to symbol
+ visibility changes. */
+
+ if (info->shared)
+ {
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
+ && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
+ || info->symbolic))
+ {
+ struct elf_i386_dyn_relocs **pp;
+
+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
+ {
+ p->count -= p->pc_count;
+ p->pc_count = 0;
+ if (p->count == 0)
+ *pp = p->next;
+ else
+ pp = &p->next;
+ }
+ }
+ }
+ else
+ {
+ /* For the non-shared case, discard space for relocs against
+ symbols which turn out to need copy relocs or are not
+ dynamic. */
+
+ if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
+ && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ || (htab->elf.dynamic_sections_created
+ && (h->root.type == bfd_link_hash_undefweak
+ || h->root.type == bfd_link_hash_undefined))))
+ {
+ /* Make sure this symbol is output as a dynamic symbol.
+ Undefined weak syms won't yet be marked as dynamic. */
+ if (h->dynindx == -1
+ && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ {
+ if (! bfd_elf32_link_record_dynamic_symbol (info, h))
+ return false;
+ }
+
+ /* If that succeeded, we know we'll be keeping all the
+ relocs. */
+ if (h->dynindx != -1)
+ goto keep;
+ }
+
+ eh->dyn_relocs = NULL;
+
+ keep: ;
+ }
+
+ /* Finally, allocate space. */
+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ {
+ asection *sreloc = elf_section_data (p->sec)->sreloc;
+ sreloc->_raw_size += p->count * sizeof (Elf32_External_Rel);
+ }
+
+ return true;
+}
+
+/* Find any dynamic relocs that apply to read-only sections. */
+
+static boolean
+readonly_dynrelocs (h, inf)
+ struct elf_link_hash_entry *h;
+ PTR inf;
+{
+ struct elf_i386_link_hash_entry *eh;
+ struct elf_i386_dyn_relocs *p;
+
+ eh = (struct elf_i386_link_hash_entry *) h;
+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ {
+ asection *s = p->sec->output_section;
+
+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
+ {
+ struct bfd_link_info *info = (struct bfd_link_info *) inf;
+
+ info->flags |= DF_TEXTREL;
+
+ /* Not an error, just cut short the traversal. */
+ return false;
+ }
+ }
+ return true;
+}
+
/* Set the sizes of the dynamic sections. */
static boolean
elf_i386_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
+ bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
{
+ struct elf_i386_link_hash_table *htab;
bfd *dynobj;
asection *s;
- boolean plt;
boolean relocs;
- boolean reltext;
+ bfd *ibfd;
- dynobj = elf_hash_table (info)->dynobj;
- BFD_ASSERT (dynobj != NULL);
+ htab = elf_i386_hash_table (info);
+ dynobj = htab->elf.dynobj;
+ if (dynobj == NULL)
+ abort ();
- if (elf_hash_table (info)->dynamic_sections_created)
+ if (htab->elf.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
if (! info->shared)
{
s = bfd_get_section_by_name (dynobj, ".interp");
- BFD_ASSERT (s != NULL);
+ if (s == NULL)
+ abort ();
s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
}
}
- else
- {
- /* We may have created entries in the .rel.got section.
- However, if we are not creating the dynamic sections, we will
- not actually use these entries. Reset the size of .rel.got,
- which will cause it to get stripped from the output file
- below. */
- s = bfd_get_section_by_name (dynobj, ".rel.got");
- if (s != NULL)
- s->_raw_size = 0;
- }
- /* If this is a -Bsymbolic shared link, then we need to discard all
- PC relative relocs against symbols defined in a regular object.
- We allocated space for them in the check_relocs routine, but we
- will not fill them in in the relocate_section routine. */
- if (info->shared)
- elf_i386_link_hash_traverse (elf_i386_hash_table (info),
- elf_i386_discard_copies,
- (PTR) info);
-
- /* The check_relocs and adjust_dynamic_symbol entry points have
- determined the sizes of the various dynamic sections. Allocate
- memory for them. */
- plt = false;
- relocs = false;
- reltext = false;
- for (s = dynobj->sections; s != NULL; s = s->next)
+ /* Set up .got offsets for local syms, and space for local dynamic
+ relocs. */
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
{
- const char *name;
- boolean strip;
+ bfd_signed_vma *local_got;
+ bfd_signed_vma *end_local_got;
+ bfd_size_type locsymcount;
+ Elf_Internal_Shdr *symtab_hdr;
+ asection *srel;
- if ((s->flags & SEC_LINKER_CREATED) == 0)
+ if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
continue;
- /* It's OK to base decisions on the section name, because none
- of the dynobj section names depend upon the input files. */
- name = bfd_get_section_name (dynobj, s);
-
- strip = false;
-
- if (strcmp (name, ".plt") == 0)
+ for (s = ibfd->sections; s != NULL; s = s->next)
{
- if (s->_raw_size == 0)
- {
- /* Strip this section if we don't need it; see the
- comment below. */
- strip = true;
- }
- else
+ struct elf_i386_dyn_relocs *p;
+
+ for (p = *((struct elf_i386_dyn_relocs **)
+ &elf_section_data (s)->local_dynrel);
+ p != NULL;
+ p = p->next)
{
- /* Remember whether there is a PLT. */
- plt = true;
+ if (!bfd_is_abs_section (p->sec)
+ && bfd_is_abs_section (p->sec->output_section))
+ {
+ /* Input section has been discarded, either because
+ it is a copy of a linkonce section or due to
+ linker script /DISCARD/, so we'll be discarding
+ the relocs too. */
+ }
+ else
+ {
+ srel = elf_section_data (p->sec)->sreloc;
+ srel->_raw_size += p->count * sizeof (Elf32_External_Rel);
+ }
}
}
- else if (strncmp (name, ".rel", 4) == 0)
+
+ local_got = elf_local_got_refcounts (ibfd);
+ if (!local_got)
+ continue;
+
+ symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+ locsymcount = symtab_hdr->sh_info;
+ end_local_got = local_got + locsymcount;
+ s = htab->sgot;
+ srel = htab->srelgot;
+ for (; local_got < end_local_got; ++local_got)
{
- if (s->_raw_size == 0)
+ if (*local_got > 0)
{
- /* If we don't need this section, strip it from the
- output file. This is mostly to handle .rel.bss and
- .rel.plt. We must create both sections in
- create_dynamic_sections, because they must be created
- before the linker maps input sections to output
- sections. The linker does that before
- adjust_dynamic_symbol is called, and it is that
- function which decides whether anything needs to go
- into these sections. */
- strip = true;
+ *local_got = s->_raw_size;
+ s->_raw_size += 4;
+ if (info->shared)
+ srel->_raw_size += sizeof (Elf32_External_Rel);
}
else
- {
- asection *target;
+ *local_got = (bfd_vma) -1;
+ }
+ }
- /* Remember whether there are any reloc sections other
- than .rel.plt. */
- if (strcmp (name, ".rel.plt") != 0)
- {
- const char *outname;
-
- relocs = true;
-
- /* If this relocation section applies to a read only
- section, then we probably need a DT_TEXTREL
- entry. The entries in the .rel.plt section
- really apply to the .got section, which we
- created ourselves and so know is not readonly. */
- outname = bfd_get_section_name (output_bfd,
- s->output_section);
- target = bfd_get_section_by_name (output_bfd, outname + 4);
- if (target != NULL
- && (target->flags & SEC_READONLY) != 0
- && (target->flags & SEC_ALLOC) != 0)
- reltext = true;
- }
+ /* Allocate global sym .plt and .got entries, and space for global
+ sym dynamic relocs. */
+ elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
- /* We use the reloc_count field as a counter if we need
- to copy relocs into the output file. */
- s->reloc_count = 0;
- }
+ /* We now have determined the sizes of the various dynamic sections.
+ Allocate memory for them. */
+ relocs = false;
+ for (s = dynobj->sections; s != NULL; s = s->next)
+ {
+ if ((s->flags & SEC_LINKER_CREATED) == 0)
+ continue;
+
+ if (s == htab->splt
+ || s == htab->sgot
+ || s == htab->sgotplt)
+ {
+ /* Strip this section if we don't need it; see the
+ comment below. */
+ }
+ else if (strncmp (bfd_get_section_name (dynobj, s), ".rel", 4) == 0)
+ {
+ if (s->_raw_size != 0 && s != htab->srelplt)
+ relocs = true;
+
+ /* We use the reloc_count field as a counter if we need
+ to copy relocs into the output file. */
+ s->reloc_count = 0;
}
- else if (strncmp (name, ".got", 4) != 0)
+ else
{
/* It's not one of our sections, so don't allocate space. */
continue;
}
- if (strip)
+ if (s->_raw_size == 0)
{
+ /* If we don't need this section, strip it from the
+ output file. This is mostly to handle .rel.bss and
+ .rel.plt. We must create both sections in
+ create_dynamic_sections, because they must be created
+ before the linker maps input sections to output
+ sections. The linker does that before
+ adjust_dynamic_symbol is called, and it is that
+ function which decides whether anything needs to go
+ into these sections. */
+
_bfd_strip_section_from_output (info, s);
continue;
}
@@ -1230,79 +1585,89 @@ elf_i386_size_dynamic_sections (output_bfd, info)
but this way if it does, we get a R_386_NONE reloc instead
of garbage. */
s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
- if (s->contents == NULL && s->_raw_size != 0)
+ if (s->contents == NULL)
return false;
}
- if (elf_hash_table (info)->dynamic_sections_created)
+ if (htab->elf.dynamic_sections_created)
{
/* Add some entries to the .dynamic section. We fill in the
values later, in elf_i386_finish_dynamic_sections, but we
must add the entries now so that we get the correct size for
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
+#define add_dynamic_entry(TAG, VAL) \
+ bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+
if (! info->shared)
{
- if (! bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0))
+ if (!add_dynamic_entry (DT_DEBUG, 0))
return false;
}
- if (plt)
+ if (htab->splt->_raw_size != 0)
{
- if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0)
- || ! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0)
- || ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_REL)
- || ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0))
+ if (!add_dynamic_entry (DT_PLTGOT, 0)
+ || !add_dynamic_entry (DT_PLTRELSZ, 0)
+ || !add_dynamic_entry (DT_PLTREL, DT_REL)
+ || !add_dynamic_entry (DT_JMPREL, 0))
return false;
}
if (relocs)
{
- if (! bfd_elf32_add_dynamic_entry (info, DT_REL, 0)
- || ! bfd_elf32_add_dynamic_entry (info, DT_RELSZ, 0)
- || ! bfd_elf32_add_dynamic_entry (info, DT_RELENT,
- sizeof (Elf32_External_Rel)))
+ if (!add_dynamic_entry (DT_REL, 0)
+ || !add_dynamic_entry (DT_RELSZ, 0)
+ || !add_dynamic_entry (DT_RELENT, sizeof (Elf32_External_Rel)))
return false;
- }
- if (reltext)
- {
- if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
- return false;
- info->flags |= DF_TEXTREL;
+ /* If any dynamic relocs apply to a read-only section,
+ then we need a DT_TEXTREL entry. */
+ elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, (PTR) info);
+
+ if ((info->flags & DF_TEXTREL) != 0)
+ {
+ if (!add_dynamic_entry (DT_TEXTREL, 0))
+ return false;
+ }
}
}
+#undef add_dynamic_entry
return true;
}
-/* This function is called via elf_i386_link_hash_traverse if we are
- creating a shared object. In the -Bsymbolic case, it discards the
- space allocated to copy PC relative relocs against symbols which
- are defined in regular objects. For the normal non-symbolic case,
- we also discard space for relocs that have become local due to
- symbol visibility changes. We allocated space for them in the
- check_relocs routine, but we won't fill them in in the
- relocate_section routine. */
+/* Set the correct type for an x86 ELF section. We do this by the
+ section name, which is a hack, but ought to work. */
static boolean
-elf_i386_discard_copies (h, inf)
- struct elf_i386_link_hash_entry *h;
- PTR inf;
+elf_i386_fake_sections (abfd, hdr, sec)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ Elf32_Internal_Shdr *hdr;
+ asection *sec;
{
- struct elf_i386_pcrel_relocs_copied *s;
- struct bfd_link_info *info = (struct bfd_link_info *) inf;
-
- /* If a symbol has been forced local or we have found a regular
- definition for the symbolic link case, then we won't be needing
- any relocs. */
- if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
- && ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
- || info->symbolic))
- {
- for (s = h->pcrel_relocs_copied; s != NULL; s = s->next)
- s->section->_raw_size -= s->count * sizeof (Elf32_External_Rel);
- }
+ register const char *name;
+
+ name = bfd_get_section_name (abfd, sec);
+
+ /* This is an ugly, but unfortunately necessary hack that is
+ needed when producing EFI binaries on x86. It tells
+ elf.c:elf_fake_sections() not to consider ".reloc" as a section
+ containing ELF relocation info. We need this hack in order to
+ be able to generate ELF binaries that can be translated into
+ EFI applications (which are essentially COFF objects). Those
+ files contain a COFF ".reloc" section inside an ELFNN object,
+ which would normally cause BFD to segfault because it would
+ attempt to interpret this section as containing relocation
+ entries for section "oc". With this hack enabled, ".reloc"
+ will be treated as a normal data section, which will avoid the
+ segfault. However, you won't be able to create an ELFNN binary
+ with a section named "oc" that needs relocations, but that's
+ the kind of ugly side-effects you get when detecting section
+ types based on their names... In practice, this limitation is
+ unlikely to bite. */
+ if (strcmp (name, ".reloc") == 0)
+ hdr->sh_type = SHT_PROGBITS;
return true;
}
@@ -1321,30 +1686,18 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Sym *local_syms;
asection **local_sections;
{
- bfd *dynobj;
+ struct elf_i386_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
bfd_vma *local_got_offsets;
- asection *sgot;
- asection *splt;
- asection *sreloc;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- dynobj = elf_hash_table (info)->dynobj;
+ htab = elf_i386_hash_table (info);
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
local_got_offsets = elf_local_got_offsets (input_bfd);
- sreloc = NULL;
- splt = NULL;
- sgot = NULL;
- if (dynobj != NULL)
- {
- splt = bfd_get_section_by_name (dynobj, ".plt");
- sgot = bfd_get_section_by_name (dynobj, ".got");
- }
-
rel = relocs;
relend = relocs + input_section->reloc_count;
for (; rel < relend; rel++)
@@ -1355,7 +1708,9 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
asection *sec;
+ bfd_vma off;
bfd_vma relocation;
+ boolean unresolved_reloc;
bfd_reloc_status_type r;
unsigned int indx;
@@ -1377,7 +1732,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
if (info->relocateable)
{
- /* This is a relocateable link. We don't have to change
+ /* This is a relocatable link. We don't have to change
anything, unless the reloc is against a section symbol,
in which case we have to adjust according to where the
section symbol winds up in the output section. */
@@ -1394,7 +1749,6 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_put_32 (input_bfd, val, contents + rel->r_offset);
}
}
-
continue;
}
@@ -1402,6 +1756,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
h = NULL;
sym = NULL;
sec = NULL;
+ unresolved_reloc = false;
if (r_symndx < symtab_hdr->sh_info)
{
sym = local_syms + r_symndx;
@@ -1409,6 +1764,30 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
relocation = (sec->output_section->vma
+ sec->output_offset
+ sym->st_value);
+ if ((sec->flags & SEC_MERGE)
+ && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ {
+ asection *msec;
+ bfd_vma addend;
+
+ if (howto->src_mask != 0xffffffff)
+ {
+ (*_bfd_error_handler)
+ (_("%s(%s+0x%lx): %s relocation against SEC_MERGE section"),
+ bfd_archive_filename (input_bfd),
+ bfd_get_section_name (input_bfd, input_section),
+ (long) rel->r_offset, howto->name);
+ return false;
+ }
+
+ addend = bfd_get_32 (input_bfd, contents + rel->r_offset);
+ msec = sec;
+ addend =
+ _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend)
+ - relocation;
+ addend += msec->output_section->vma + msec->output_offset;
+ bfd_put_32 (input_bfd, addend, contents + rel->r_offset);
+ }
}
else
{
@@ -1416,59 +1795,30 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ relocation = 0;
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
{
sec = h->root.u.def.section;
- if (r_type == R_386_GOTPC
- || (r_type == R_386_PLT32
- && splt != NULL
- && h->plt.offset != (bfd_vma) -1)
- || (r_type == R_386_GOT32
- && elf_hash_table (info)->dynamic_sections_created
- && (! info->shared
- || (! info->symbolic && h->dynindx != -1)
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
- || (info->shared
- && ((! info->symbolic && h->dynindx != -1)
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)
- && (r_type == R_386_32
- || r_type == R_386_PC32)
- && ((input_section->flags & SEC_ALLOC) != 0
- /* DWARF will emit R_386_32 relocations in its
- sections against symbols defined externally
- in shared libraries. We can't do anything
- with them here. */
- || ((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0))))
- {
- /* In these cases, we don't need the relocation
- value. We check specially because in some
- obscure cases sec->output_section will be NULL. */
- relocation = 0;
- }
- else if (sec->output_section == NULL)
- {
- (*_bfd_error_handler)
- (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
- bfd_get_filename (input_bfd), h->root.root.string,
- bfd_get_section_name (input_bfd, input_section));
- relocation = 0;
- }
+ if (sec->output_section == NULL)
+ /* Set a flag that will be cleared later if we find a
+ relocation value for this symbol. output_section
+ is typically NULL for symbols satisfied by a shared
+ library. */
+ unresolved_reloc = true;
else
relocation = (h->root.u.def.value
+ sec->output_section->vma
+ sec->output_offset);
}
else if (h->root.type == bfd_link_hash_undefweak)
- relocation = 0;
- else if (info->shared && !info->symbolic
+ ;
+ else if (info->shared
+ && (!info->symbolic || info->allow_shlib_undefined)
&& !info->no_undefined
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- relocation = 0;
+ ;
else
{
if (! ((*info->callbacks->undefined_symbol)
@@ -1477,7 +1827,6 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
(!info->shared || info->no_undefined
|| ELF_ST_VISIBILITY (h->other)))))
return false;
- relocation = 0;
}
}
@@ -1486,18 +1835,20 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
case R_386_GOT32:
/* Relocation is to the entry for this symbol in the global
offset table. */
- BFD_ASSERT (sgot != NULL);
+ if (htab->sgot == NULL)
+ abort ();
if (h != NULL)
{
- bfd_vma off;
+ boolean dyn;
off = h->got.offset;
- BFD_ASSERT (off != (bfd_vma) -1);
-
- if (! elf_hash_table (info)->dynamic_sections_created
+ dyn = htab->elf.dynamic_sections_created;
+ if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)
|| (info->shared
- && (info->symbolic || h->dynindx == -1)
+ && (info->symbolic
+ || h->dynindx == -1
+ || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
{
/* This is actually a static link, or it is a
@@ -1517,88 +1868,75 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
bfd_put_32 (output_bfd, relocation,
- sgot->contents + off);
+ htab->sgot->contents + off);
h->got.offset |= 1;
}
}
-
- relocation = sgot->output_offset + off;
+ else
+ unresolved_reloc = false;
}
else
{
- bfd_vma off;
-
- BFD_ASSERT (local_got_offsets != NULL
- && local_got_offsets[r_symndx] != (bfd_vma) -1);
+ if (local_got_offsets == NULL)
+ abort ();
off = local_got_offsets[r_symndx];
/* The offset must always be a multiple of 4. We use
- the least significant bit to record whether we have
- already generated the necessary reloc. */
+ the least significant bit to record whether we have
+ already generated the necessary reloc. */
if ((off & 1) != 0)
off &= ~1;
else
{
- bfd_put_32 (output_bfd, relocation, sgot->contents + off);
+ bfd_put_32 (output_bfd, relocation,
+ htab->sgot->contents + off);
if (info->shared)
{
asection *srelgot;
Elf_Internal_Rel outrel;
+ Elf32_External_Rel *loc;
- srelgot = bfd_get_section_by_name (dynobj, ".rel.got");
- BFD_ASSERT (srelgot != NULL);
+ srelgot = htab->srelgot;
+ if (srelgot == NULL)
+ abort ();
- outrel.r_offset = (sgot->output_section->vma
- + sgot->output_offset
+ outrel.r_offset = (htab->sgot->output_section->vma
+ + htab->sgot->output_offset
+ off);
outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
- bfd_elf32_swap_reloc_out (output_bfd, &outrel,
- (((Elf32_External_Rel *)
- srelgot->contents)
- + srelgot->reloc_count));
- ++srelgot->reloc_count;
+ loc = (Elf32_External_Rel *) srelgot->contents;
+ loc += srelgot->reloc_count++;
+ bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
}
local_got_offsets[r_symndx] |= 1;
}
-
- relocation = sgot->output_offset + off;
}
+ if (off >= (bfd_vma) -2)
+ abort ();
+
+ relocation = htab->sgot->output_offset + off;
break;
case R_386_GOTOFF:
/* Relocation is relative to the start of the global offset
table. */
- if (sgot == NULL)
- {
- sgot = bfd_get_section_by_name (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- }
-
/* Note that sgot->output_offset is not involved in this
calculation. We always want the start of .got. If we
defined _GLOBAL_OFFSET_TABLE in a different way, as is
permitted by the ABI, we might have to change this
calculation. */
- relocation -= sgot->output_section->vma;
-
+ relocation -= htab->sgot->output_section->vma;
break;
case R_386_GOTPC:
/* Use global offset table as symbol value. */
-
- if (sgot == NULL)
- {
- sgot = bfd_get_section_by_name (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- }
-
- relocation = sgot->output_section->vma;
-
+ relocation = htab->sgot->output_section->vma;
+ unresolved_reloc = false;
break;
case R_386_PLT32:
@@ -1606,93 +1944,68 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
procedure linkage table. */
/* Resolve a PLT32 reloc against a local symbol directly,
- without using the procedure linkage table. */
+ without using the procedure linkage table. */
if (h == NULL)
break;
if (h->plt.offset == (bfd_vma) -1
- || splt == NULL)
+ || htab->splt == NULL)
{
/* We didn't make a PLT entry for this symbol. This
- happens when statically linking PIC code, or when
- using -Bsymbolic. */
+ happens when statically linking PIC code, or when
+ using -Bsymbolic. */
break;
}
- relocation = (splt->output_section->vma
- + splt->output_offset
+ relocation = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ h->plt.offset);
-
+ unresolved_reloc = false;
break;
case R_386_32:
case R_386_PC32:
- if (info->shared
- && (input_section->flags & SEC_ALLOC) != 0
- && (r_type != R_386_PC32
- || (h != NULL
- && h->dynindx != -1
- && (! info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ /* r_symndx will be zero only for relocs against symbols
+ from removed linkonce sections, or sections discarded by
+ a linker script. */
+ if (r_symndx == 0
+ || (input_section->flags & SEC_ALLOC) == 0)
+ break;
+
+ if ((info->shared
+ && (r_type != R_386_PC32
+ || (h != NULL
+ && h->dynindx != -1
+ && (! info->symbolic
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ || (!info->shared
+ && h != NULL
+ && h->dynindx != -1
+ && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
+ && (((h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ && (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ || h->root.type == bfd_link_hash_undefweak
+ || h->root.type == bfd_link_hash_undefined)))
{
Elf_Internal_Rel outrel;
boolean skip, relocate;
+ asection *sreloc;
+ Elf32_External_Rel *loc;
/* When generating a shared object, these relocations
are copied into the output file to be resolved at run
time. */
- if (sreloc == NULL)
- {
- const char *name;
-
- name = (bfd_elf_string_from_elf_section
- (input_bfd,
- elf_elfheader (input_bfd)->e_shstrndx,
- elf_section_data (input_section)->rel_hdr.sh_name));
- if (name == NULL)
- return false;
-
- if (strncmp (name, ".rel", 4) != 0
- || strcmp (bfd_get_section_name (input_bfd,
- input_section),
- name + 4) != 0)
- {
- if (input_bfd->my_archive)
- (*_bfd_error_handler) (_("%s(%s): bad relocation section name `%s\'"),
- bfd_get_filename (input_bfd->my_archive),
- bfd_get_filename (input_bfd),
- name);
- else
- (*_bfd_error_handler) (_("%s: bad relocation section name `%s\'"),
- bfd_get_filename (input_bfd),
- name);
- return false;
- }
-
- sreloc = bfd_get_section_by_name (dynobj, name);
- BFD_ASSERT (sreloc != NULL);
- }
-
skip = false;
- if (elf_section_data (input_section)->stab_info == NULL)
- outrel.r_offset = rel->r_offset;
- else
- {
- bfd_vma off;
-
- off = (_bfd_stab_section_offset
- (output_bfd, &elf_hash_table (info)->stab_info,
- input_section,
- &elf_section_data (input_section)->stab_info,
- rel->r_offset));
- if (off == (bfd_vma) -1)
- skip = true;
- outrel.r_offset = off;
- }
-
+ outrel.r_offset =
+ _bfd_elf_section_offset (output_bfd, info, input_section,
+ rel->r_offset);
+ if (outrel.r_offset == (bfd_vma) -1)
+ skip = true;
outrel.r_offset += (input_section->output_section->vma
+ input_section->output_offset);
@@ -1701,37 +2014,32 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
memset (&outrel, 0, sizeof outrel);
relocate = false;
}
- else if (r_type == R_386_PC32)
+ else if (h != NULL
+ && h->dynindx != -1
+ && (r_type == R_386_PC32
+ || !info->shared
+ || !info->symbolic
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))
+
{
- BFD_ASSERT (h != NULL && h->dynindx != -1);
relocate = false;
- outrel.r_info = ELF32_R_INFO (h->dynindx, R_386_PC32);
+ outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
}
else
{
- /* h->dynindx may be -1 if this symbol was marked to
- become local. */
- if (h == NULL
- || ((info->symbolic || h->dynindx == -1)
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) != 0))
- {
- relocate = true;
- outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
- }
- else
- {
- BFD_ASSERT (h->dynindx != -1);
- relocate = false;
- outrel.r_info = ELF32_R_INFO (h->dynindx, R_386_32);
- }
+ /* This symbol is local, or marked to become local. */
+ relocate = true;
+ outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
}
- bfd_elf32_swap_reloc_out (output_bfd, &outrel,
- (((Elf32_External_Rel *)
- sreloc->contents)
- + sreloc->reloc_count));
- ++sreloc->reloc_count;
+ sreloc = elf_section_data (input_section)->sreloc;
+ if (sreloc == NULL)
+ abort ();
+
+ loc = (Elf32_External_Rel *) sreloc->contents;
+ loc += sreloc->reloc_count++;
+ bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
/* If this reloc is against an external symbol, we do
not want to fiddle with the addend. Otherwise, we
@@ -1740,46 +2048,65 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
if (! relocate)
continue;
}
-
break;
default:
break;
}
+ /* FIXME: Why do we allow debugging sections to escape this error?
+ More importantly, why do we not emit dynamic relocs for
+ R_386_32 above in debugging sections (which are ! SEC_ALLOC)?
+ If we had emitted the dynamic reloc, we could remove the
+ fudge here. */
+ if (unresolved_reloc
+ && !(info->shared
+ && (input_section->flags & SEC_DEBUGGING) != 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
+ (*_bfd_error_handler)
+ (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
+ bfd_archive_filename (input_bfd),
+ bfd_get_section_name (input_bfd, input_section),
+ (long) rel->r_offset,
+ h->root.root.string);
+
r = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, rel->r_offset,
relocation, (bfd_vma) 0);
if (r != bfd_reloc_ok)
{
- switch (r)
+ const char *name;
+
+ if (h != NULL)
+ name = h->root.root.string;
+ else
{
- default:
- case bfd_reloc_outofrange:
- abort ();
- case bfd_reloc_overflow:
- {
- const char *name;
-
- if (h != NULL)
- name = h->root.root.string;
- else
- {
- name = bfd_elf_string_from_elf_section (input_bfd,
- symtab_hdr->sh_link,
- sym->st_name);
- if (name == NULL)
- return false;
- if (*name == '\0')
- name = bfd_section_name (input_bfd, sec);
- }
- if (! ((*info->callbacks->reloc_overflow)
- (info, name, howto->name, (bfd_vma) 0,
- input_bfd, input_section, rel->r_offset)))
- return false;
- }
- break;
+ name = bfd_elf_string_from_elf_section (input_bfd,
+ symtab_hdr->sh_link,
+ sym->st_name);
+ if (name == NULL)
+ return false;
+ if (*name == '\0')
+ name = bfd_section_name (input_bfd, sec);
+ }
+
+ if (r == bfd_reloc_overflow)
+ {
+
+ if (! ((*info->callbacks->reloc_overflow)
+ (info, name, howto->name, (bfd_vma) 0,
+ input_bfd, input_section, rel->r_offset)))
+ return false;
+ }
+ else
+ {
+ (*_bfd_error_handler)
+ (_("%s(%s+0x%lx): reloc against `%s': error %d"),
+ bfd_archive_filename (input_bfd),
+ bfd_get_section_name (input_bfd, input_section),
+ (long) rel->r_offset, name, (int) r);
+ return false;
}
}
}
@@ -1797,28 +2124,25 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
{
- bfd *dynobj;
+ struct elf_i386_link_hash_table *htab;
- dynobj = elf_hash_table (info)->dynobj;
+ htab = elf_i386_hash_table (info);
if (h->plt.offset != (bfd_vma) -1)
{
- asection *splt;
- asection *sgot;
- asection *srel;
bfd_vma plt_index;
bfd_vma got_offset;
Elf_Internal_Rel rel;
+ Elf32_External_Rel *loc;
/* This symbol has an entry in the procedure linkage table. Set
it up. */
- BFD_ASSERT (h->dynindx != -1);
-
- splt = bfd_get_section_by_name (dynobj, ".plt");
- sgot = bfd_get_section_by_name (dynobj, ".got.plt");
- srel = bfd_get_section_by_name (dynobj, ".rel.plt");
- BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL);
+ if (h->dynindx == -1
+ || htab->splt == NULL
+ || htab->sgotplt == NULL
+ || htab->srelplt == NULL)
+ abort ();
/* Get the index in the procedure linkage table which
corresponds to this symbol. This is the index of this symbol
@@ -1834,117 +2158,116 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
/* Fill in the entry in the procedure linkage table. */
if (! info->shared)
{
- memcpy (splt->contents + h->plt.offset, elf_i386_plt_entry,
+ memcpy (htab->splt->contents + h->plt.offset, elf_i386_plt_entry,
PLT_ENTRY_SIZE);
bfd_put_32 (output_bfd,
- (sgot->output_section->vma
- + sgot->output_offset
+ (htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset
+ got_offset),
- splt->contents + h->plt.offset + 2);
+ htab->splt->contents + h->plt.offset + 2);
}
else
{
- memcpy (splt->contents + h->plt.offset, elf_i386_pic_plt_entry,
+ memcpy (htab->splt->contents + h->plt.offset, elf_i386_pic_plt_entry,
PLT_ENTRY_SIZE);
bfd_put_32 (output_bfd, got_offset,
- splt->contents + h->plt.offset + 2);
+ htab->splt->contents + h->plt.offset + 2);
}
bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rel),
- splt->contents + h->plt.offset + 7);
+ htab->splt->contents + h->plt.offset + 7);
bfd_put_32 (output_bfd, - (h->plt.offset + PLT_ENTRY_SIZE),
- splt->contents + h->plt.offset + 12);
+ htab->splt->contents + h->plt.offset + 12);
/* Fill in the entry in the global offset table. */
bfd_put_32 (output_bfd,
- (splt->output_section->vma
- + splt->output_offset
+ (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ h->plt.offset
+ 6),
- sgot->contents + got_offset);
+ htab->sgotplt->contents + got_offset);
/* Fill in the entry in the .rel.plt section. */
- rel.r_offset = (sgot->output_section->vma
- + sgot->output_offset
+ rel.r_offset = (htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset
+ got_offset);
rel.r_info = ELF32_R_INFO (h->dynindx, R_386_JUMP_SLOT);
- bfd_elf32_swap_reloc_out (output_bfd, &rel,
- ((Elf32_External_Rel *) srel->contents
- + plt_index));
+ loc = (Elf32_External_Rel *) htab->srelplt->contents + plt_index;
+ bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
/* Mark the symbol as undefined, rather than as defined in
- the .plt section. Leave the value alone. */
+ the .plt section. Leave the value alone. This is a clue
+ for the dynamic linker, to make function pointer
+ comparisons work between an application and shared
+ library. */
sym->st_shndx = SHN_UNDEF;
}
}
if (h->got.offset != (bfd_vma) -1)
{
- asection *sgot;
- asection *srel;
Elf_Internal_Rel rel;
+ Elf32_External_Rel *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
- sgot = bfd_get_section_by_name (dynobj, ".got");
- srel = bfd_get_section_by_name (dynobj, ".rel.got");
- BFD_ASSERT (sgot != NULL && srel != NULL);
+ if (htab->sgot == NULL || htab->srelgot == NULL)
+ abort ();
- rel.r_offset = (sgot->output_section->vma
- + sgot->output_offset
- + (h->got.offset &~ 1));
+ rel.r_offset = (htab->sgot->output_section->vma
+ + htab->sgot->output_offset
+ + (h->got.offset & ~(bfd_vma) 1));
/* If this is a static link, or it is a -Bsymbolic link and the
symbol is defined locally or was forced to be local because
of a version file, we just want to emit a RELATIVE reloc.
The entry in the global offset table will already have been
initialized in the relocate_section function. */
- if (! elf_hash_table (info)->dynamic_sections_created
- || (info->shared
- && (info->symbolic || h->dynindx == -1)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+ if (info->shared
+ && (info->symbolic
+ || h->dynindx == -1
+ || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
{
+ BFD_ASSERT((h->got.offset & 1) != 0);
rel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
}
else
{
BFD_ASSERT((h->got.offset & 1) == 0);
- bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
+ bfd_put_32 (output_bfd, (bfd_vma) 0,
+ htab->sgot->contents + h->got.offset);
rel.r_info = ELF32_R_INFO (h->dynindx, R_386_GLOB_DAT);
}
- bfd_elf32_swap_reloc_out (output_bfd, &rel,
- ((Elf32_External_Rel *) srel->contents
- + srel->reloc_count));
- ++srel->reloc_count;
+ loc = (Elf32_External_Rel *) htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++;
+ bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
- asection *s;
Elf_Internal_Rel rel;
+ Elf32_External_Rel *loc;
/* This symbol needs a copy reloc. Set it up. */
- BFD_ASSERT (h->dynindx != -1
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak));
-
- s = bfd_get_section_by_name (h->root.u.def.section->owner,
- ".rel.bss");
- BFD_ASSERT (s != NULL);
+ if (h->dynindx == -1
+ || (h->root.type != bfd_link_hash_defined
+ && h->root.type != bfd_link_hash_defweak)
+ || htab->srelbss == NULL)
+ abort ();
rel.r_offset = (h->root.u.def.value
+ h->root.u.def.section->output_section->vma
+ h->root.u.def.section->output_offset);
rel.r_info = ELF32_R_INFO (h->dynindx, R_386_COPY);
- bfd_elf32_swap_reloc_out (output_bfd, &rel,
- ((Elf32_External_Rel *) s->contents
- + s->reloc_count));
- ++s->reloc_count;
+ loc = (Elf32_External_Rel *) htab->srelbss->contents;
+ loc += htab->srelbss->reloc_count++;
+ bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
@@ -1955,6 +2278,26 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
return true;
}
+/* Used to decide how to sort relocs in an optimal manner for the
+ dynamic linker, before writing them out. */
+
+static enum elf_reloc_type_class
+elf_i386_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
+{
+ switch ((int) ELF32_R_TYPE (rela->r_info))
+ {
+ case R_386_RELATIVE:
+ return reloc_class_relative;
+ case R_386_JUMP_SLOT:
+ return reloc_class_plt;
+ case R_386_COPY:
+ return reloc_class_copy;
+ default:
+ return reloc_class_normal;
+ }
+}
+
/* Finish up the dynamic sections. */
static boolean
@@ -1962,29 +2305,26 @@ elf_i386_finish_dynamic_sections (output_bfd, info)
bfd *output_bfd;
struct bfd_link_info *info;
{
+ struct elf_i386_link_hash_table *htab;
bfd *dynobj;
- asection *sgot;
asection *sdyn;
- dynobj = elf_hash_table (info)->dynobj;
-
- sgot = bfd_get_section_by_name (dynobj, ".got.plt");
- BFD_ASSERT (sgot != NULL);
+ htab = elf_i386_hash_table (info);
+ dynobj = htab->elf.dynobj;
sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
- if (elf_hash_table (info)->dynamic_sections_created)
+ if (htab->elf.dynamic_sections_created)
{
- asection *splt;
Elf32_External_Dyn *dyncon, *dynconend;
- BFD_ASSERT (sdyn != NULL);
+ if (sdyn == NULL || htab->sgot == NULL)
+ abort ();
dyncon = (Elf32_External_Dyn *) sdyn->contents;
dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
for (; dyncon < dynconend; dyncon++)
{
Elf_Internal_Dyn dyn;
- const char *name;
asection *s;
bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
@@ -1992,28 +2332,22 @@ elf_i386_finish_dynamic_sections (output_bfd, info)
switch (dyn.d_tag)
{
default:
- break;
+ continue;
case DT_PLTGOT:
- name = ".got";
- goto get_vma;
+ dyn.d_un.d_ptr = htab->sgot->output_section->vma;
+ break;
+
case DT_JMPREL:
- name = ".rel.plt";
- get_vma:
- s = bfd_get_section_by_name (output_bfd, name);
- BFD_ASSERT (s != NULL);
- dyn.d_un.d_ptr = s->vma;
- bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+ dyn.d_un.d_ptr = htab->srelplt->output_section->vma;
break;
case DT_PLTRELSZ:
- s = bfd_get_section_by_name (output_bfd, ".rel.plt");
- BFD_ASSERT (s != NULL);
+ s = htab->srelplt->output_section;
if (s->_cooked_size != 0)
dyn.d_un.d_val = s->_cooked_size;
else
dyn.d_un.d_val = s->_raw_size;
- bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
case DT_RELSZ:
@@ -2026,98 +2360,67 @@ elf_i386_finish_dynamic_sections (output_bfd, info)
the linker script arranges for .rel.plt to follow all
other relocation sections, we don't have to worry
about changing the DT_REL entry. */
- s = bfd_get_section_by_name (output_bfd, ".rel.plt");
- if (s != NULL)
+ if (htab->srelplt != NULL)
{
+ s = htab->srelplt->output_section;
if (s->_cooked_size != 0)
dyn.d_un.d_val -= s->_cooked_size;
else
dyn.d_un.d_val -= s->_raw_size;
}
- bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
}
+
+ bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
}
/* Fill in the first entry in the procedure linkage table. */
- splt = bfd_get_section_by_name (dynobj, ".plt");
- if (splt && splt->_raw_size > 0)
+ if (htab->splt && htab->splt->_raw_size > 0)
{
if (info->shared)
- memcpy (splt->contents, elf_i386_pic_plt0_entry, PLT_ENTRY_SIZE);
+ memcpy (htab->splt->contents,
+ elf_i386_pic_plt0_entry, PLT_ENTRY_SIZE);
else
{
- memcpy (splt->contents, elf_i386_plt0_entry, PLT_ENTRY_SIZE);
+ memcpy (htab->splt->contents,
+ elf_i386_plt0_entry, PLT_ENTRY_SIZE);
bfd_put_32 (output_bfd,
- sgot->output_section->vma + sgot->output_offset + 4,
- splt->contents + 2);
+ (htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset
+ + 4),
+ htab->splt->contents + 2);
bfd_put_32 (output_bfd,
- sgot->output_section->vma + sgot->output_offset + 8,
- splt->contents + 8);
+ (htab->sgotplt->output_section->vma
+ + htab->sgotplt->output_offset
+ + 8),
+ htab->splt->contents + 8);
}
/* UnixWare sets the entsize of .plt to 4, although that doesn't
really seem like the right value. */
- elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4;
+ elf_section_data (htab->splt->output_section)
+ ->this_hdr.sh_entsize = 4;
}
}
- /* Fill in the first three entries in the global offset table. */
- if (sgot->_raw_size > 0)
+ if (htab->sgotplt)
{
- if (sdyn == NULL)
- bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents);
- else
- bfd_put_32 (output_bfd,
- sdyn->output_section->vma + sdyn->output_offset,
- sgot->contents);
- bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4);
- bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8);
- }
-
- elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
-
- return true;
-}
-
-/* Set the correct type for an x86 ELF section. We do this by the
- section name, which is a hack, but ought to work. */
-
-static boolean
-elf_i386_fake_sections (abfd, hdr, sec)
- bfd *abfd ATTRIBUTE_UNUSED;
- Elf32_Internal_Shdr *hdr;
- asection *sec;
-{
- register const char *name;
-
- name = bfd_get_section_name (abfd, sec);
-
- if (strcmp (name, ".reloc") == 0)
- /*
- * This is an ugly, but unfortunately necessary hack that is
- * needed when producing EFI binaries on x86. It tells
- * elf.c:elf_fake_sections() not to consider ".reloc" as a section
- * containing ELF relocation info. We need this hack in order to
- * be able to generate ELF binaries that can be translated into
- * EFI applications (which are essentially COFF objects). Those
- * files contain a COFF ".reloc" section inside an ELFNN object,
- * which would normally cause BFD to segfault because it would
- * attempt to interpret this section as containing relocation
- * entries for section "oc". With this hack enabled, ".reloc"
- * will be treated as a normal data section, which will avoid the
- * segfault. However, you won't be able to create an ELFNN binary
- * with a section named "oc" that needs relocations, but that's
- * the kind of ugly side-effects you get when detecting section
- * types based on their names... In practice, this limitation is
- * unlikely to bite.
- */
- hdr->sh_type = SHT_PROGBITS;
+ /* Fill in the first three entries in the global offset table. */
+ if (htab->sgotplt->_raw_size > 0)
+ {
+ bfd_put_32 (output_bfd,
+ (sdyn == NULL ? (bfd_vma) 0
+ : sdyn->output_section->vma + sdyn->output_offset),
+ htab->sgotplt->contents);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + 4);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + 8);
+ }
+ elf_section_data (htab->sgotplt->output_section)->this_hdr.sh_entsize = 4;
+ }
return true;
}
-
#define TARGET_LITTLE_SYM bfd_elf32_i386_vec
#define TARGET_LITTLE_NAME "elf32-i386"
#define ELF_ARCH bfd_arch_i386
@@ -2125,6 +2428,7 @@ elf_i386_fake_sections (abfd, hdr, sec)
#define ELF_MAXPAGESIZE 0x1000
#define elf_backend_can_gc_sections 1
+#define elf_backend_can_refcount 1
#define elf_backend_want_got_plt 1
#define elf_backend_plt_readonly 1
#define elf_backend_want_plt_sym 0
@@ -2134,20 +2438,23 @@ elf_i386_fake_sections (abfd, hdr, sec)
#define elf_info_to_howto elf_i386_info_to_howto
#define elf_info_to_howto_rel elf_i386_info_to_howto_rel
-#define bfd_elf32_bfd_final_link _bfd_elf32_gc_common_final_link
#define bfd_elf32_bfd_is_local_label_name elf_i386_is_local_label_name
#define bfd_elf32_bfd_link_hash_table_create elf_i386_link_hash_table_create
#define bfd_elf32_bfd_reloc_type_lookup elf_i386_reloc_type_lookup
#define elf_backend_adjust_dynamic_symbol elf_i386_adjust_dynamic_symbol
#define elf_backend_check_relocs elf_i386_check_relocs
-#define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections
+#define elf_backend_copy_indirect_symbol elf_i386_copy_indirect_symbol
+#define elf_backend_create_dynamic_sections elf_i386_create_dynamic_sections
+#define elf_backend_fake_sections elf_i386_fake_sections
#define elf_backend_finish_dynamic_sections elf_i386_finish_dynamic_sections
#define elf_backend_finish_dynamic_symbol elf_i386_finish_dynamic_symbol
#define elf_backend_gc_mark_hook elf_i386_gc_mark_hook
#define elf_backend_gc_sweep_hook elf_i386_gc_sweep_hook
+#define elf_backend_grok_prstatus elf_i386_grok_prstatus
+#define elf_backend_grok_psinfo elf_i386_grok_psinfo
+#define elf_backend_reloc_type_class elf_i386_reloc_type_class
#define elf_backend_relocate_section elf_i386_relocate_section
#define elf_backend_size_dynamic_sections elf_i386_size_dynamic_sections
-#define elf_backend_fake_sections elf_i386_fake_sections
#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-ppc.c b/contrib/binutils/bfd/elf32-ppc.c
index ab803f4..4c9ff82 100644
--- a/contrib/binutils/bfd/elf32-ppc.c
+++ b/contrib/binutils/bfd/elf32-ppc.c
@@ -38,10 +38,12 @@ static reloc_howto_type *ppc_elf_reloc_type_lookup
static void ppc_elf_info_to_howto
PARAMS ((bfd *abfd, arelent *cache_ptr, Elf32_Internal_Rela *dst));
static void ppc_elf_howto_init PARAMS ((void));
+static int ppc_elf_sort_rela PARAMS ((const PTR, const PTR));
+static boolean ppc_elf_relax_section
+ PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
static bfd_reloc_status_type ppc_elf_addr16_ha_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static boolean ppc_elf_set_private_flags PARAMS ((bfd *, flagword));
-static boolean ppc_elf_copy_private_bfd_data PARAMS ((bfd *, bfd *));
static boolean ppc_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *));
static int ppc_elf_additional_program_headers PARAMS ((bfd *));
@@ -105,6 +107,12 @@ static boolean ppc_elf_finish_dynamic_symbol PARAMS ((bfd *,
Elf_Internal_Sym *));
static boolean ppc_elf_finish_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *));
+static enum elf_reloc_type_class ppc_elf_reloc_type_class
+ PARAMS ((const Elf_Internal_Rela *));
+static boolean ppc_elf_grok_prstatus
+ PARAMS ((bfd *abfd, Elf_Internal_Note *note));
+static boolean ppc_elf_grok_psinfo
+ PARAMS ((bfd *abfd, Elf_Internal_Note *note));
#define BRANCH_PREDICT_BIT 0x200000 /* branch prediction bit for branch taken relocs */
#define RA_REGISTER_MASK 0x001f0000 /* mask to set RA in memory instructions */
@@ -989,8 +997,8 @@ ppc_elf_howto_init ()
static int
ppc_elf_sort_rela (arg1, arg2)
- const void *arg1;
- const void *arg2;
+ const PTR arg1;
+ const PTR arg2;
{
const Elf_Internal_Rela **rela1 = (const Elf_Internal_Rela**) arg1;
const Elf_Internal_Rela **rela2 = (const Elf_Internal_Rela**) arg2;
@@ -1051,6 +1059,7 @@ ppc_elf_relax_section (abfd, isec, link_info, again)
if (isec->reloc_count)
{
unsigned n;
+ bfd_size_type amt;
/* Get a copy of the native relocations. */
internal_relocs = _bfd_elf32_link_read_relocs (
@@ -1062,8 +1071,9 @@ ppc_elf_relax_section (abfd, isec, link_info, again)
free_relocs = internal_relocs;
/* Setup a faster access method for the reloc info we need. */
- rela_comb = (Elf_Internal_Rela**)
- bfd_malloc (isec->reloc_count*sizeof (Elf_Internal_Rela*));
+ amt = isec->reloc_count;
+ amt *= sizeof (Elf_Internal_Rela*);
+ rela_comb = (Elf_Internal_Rela**) bfd_malloc (amt);
if (rela_comb == NULL)
goto error_return;
for (n = 0; n < isec->reloc_count; ++n)
@@ -1192,7 +1202,7 @@ ppc_elf_relax_section (abfd, isec, link_info, again)
#undef BO4
if (modified)
{
- bfd_put_32 (abfd, insn, contents + isec_offset);
+ bfd_put_32 (abfd, (bfd_vma) insn, contents + isec_offset);
section_modified = true;
}
}
@@ -1383,24 +1393,6 @@ ppc_elf_set_private_flags (abfd, flags)
return true;
}
-/* Copy backend specific data from one object module to another */
-static boolean
-ppc_elf_copy_private_bfd_data (ibfd, obfd)
- bfd *ibfd;
- bfd *obfd;
-{
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
- || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return true;
-
- BFD_ASSERT (!elf_flags_init (obfd)
- || elf_elfheader (obfd)->e_flags == elf_elfheader (ibfd)->e_flags);
-
- elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
- elf_flags_init (obfd) = true;
- return true;
-}
-
/* Merge backend specific data from an object file to the output
object file when linking */
static boolean
@@ -1442,7 +1434,7 @@ ppc_elf_merge_private_bfd_data (ibfd, obfd)
error = true;
(*_bfd_error_handler)
(_("%s: compiled with -mrelocatable and linked with modules compiled normally"),
- bfd_get_filename (ibfd));
+ bfd_archive_filename (ibfd));
}
else if ((new_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0
&& (old_flags & EF_PPC_RELOCATABLE) != 0)
@@ -1450,7 +1442,7 @@ ppc_elf_merge_private_bfd_data (ibfd, obfd)
error = true;
(*_bfd_error_handler)
(_("%s: compiled normally and linked with modules compiled with -mrelocatable"),
- bfd_get_filename (ibfd));
+ bfd_archive_filename (ibfd));
}
/* The output is -mrelocatable-lib iff both the input files are. */
@@ -1476,7 +1468,7 @@ ppc_elf_merge_private_bfd_data (ibfd, obfd)
error = true;
(*_bfd_error_handler)
(_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"),
- bfd_get_filename (ibfd), (long) new_flags, (long) old_flags);
+ bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags);
}
if (error)
@@ -1786,6 +1778,8 @@ ppc_elf_adjust_dynamic_symbol (info, h)
return true;
}
+ else
+ h->plt.offset = (bfd_vma) -1;
/* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the
@@ -1875,14 +1869,13 @@ ppc_elf_adjust_dynamic_symbol (info, h)
static boolean
ppc_elf_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
+ bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
{
bfd *dynobj;
asection *s;
boolean plt;
boolean relocs;
- boolean reltext;
#ifdef DEBUG
fprintf (stderr, "ppc_elf_size_dynamic_sections called\n");
@@ -1927,7 +1920,6 @@ ppc_elf_size_dynamic_sections (output_bfd, info)
memory for them. */
plt = false;
relocs = false;
- reltext = false;
for (s = dynobj->sections; s != NULL; s = s->next)
{
const char *name;
@@ -1973,22 +1965,9 @@ ppc_elf_size_dynamic_sections (output_bfd, info)
}
else
{
- asection *target;
- const char *outname;
-
/* Remember whether there are any relocation sections. */
relocs = true;
- /* If this relocation section applies to a read only
- section, then we probably need a DT_TEXTREL entry. */
- outname = bfd_get_section_name (output_bfd,
- s->output_section);
- target = bfd_get_section_by_name (output_bfd, outname + 5);
- if (target != NULL
- && (target->flags & SEC_READONLY) != 0
- && (target->flags & SEC_ALLOC) != 0)
- reltext = true;
-
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
s->reloc_count = 0;
@@ -2021,37 +2000,40 @@ ppc_elf_size_dynamic_sections (output_bfd, info)
must add the entries now so that we get the correct size for
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
- if (! info->shared)
+#define add_dynamic_entry(TAG, VAL) \
+ bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+
+ if (!info->shared)
{
- if (! bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0))
+ if (!add_dynamic_entry (DT_DEBUG, 0))
return false;
}
if (plt)
{
- if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0)
- || ! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0)
- || ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_RELA)
- || ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0))
+ if (!add_dynamic_entry (DT_PLTGOT, 0)
+ || !add_dynamic_entry (DT_PLTRELSZ, 0)
+ || !add_dynamic_entry (DT_PLTREL, DT_RELA)
+ || !add_dynamic_entry (DT_JMPREL, 0))
return false;
}
if (relocs)
{
- if (! bfd_elf32_add_dynamic_entry (info, DT_RELA, 0)
- || ! bfd_elf32_add_dynamic_entry (info, DT_RELASZ, 0)
- || ! bfd_elf32_add_dynamic_entry (info, DT_RELAENT,
- sizeof (Elf32_External_Rela)))
+ if (!add_dynamic_entry (DT_RELA, 0)
+ || !add_dynamic_entry (DT_RELASZ, 0)
+ || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela)))
return false;
}
- if (reltext)
+ if ((info->flags & DF_TEXTREL) != 0)
{
- if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
+ if (!add_dynamic_entry (DT_TEXTREL, 0))
return false;
info->flags |= DF_TEXTREL;
}
}
+#undef add_dynamic_entry
return true;
}
@@ -2085,7 +2067,7 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
#ifdef DEBUG
fprintf (stderr, "ppc_elf_check_relocs called for section %s in %s\n",
bfd_get_section_name (abfd, sec),
- bfd_get_filename (abfd));
+ bfd_archive_filename (abfd));
#endif
/* Create the linker generated sections all the time so that the
@@ -2185,7 +2167,7 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
if (h != NULL)
{
- if (h->got.refcount == -1)
+ if (h->got.refcount == 0)
{
/* Make sure this symbol is output as a dynamic symbol. */
if (h->dynindx == -1)
@@ -2196,28 +2178,25 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
sgot->_raw_size += 4;
/* Allocate relocation space. */
srelgot->_raw_size += sizeof (Elf32_External_Rela);
-
- h->got.refcount = 1;
}
- else
- h->got.refcount++;
+ h->got.refcount++;
}
else
{
/* This is a global offset table entry for a local symbol. */
if (local_got_refcounts == NULL)
{
- size_t size;
+ bfd_size_type size;
- size = symtab_hdr->sh_info * sizeof (bfd_signed_vma);
- local_got_refcounts = (bfd_signed_vma *)
- bfd_alloc (abfd, size);
+ size = symtab_hdr->sh_info;
+ size *= sizeof (bfd_signed_vma);
+ local_got_refcounts
+ = (bfd_signed_vma *) bfd_zalloc (abfd, size);
if (local_got_refcounts == NULL)
return false;
elf_local_got_refcounts (abfd) = local_got_refcounts;
- memset (local_got_refcounts, -1, size);
}
- if (local_got_refcounts[r_symndx] == -1)
+ if (local_got_refcounts[r_symndx] == 0)
{
sgot->_raw_size += 4;
@@ -2226,11 +2205,8 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
dynamic linker can adjust this GOT entry. */
if (info->shared)
srelgot->_raw_size += sizeof (Elf32_External_Rela);
-
- local_got_refcounts[r_symndx] = 1;
}
- else
- local_got_refcounts[r_symndx]++;
+ local_got_refcounts[r_symndx]++;
}
break;
@@ -2240,7 +2216,7 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
{
((*_bfd_error_handler)
(_("%s: relocation %s cannot be used when making a shared object"),
- bfd_get_filename (abfd), "R_PPC_EMB_SDAI16"));
+ bfd_archive_filename (abfd), "R_PPC_EMB_SDAI16"));
return false;
}
@@ -2274,7 +2250,7 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
{
((*_bfd_error_handler)
(_("%s: relocation %s cannot be used when making a shared object"),
- bfd_get_filename (abfd), "R_PPC_EMB_SDA2I16"));
+ bfd_archive_filename (abfd), "R_PPC_EMB_SDA2I16"));
return false;
}
@@ -2309,7 +2285,7 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
{
((*_bfd_error_handler)
(_("%s: relocation %s cannot be used when making a shared object"),
- bfd_get_filename (abfd),
+ bfd_archive_filename (abfd),
ppc_elf_howto_table[(int) ELF32_R_TYPE (rel->r_info)]->name));
return false;
}
@@ -2343,13 +2319,8 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
if (! bfd_elf32_link_record_dynamic_symbol (info, h))
return false;
}
- if (h->plt.refcount == -1)
- {
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- h->plt.refcount = 1;
- }
- else
- h->plt.refcount++;
+ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->plt.refcount++;
break;
/* The following relocations don't need to propagate the
@@ -2430,6 +2401,8 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
|| ! bfd_set_section_alignment (dynobj, sreloc, 2))
return false;
}
+ if (sec->flags & SEC_READONLY)
+ info->flags |= DF_TEXTREL;
}
sreloc->_raw_size += sizeof (Elf32_External_Rela);
@@ -2485,13 +2458,7 @@ ppc_elf_gc_mark_hook (abfd, info, rel, h, sym)
}
else
{
- if (!(elf_bad_symtab (abfd)
- && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
- && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
- && sym->st_shndx != SHN_COMMON))
- {
- return bfd_section_from_elf_index (abfd, sym->st_shndx);
- }
+ return bfd_section_from_elf_index (abfd, sym->st_shndx);
}
return NULL;
@@ -2575,7 +2542,7 @@ ppc_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
{
if (sym->st_shndx == SHN_COMMON
&& !info->relocateable
- && sym->st_size <= (bfd_vma) bfd_get_gp_size (abfd))
+ && sym->st_size <= elf_gp_size (abfd))
{
/* Common symbols less than or equal to -G nn bytes are automatically
put into .sdata. */
@@ -2584,21 +2551,24 @@ ppc_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
if (!sdata->bss_section)
{
+ bfd_size_type amt;
+
/* We don't go through bfd_make_section, because we don't
want to attach this common section to DYNOBJ. The linker
will move the symbols to the appropriate output section
when it defines common symbols. */
- sdata->bss_section = ((asection *)
- bfd_zalloc (abfd, sizeof (asection)));
+ amt = sizeof (asection);
+ sdata->bss_section = (asection *) bfd_zalloc (abfd, amt);
if (sdata->bss_section == NULL)
return false;
sdata->bss_section->name = sdata->bss_name;
sdata->bss_section->flags = SEC_IS_COMMON;
sdata->bss_section->output_section = sdata->bss_section;
- sdata->bss_section->symbol =
- (asymbol *) bfd_zalloc (abfd, sizeof (asymbol));
+ amt = sizeof (asymbol);
+ sdata->bss_section->symbol = (asymbol *) bfd_zalloc (abfd, amt);
+ amt = sizeof (asymbol *);
sdata->bss_section->symbol_ptr_ptr =
- (asymbol **) bfd_zalloc (abfd, sizeof (asymbol *));
+ (asymbol **) bfd_zalloc (abfd, amt);
if (sdata->bss_section->symbol == NULL
|| sdata->bss_section->symbol_ptr_ptr == NULL)
return false;
@@ -2702,7 +2672,7 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
rela.r_offset = (sgot->output_section->vma
+ sgot->output_offset
- + (h->got.offset &~ 1));
+ + (h->got.offset &~ (bfd_vma) 1));
/* If this is a -Bsymbolic link, and the symbol is defined
locally, we just want to emit a RELATIVE reloc. The entry in
@@ -2847,7 +2817,7 @@ ppc_elf_finish_dynamic_sections (output_bfd, info)
if (sgot)
{
unsigned char *contents = sgot->contents;
- bfd_put_32 (output_bfd, 0x4e800021 /* blrl */, contents);
+ bfd_put_32 (output_bfd, (bfd_vma) 0x4e800021 /* blrl */, contents);
if (sdyn == NULL)
bfd_put_32 (output_bfd, (bfd_vma) 0, contents+4);
@@ -2919,7 +2889,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
#ifdef DEBUG
fprintf (stderr, "ppc_elf_relocate_section called for %s section %s, %ld relocations%s\n",
- bfd_get_filename (input_bfd),
+ bfd_archive_filename (input_bfd),
bfd_section_name(input_bfd, input_section),
(long) input_section->reloc_count,
(info->relocateable) ? " (relocatable)" : "");
@@ -2958,7 +2928,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|| !ppc_elf_howto_table[(int) r_type])
{
(*_bfd_error_handler) (_("%s: unknown relocation type %d"),
- bfd_get_filename (input_bfd),
+ bfd_archive_filename (input_bfd),
(int) r_type);
bfd_set_error (bfd_error_bad_value);
@@ -3003,9 +2973,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
sec = local_sections[r_symndx];
sym_name = "<local symbol>";
- relocation = (sec->output_section->vma
- + sec->output_offset
- + sym->st_value);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ addend = rel->r_addend;
/* Relocs to local symbols are always resolved. */
will_become_local = 1;
}
@@ -3091,7 +3060,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
(*_bfd_error_handler)
(_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
- bfd_get_filename (input_bfd), h->root.root.string,
+ bfd_archive_filename (input_bfd), h->root.root.string,
bfd_get_section_name (input_bfd, input_section));
relocation = 0;
}
@@ -3102,7 +3071,9 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
}
else if (h->root.type == bfd_link_hash_undefweak)
relocation = 0;
- else if (info->shared && !info->symbolic && !info->no_undefined
+ else if (info->shared
+ && (!info->symbolic || info->allow_shlib_undefined)
+ && !info->no_undefined
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
relocation = 0;
else
@@ -3124,13 +3095,16 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
default:
(*_bfd_error_handler) (_("%s: unknown relocation type %d for symbol %s"),
- bfd_get_filename (input_bfd),
+ bfd_archive_filename (input_bfd),
(int) r_type, sym_name);
bfd_set_error (bfd_error_bad_value);
ret = false;
continue;
+ case (int) R_PPC_NONE:
+ continue;
+
/* Relocations that need no special processing. */
case (int) R_PPC_LOCAL24PC:
/* It makes no sense to point a local relocation
@@ -3166,7 +3140,6 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* Relocations that always need to be propagated if this is a shared
object. */
- case (int) R_PPC_NONE:
case (int) R_PPC_ADDR32:
case (int) R_PPC_ADDR24:
case (int) R_PPC_ADDR16:
@@ -3176,7 +3149,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
case (int) R_PPC_ADDR14:
case (int) R_PPC_UADDR32:
case (int) R_PPC_UADDR16:
- if (info->shared)
+ if (info->shared && r_symndx != 0)
{
Elf_Internal_Rela outrel;
boolean skip;
@@ -3212,22 +3185,11 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
skip = false;
- if (elf_section_data (input_section)->stab_info == NULL)
- outrel.r_offset = rel->r_offset;
- else
- {
- bfd_vma off;
-
- off = (_bfd_stab_section_offset
- (output_bfd, &elf_hash_table (info)->stab_info,
- input_section,
- &elf_section_data (input_section)->stab_info,
- rel->r_offset));
- if (off == (bfd_vma) -1)
- skip = true;
- outrel.r_offset = off;
- }
-
+ outrel.r_offset =
+ _bfd_elf_section_offset (output_bfd, info, input_section,
+ rel->r_offset);
+ if (outrel.r_offset == (bfd_vma) -1)
+ skip = true;
outrel.r_offset += (input_section->output_section->vma
+ input_section->output_offset);
@@ -3325,7 +3287,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
insn &= ~BRANCH_PREDICT_BIT;
else
insn |= BRANCH_PREDICT_BIT;
- bfd_put_32 (output_bfd, insn, contents + offset);
+ bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset);
break;
/* branch not taken predicition relocations */
@@ -3336,7 +3298,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
insn |= BRANCH_PREDICT_BIT;
else
insn &= ~BRANCH_PREDICT_BIT;
- bfd_put_32 (output_bfd, insn, contents + offset);
+ bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset);
break;
/* GOT16 relocations */
@@ -3488,7 +3450,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
&& strcmp (name, ".sbss") != 0)
{
(*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
- bfd_get_filename (input_bfd),
+ bfd_archive_filename (input_bfd),
sym_name,
ppc_elf_howto_table[(int) r_type]->name,
name);
@@ -3509,7 +3471,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
if (strcmp (name, ".sdata2") != 0 && strcmp (name, ".sbss2") != 0)
{
(*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
- bfd_get_filename (input_bfd),
+ bfd_archive_filename (input_bfd),
sym_name,
ppc_elf_howto_table[(int) r_type]->name,
name);
@@ -3559,7 +3521,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
(*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
- bfd_get_filename (input_bfd),
+ bfd_archive_filename (input_bfd),
sym_name,
ppc_elf_howto_table[(int) r_type]->name,
name);
@@ -3573,7 +3535,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{ /* fill in register field */
insn = bfd_get_32 (output_bfd, contents + offset);
insn = (insn & ~RA_REGISTER_MASK) | (reg << RA_REGISTER_SHIFT);
- bfd_put_32 (output_bfd, insn, contents + offset);
+ bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset);
}
}
break;
@@ -3625,7 +3587,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
case (int) R_PPC_EMB_RELST_HA:
case (int) R_PPC_EMB_BIT_FLD:
(*_bfd_error_handler) (_("%s: Relocation %s is not yet supported for symbol %s."),
- bfd_get_filename (input_bfd),
+ bfd_archive_filename (input_bfd),
ppc_elf_howto_table[(int) r_type]->name,
sym_name);
@@ -3709,6 +3671,90 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
return ret;
}
+
+static enum elf_reloc_type_class
+ppc_elf_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
+{
+ switch ((int) ELF32_R_TYPE (rela->r_info))
+ {
+ case R_PPC_RELATIVE:
+ return reloc_class_relative;
+ case R_PPC_REL24:
+ case R_PPC_ADDR24:
+ case R_PPC_JMP_SLOT:
+ return reloc_class_plt;
+ case R_PPC_COPY:
+ return reloc_class_copy;
+ default:
+ return reloc_class_normal;
+ }
+}
+
+/* Support for core dump NOTE sections */
+static boolean
+ppc_elf_grok_prstatus (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ int offset;
+ unsigned int raw_size;
+
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 268: /* Linux/PPC */
+ /* pr_cursig */
+ elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+
+ /* pr_pid */
+ elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+
+ /* pr_reg */
+ offset = 72;
+ raw_size = 192;
+
+ break;
+ }
+
+ /* Make a ".reg/999" section. */
+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ raw_size, note->descpos + offset);
+}
+
+static boolean
+ppc_elf_grok_psinfo (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 128: /* Linux/PPC elf_prpsinfo */
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
+ }
+
+ /* Note that for some reason, a spurious space is tacked
+ onto the end of the args in some (at least one anyway)
+ implementations, so strip it off if it exists. */
+
+ {
+ char *command = elf_tdata (abfd)->core_command;
+ int n = strlen (command);
+
+ if (0 < n && command[n - 1] == ' ')
+ command[n - 1] = '\0';
+ }
+
+ return true;
+}
#define TARGET_LITTLE_SYM bfd_elf32_powerpcle_vec
#define TARGET_LITTLE_NAME "elf32-powerpcle"
@@ -3730,10 +3776,10 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
#define elf_backend_plt_not_loaded 1
#define elf_backend_got_symbol_offset 4
#define elf_backend_can_gc_sections 1
+#define elf_backend_can_refcount 1
#define elf_backend_got_header_size 12
#define elf_backend_plt_header_size PLT_INITIAL_ENTRY_SIZE
-#define bfd_elf32_bfd_copy_private_bfd_data ppc_elf_copy_private_bfd_data
#define bfd_elf32_bfd_merge_private_bfd_data ppc_elf_merge_private_bfd_data
#define bfd_elf32_bfd_relax_section ppc_elf_relax_section
#define bfd_elf32_bfd_reloc_type_lookup ppc_elf_reloc_type_lookup
@@ -3754,5 +3800,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
#define elf_backend_fake_sections ppc_elf_fake_sections
#define elf_backend_additional_program_headers ppc_elf_additional_program_headers
#define elf_backend_modify_segment_map ppc_elf_modify_segment_map
+#define elf_backend_grok_prstatus ppc_elf_grok_prstatus
+#define elf_backend_grok_psinfo ppc_elf_grok_psinfo
+#define elf_backend_reloc_type_class ppc_elf_reloc_type_class
#include "elf32-target.h"
diff --git a/contrib/binutils/bfd/elf32-sparc.c b/contrib/binutils/bfd/elf32-sparc.c
index 091cd39..f0f9746 100644
--- a/contrib/binutils/bfd/elf32-sparc.c
+++ b/contrib/binutils/bfd/elf32-sparc.c
@@ -52,6 +52,14 @@ static boolean elf32_sparc_object_p
PARAMS ((bfd *));
static void elf32_sparc_final_write_processing
PARAMS ((bfd *, boolean));
+static enum elf_reloc_type_class elf32_sparc_reloc_type_class
+ PARAMS ((const Elf_Internal_Rela *));
+static asection * elf32_sparc_gc_mark_hook
+ PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry *, Elf_Internal_Sym *));
+static boolean elf32_sparc_gc_sweep_hook
+ PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ const Elf_Internal_Rela *));
/* The relocation "howto" table. */
@@ -68,7 +76,7 @@ reloc_howto_type _bfd_sparc_elf_howto_table[] =
HOWTO(R_SPARC_32, 0,2,32,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_32", false,0,0xffffffff,true),
HOWTO(R_SPARC_DISP8, 0,0, 8,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP8", false,0,0x000000ff,true),
HOWTO(R_SPARC_DISP16, 0,1,16,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP16", false,0,0x0000ffff,true),
- HOWTO(R_SPARC_DISP32, 0,2,32,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP32", false,0,0x00ffffff,true),
+ HOWTO(R_SPARC_DISP32, 0,2,32,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP32", false,0,0xffffffff,true),
HOWTO(R_SPARC_WDISP30, 2,2,30,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP30", false,0,0x3fffffff,true),
HOWTO(R_SPARC_WDISP22, 2,2,22,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP22", false,0,0x003fffff,true),
HOWTO(R_SPARC_HI22, 10,2,22,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_HI22", false,0,0x003fffff,true),
@@ -86,7 +94,7 @@ reloc_howto_type _bfd_sparc_elf_howto_table[] =
HOWTO(R_SPARC_JMP_SLOT, 0,0,00,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_JMP_SLOT",false,0,0x00000000,true),
HOWTO(R_SPARC_RELATIVE, 0,0,00,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_RELATIVE",false,0,0x00000000,true),
HOWTO(R_SPARC_UA32, 0,2,32,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA32", false,0,0xffffffff,true),
- HOWTO(R_SPARC_PLT32, 0,0,00,false,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_PLT32", false,0,0x00000000,true),
+ HOWTO(R_SPARC_PLT32, 0,0,00,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_PLT32", false,0,0xffffffff,true),
HOWTO(R_SPARC_HIPLT22, 0,0,00,false,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_HIPLT22", false,0,0x00000000,true),
HOWTO(R_SPARC_LOPLT10, 0,0,00,false,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_LOPLT10", false,0,0x00000000,true),
HOWTO(R_SPARC_PCPLT32, 0,0,00,false,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_PCPLT32", false,0,0x00000000,true),
@@ -120,7 +128,7 @@ reloc_howto_type _bfd_sparc_elf_howto_table[] =
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true),
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true),
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true),
- HOWTO(R_SPARC_UA64, 0,4,64,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA64", false,0,(~ (bfd_vma)0), true),
+ HOWTO(R_SPARC_UA64, 0,0, 0,false,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_UA64", false,0,0x00000000,true),
HOWTO(R_SPARC_UA16, 0,1,16,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA16", false,0,0x0000ffff,true),
HOWTO(R_SPARC_REV32, 0,2,32,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_REV32", false,0,0xffffffff,true),
};
@@ -134,10 +142,11 @@ struct elf_reloc_map {
unsigned char elf_reloc_val;
};
-static CONST struct elf_reloc_map sparc_reloc_map[] =
+static const struct elf_reloc_map sparc_reloc_map[] =
{
{ BFD_RELOC_NONE, R_SPARC_NONE, },
{ BFD_RELOC_16, R_SPARC_16, },
+ { BFD_RELOC_16_PCREL, R_SPARC_DISP16 },
{ BFD_RELOC_8, R_SPARC_8 },
{ BFD_RELOC_8_PCREL, R_SPARC_DISP8 },
{ BFD_RELOC_CTOR, R_SPARC_32 },
@@ -146,6 +155,7 @@ static CONST struct elf_reloc_map sparc_reloc_map[] =
{ BFD_RELOC_HI22, R_SPARC_HI22 },
{ BFD_RELOC_LO10, R_SPARC_LO10, },
{ BFD_RELOC_32_PCREL_S2, R_SPARC_WDISP30 },
+ { BFD_RELOC_SPARC_PLT32, R_SPARC_PLT32 },
{ BFD_RELOC_SPARC22, R_SPARC_22 },
{ BFD_RELOC_SPARC13, R_SPARC_13 },
{ BFD_RELOC_SPARC_GOT10, R_SPARC_GOT10 },
@@ -447,10 +457,11 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
symbol. */
if (local_got_offsets == NULL)
{
- size_t size;
+ bfd_size_type size;
register unsigned int i;
- size = symtab_hdr->sh_info * sizeof (bfd_vma);
+ size = symtab_hdr->sh_info;
+ size *= sizeof (bfd_vma);
local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size);
if (local_got_offsets == NULL)
return false;
@@ -485,6 +496,7 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
break;
+ case R_SPARC_PLT32:
case R_SPARC_WPLT30:
/* This symbol requires a procedure linkage table entry. We
actually build the entry in adjust_dynamic_symbol,
@@ -498,6 +510,8 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
reloc for a local symbol if you assemble a call from
one section to another when using -K pic. We treat
it as WDISP30. */
+ if (ELF32_R_TYPE (rel->r_info) != R_SPARC_WPLT30)
+ goto r_sparc_plt32;
break;
}
@@ -510,6 +524,8 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ if (ELF32_R_TYPE (rel->r_info) != R_SPARC_WPLT30)
+ goto r_sparc_plt32;
break;
case R_SPARC_PC10:
@@ -554,11 +570,11 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
case R_SPARC_LO10:
case R_SPARC_UA16:
case R_SPARC_UA32:
- case R_SPARC_UA64:
if (h != NULL)
h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
- if (info->shared)
+ r_sparc_plt32:
+ if (info->shared && (sec->flags & SEC_ALLOC))
{
/* When creating a shared object, we must copy these
relocs into the output file. We create a reloc
@@ -593,6 +609,8 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
|| ! bfd_set_section_alignment (dynobj, sreloc, 2))
return false;
}
+ if (sec->flags & SEC_READONLY)
+ info->flags |= DF_TEXTREL;
}
sreloc->_raw_size += sizeof (Elf32_External_Rela);
@@ -652,14 +670,8 @@ elf32_sparc_gc_mark_hook (abfd, info, rel, h, sym)
}
else
{
- if (!(elf_bad_symtab (abfd)
- && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
- && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
- && sym->st_shndx != SHN_COMMON))
- {
- return bfd_section_from_elf_index (abfd, sym->st_shndx);
- }
- }
+ return bfd_section_from_elf_index (abfd, sym->st_shndx);
+ }
return NULL;
}
@@ -910,12 +922,11 @@ elf32_sparc_adjust_dynamic_symbol (info, h)
static boolean
elf32_sparc_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
+ bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
{
bfd *dynobj;
asection *s;
- boolean reltext;
boolean relplt;
dynobj = elf_hash_table (info)->dynobj;
@@ -953,7 +964,6 @@ elf32_sparc_size_dynamic_sections (output_bfd, info)
/* The check_relocs and adjust_dynamic_symbol entry points have
determined the sizes of the various dynamic sections. Allocate
memory for them. */
- reltext = false;
relplt = false;
for (s = dynobj->sections; s != NULL; s = s->next)
{
@@ -986,19 +996,6 @@ elf32_sparc_size_dynamic_sections (output_bfd, info)
}
else
{
- const char *outname;
- asection *target;
-
- /* If this relocation section applies to a read only
- section, then we probably need a DT_TEXTREL entry. */
- outname = bfd_get_section_name (output_bfd,
- s->output_section);
- target = bfd_get_section_by_name (output_bfd, outname + 5);
- if (target != NULL
- && (target->flags & SEC_READONLY) != 0
- && (target->flags & SEC_ALLOC) != 0)
- reltext = true;
-
if (strcmp (name, ".rela.plt") == 0)
relplt = true;
@@ -1038,34 +1035,36 @@ elf32_sparc_size_dynamic_sections (output_bfd, info)
must add the entries now so that we get the correct size for
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
- if (! info->shared)
+#define add_dynamic_entry(TAG, VAL) \
+ bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+
+ if (!info->shared)
{
- if (! bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0))
+ if (!add_dynamic_entry (DT_DEBUG, 0))
return false;
}
if (relplt)
{
- if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0)
- || ! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0)
- || ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_RELA)
- || ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0))
+ if (!add_dynamic_entry (DT_PLTGOT, 0)
+ || !add_dynamic_entry (DT_PLTRELSZ, 0)
+ || !add_dynamic_entry (DT_PLTREL, DT_RELA)
+ || !add_dynamic_entry (DT_JMPREL, 0))
return false;
}
- if (! bfd_elf32_add_dynamic_entry (info, DT_RELA, 0)
- || ! bfd_elf32_add_dynamic_entry (info, DT_RELASZ, 0)
- || ! bfd_elf32_add_dynamic_entry (info, DT_RELAENT,
- sizeof (Elf32_External_Rela)))
+ if (!add_dynamic_entry (DT_RELA, 0)
+ || !add_dynamic_entry (DT_RELASZ, 0)
+ || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela)))
return false;
- if (reltext)
+ if (info->flags & DF_TEXTREL)
{
- if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
+ if (!add_dynamic_entry (DT_TEXTREL, 0))
return false;
- info->flags |= DF_TEXTREL;
}
}
+#undef add_dynamic_entry
return true;
}
@@ -1136,6 +1135,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
asection *sec;
bfd_vma relocation;
bfd_reloc_status_type r;
+ boolean is_plt = false;
r_type = ELF32_R_TYPE (rel->r_info);
@@ -1179,9 +1179,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = (sec->output_section->vma
- + sec->output_offset
- + sym->st_value);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
}
else
{
@@ -1193,7 +1191,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
|| h->root.type == bfd_link_hash_defweak)
{
sec = h->root.u.def.section;
- if ((r_type == R_SPARC_WPLT30
+ if (((r_type == R_SPARC_WPLT30
+ || r_type == R_SPARC_PLT32)
&& h->plt.offset != (bfd_vma) -1)
|| ((r_type == R_SPARC_GOT10
|| r_type == R_SPARC_GOT13
@@ -1223,11 +1222,18 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == R_SPARC_LO10
|| r_type == R_SPARC_UA16
|| r_type == R_SPARC_UA32
- || r_type == R_SPARC_UA64
|| ((r_type == R_SPARC_PC10
|| r_type == R_SPARC_PC22)
&& strcmp (h->root.root.string,
- "_GLOBAL_OFFSET_TABLE_") != 0))))
+ "_GLOBAL_OFFSET_TABLE_") != 0))
+ && ((input_section->flags & SEC_ALLOC) != 0
+ /* DWARF will emit R_SPARC_32 relocations in its
+ sections against symbols defined externally
+ in shared libraries. We can't do anything
+ with them here. */
+ || ((input_section->flags & SEC_DEBUGGING) != 0
+ && (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_DYNAMIC) != 0))))
{
/* In these cases, we don't need the relocation
value. We check specially because in some
@@ -1241,7 +1247,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
}
else if (h->root.type == bfd_link_hash_undefweak)
relocation = 0;
- else if (info->shared && !info->symbolic
+ else if (info->shared
+ && (!info->symbolic || info->allow_shlib_undefined)
&& !info->no_undefined
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
relocation = 0;
@@ -1354,6 +1361,13 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
break;
+ case R_SPARC_PLT32:
+ if (h == NULL || h->plt.offset == (bfd_vma) -1)
+ {
+ r_type = R_SPARC_32;
+ goto r_sparc_plt32;
+ }
+ /* Fall through. */
case R_SPARC_WPLT30:
/* Relocation is to the entry for this symbol in the
procedure linkage table. */
@@ -1382,6 +1396,12 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
relocation = (splt->output_section->vma
+ splt->output_offset
+ h->plt.offset);
+ if (r_type == R_SPARC_PLT32)
+ {
+ r_type = R_SPARC_32;
+ is_plt = true;
+ goto r_sparc_plt32;
+ }
break;
case R_SPARC_PC10:
@@ -1412,8 +1432,10 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
case R_SPARC_LO10:
case R_SPARC_UA16:
case R_SPARC_UA32:
- case R_SPARC_UA64:
- if (info->shared)
+ r_sparc_plt32:
+ if (info->shared
+ && r_symndx != 0
+ && (input_section->flags & SEC_ALLOC))
{
Elf_Internal_Rela outrel;
boolean skip;
@@ -1444,30 +1466,41 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
skip = false;
- if (elf_section_data (input_section)->stab_info == NULL)
- outrel.r_offset = rel->r_offset;
- else
- {
- bfd_vma off;
-
- off = (_bfd_stab_section_offset
- (output_bfd, &elf_hash_table (info)->stab_info,
- input_section,
- &elf_section_data (input_section)->stab_info,
- rel->r_offset));
- if (off == (bfd_vma) -1)
- skip = true;
- outrel.r_offset = off;
- }
-
+ outrel.r_offset =
+ _bfd_elf_section_offset (output_bfd, info, input_section,
+ rel->r_offset);
+ if (outrel.r_offset == (bfd_vma) -1)
+ skip = true;
outrel.r_offset += (input_section->output_section->vma
+ input_section->output_offset);
+ /* Optimize unaligned reloc usage now that we know where
+ it finally resides. */
+ switch (r_type)
+ {
+ case R_SPARC_16:
+ if (outrel.r_offset & 1)
+ r_type = R_SPARC_UA16;
+ break;
+ case R_SPARC_UA16:
+ if (!(outrel.r_offset & 1))
+ r_type = R_SPARC_16;
+ break;
+ case R_SPARC_32:
+ if (outrel.r_offset & 3)
+ r_type = R_SPARC_UA32;
+ break;
+ case R_SPARC_UA32:
+ if (!(outrel.r_offset & 3))
+ r_type = R_SPARC_32;
+ break;
+ }
+
if (skip)
memset (&outrel, 0, sizeof outrel);
/* h->dynindx may be -1 if the symbol was marked to
become local. */
- else if (h != NULL
+ else if (h != NULL && ! is_plt
&& ((! info->symbolic && h->dynindx != -1)
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))
@@ -1487,7 +1520,9 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
{
long indx;
- if (h == NULL)
+ if (is_plt)
+ sec = splt;
+ else if (h == NULL)
sec = local_sections[r_symndx];
else
{
@@ -1517,7 +1552,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
BFD_FAIL ();
(*_bfd_error_handler)
(_("%s: probably compiled without -fPIC?"),
- bfd_get_filename (input_bfd));
+ bfd_archive_filename (input_bfd));
bfd_set_error (bfd_error_bad_value);
return false;
}
@@ -1535,12 +1570,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
++sreloc->reloc_count;
/* This reloc will be computed at runtime, so there's no
- need to do anything now, unless this is a RELATIVE
- reloc in an unallocated section. */
- if (skip
- || (input_section->flags & SEC_ALLOC) != 0
- || ELF32_R_TYPE (outrel.r_info) != R_SPARC_RELATIVE)
- continue;
+ need to do anything now. */
+ continue;
}
break;
@@ -1661,7 +1692,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
|| reg == G0 || reg == O7)
break;
- bfd_put_32 (input_bfd, INSN_NOP,
+ bfd_put_32 (input_bfd, (bfd_vma) INSN_NOP,
contents + rel->r_offset + 4);
}
@@ -1748,7 +1779,7 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
(PLT_ENTRY_WORD1
+ (((- (h->plt.offset + 4)) >> 2) & 0x3fffff)),
splt->contents + h->plt.offset + 4);
- bfd_put_32 (output_bfd, PLT_ENTRY_WORD2,
+ bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD2,
splt->contents + h->plt.offset + 8);
/* Fill in the entry in the .rela.plt section. */
@@ -1791,7 +1822,7 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
rela.r_offset = (sgot->output_section->vma
+ sgot->output_offset
- + (h->got.offset &~ 1));
+ + (h->got.offset &~ (bfd_vma) 1));
/* If this is a -Bsymbolic link, and the symbol is defined
locally, we just want to emit a RELATIVE reloc. Likewise if
@@ -1917,7 +1948,7 @@ elf32_sparc_finish_dynamic_sections (output_bfd, info)
if (splt->_raw_size > 0)
{
memset (splt->contents, 0, 4 * PLT_ENTRY_SIZE);
- bfd_put_32 (output_bfd, SPARC_NOP,
+ bfd_put_32 (output_bfd, (bfd_vma) SPARC_NOP,
splt->contents + splt->_raw_size - 4);
}
@@ -1974,7 +2005,7 @@ elf32_sparc_merge_private_bfd_data (ibfd, obfd)
error = true;
(*_bfd_error_handler)
(_("%s: compiled for a 64 bit system and target is 32 bit"),
- bfd_get_filename (ibfd));
+ bfd_archive_filename (ibfd));
}
else if ((ibfd->flags & DYNAMIC) == 0)
{
@@ -1988,7 +2019,7 @@ elf32_sparc_merge_private_bfd_data (ibfd, obfd)
{
(*_bfd_error_handler)
(_("%s: linking little endian files with big endian files"),
- bfd_get_filename (ibfd));
+ bfd_archive_filename (ibfd));
error = true;
}
previous_ibfd_e_flags = elf_elfheader (ibfd)->e_flags & EF_SPARC_LEDATA;
@@ -2024,7 +2055,7 @@ elf32_sparc_object_p (abfd)
}
else if (elf_elfheader (abfd)->e_flags & EF_SPARC_LEDATA)
return bfd_default_set_arch_mach (abfd, bfd_arch_sparc,
- bfd_mach_sparc_sparclite_le);
+ bfd_mach_sparc_sparclite_le);
else
return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, bfd_mach_sparc);
}
@@ -2066,6 +2097,23 @@ elf32_sparc_final_write_processing (abfd, linker)
break;
}
}
+
+static enum elf_reloc_type_class
+elf32_sparc_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
+{
+ switch ((int) ELF32_R_TYPE (rela->r_info))
+ {
+ case R_SPARC_RELATIVE:
+ return reloc_class_relative;
+ case R_SPARC_JMP_SLOT:
+ return reloc_class_plt;
+ case R_SPARC_COPY:
+ return reloc_class_copy;
+ default:
+ return reloc_class_normal;
+ }
+}
#define TARGET_BIG_SYM bfd_elf32_sparc_vec
#define TARGET_BIG_NAME "elf32-sparc"
@@ -2096,6 +2144,7 @@ elf32_sparc_final_write_processing (abfd, linker)
elf32_sparc_final_write_processing
#define elf_backend_gc_mark_hook elf32_sparc_gc_mark_hook
#define elf_backend_gc_sweep_hook elf32_sparc_gc_sweep_hook
+#define elf_backend_reloc_type_class elf32_sparc_reloc_type_class
#define elf_backend_can_gc_sections 1
#define elf_backend_want_got_plt 0
diff --git a/contrib/binutils/bfd/elf64-alpha.c b/contrib/binutils/bfd/elf64-alpha.c
index bd89a7b..ef6e853 100644
--- a/contrib/binutils/bfd/elf64-alpha.c
+++ b/contrib/binutils/bfd/elf64-alpha.c
@@ -1,5 +1,5 @@
/* Alpha specific support for 64-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@tamu.edu>.
@@ -74,6 +74,8 @@ static boolean elf64_alpha_object_p
PARAMS((bfd *));
static boolean elf64_alpha_section_from_shdr
PARAMS((bfd *, Elf64_Internal_Shdr *, char *));
+static boolean elf64_alpha_section_flags
+ PARAMS((flagword *, Elf64_Internal_Shdr *));
static boolean elf64_alpha_fake_sections
PARAMS((bfd *, Elf64_Internal_Shdr *, asection *));
static boolean elf64_alpha_create_got_section
@@ -133,6 +135,8 @@ static boolean elf64_alpha_merge_ind_symbols
PARAMS((struct alpha_elf_link_hash_entry *, PTR));
static Elf_Internal_Rela * elf64_alpha_find_reloc_at_ofs
PARAMS ((Elf_Internal_Rela *, Elf_Internal_Rela *, bfd_vma, int));
+static enum elf_reloc_type_class elf64_alpha_reloc_type_class
+ PARAMS ((const Elf_Internal_Rela *));
struct alpha_elf_link_hash_entry
{
@@ -166,8 +170,9 @@ struct alpha_elf_link_hash_entry
int flags;
- /* An additional flag. */
+ /* Additional flags. */
#define ALPHA_ELF_GOT_ENTRY_RELOCS_DONE 0x10
+#define ALPHA_ELF_GOT_ENTRY_RELOCS_XLATED 0x20
int use_count;
} *got_entries;
@@ -182,7 +187,10 @@ struct alpha_elf_link_hash_entry
asection *srel;
/* what kind of relocation? */
- unsigned long rtype;
+ unsigned int rtype;
+
+ /* is this against read-only section? */
+ unsigned int reltext : 1;
/* how many did we find? */
unsigned long count;
@@ -314,9 +322,9 @@ elf64_alpha_bfd_link_hash_table_create (abfd)
bfd *abfd;
{
struct alpha_elf_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct alpha_elf_link_hash_table);
- ret = ((struct alpha_elf_link_hash_table *)
- bfd_zalloc (abfd, sizeof (struct alpha_elf_link_hash_table)));
+ ret = (struct alpha_elf_link_hash_table *) bfd_zalloc (abfd, amt);
if (ret == (struct alpha_elf_link_hash_table *) NULL)
return NULL;
@@ -368,7 +376,8 @@ static boolean
elf64_alpha_mkobject (abfd)
bfd *abfd;
{
- abfd->tdata.any = bfd_zalloc (abfd, sizeof (struct alpha_elf_obj_tdata));
+ bfd_size_type amt = sizeof (struct alpha_elf_obj_tdata);
+ abfd->tdata.any = bfd_zalloc (abfd, amt);
if (abfd->tdata.any == NULL)
return false;
return true;
@@ -380,7 +389,8 @@ elf64_alpha_object_p (abfd)
{
/* Allocate our special target data. */
struct alpha_elf_obj_tdata *new_tdata;
- new_tdata = bfd_zalloc (abfd, sizeof (struct alpha_elf_obj_tdata));
+ bfd_size_type amt = sizeof (struct alpha_elf_obj_tdata);
+ new_tdata = bfd_zalloc (abfd, amt);
if (new_tdata == NULL)
return false;
new_tdata->root = *abfd->tdata.elf_obj_data;
@@ -394,6 +404,9 @@ elf64_alpha_object_p (abfd)
from smaller values. Start with zero, widen, *then* decrement. */
#define MINUS_ONE (((bfd_vma)0) - 1)
+#define SKIP_HOWTO(N) \
+ HOWTO(N, 0, 0, 0, 0, 0, 0, elf64_alpha_reloc_bad, 0, 0, 0, 0, 0)
+
static reloc_howto_type elf64_alpha_howto_table[] =
{
HOWTO (R_ALPHA_NONE, /* type */
@@ -460,7 +473,7 @@ static reloc_howto_type elf64_alpha_howto_table[] =
/* Used for an instruction that refers to memory off the GP register. */
HOWTO (R_ALPHA_LITERAL, /* type */
0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
@@ -481,7 +494,7 @@ static reloc_howto_type elf64_alpha_howto_table[] =
This does not actually do any relocation. */
HOWTO (R_ALPHA_LITUSE, /* type */
0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
@@ -541,7 +554,7 @@ static reloc_howto_type elf64_alpha_howto_table[] =
/* A hint for a jump to a register. */
HOWTO (R_ALPHA_HINT, /* type */
2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
14, /* bitsize */
true, /* pc_relative */
0, /* bitpos */
@@ -598,99 +611,22 @@ static reloc_howto_type elf64_alpha_howto_table[] =
MINUS_ONE, /* dst_mask */
true), /* pcrel_offset */
- /* Push a value on the reloc evaluation stack. */
- /* Not implemented -- it's dumb. */
- HOWTO (R_ALPHA_OP_PUSH, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- elf64_alpha_reloc_bad, /* special_function */
- "OP_PUSH", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
-
- /* Store the value from the stack at the given address. Store it in
- a bitfield of size r_size starting at bit position r_offset. */
- /* Not implemented -- it's dumb. */
- HOWTO (R_ALPHA_OP_STORE, /* type */
- 0, /* rightshift */
- 4, /* size (0 = byte, 1 = short, 2 = long) */
- 64, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- elf64_alpha_reloc_bad, /* special_function */
- "OP_STORE", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- MINUS_ONE, /* dst_mask */
- false), /* pcrel_offset */
-
- /* Subtract the reloc address from the value on the top of the
- relocation stack. */
- /* Not implemented -- it's dumb. */
- HOWTO (R_ALPHA_OP_PSUB, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- elf64_alpha_reloc_bad, /* special_function */
- "OP_PSUB", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
-
- /* Shift the value on the top of the relocation stack right by the
- given value. */
- /* Not implemented -- it's dumb. */
- HOWTO (R_ALPHA_OP_PRSHIFT, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- elf64_alpha_reloc_bad, /* special_function */
- "OP_PRSHIFT", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
-
- /* Change the value of GP used by +r_addend until the next GPVALUE or the
- end of the input bfd. */
- /* Not implemented -- it's dumb. */
- HOWTO (R_ALPHA_GPVALUE,
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- elf64_alpha_reloc_bad, /* special_function */
- "GPVALUE", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
+ /* Skip 12 - 16; deprecated ECOFF relocs. */
+ SKIP_HOWTO (12),
+ SKIP_HOWTO (13),
+ SKIP_HOWTO (14),
+ SKIP_HOWTO (15),
+ SKIP_HOWTO (16),
/* The high 16 bits of the displacement from GP to the target. */
HOWTO (R_ALPHA_GPRELHIGH,
0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- elf64_alpha_reloc_bad, /* special_function */
+ 0, /* special_function */
"GPRELHIGH", /* name */
false, /* partial_inplace */
0xffff, /* src_mask */
@@ -700,12 +636,12 @@ static reloc_howto_type elf64_alpha_howto_table[] =
/* The low 16 bits of the displacement from GP to the target. */
HOWTO (R_ALPHA_GPRELLOW,
0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
- elf64_alpha_reloc_bad, /* special_function */
+ 0, /* special_function */
"GPRELLOW", /* name */
false, /* partial_inplace */
0xffff, /* src_mask */
@@ -713,89 +649,25 @@ static reloc_howto_type elf64_alpha_howto_table[] =
false), /* pcrel_offset */
/* A 16-bit displacement from the GP to the target. */
- /* XXX: Not implemented. */
- HOWTO (R_ALPHA_IMMED_GP_16,
+ HOWTO (R_ALPHA_GPREL16,
0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
- "IMMED_GP_16", /* name */
+ "GPREL16", /* name */
false, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
false), /* pcrel_offset */
- /* The high bits of a 32-bit displacement from the GP to the target; the
- low bits are supplied in the subsequent R_ALPHA_IMMED_LO32 relocs. */
- /* XXX: Not implemented. */
- HOWTO (R_ALPHA_IMMED_GP_HI32,
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- elf64_alpha_reloc_bad, /* special_function */
- "IMMED_GP_HI32", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
-
- /* The high bits of a 32-bit displacement to the starting address of the
- current section (the relocation target is ignored); the low bits are
- supplied in the subsequent R_ALPHA_IMMED_LO32 relocs. */
- /* XXX: Not implemented. */
- HOWTO (R_ALPHA_IMMED_SCN_HI32,
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- elf64_alpha_reloc_bad, /* special_function */
- "IMMED_SCN_HI32", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
-
- /* The high bits of a 32-bit displacement from the previous br, bsr, jsr
- or jmp insn (as tagged by a BRADDR or HINT reloc) to the target; the
- low bits are supplied by subsequent R_ALPHA_IMMED_LO32 relocs. */
- /* XXX: Not implemented. */
- HOWTO (R_ALPHA_IMMED_BR_HI32,
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- elf64_alpha_reloc_bad, /* special_function */
- "IMMED_BR_HI32", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
-
- /* The low 16 bits of a displacement calculated in a previous HI32 reloc. */
- /* XXX: Not implemented. */
- HOWTO (R_ALPHA_IMMED_LO32,
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- elf64_alpha_reloc_bad, /* special_function */
- "IMMED_LO32", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
+ /* Skip 20 - 23; deprecated ECOFF relocs. */
+ SKIP_HOWTO (20),
+ SKIP_HOWTO (21),
+ SKIP_HOWTO (22),
+ SKIP_HOWTO (23),
/* Misc ELF relocations. */
@@ -934,8 +806,8 @@ elf64_alpha_do_reloc_gpdisp (abfd, gpdisp, p_ldah, p_lda)
| (((gpdisp >> 16) + ((gpdisp >> 15) & 1)) & 0xffff));
i_lda = (i_lda & 0xffff0000) | (gpdisp & 0xffff);
- bfd_put_32 (abfd, i_ldah, p_ldah);
- bfd_put_32 (abfd, i_lda, p_lda);
+ bfd_put_32 (abfd, (bfd_vma) i_ldah, p_ldah);
+ bfd_put_32 (abfd, (bfd_vma) i_lda, p_lda);
return ret;
}
@@ -998,30 +870,22 @@ struct elf_reloc_map
static const struct elf_reloc_map elf64_alpha_reloc_map[] =
{
- {BFD_RELOC_NONE, R_ALPHA_NONE},
- {BFD_RELOC_32, R_ALPHA_REFLONG},
- {BFD_RELOC_64, R_ALPHA_REFQUAD},
- {BFD_RELOC_CTOR, R_ALPHA_REFQUAD},
- {BFD_RELOC_GPREL32, R_ALPHA_GPREL32},
- {BFD_RELOC_ALPHA_ELF_LITERAL, R_ALPHA_LITERAL},
- {BFD_RELOC_ALPHA_LITUSE, R_ALPHA_LITUSE},
- {BFD_RELOC_ALPHA_GPDISP, R_ALPHA_GPDISP},
- {BFD_RELOC_23_PCREL_S2, R_ALPHA_BRADDR},
- {BFD_RELOC_ALPHA_HINT, R_ALPHA_HINT},
- {BFD_RELOC_16_PCREL, R_ALPHA_SREL16},
- {BFD_RELOC_32_PCREL, R_ALPHA_SREL32},
- {BFD_RELOC_64_PCREL, R_ALPHA_SREL64},
-
-/* The BFD_RELOC_ALPHA_USER_* relocations are used by the assembler to process
- the explicit !<reloc>!sequence relocations, and are mapped into the normal
- relocations at the end of processing. */
- {BFD_RELOC_ALPHA_USER_LITERAL, R_ALPHA_LITERAL},
- {BFD_RELOC_ALPHA_USER_LITUSE_BASE, R_ALPHA_LITUSE},
- {BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF, R_ALPHA_LITUSE},
- {BFD_RELOC_ALPHA_USER_LITUSE_JSR, R_ALPHA_LITUSE},
- {BFD_RELOC_ALPHA_USER_GPDISP, R_ALPHA_GPDISP},
- {BFD_RELOC_ALPHA_USER_GPRELHIGH, R_ALPHA_GPRELHIGH},
- {BFD_RELOC_ALPHA_USER_GPRELLOW, R_ALPHA_GPRELLOW},
+ {BFD_RELOC_NONE, R_ALPHA_NONE},
+ {BFD_RELOC_32, R_ALPHA_REFLONG},
+ {BFD_RELOC_64, R_ALPHA_REFQUAD},
+ {BFD_RELOC_CTOR, R_ALPHA_REFQUAD},
+ {BFD_RELOC_GPREL32, R_ALPHA_GPREL32},
+ {BFD_RELOC_ALPHA_ELF_LITERAL, R_ALPHA_LITERAL},
+ {BFD_RELOC_ALPHA_LITUSE, R_ALPHA_LITUSE},
+ {BFD_RELOC_ALPHA_GPDISP, R_ALPHA_GPDISP},
+ {BFD_RELOC_23_PCREL_S2, R_ALPHA_BRADDR},
+ {BFD_RELOC_ALPHA_HINT, R_ALPHA_HINT},
+ {BFD_RELOC_16_PCREL, R_ALPHA_SREL16},
+ {BFD_RELOC_32_PCREL, R_ALPHA_SREL32},
+ {BFD_RELOC_64_PCREL, R_ALPHA_SREL64},
+ {BFD_RELOC_ALPHA_GPREL_HI16, R_ALPHA_GPRELHIGH},
+ {BFD_RELOC_ALPHA_GPREL_LO16, R_ALPHA_GPRELLOW},
+ {BFD_RELOC_GPREL16, R_ALPHA_GPREL16},
};
/* Given a BFD reloc type, return a HOWTO structure. */
@@ -1077,7 +941,7 @@ elf64_alpha_info_to_howto (abfd, cache_ptr, dst)
#define OP_LDQ 0x29
#define OP_BR 0x30
#define OP_BSR 0x34
-#define INSN_UNOP 0x2fe00000
+#define INSN_UNOP 0x2ffe0000
struct alpha_relax_info
{
@@ -1119,7 +983,8 @@ elf64_alpha_find_reloc_at_ofs (rel, relend, offset, type)
{
while (rel < relend)
{
- if (rel->r_offset == offset && ELF64_R_TYPE (rel->r_info) == type)
+ if (rel->r_offset == offset
+ && ELF64_R_TYPE (rel->r_info) == (unsigned int) type)
return rel;
++rel;
}
@@ -1146,8 +1011,8 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
{
((*_bfd_error_handler)
("%s: %s+0x%lx: warning: LITERAL relocation against unexpected insn",
- bfd_get_filename (info->abfd), info->sec->name,
- (unsigned long)irel->r_offset));
+ bfd_archive_filename (info->abfd), info->sec->name,
+ (unsigned long) irel->r_offset));
return irel;
}
@@ -1156,7 +1021,7 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
{
if (ELF64_R_TYPE (urel->r_info) != R_ALPHA_LITUSE)
break;
- if (urel->r_addend >= 0 && urel->r_addend <= 3)
+ if (urel->r_addend <= 3)
flags |= 1 << urel->r_addend;
}
@@ -1199,11 +1064,12 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
register from the literal insn. Leave the offset alone. */
insn = (insn & 0xffe0ffff) | (lit_insn & 0x001f0000);
urel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
- R_ALPHA_GPRELLOW);
+ R_ALPHA_GPREL16);
urel->r_addend = irel->r_addend;
info->changed_relocs = true;
- bfd_put_32 (info->abfd, insn, info->contents + urel->r_offset);
+ bfd_put_32 (info->abfd, (bfd_vma) insn,
+ info->contents + urel->r_offset);
info->changed_contents = true;
}
@@ -1215,7 +1081,7 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info),
R_ALPHA_GPRELHIGH);
lit_insn = (OP_LDAH << 26) | (lit_insn & 0x03ff0000);
- bfd_put_32 (info->abfd, lit_insn,
+ bfd_put_32 (info->abfd, (bfd_vma) lit_insn,
info->contents + irel->r_offset);
lit_reused = true;
info->changed_contents = true;
@@ -1235,13 +1101,15 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
/* FIXME: sanity check the insn for byte op. Check that the
literal dest reg is indeed Rb in the byte insn. */
- insn = (insn & ~0x001ff000) | ((symval & 7) << 13) | 0x1000;
+ insn &= ~ (unsigned) 0x001ff000;
+ insn |= ((symval & 7) << 13) | 0x1000;
urel->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
urel->r_addend = 0;
info->changed_relocs = true;
- bfd_put_32 (info->abfd, insn, info->contents + urel->r_offset);
+ bfd_put_32 (info->abfd, (bfd_vma) insn,
+ info->contents + urel->r_offset);
info->changed_contents = true;
break;
@@ -1274,7 +1142,8 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
else
all_optimized = false;
- bfd_put_32 (info->abfd, insn, info->contents + urel->r_offset);
+ bfd_put_32 (info->abfd, (bfd_vma) insn,
+ info->contents + urel->r_offset);
/* Kill any HINT reloc that might exist for this insn. */
xrel = (elf64_alpha_find_reloc_at_ofs
@@ -1289,14 +1158,36 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
else
all_optimized = false;
- /* ??? If target gp == current gp we can eliminate the gp reload.
- This does depend on every place a gp could be reloaded will
- be, which currently happens for all code produced by gcc, but
- not necessarily by hand-coded assembly, or if sibling calls
- are enabled in gcc.
-
- Perhaps conditionalize this on a flag being set in the target
- object file's header, and have gcc set it? */
+ /* Even if the target is not in range for a direct branch,
+ if we share a GP, we can eliminate the gp reload. */
+ if (optdest)
+ {
+ Elf_Internal_Rela *gpdisp
+ = (elf64_alpha_find_reloc_at_ofs
+ (irel, irelend, urel->r_offset + 4, R_ALPHA_GPDISP));
+ if (gpdisp)
+ {
+ bfd_byte *p_ldah = info->contents + gpdisp->r_offset;
+ bfd_byte *p_lda = p_ldah + gpdisp->r_addend;
+ unsigned int ldah = bfd_get_32 (info->abfd, p_ldah);
+ unsigned int lda = bfd_get_32 (info->abfd, p_lda);
+
+ /* Verify that the instruction is "ldah $29,0($26)".
+ Consider a function that ends in a noreturn call,
+ and that the next function begins with an ldgp,
+ and that by accident there is no padding between.
+ In that case the insn would use $27 as the base. */
+ if (ldah == 0x27ba0000 && lda == 0x23bd0000)
+ {
+ bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, p_ldah);
+ bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, p_lda);
+
+ gpdisp->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
+ info->changed_contents = true;
+ info->changed_relocs = true;
+ }
+ }
+ }
}
break;
}
@@ -1320,7 +1211,8 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend)
irel->r_info = ELF64_R_INFO (0, R_ALPHA_NONE);
info->changed_relocs = true;
- bfd_put_32 (info->abfd, INSN_UNOP, info->contents + irel->r_offset);
+ bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP,
+ info->contents + irel->r_offset);
info->changed_contents = true;
}
}
@@ -1416,7 +1308,7 @@ elf64_alpha_relax_without_lituse (info, symval, irel)
{
((*_bfd_error_handler)
("%s: %s+0x%lx: warning: LITERAL relocation against unexpected insn",
- bfd_get_filename (info->abfd), info->sec->name,
+ bfd_archive_filename (info->abfd), info->sec->name,
(unsigned long) irel->r_offset));
return true;
}
@@ -1433,10 +1325,10 @@ elf64_alpha_relax_without_lituse (info, symval, irel)
`ldq R,X(gp)' for `lda R,Y(gp)'. */
insn = (OP_LDA << 26) | (insn & 0x03ff0000);
- bfd_put_32 (info->abfd, insn, info->contents + irel->r_offset);
+ bfd_put_32 (info->abfd, (bfd_vma) insn, info->contents + irel->r_offset);
info->changed_contents = true;
- irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), R_ALPHA_GPRELLOW);
+ irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), R_ALPHA_GPREL16);
info->changed_relocs = true;
/* Reduce the use count on this got entry by one, possibly
@@ -1470,12 +1362,14 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
boolean *again;
{
Elf_Internal_Shdr *symtab_hdr;
+ Elf_Internal_Shdr *shndx_hdr;
Elf_Internal_Rela *internal_relocs;
Elf_Internal_Rela *free_relocs = NULL;
Elf_Internal_Rela *irel, *irelend;
bfd_byte *free_contents = NULL;
Elf64_External_Sym *extsyms = NULL;
Elf64_External_Sym *free_extsyms = NULL;
+ Elf_External_Sym_Shndx *shndx_buf = NULL;
struct alpha_elf_got_entry **local_got_entries;
struct alpha_relax_info info;
@@ -1556,18 +1450,33 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
/* Read this BFD's symbols if we haven't done so already. */
if (extsyms == NULL)
{
+ bfd_size_type amt;
+
if (symtab_hdr->contents != NULL)
extsyms = (Elf64_External_Sym *) symtab_hdr->contents;
else
{
- extsyms = ((Elf64_External_Sym *)
- bfd_malloc (symtab_hdr->sh_size));
+ amt = symtab_hdr->sh_info;
+ amt *= sizeof (Elf64_External_Sym);
+ extsyms = (Elf64_External_Sym *) bfd_malloc (amt);
if (extsyms == NULL)
goto error_return;
free_extsyms = extsyms;
if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0
- || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd)
- != symtab_hdr->sh_size))
+ || bfd_bread ((PTR) extsyms, amt, abfd) != amt)
+ goto error_return;
+ }
+
+ shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
+ if (shndx_hdr->sh_size != 0)
+ {
+ amt = symtab_hdr->sh_info;
+ amt *= sizeof (Elf_External_Sym_Shndx);
+ shndx_buf = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
+ if (shndx_buf == NULL)
+ goto error_return;
+ if (bfd_seek (abfd, shndx_hdr->sh_offset, SEEK_SET) != 0
+ || bfd_bread ((PTR) shndx_buf, amt, abfd) != amt)
goto error_return;
}
}
@@ -1576,19 +1485,20 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
if (ELF64_R_SYM (irel->r_info) < symtab_hdr->sh_info)
{
/* A local symbol. */
- bfd_elf64_swap_symbol_in (abfd,
- extsyms + ELF64_R_SYM (irel->r_info),
- &isym);
+ Elf64_External_Sym *esym;
+ Elf_External_Sym_Shndx *shndx;
+
+ esym = extsyms + ELF64_R_SYM (irel->r_info);
+ shndx = shndx_buf + (shndx_buf ? ELF64_R_SYM (irel->r_info) : 0);
+ bfd_elf64_swap_symbol_in (abfd, esym, shndx, &isym);
if (isym.st_shndx == SHN_UNDEF)
info.tsec = bfd_und_section_ptr;
- else if (isym.st_shndx > 0 && isym.st_shndx < SHN_LORESERVE)
- info.tsec = bfd_section_from_elf_index (abfd, isym.st_shndx);
else if (isym.st_shndx == SHN_ABS)
info.tsec = bfd_abs_section_ptr;
else if (isym.st_shndx == SHN_COMMON)
info.tsec = bfd_com_section_ptr;
else
- continue; /* who knows. */
+ info.tsec = bfd_section_from_elf_index (abfd, isym.st_shndx);
info.h = NULL;
info.other = isym.st_other;
@@ -1615,7 +1525,6 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
continue;
info.h = h;
- info.gotent = gotent;
info.tsec = h->root.root.u.def.section;
info.other = h->root.other;
gotent = h->got_entries;
@@ -1676,6 +1585,9 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
}
}
+ if (shndx_buf != NULL)
+ free (shndx_buf);
+
if (free_extsyms != NULL)
{
if (! link_info->keep_memory)
@@ -1683,7 +1595,7 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
else
{
/* Cache the symbols for elf_link_input_bfd. */
- symtab_hdr->contents = extsyms;
+ symtab_hdr->contents = (unsigned char *) extsyms;
}
}
@@ -1696,6 +1608,8 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
free (free_relocs);
if (free_contents != NULL)
free (free_contents);
+ if (shndx_buf != NULL)
+ free (shndx_buf);
if (free_extsyms != NULL)
free (free_extsyms);
return false;
@@ -1703,10 +1617,10 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
/* PLT/GOT Stuff */
#define PLT_HEADER_SIZE 32
-#define PLT_HEADER_WORD1 0xc3600000 /* br $27,.+4 */
-#define PLT_HEADER_WORD2 0xa77b000c /* ldq $27,12($27) */
-#define PLT_HEADER_WORD3 0x47ff041f /* nop */
-#define PLT_HEADER_WORD4 0x6b7b0000 /* jmp $27,($27) */
+#define PLT_HEADER_WORD1 (bfd_vma) 0xc3600000 /* br $27,.+4 */
+#define PLT_HEADER_WORD2 (bfd_vma) 0xa77b000c /* ldq $27,12($27) */
+#define PLT_HEADER_WORD3 (bfd_vma) 0x47ff041f /* nop */
+#define PLT_HEADER_WORD4 (bfd_vma) 0x6b7b0000 /* jmp $27,($27) */
#define PLT_ENTRY_SIZE 12
#define PLT_ENTRY_WORD1 0xc3800000 /* br $28, plt0 */
@@ -1741,13 +1655,6 @@ elf64_alpha_section_from_shdr (abfd, hdr, name)
if (strcmp (name, ".mdebug") != 0)
return false;
break;
-#ifdef ERIC_neverdef
- case SHT_ALPHA_REGINFO:
- if (strcmp (name, ".reginfo") != 0
- || hdr->sh_size != sizeof (Elf64_External_RegInfo))
- return false;
- break;
-#endif
default:
return false;
}
@@ -1764,22 +1671,18 @@ elf64_alpha_section_from_shdr (abfd, hdr, name)
return false;
}
-#ifdef ERIC_neverdef
- /* For a .reginfo section, set the gp value in the tdata information
- from the contents of this section. We need the gp value while
- processing relocs, so we just get it now. */
- if (hdr->sh_type == SHT_ALPHA_REGINFO)
- {
- Elf64_External_RegInfo ext;
- Elf64_RegInfo s;
+ return true;
+}
- if (! bfd_get_section_contents (abfd, newsect, (PTR) &ext,
- (file_ptr) 0, sizeof ext))
- return false;
- bfd_alpha_elf64_swap_reginfo_in (abfd, &ext, &s);
- elf_gp (abfd) = s.ri_gp_value;
- }
-#endif
+/* Convert Alpha specific section flags to bfd internal section flags. */
+
+static boolean
+elf64_alpha_section_flags (flags, hdr)
+ flagword *flags;
+ Elf64_Internal_Shdr *hdr;
+{
+ if (hdr->sh_flags & SHF_ALPHA_GPREL)
+ *flags |= SEC_SMALL_DATA;
return true;
}
@@ -1807,31 +1710,8 @@ elf64_alpha_fake_sections (abfd, hdr, sec)
else
hdr->sh_entsize = 1;
}
-#ifdef ERIC_neverdef
- else if (strcmp (name, ".reginfo") == 0)
- {
- hdr->sh_type = SHT_ALPHA_REGINFO;
- /* In a shared object on Irix 5.3, the .reginfo section has an
- entsize of 0x18. FIXME: Does this matter? */
- if ((abfd->flags & DYNAMIC) != 0)
- hdr->sh_entsize = sizeof (Elf64_External_RegInfo);
- else
- hdr->sh_entsize = 1;
-
- /* Force the section size to the correct value, even if the
- linker thinks it is larger. The link routine below will only
- write out this much data for .reginfo. */
- hdr->sh_size = sec->_raw_size = sizeof (Elf64_External_RegInfo);
- }
- else if (strcmp (name, ".hash") == 0
- || strcmp (name, ".dynamic") == 0
- || strcmp (name, ".dynstr") == 0)
- {
- hdr->sh_entsize = 0;
- hdr->sh_info = SIZEOF_ALPHA_DYNSYM_SECNAMES;
- }
-#endif
- else if (strcmp (name, ".sdata") == 0
+ else if ((sec->flags & SEC_SMALL_DATA)
+ || strcmp (name, ".sdata") == 0
|| strcmp (name, ".sbss") == 0
|| strcmp (name, ".lit4") == 0
|| strcmp (name, ".lit8") == 0)
@@ -1855,7 +1735,7 @@ elf64_alpha_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
{
if (sym->st_shndx == SHN_COMMON
&& !info->relocateable
- && sym->st_size <= bfd_get_gp_size (abfd))
+ && sym->st_size <= elf_gp_size (abfd))
{
/* Common symbols less than or equal to -G nn bytes are
automatically put into .sbss. */
@@ -2008,7 +1888,7 @@ elf64_alpha_read_ecoff_info (abfd, section, debug)
swap = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
memset (debug, 0, sizeof (*debug));
- ext_hdr = (char *) bfd_malloc ((size_t) swap->external_hdr_size);
+ ext_hdr = (char *) bfd_malloc (swap->external_hdr_size);
if (ext_hdr == NULL && swap->external_hdr_size != 0)
goto error_return;
@@ -2027,12 +1907,12 @@ elf64_alpha_read_ecoff_info (abfd, section, debug)
debug->ptr = NULL; \
else \
{ \
- debug->ptr = (type) bfd_malloc ((size_t) (size * symhdr->count)); \
+ bfd_size_type amt = (bfd_size_type) size * symhdr->count; \
+ debug->ptr = (type) bfd_malloc (amt); \
if (debug->ptr == NULL) \
goto error_return; \
if (bfd_seek (abfd, (file_ptr) symhdr->offset, SEEK_SET) != 0 \
- || (bfd_read (debug->ptr, size, symhdr->count, \
- abfd) != size * symhdr->count)) \
+ || bfd_bread (debug->ptr, amt, abfd) != amt) \
goto error_return; \
}
@@ -2145,9 +2025,9 @@ elf64_alpha_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
char *fraw_src;
char *fraw_end;
struct fdr *fdr_ptr;
+ bfd_size_type amt = sizeof (struct mips_elf_find_line);
- fi = ((struct mips_elf_find_line *)
- bfd_zalloc (abfd, sizeof (struct mips_elf_find_line)));
+ fi = (struct mips_elf_find_line *) bfd_zalloc (abfd, amt);
if (fi == NULL)
{
msec->flags = origflags;
@@ -2161,10 +2041,8 @@ elf64_alpha_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
}
/* Swap in the FDR information. */
- fi->d.fdr = ((struct fdr *)
- bfd_alloc (abfd,
- (fi->d.symbolic_header.ifdMax *
- sizeof (struct fdr))));
+ amt = fi->d.symbolic_header.ifdMax * sizeof (struct fdr);
+ fi->d.fdr = (struct fdr *) bfd_alloc (abfd, amt);
if (fi->d.fdr == NULL)
{
msec->flags = origflags;
@@ -2335,9 +2213,6 @@ elf64_alpha_output_extsym (h, data)
else
h->esym.asym.value = 0;
}
-#if 0 /* FIXME? */
- h->esym.ifd = 0;
-#endif
}
if (! bfd_ecoff_debug_one_external (einfo->abfd, einfo->debug, einfo->swap,
@@ -2379,6 +2254,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
struct alpha_elf_got_entry **local_got_entries;
const Elf_Internal_Rela *rel, *relend;
int got_created;
+ bfd_size_type amt;
if (info->relocateable)
return true;
@@ -2432,9 +2308,9 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
if (!gotent)
{
+ amt = sizeof (struct alpha_elf_got_entry);
gotent = ((struct alpha_elf_got_entry *)
- bfd_alloc (abfd,
- sizeof (struct alpha_elf_got_entry)));
+ bfd_alloc (abfd, amt));
if (!gotent)
return false;
@@ -2457,16 +2333,16 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
/* This is a local .got entry -- record for merge. */
if (!local_got_entries)
{
- size_t size;
- size = (symtab_hdr->sh_info
- * sizeof (struct alpha_elf_got_entry *));
+ bfd_size_type size;
+ size = symtab_hdr->sh_info;
+ size *= sizeof (struct alpha_elf_got_entry *);
local_got_entries = ((struct alpha_elf_got_entry **)
bfd_alloc (abfd, size));
if (!local_got_entries)
return false;
- memset (local_got_entries, 0, size);
+ memset (local_got_entries, 0, (size_t) size);
alpha_elf_tdata (abfd)->local_got_entries =
local_got_entries;
}
@@ -2477,9 +2353,9 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
continue;
if (!gotent)
{
+ amt = sizeof (struct alpha_elf_got_entry);
gotent = ((struct alpha_elf_got_entry *)
- bfd_alloc (abfd,
- sizeof (struct alpha_elf_got_entry)));
+ bfd_alloc (abfd, amt));
if (!gotent)
return false;
@@ -2534,6 +2410,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
/* FALLTHRU */
case R_ALPHA_GPDISP:
+ case R_ALPHA_GPREL16:
case R_ALPHA_GPREL32:
case R_ALPHA_GPRELHIGH:
case R_ALPHA_GPRELLOW:
@@ -2586,15 +2463,15 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
sreloc = bfd_get_section_by_name (dynobj, rel_sec_name);
if (sreloc == NULL)
{
+ flagword flags;
+
sreloc = bfd_make_section (dynobj, rel_sec_name);
+ flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED | SEC_READONLY);
+ if (sec->flags & SEC_ALLOC)
+ flags |= SEC_ALLOC | SEC_LOAD;
if (sreloc == NULL
- || !bfd_set_section_flags (dynobj, sreloc,
- ((sec->flags & (SEC_ALLOC
- | SEC_LOAD))
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
+ || !bfd_set_section_flags (dynobj, sreloc, flags)
|| !bfd_set_section_alignment (dynobj, sreloc, 3))
return false;
}
@@ -2616,15 +2493,16 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
if (!rent)
{
- rent = ((struct alpha_elf_reloc_entry *)
- bfd_alloc (abfd,
- sizeof (struct alpha_elf_reloc_entry)));
+ amt = sizeof (struct alpha_elf_reloc_entry);
+ rent = (struct alpha_elf_reloc_entry *) bfd_alloc (abfd, amt);
if (!rent)
return false;
rent->srel = sreloc;
rent->rtype = r_type;
rent->count = 1;
+ rent->reltext = ((sec->flags & (SEC_READONLY | SEC_ALLOC))
+ == (SEC_READONLY | SEC_ALLOC));
rent->next = h->reloc_entries;
h->reloc_entries = rent;
@@ -2637,6 +2515,8 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
/* If this is a shared library, and the section is to be
loaded into memory, we need a RELATIVE reloc. */
sreloc->_raw_size += sizeof (Elf64_External_Rela);
+ if (sec->flags & SEC_READONLY)
+ info->flags |= DF_TEXTREL;
}
break;
}
@@ -2666,8 +2546,7 @@ elf64_alpha_adjust_dynamic_symbol (info, h)
/* Now that we've seen all of the input symbols, finalize our decision
about whether this symbol should get a .plt entry. */
- if (h->root.type != bfd_link_hash_undefweak
- && alpha_elf_dynamic_symbol_p (h, info)
+ if (alpha_elf_dynamic_symbol_p (h, info)
&& ((h->type == STT_FUNC
&& !(ah->flags & ALPHA_ELF_LINK_HASH_LU_ADDR))
|| (h->type == STT_NOTYPE
@@ -2961,7 +2840,7 @@ elf64_alpha_merge_gots (a, b)
static boolean
elf64_alpha_calc_got_offsets_for_symbol (h, arg)
struct alpha_elf_link_hash_entry *h;
- PTR arg;
+ PTR arg ATTRIBUTE_UNUSED;
{
struct alpha_elf_got_entry *gotent;
@@ -3027,10 +2906,10 @@ elf64_alpha_calc_got_offsets (info)
static boolean
elf64_alpha_size_got_sections (output_bfd, info)
- bfd *output_bfd;
+ bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
{
- bfd *i, *got_list, *cur_got_obj;
+ bfd *i, *got_list, *cur_got_obj = NULL;
int something_changed = 0;
got_list = alpha_elf_hash_table (info)->got_list;
@@ -3053,7 +2932,7 @@ elf64_alpha_size_got_sections (output_bfd, info)
/* Yikes! A single object file has too many entries. */
(*_bfd_error_handler)
(_("%s: .got subsegment exceeds 64K (size %d)"),
- bfd_get_filename (i),
+ bfd_archive_filename (i),
alpha_elf_tdata (this_got)->total_got_entries * 8);
return false;
}
@@ -3179,6 +3058,8 @@ elf64_alpha_calc_dynrel_sizes (h, info)
{
relent->srel->_raw_size +=
sizeof (Elf64_External_Rela) * relent->count;
+ if (relent->reltext)
+ info->flags |= DT_TEXTREL;
}
dynobj = elf_hash_table(info)->dynobj;
@@ -3207,12 +3088,11 @@ elf64_alpha_calc_dynrel_sizes (h, info)
static boolean
elf64_alpha_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
+ bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
{
bfd *dynobj;
asection *s;
- boolean reltext;
boolean relplt;
dynobj = elf_hash_table(info)->dynobj;
@@ -3261,7 +3141,6 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
/* The check_relocs and adjust_dynamic_symbol entry points have
determined the sizes of the various dynamic sections. Allocate
memory for them. */
- reltext = false;
relplt = false;
for (s = dynobj->sections; s != NULL; s = s->next)
{
@@ -3291,19 +3170,6 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
if (!strip)
{
- const char *outname;
- asection *target;
-
- /* If this relocation section applies to a read only
- section, then we probably need a DT_TEXTREL entry. */
- outname = bfd_get_section_name (output_bfd,
- s->output_section);
- target = bfd_get_section_by_name (output_bfd, outname + 5);
- if (target != NULL
- && (target->flags & SEC_READONLY) != 0
- && (target->flags & SEC_ALLOC) != 0)
- reltext = true;
-
if (strcmp(name, ".rela.plt") == 0)
relplt = true;
@@ -3323,7 +3189,7 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
else
{
/* Allocate memory for the section contents. */
- s->contents = (bfd_byte *) bfd_zalloc(dynobj, s->_raw_size);
+ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
if (s->contents == NULL && s->_raw_size != 0)
return false;
}
@@ -3336,36 +3202,38 @@ elf64_alpha_size_dynamic_sections (output_bfd, info)
must add the entries now so that we get the correct size for
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
+#define add_dynamic_entry(TAG, VAL) \
+ bfd_elf64_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+
if (!info->shared)
{
- if (!bfd_elf64_add_dynamic_entry (info, DT_DEBUG, 0))
+ if (!add_dynamic_entry (DT_DEBUG, 0))
return false;
}
- if (! bfd_elf64_add_dynamic_entry (info, DT_PLTGOT, 0))
+ if (!add_dynamic_entry (DT_PLTGOT, 0))
return false;
if (relplt)
{
- if (! bfd_elf64_add_dynamic_entry (info, DT_PLTRELSZ, 0)
- || ! bfd_elf64_add_dynamic_entry (info, DT_PLTREL, DT_RELA)
- || ! bfd_elf64_add_dynamic_entry (info, DT_JMPREL, 0))
+ if (!add_dynamic_entry (DT_PLTRELSZ, 0)
+ || !add_dynamic_entry (DT_PLTREL, DT_RELA)
+ || !add_dynamic_entry (DT_JMPREL, 0))
return false;
}
- if (! bfd_elf64_add_dynamic_entry (info, DT_RELA, 0)
- || ! bfd_elf64_add_dynamic_entry (info, DT_RELASZ, 0)
- || ! bfd_elf64_add_dynamic_entry (info, DT_RELAENT,
- sizeof (Elf64_External_Rela)))
+ if (!add_dynamic_entry (DT_RELA, 0)
+ || !add_dynamic_entry (DT_RELASZ, 0)
+ || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela)))
return false;
- if (reltext)
+ if (info->flags & DF_TEXTREL)
{
- if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
+ if (!add_dynamic_entry (DT_TEXTREL, 0))
return false;
- info->flags |= DF_TEXTREL;
}
}
+#undef add_dynamic_entry
return true;
}
@@ -3390,6 +3258,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
asection *sec, *sgot, *srel, *srelgot;
bfd *dynobj, *gotobj;
bfd_vma gp;
+ boolean ret_val = true;
srelgot = srel = NULL;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
@@ -3474,9 +3343,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = (sec->output_section->vma
- + sec->output_offset
- + sym->st_value);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
}
else
{
@@ -3491,33 +3358,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
{
sec = h->root.root.u.def.section;
-#if rth_notdef
- if ((r_type == R_ALPHA_LITERAL
- && elf_hash_table(info)->dynamic_sections_created
- && (!info->shared
- || !info->symbolic
- || !(h->root.elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR)))
- || (info->shared
- && (!info->symbolic
- || !(h->root.elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR))
- && (input_section->flags & SEC_ALLOC)
- && (r_type == R_ALPHA_REFLONG
- || r_type == R_ALPHA_REFQUAD
- || r_type == R_ALPHA_LITERAL)))
- {
- /* In these cases, we don't need the relocation value.
- We check specially because in some obscure cases
- sec->output_section will be NULL. */
- relocation = 0;
- }
-#else
- /* FIXME: Are not these obscure cases simply bugs? Let's
- get something working and come back to this. */
if (sec->output_section == NULL)
relocation = 0;
-#endif /* rth_notdef */
else
{
relocation = (h->root.root.u.def.value
@@ -3527,7 +3369,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
}
else if (h->root.root.type == bfd_link_hash_undefweak)
relocation = 0;
- else if (info->shared && !info->symbolic
+ else if (info->shared
+ && (!info->symbolic || info->allow_shlib_undefined)
&& !info->no_undefined
&& ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT)
relocation = 0;
@@ -3538,7 +3381,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
input_section, rel->r_offset,
(!info->shared || info->no_undefined
|| ELF_ST_VISIBILITY (h->root.other)))))
- return false;
+ ret_val = false;
relocation = 0;
}
}
@@ -3564,13 +3407,6 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
}
break;
- case R_ALPHA_OP_PUSH:
- case R_ALPHA_OP_STORE:
- case R_ALPHA_OP_PSUB:
- case R_ALPHA_OP_PRSHIFT:
- /* We hate these silly beasts. */
- abort ();
-
case R_ALPHA_LITERAL:
{
struct alpha_elf_got_entry *gotent;
@@ -3589,6 +3425,38 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
gotent = (alpha_elf_tdata(input_bfd)->
local_got_entries[r_symndx]);
dynamic_symbol = false;
+
+ /* Need to adjust local GOT entries' addends for SEC_MERGE
+ unless it has been done already. */
+ if ((sec->flags & SEC_MERGE)
+ && ELF_ST_TYPE (sym->st_info) == STT_SECTION
+ && (elf_section_data (sec)->sec_info_type
+ == ELF_INFO_TYPE_MERGE)
+ && (gotent->flags & ALPHA_ELF_GOT_ENTRY_RELOCS_XLATED) == 0)
+ {
+ struct alpha_elf_got_entry *ent;
+ asection *msec;
+
+ for (ent = gotent; ent; ent = ent->next)
+ {
+ ent->flags |= ALPHA_ELF_GOT_ENTRY_RELOCS_XLATED;
+ if (ent->use_count == 0)
+ continue;
+ msec = sec;
+ ent->addend =
+ _bfd_merged_section_offset (output_bfd, &msec,
+ elf_section_data (sec)->
+ sec_info,
+ sym->st_value
+ + ent->addend,
+ (bfd_vma) 0);
+ ent->addend -= sym->st_value;
+ ent->addend += msec->output_section->vma
+ + msec->output_offset
+ - sec->output_section->vma
+ - sec->output_offset;
+ }
+ }
}
BFD_ASSERT(gotent != NULL);
@@ -3601,7 +3469,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
/* Initialize the .got entry's value. */
if (!(gotent->flags & ALPHA_ELF_GOT_ENTRY_RELOCS_DONE))
{
- bfd_put_64 (output_bfd, relocation+addend,
+ bfd_put_64 (output_bfd, relocation + addend,
sgot->contents + gotent->got_offset);
/* If the symbol has been forced local, output a
@@ -3617,7 +3485,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
+ sgot->output_offset
+ gotent->got_offset);
outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE);
- outrel.r_addend = 0;
+ outrel.r_addend = relocation + addend;
bfd_elf64_swap_reloca_out (output_bfd, &outrel,
((Elf64_External_Rela *)
@@ -3641,13 +3509,28 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
/* overflow handled by _bfd_final_link_relocate */
goto default_reloc;
+ case R_ALPHA_GPREL16:
case R_ALPHA_GPREL32:
case R_ALPHA_GPRELLOW:
+ if (h && alpha_elf_dynamic_symbol_p (&h->root, info))
+ {
+ (*_bfd_error_handler)
+ (_("%s: gp-relative relocation against dynamic symbol %s"),
+ bfd_archive_filename (input_bfd), h->root.root.root.string);
+ ret_val = false;
+ }
BFD_ASSERT(gp != 0);
relocation -= gp;
goto default_reloc;
case R_ALPHA_GPRELHIGH:
+ if (h && alpha_elf_dynamic_symbol_p (&h->root, info))
+ {
+ (*_bfd_error_handler)
+ (_("%s: gp-relative relocation against dynamic symbol %s"),
+ bfd_archive_filename (input_bfd), h->root.root.root.string);
+ ret_val = false;
+ }
BFD_ASSERT(gp != 0);
relocation -= gp;
relocation += addend;
@@ -3656,8 +3539,17 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
+ ((relocation >> 15) & 1));
goto default_reloc;
- case R_ALPHA_BRADDR:
case R_ALPHA_HINT:
+ /* A call to a dynamic symbol is definitely out of range of
+ the 16-bit displacement. Don't bother writing anything. */
+ if (h && alpha_elf_dynamic_symbol_p (&h->root, info))
+ {
+ r = bfd_reloc_ok;
+ break;
+ }
+ /* FALLTHRU */
+
+ case R_ALPHA_BRADDR:
/* The regular PC-relative stuff measures from the start of
the instruction rather than the end. */
addend -= 4;
@@ -3667,7 +3559,6 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
case R_ALPHA_REFQUAD:
{
Elf_Internal_Rela outrel;
- boolean skip;
/* Careful here to remember RELATIVE relocations for global
variables for symbolic shared objects. */
@@ -3679,10 +3570,12 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
outrel.r_addend = addend;
addend = 0, relocation = 0;
}
- else if (info->shared && (input_section->flags & SEC_ALLOC))
+ else if (info->shared
+ && r_symndx != 0
+ && (input_section->flags & SEC_ALLOC))
{
outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE);
- outrel.r_addend = 0;
+ outrel.r_addend = relocation + addend;
}
else
goto default_reloc;
@@ -3700,25 +3593,10 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
BFD_ASSERT(srel != NULL);
}
- skip = false;
-
- if (elf_section_data (input_section)->stab_info == NULL)
- outrel.r_offset = rel->r_offset;
- else
- {
- bfd_vma off;
-
- off = (_bfd_stab_section_offset
- (output_bfd, &elf_hash_table (info)->stab_info,
- input_section,
- &elf_section_data (input_section)->stab_info,
- rel->r_offset));
- if (off == (bfd_vma) -1)
- skip = true;
- outrel.r_offset = off;
- }
-
- if (! skip)
+ outrel.r_offset =
+ _bfd_elf_section_offset (output_bfd, info, input_section,
+ rel->r_offset);
+ if (outrel.r_offset != (bfd_vma) -1)
outrel.r_offset += (input_section->output_section->vma
+ input_section->output_offset);
else
@@ -3750,6 +3628,15 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
{
const char *name;
+ /* Don't warn if the overflow is due to pc relative reloc
+ against discarded section. Section optimization code should
+ handle it. */
+
+ if (r_symndx < symtab_hdr->sh_info
+ && sec != NULL && howto->pc_relative
+ && elf_discarded_section (sec))
+ break;
+
if (h != NULL)
name = h->root.root.root.string;
else
@@ -3764,7 +3651,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
if (! ((*info->callbacks->reloc_overflow)
(info, name, howto->name, (bfd_vma) 0,
input_bfd, input_section, rel->r_offset)))
- return false;
+ ret_val = false;
}
break;
@@ -3774,7 +3661,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
}
}
- return true;
+ return ret_val;
}
/* Finish up dynamic symbol handling. We set the contents of various
@@ -3823,7 +3710,7 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
/* Fill in the entry in the procedure linkage table. */
{
- unsigned insn1, insn2, insn3;
+ bfd_vma insn1, insn2, insn3;
insn1 = PLT_ENTRY_WORD1 | ((-(h->plt.offset + 4) >> 2) & 0x1fffff);
insn2 = PLT_ENTRY_WORD2;
@@ -3875,7 +3762,7 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
+ sgot->output_offset
+ gotent->got_offset);
outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE);
- outrel.r_addend = 0;
+ outrel.r_addend = plt_addr;
bfd_elf64_swap_reloca_out (output_bfd, &outrel,
((Elf64_External_Rela *)
@@ -4009,8 +3896,8 @@ elf64_alpha_finish_dynamic_sections (output_bfd, info)
bfd_put_32 (output_bfd, PLT_HEADER_WORD4, splt->contents + 12);
/* The next two words will be filled in by ld.so */
- bfd_put_64 (output_bfd, 0, splt->contents + 16);
- bfd_put_64 (output_bfd, 0, splt->contents + 24);
+ bfd_put_64 (output_bfd, (bfd_vma) 0, splt->contents + 16);
+ bfd_put_64 (output_bfd, (bfd_vma) 0, splt->contents + 24);
elf_section_data (splt->output_section)->this_hdr.sh_entsize =
PLT_HEADER_SIZE;
@@ -4020,9 +3907,9 @@ elf64_alpha_finish_dynamic_sections (output_bfd, info)
return true;
}
-/* We need to use a special link routine to handle the .reginfo and
- the .mdebug sections. We need to merge all instances of these
- sections together, not write them all out sequentially. */
+/* We need to use a special link routine to handle the .mdebug section.
+ We need to merge all instances of these sections together, not write
+ them all out sequentially. */
static boolean
elf64_alpha_final_link (abfd, info)
@@ -4031,96 +3918,17 @@ elf64_alpha_final_link (abfd, info)
{
asection *o;
struct bfd_link_order *p;
- asection *reginfo_sec, *mdebug_sec, *gptab_data_sec, *gptab_bss_sec;
+ asection *mdebug_sec;
struct ecoff_debug_info debug;
const struct ecoff_debug_swap *swap
= get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
HDRR *symhdr = &debug.symbolic_header;
PTR mdebug_handle = NULL;
-#if 0
- if (++ngots == 2)
- {
- (*info->callbacks->warning)
- (info, _("using multiple gp values"), (char *) NULL,
- output_bfd, (asection *) NULL, (bfd_vma) 0);
- }
-#endif
-
- /* Go through the sections and collect the .reginfo and .mdebug
- information. */
- reginfo_sec = NULL;
+ /* Go through the sections and collect the mdebug information. */
mdebug_sec = NULL;
- gptab_data_sec = NULL;
- gptab_bss_sec = NULL;
for (o = abfd->sections; o != (asection *) NULL; o = o->next)
{
-#ifdef ERIC_neverdef
- if (strcmp (o->name, ".reginfo") == 0)
- {
- memset (&reginfo, 0, sizeof reginfo);
-
- /* We have found the .reginfo section in the output file.
- Look through all the link_orders comprising it and merge
- the information together. */
- for (p = o->link_order_head;
- p != (struct bfd_link_order *) NULL;
- p = p->next)
- {
- asection *input_section;
- bfd *input_bfd;
- Elf64_External_RegInfo ext;
- Elf64_RegInfo sub;
-
- if (p->type != bfd_indirect_link_order)
- {
- if (p->type == bfd_fill_link_order)
- continue;
- abort ();
- }
-
- input_section = p->u.indirect.section;
- input_bfd = input_section->owner;
-
- /* The linker emulation code has probably clobbered the
- size to be zero bytes. */
- if (input_section->_raw_size == 0)
- input_section->_raw_size = sizeof (Elf64_External_RegInfo);
-
- if (! bfd_get_section_contents (input_bfd, input_section,
- (PTR) &ext,
- (file_ptr) 0,
- sizeof ext))
- return false;
-
- bfd_alpha_elf64_swap_reginfo_in (input_bfd, &ext, &sub);
-
- reginfo.ri_gprmask |= sub.ri_gprmask;
- reginfo.ri_cprmask[0] |= sub.ri_cprmask[0];
- reginfo.ri_cprmask[1] |= sub.ri_cprmask[1];
- reginfo.ri_cprmask[2] |= sub.ri_cprmask[2];
- reginfo.ri_cprmask[3] |= sub.ri_cprmask[3];
-
- /* ri_gp_value is set by the function
- alpha_elf_section_processing when the section is
- finally written out. */
-
- /* Hack: reset the SEC_HAS_CONTENTS flag so that
- elf_link_input_bfd ignores this section. */
- input_section->flags &=~ SEC_HAS_CONTENTS;
- }
-
- /* Force the section size to the value we want. */
- o->_raw_size = sizeof (Elf64_External_RegInfo);
-
- /* Skip this section later on (I don't think this currently
- matters, but someday it might). */
- o->link_order_head = (struct bfd_link_order *) NULL;
-
- reginfo_sec = o;
- }
-#endif
-
if (strcmp (o->name, ".mdebug") == 0)
{
struct extsym_info einfo;
@@ -4166,7 +3974,7 @@ elf64_alpha_final_link (abfd, info)
{
asection *s;
EXTR esym;
- bfd_vma last;
+ bfd_vma last = 0;
unsigned int i;
static const char * const name[] =
{
@@ -4307,31 +4115,6 @@ elf64_alpha_final_link (abfd, info)
input_section->flags &=~ SEC_HAS_CONTENTS;
}
-#ifdef ERIC_neverdef
- if (info->shared)
- {
- /* Create .rtproc section. */
- rtproc_sec = bfd_get_section_by_name (abfd, ".rtproc");
- if (rtproc_sec == NULL)
- {
- flagword flags = (SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY);
-
- rtproc_sec = bfd_make_section (abfd, ".rtproc");
- if (rtproc_sec == NULL
- || ! bfd_set_section_flags (abfd, rtproc_sec, flags)
- || ! bfd_set_section_alignment (abfd, rtproc_sec, 12))
- return false;
- }
-
- if (! alpha_elf_create_procedure_table (mdebug_handle, abfd,
- info, rtproc_sec, &debug))
- return false;
- }
-#endif
-
/* Build the external symbol information. */
einfo.abfd = abfd;
einfo.info = info;
@@ -4353,229 +4136,6 @@ elf64_alpha_final_link (abfd, info)
mdebug_sec = o;
}
-
-#ifdef ERIC_neverdef
- if (strncmp (o->name, ".gptab.", sizeof ".gptab." - 1) == 0)
- {
- const char *subname;
- unsigned int c;
- Elf64_gptab *tab;
- Elf64_External_gptab *ext_tab;
- unsigned int i;
-
- /* The .gptab.sdata and .gptab.sbss sections hold
- information describing how the small data area would
- change depending upon the -G switch. These sections
- not used in executables files. */
- if (! info->relocateable)
- {
- asection **secpp;
-
- for (p = o->link_order_head;
- p != (struct bfd_link_order *) NULL;
- p = p->next)
- {
- asection *input_section;
-
- if (p->type != bfd_indirect_link_order)
- {
- if (p->type == bfd_fill_link_order)
- continue;
- abort ();
- }
-
- input_section = p->u.indirect.section;
-
- /* Hack: reset the SEC_HAS_CONTENTS flag so that
- elf_link_input_bfd ignores this section. */
- input_section->flags &=~ SEC_HAS_CONTENTS;
- }
-
- /* Skip this section later on (I don't think this
- currently matters, but someday it might). */
- o->link_order_head = (struct bfd_link_order *) NULL;
-
- /* Really remove the section. */
- for (secpp = &abfd->sections;
- *secpp != o;
- secpp = &(*secpp)->next)
- ;
- *secpp = (*secpp)->next;
- --abfd->section_count;
-
- continue;
- }
-
- /* There is one gptab for initialized data, and one for
- uninitialized data. */
- if (strcmp (o->name, ".gptab.sdata") == 0)
- gptab_data_sec = o;
- else if (strcmp (o->name, ".gptab.sbss") == 0)
- gptab_bss_sec = o;
- else
- {
- (*_bfd_error_handler)
- (_("%s: illegal section name `%s'"),
- bfd_get_filename (abfd), o->name);
- bfd_set_error (bfd_error_nonrepresentable_section);
- return false;
- }
-
- /* The linker script always combines .gptab.data and
- .gptab.sdata into .gptab.sdata, and likewise for
- .gptab.bss and .gptab.sbss. It is possible that there is
- no .sdata or .sbss section in the output file, in which
- case we must change the name of the output section. */
- subname = o->name + sizeof ".gptab" - 1;
- if (bfd_get_section_by_name (abfd, subname) == NULL)
- {
- if (o == gptab_data_sec)
- o->name = ".gptab.data";
- else
- o->name = ".gptab.bss";
- subname = o->name + sizeof ".gptab" - 1;
- BFD_ASSERT (bfd_get_section_by_name (abfd, subname) != NULL);
- }
-
- /* Set up the first entry. */
- c = 1;
- tab = (Elf64_gptab *) bfd_malloc (c * sizeof (Elf64_gptab));
- if (tab == NULL)
- return false;
- tab[0].gt_header.gt_current_g_value = elf_gp_size (abfd);
- tab[0].gt_header.gt_unused = 0;
-
- /* Combine the input sections. */
- for (p = o->link_order_head;
- p != (struct bfd_link_order *) NULL;
- p = p->next)
- {
- asection *input_section;
- bfd *input_bfd;
- bfd_size_type size;
- unsigned long last;
- bfd_size_type gpentry;
-
- if (p->type != bfd_indirect_link_order)
- {
- if (p->type == bfd_fill_link_order)
- continue;
- abort ();
- }
-
- input_section = p->u.indirect.section;
- input_bfd = input_section->owner;
-
- /* Combine the gptab entries for this input section one
- by one. We know that the input gptab entries are
- sorted by ascending -G value. */
- size = bfd_section_size (input_bfd, input_section);
- last = 0;
- for (gpentry = sizeof (Elf64_External_gptab);
- gpentry < size;
- gpentry += sizeof (Elf64_External_gptab))
- {
- Elf64_External_gptab ext_gptab;
- Elf64_gptab int_gptab;
- unsigned long val;
- unsigned long add;
- boolean exact;
- unsigned int look;
-
- if (! (bfd_get_section_contents
- (input_bfd, input_section, (PTR) &ext_gptab,
- gpentry, sizeof (Elf64_External_gptab))))
- {
- free (tab);
- return false;
- }
-
- bfd_alpha_elf64_swap_gptab_in (input_bfd, &ext_gptab,
- &int_gptab);
- val = int_gptab.gt_entry.gt_g_value;
- add = int_gptab.gt_entry.gt_bytes - last;
-
- exact = false;
- for (look = 1; look < c; look++)
- {
- if (tab[look].gt_entry.gt_g_value >= val)
- tab[look].gt_entry.gt_bytes += add;
-
- if (tab[look].gt_entry.gt_g_value == val)
- exact = true;
- }
-
- if (! exact)
- {
- Elf64_gptab *new_tab;
- unsigned int max;
-
- /* We need a new table entry. */
- new_tab = ((Elf64_gptab *)
- bfd_realloc ((PTR) tab,
- (c + 1) * sizeof (Elf64_gptab)));
- if (new_tab == NULL)
- {
- free (tab);
- return false;
- }
- tab = new_tab;
- tab[c].gt_entry.gt_g_value = val;
- tab[c].gt_entry.gt_bytes = add;
-
- /* Merge in the size for the next smallest -G
- value, since that will be implied by this new
- value. */
- max = 0;
- for (look = 1; look < c; look++)
- {
- if (tab[look].gt_entry.gt_g_value < val
- && (max == 0
- || (tab[look].gt_entry.gt_g_value
- > tab[max].gt_entry.gt_g_value)))
- max = look;
- }
- if (max != 0)
- tab[c].gt_entry.gt_bytes +=
- tab[max].gt_entry.gt_bytes;
-
- ++c;
- }
-
- last = int_gptab.gt_entry.gt_bytes;
- }
-
- /* Hack: reset the SEC_HAS_CONTENTS flag so that
- elf_link_input_bfd ignores this section. */
- input_section->flags &=~ SEC_HAS_CONTENTS;
- }
-
- /* The table must be sorted by -G value. */
- if (c > 2)
- qsort (tab + 1, c - 1, sizeof (tab[0]), gptab_compare);
-
- /* Swap out the table. */
- ext_tab = ((Elf64_External_gptab *)
- bfd_alloc (abfd, c * sizeof (Elf64_External_gptab)));
- if (ext_tab == NULL)
- {
- free (tab);
- return false;
- }
-
- for (i = 0; i < c; i++)
- bfd_alpha_elf64_swap_gptab_out (abfd, tab + i, ext_tab + i);
- free (tab);
-
- o->_raw_size = c * sizeof (Elf64_External_gptab);
- o->contents = (bfd_byte *) ext_tab;
-
- /* Skip this section later on (I don't think this currently
- matters, but someday it might). */
- o->link_order_head = (struct bfd_link_order *) NULL;
- }
-#endif
-
}
/* Invoke the regular ELF backend linker to do all the work. */
@@ -4599,24 +4159,13 @@ elf64_alpha_final_link (abfd, info)
sgot = alpha_elf_tdata(i)->got;
if (! bfd_set_section_contents (abfd, sgot->output_section,
- sgot->contents, sgot->output_offset,
+ sgot->contents,
+ (file_ptr) sgot->output_offset,
sgot->_raw_size))
return false;
}
}
-#ifdef ERIC_neverdef
- if (reginfo_sec != (asection *) NULL)
- {
- Elf64_External_RegInfo ext;
-
- bfd_alpha_elf64_swap_reginfo_out (abfd, &reginfo, &ext);
- if (! bfd_set_section_contents (abfd, reginfo_sec, (PTR) &ext,
- (file_ptr) 0, sizeof ext))
- return false;
- }
-#endif
-
if (mdebug_sec != (asection *) NULL)
{
BFD_ASSERT (abfd->output_has_begun);
@@ -4628,25 +4177,24 @@ elf64_alpha_final_link (abfd, info)
bfd_ecoff_debug_free (mdebug_handle, abfd, &debug, swap, info);
}
- if (gptab_data_sec != (asection *) NULL)
- {
- if (! bfd_set_section_contents (abfd, gptab_data_sec,
- gptab_data_sec->contents,
- (file_ptr) 0,
- gptab_data_sec->_raw_size))
- return false;
- }
+ return true;
+}
- if (gptab_bss_sec != (asection *) NULL)
+static enum elf_reloc_type_class
+elf64_alpha_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
+{
+ switch ((int) ELF64_R_TYPE (rela->r_info))
{
- if (! bfd_set_section_contents (abfd, gptab_bss_sec,
- gptab_bss_sec->contents,
- (file_ptr) 0,
- gptab_bss_sec->_raw_size))
- return false;
+ case R_ALPHA_RELATIVE:
+ return reloc_class_relative;
+ case R_ALPHA_JMP_SLOT:
+ return reloc_class_plt;
+ case R_ALPHA_COPY:
+ return reloc_class_copy;
+ default:
+ return reloc_class_normal;
}
-
- return true;
}
/* ECOFF swapping routines. These are used when dealing with the
@@ -4745,6 +4293,8 @@ const struct elf_size_info alpha_elf_size_info =
#define elf_backend_section_from_shdr \
elf64_alpha_section_from_shdr
+#define elf_backend_section_flags \
+ elf64_alpha_section_flags
#define elf_backend_fake_sections \
elf64_alpha_fake_sections
@@ -4775,6 +4325,8 @@ const struct elf_size_info alpha_elf_size_info =
elf64_alpha_finish_dynamic_sections
#define bfd_elf64_bfd_final_link \
elf64_alpha_final_link
+#define elf_backend_reloc_type_class \
+ elf64_alpha_reloc_type_class
#define elf_backend_ecoff_debug_swap \
&elf64_alpha_ecoff_debug_swap
diff --git a/contrib/binutils/bfd/elf64-gen.c b/contrib/binutils/bfd/elf64-gen.c
index db68a07..a58f6ac 100644
--- a/contrib/binutils/bfd/elf64-gen.c
+++ b/contrib/binutils/bfd/elf64-gen.c
@@ -40,6 +40,13 @@ static reloc_howto_type dummy =
0, /* dst_mask */
false); /* pcrel_offset */
+static void elf_generic_info_to_howto
+ PARAMS ((bfd *, arelent *, Elf64_Internal_Rela *));
+static void elf_generic_info_to_howto_rel
+ PARAMS ((bfd *, arelent *, Elf64_Internal_Rel *));
+static boolean elf64_generic_link_add_symbols
+ PARAMS ((bfd *, struct bfd_link_info *));
+
static void
elf_generic_info_to_howto (abfd, bfd_reloc, elf_reloc)
bfd *abfd ATTRIBUTE_UNUSED;
@@ -72,15 +79,9 @@ elf64_generic_link_add_symbols (abfd, info)
Elf_Internal_Ehdr *ehdrp;
ehdrp = elf_elfheader (abfd);
- if (abfd->my_archive)
- (*_bfd_error_handler) (_("%s(%s): Relocations in generic ELF (EM: %d)"),
- bfd_get_filename (abfd->my_archive),
- bfd_get_filename (abfd),
- ehdrp->e_machine);
- else
- (*_bfd_error_handler) (_("%s: Relocations in generic ELF (EM: %d)"),
- bfd_get_filename (abfd),
- ehdrp->e_machine);
+ (*_bfd_error_handler) (_("%s: Relocations in generic ELF (EM: %d)"),
+ bfd_archive_filename (abfd),
+ ehdrp->e_machine);
bfd_set_error (bfd_error_wrong_format);
return false;
diff --git a/contrib/binutils/bfd/elf64-ppc.c b/contrib/binutils/bfd/elf64-ppc.c
new file mode 100644
index 0000000..da339bb
--- /dev/null
+++ b/contrib/binutils/bfd/elf64-ppc.c
@@ -0,0 +1,4463 @@
+/* PowerPC64-specific support for 64-bit ELF.
+ Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Written by Linus Nordberg, Swox AB <info@swox.com>,
+ based on elf32-ppc.c by Ian Lance Taylor.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* This file is based on the 64-bit PowerPC ELF ABI. It is also based
+ on the file elf32-ppc.c. */
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "bfdlink.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "elf/ppc.h"
+#include "elf64-ppc.h"
+
+#define USE_RELA /* we want RELA relocations, not REL. */
+
+
+static void ppc_howto_init
+ PARAMS ((void));
+static reloc_howto_type *ppc64_elf_reloc_type_lookup
+ PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
+static void ppc64_elf_info_to_howto
+ PARAMS ((bfd *abfd, arelent *cache_ptr, Elf64_Internal_Rela *dst));
+static bfd_reloc_status_type ppc64_elf_addr16_ha_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static boolean ppc64_elf_set_private_flags
+ PARAMS ((bfd *, flagword));
+static boolean ppc64_elf_merge_private_bfd_data
+ PARAMS ((bfd *, bfd *));
+static boolean ppc64_elf_section_from_shdr
+ PARAMS ((bfd *, Elf64_Internal_Shdr *, char *));
+static struct bfd_hash_entry *link_hash_newfunc
+ PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+static struct bfd_link_hash_table *ppc64_elf_link_hash_table_create
+ PARAMS ((bfd *));
+static boolean create_got_section
+ PARAMS ((bfd *, struct bfd_link_info *));
+static boolean ppc64_elf_create_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
+static void ppc64_elf_copy_indirect_symbol
+ PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
+static boolean ppc64_elf_check_relocs
+ PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ const Elf_Internal_Rela *));
+static asection * ppc64_elf_gc_mark_hook
+ PARAMS ((bfd *abfd, struct bfd_link_info *info, Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h, Elf_Internal_Sym *sym));
+static boolean ppc64_elf_gc_sweep_hook
+ PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *sec,
+ const Elf_Internal_Rela *relocs));
+static boolean func_desc_adjust
+ PARAMS ((struct elf_link_hash_entry *, PTR));
+static boolean ppc64_elf_func_desc_adjust
+ PARAMS ((bfd *, struct bfd_link_info *));
+static boolean ppc64_elf_adjust_dynamic_symbol
+ PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
+static void ppc64_elf_hide_symbol
+ PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
+static boolean allocate_dynrelocs
+ PARAMS ((struct elf_link_hash_entry *, PTR));
+static boolean readonly_dynrelocs
+ PARAMS ((struct elf_link_hash_entry *, PTR));
+static enum elf_reloc_type_class ppc64_elf_reloc_type_class
+ PARAMS ((const Elf_Internal_Rela *));
+static boolean ppc64_elf_size_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
+static bfd_byte *build_plt_stub
+ PARAMS ((bfd *, bfd_byte *, int, int));
+static boolean build_one_stub
+ PARAMS ((struct elf_link_hash_entry *, PTR));
+static boolean ppc64_elf_fake_sections
+ PARAMS ((bfd *, Elf64_Internal_Shdr *, asection *));
+static boolean ppc64_elf_relocate_section
+ PARAMS ((bfd *, struct bfd_link_info *info, bfd *, asection *, bfd_byte *,
+ Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms,
+ asection **));
+static boolean ppc64_elf_finish_dynamic_symbol
+ PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
+ Elf_Internal_Sym *));
+static boolean ppc64_elf_finish_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
+
+
+/* Mask to set RA in memory instructions. */
+#define RA_REGISTER_MASK 0x001f0000
+
+/* Value to shift register by to insert RA. */
+#define RA_REGISTER_SHIFT 16
+
+/* The name of the dynamic interpreter. This is put in the .interp
+ section. */
+#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
+
+/* The size in bytes of an entry in the procedure linkage table. */
+#define PLT_ENTRY_SIZE 24
+
+/* The initial size of the plt reserved for the dynamic linker. */
+#define PLT_INITIAL_ENTRY_SIZE PLT_ENTRY_SIZE
+
+/* TOC base pointers offset from start of TOC. */
+#define TOC_BASE_OFF (0x8000)
+
+/* .plt call stub instructions. */
+#define ADDIS_R12_R2 0x3d820000 /* addis %r12,%r2,xxx@ha */
+#define STD_R2_40R1 0xf8410028 /* std %r2,40(%r1) */
+#define LD_R11_0R12 0xe96c0000 /* ld %r11,xxx+0@l(%r12) */
+#define LD_R2_0R12 0xe84c0000 /* ld %r2,xxx+8@l(%r12) */
+#define MTCTR_R11 0x7d6903a6 /* mtctr %r11 */
+ /* ld %r11,xxx+16@l(%r12) */
+#define BCTR 0x4e800420 /* bctr */
+
+/* The normal stub is this size. */
+#define PLT_CALL_STUB_SIZE (7*4)
+
+/* But sometimes the .plt entry crosses a 64k boundary, and we need
+ to adjust the high word with this insn. */
+#define ADDIS_R12_R12_1 0x3d8c0001 /* addis %r12,%r12,1 */
+
+/* The .glink fixup call stub is the same as the .plt call stub, but
+ the first instruction restores r2, and the std is omitted. */
+#define LD_R2_40R1 0xe8410028 /* ld %r2,40(%r1) */
+
+/* Always allow this much space. */
+#define GLINK_CALL_STUB_SIZE (8*4)
+
+/* Pad with this. */
+#define NOP 0x60000000
+
+/* .glink entries for the first 32k functions are two instructions. */
+#define LI_R0_0 0x38000000 /* li %r0,0 */
+#define B_DOT 0x48000000 /* b . */
+
+/* After that, we need two instructions to load the index, followed by
+ a branch. */
+#define LIS_R0_0 0x3c000000 /* lis %r0,0 */
+#define ORI_R0_R0_0 0x60000000 /* ori %r0,%r0,0 */
+
+/* Since .opd is an array of descriptors and each entry will end up
+ with identical R_PPC64_RELATIVE relocs, there is really no need to
+ propagate .opd relocs; The dynamic linker should be taught to
+ relocate .opd without reloc entries. FIXME: the dynamic linker
+ will need to know where and how large .opd is via a couple of new
+ DT_PPC64_* tags, or perhaps just with one reloc that specifies the
+ start of .opd via its offset and the size via its addend. Also,
+ .opd should be trimmed of unused values. */
+#ifndef NO_OPD_RELOCS
+#define NO_OPD_RELOCS 0
+#endif
+
+/* Relocation HOWTO's. */
+static reloc_howto_type *ppc64_elf_howto_table[(int) R_PPC_max];
+
+static reloc_howto_type ppc64_elf_howto_raw[] = {
+ /* This reloc does nothing. */
+ HOWTO (R_PPC64_NONE, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_NONE", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* A standard 32 bit relocation. */
+ HOWTO (R_PPC64_ADDR32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_ADDR32", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* An absolute 26 bit branch; the lower two bits must be zero.
+ FIXME: we don't check that, we just clear them. */
+ HOWTO (R_PPC64_ADDR24, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 26, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_ADDR24", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* A standard 16 bit relocation. */
+ HOWTO (R_PPC64_ADDR16, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_ADDR16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* A 16 bit relocation without overflow. */
+ HOWTO (R_PPC64_ADDR16_LO, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_ADDR16_LO", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Bits 16-31 of an address. */
+ HOWTO (R_PPC64_ADDR16_HI, /* type */
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_ADDR16_HI", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Bits 16-31 of an address, plus 1 if the contents of the low 16
+ bits, treated as a signed number, is negative. */
+ HOWTO (R_PPC64_ADDR16_HA, /* type */
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_addr16_ha_reloc, /* special_function */
+ "R_PPC64_ADDR16_HA", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* An absolute 16 bit branch; the lower two bits must be zero.
+ FIXME: we don't check that, we just clear them. */
+ HOWTO (R_PPC64_ADDR14, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_ADDR14", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* An absolute 16 bit branch, for which bit 10 should be set to
+ indicate that the branch is expected to be taken. The lower two
+ bits must be zero. */
+ HOWTO (R_PPC64_ADDR14_BRTAKEN, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_ADDR14_BRTAKEN",/* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* An absolute 16 bit branch, for which bit 10 should be set to
+ indicate that the branch is not expected to be taken. The lower
+ two bits must be zero. */
+ HOWTO (R_PPC64_ADDR14_BRNTAKEN, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_ADDR14_BRNTAKEN",/* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* A relative 26 bit branch; the lower two bits must be zero. */
+ HOWTO (R_PPC64_REL24, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 26, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_REL24", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0x3fffffc, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* A relative 16 bit branch; the lower two bits must be zero. */
+ HOWTO (R_PPC64_REL14, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_REL14", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* A relative 16 bit branch. Bit 10 should be set to indicate that
+ the branch is expected to be taken. The lower two bits must be
+ zero. */
+ HOWTO (R_PPC64_REL14_BRTAKEN, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_REL14_BRTAKEN", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* A relative 16 bit branch. Bit 10 should be set to indicate that
+ the branch is not expected to be taken. The lower two bits must
+ be zero. */
+ HOWTO (R_PPC64_REL14_BRNTAKEN, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_REL14_BRNTAKEN",/* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* Like R_PPC64_ADDR16, but referring to the GOT table entry for the
+ symbol. */
+ HOWTO (R_PPC64_GOT16, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_GOT16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_ADDR16_LO, but referring to the GOT table entry for
+ the symbol. */
+ HOWTO (R_PPC64_GOT16_LO, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_GOT16_LO", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_ADDR16_HI, but referring to the GOT table entry for
+ the symbol. */
+ HOWTO (R_PPC64_GOT16_HI, /* type */
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_GOT16_HI", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_ADDR16_HA, but referring to the GOT table entry for
+ the symbol. */
+ HOWTO (R_PPC64_GOT16_HA, /* type */
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ ppc64_elf_addr16_ha_reloc, /* special_function */
+ "R_PPC64_GOT16_HA", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* This is used only by the dynamic linker. The symbol should exist
+ both in the object being run and in some shared library. The
+ dynamic linker copies the data addressed by the symbol from the
+ shared library into the object, because the object being
+ run has to have the data at some particular address. */
+ HOWTO (R_PPC64_COPY, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_COPY", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_ADDR64, but used when setting global offset table
+ entries. */
+ HOWTO (R_PPC64_GLOB_DAT, /* type */
+ 0, /* rightshift */
+ 4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_GLOB_DAT", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffffffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Created by the link editor. Marks a procedure linkage table
+ entry for a symbol. */
+ HOWTO (R_PPC64_JMP_SLOT, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_JMP_SLOT", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Used only by the dynamic linker. When the object is run, this
+ doubleword64 is set to the load address of the object, plus the
+ addend. */
+ HOWTO (R_PPC64_RELATIVE, /* type */
+ 0, /* rightshift */
+ 4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_RELATIVE", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffffffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_ADDR32, but may be unaligned. */
+ HOWTO (R_PPC64_UADDR32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_UADDR32", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_ADDR16, but may be unaligned. */
+ HOWTO (R_PPC64_UADDR16, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_UADDR16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 32-bit PC relative. */
+ HOWTO (R_PPC64_REL32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ /* FIXME: Verify. Was complain_overflow_bitfield. */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_REL32", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* 32-bit relocation to the symbol's procedure linkage table. */
+ HOWTO (R_PPC64_PLT32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_PLT32", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 32-bit PC relative relocation to the symbol's procedure linkage table.
+ FIXME: R_PPC64_PLTREL32 not supported. */
+ HOWTO (R_PPC64_PLTREL32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_PLTREL32", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* Like R_PPC64_ADDR16_LO, but referring to the PLT table entry for
+ the symbol. */
+ HOWTO (R_PPC64_PLT16_LO, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_PLT16_LO", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_ADDR16_HI, but referring to the PLT table entry for
+ the symbol. */
+ HOWTO (R_PPC64_PLT16_HI, /* type */
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_PLT16_HI", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_ADDR16_HA, but referring to the PLT table entry for
+ the symbol. */
+ HOWTO (R_PPC64_PLT16_HA, /* type */
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_addr16_ha_reloc, /* special_function */
+ "R_PPC64_PLT16_HA", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 32-bit section relative relocation. */
+ /* FIXME: Verify R_PPC64_SECTOFF. Seems strange with size=2 and
+ dst_mask=0. */
+ HOWTO (R_PPC64_SECTOFF, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_SECTOFF", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* 16-bit lower half section relative relocation. */
+ HOWTO (R_PPC64_SECTOFF_LO, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_SECTOFF_LO", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 16-bit upper half section relative relocation. */
+ HOWTO (R_PPC64_SECTOFF_HI, /* type */
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_SECTOFF_HI", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 16-bit upper half adjusted section relative relocation. */
+ HOWTO (R_PPC64_SECTOFF_HA, /* type */
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_addr16_ha_reloc, /* special_function */
+ "R_PPC64_SECTOFF_HA", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_REL24 without touching the two least significant
+ bits. */
+ /* FIXME: Verify R_PPC64_ADDR30. */
+ HOWTO (R_PPC64_ADDR30, /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 30, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_ADDR30", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffffffc, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* Relocs in the 64-bit PowerPC ELF ABI, not in the 32-bit ABI. */
+
+ /* A standard 64-bit relocation. */
+ HOWTO (R_PPC64_ADDR64, /* type */
+ 0, /* rightshift */
+ 4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_ADDR64", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffffffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* The bits 32-47 of an address. */
+ HOWTO (R_PPC64_ADDR16_HIGHER, /* type */
+ 32, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_ADDR16_HIGHER", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* The bits 32-47 of an address, plus 1 if the contents of the low
+ 16 bits, treated as a signed number, is negative. */
+ HOWTO (R_PPC64_ADDR16_HIGHERA, /* type */
+ 32, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_addr16_ha_reloc, /* special_function */
+ "R_PPC64_ADDR16_HIGHERA", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* The bits 48-63 of an address. */
+ HOWTO (R_PPC64_ADDR16_HIGHEST,/* type */
+ 48, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_ADDR16_HIGHEST", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* The bits 48-63 of an address, plus 1 if the contents of the low
+ 16 bits, treated as a signed number, is negative. */
+ HOWTO (R_PPC64_ADDR16_HIGHESTA,/* type */
+ 48, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_addr16_ha_reloc, /* special_function */
+ "R_PPC64_ADDR16_HIGHESTA", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like ADDR64, but may be unaligned. */
+ HOWTO (R_PPC64_UADDR64, /* type */
+ 0, /* rightshift */
+ 4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_UADDR64", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffffffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 64-bit relative relocation. */
+ HOWTO (R_PPC64_REL64, /* type */
+ 0, /* rightshift */
+ 4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
+ 64, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_REL64", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffffffffffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* 64-bit relocation to the symbol's procedure linkage table. */
+ HOWTO (R_PPC64_PLT64, /* type */
+ 0, /* rightshift */
+ 4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_PLT64", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 64-bit PC relative relocation to the symbol's procedure linkage
+ table. */
+ /* FIXME: R_PPC64_PLTREL64 not supported. */
+ HOWTO (R_PPC64_PLTREL64, /* type */
+ 0, /* rightshift */
+ 4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
+ 64, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_PLTREL64", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* 16 bit TOC-relative relocation. */
+
+ /* R_PPC64_TOC16 47 half16* S + A - .TOC. */
+ HOWTO (R_PPC64_TOC16, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_TOC16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 16 bit TOC-relative relocation without overflow. */
+
+ /* R_PPC64_TOC16_LO 48 half16 #lo (S + A - .TOC.) */
+ HOWTO (R_PPC64_TOC16_LO, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_TOC16_LO", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 16 bit TOC-relative relocation, high 16 bits. */
+
+ /* R_PPC64_TOC16_HI 49 half16 #hi (S + A - .TOC.) */
+ HOWTO (R_PPC64_TOC16_HI, /* type */
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_TOC16_HI", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 16 bit TOC-relative relocation, high 16 bits, plus 1 if the
+ contents of the low 16 bits, treated as a signed number, is
+ negative. */
+
+ /* R_PPC64_TOC16_HA 50 half16 #ha (S + A - .TOC.) */
+ HOWTO (R_PPC64_TOC16_HA, /* type */
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ ppc64_elf_addr16_ha_reloc, /* special_function */
+ "R_PPC64_TOC16_HA", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 64-bit relocation; insert value of TOC base (.TOC.). */
+
+ /* R_PPC64_TOC 51 doubleword64 .TOC. */
+ HOWTO (R_PPC64_TOC, /* type */
+ 0, /* rightshift */
+ 4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_TOC", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffffffffffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_GOT16, but also informs the link editor that the
+ value to relocate may (!) refer to a PLT entry which the link
+ editor (a) may replace with the symbol value. If the link editor
+ is unable to fully resolve the symbol, it may (b) create a PLT
+ entry and store the address to the new PLT entry in the GOT.
+ This permits lazy resolution of function symbols at run time.
+ The link editor may also skip all of this and just (c) emit a
+ R_PPC64_GLOB_DAT to tie the symbol to the GOT entry. */
+ /* FIXME: R_PPC64_PLTGOT16 not implemented. */
+ HOWTO (R_PPC64_PLTGOT16, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_PLTGOT16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_PLTGOT16, but without overflow. */
+ /* FIXME: R_PPC64_PLTGOT16_LO not implemented. */
+ HOWTO (R_PPC64_PLTGOT16_LO, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_PLTGOT16_LO", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_PLT_GOT16, but using bits 16-31 of the address. */
+ /* FIXME: R_PPC64_PLTGOT16_HI not implemented. */
+ HOWTO (R_PPC64_PLTGOT16_HI, /* type */
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_PLTGOT16_HI", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_PLT_GOT16, but using bits 16-31 of the address, plus
+ 1 if the contents of the low 16 bits, treated as a signed number,
+ is negative. */
+ /* FIXME: R_PPC64_PLTGOT16_HA not implemented. */
+ HOWTO (R_PPC64_PLTGOT16_HA, /* type */
+ 16, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ ppc64_elf_addr16_ha_reloc, /* special_function */
+ "R_PPC64_PLTGOT16_HA", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_ADDR16, but for instructions with a DS field. */
+ HOWTO (R_PPC64_ADDR16_DS, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_ADDR16_DS", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_ADDR16_LO, but for instructions with a DS field. */
+ HOWTO (R_PPC64_ADDR16_LO_DS, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_ADDR16_LO_DS",/* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_GOT16, but for instructions with a DS field. */
+ HOWTO (R_PPC64_GOT16_DS, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_GOT16_DS", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_GOT16_LO, but for instructions with a DS field. */
+ HOWTO (R_PPC64_GOT16_LO_DS, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_GOT16_LO_DS", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_PLT16_LO, but for instructions with a DS field. */
+ HOWTO (R_PPC64_PLT16_LO_DS, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_PLT16_LO_DS", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_SECTOFF, but for instructions with a DS field. */
+ /* FIXME: Verify R_PPC64_SECTOFF. Seems strange with size=2 and
+ dst_mask=0. */
+ HOWTO (R_PPC64_SECTOFF_DS, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_SECTOFF_DS", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* Like R_PPC64_SECTOFF_LO, but for instructions with a DS field. */
+ HOWTO (R_PPC64_SECTOFF_LO_DS, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_SECTOFF_LO_DS",/* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_TOC16, but for instructions with a DS field. */
+ HOWTO (R_PPC64_TOC16_DS, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_TOC16_DS", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_TOC16_LO, but for instructions with a DS field. */
+ HOWTO (R_PPC64_TOC16_LO_DS, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_TOC16_LO_DS", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_PLTGOT16, but for instructions with a DS field. */
+ /* FIXME: R_PPC64_PLTGOT16_DS not implemented. */
+ HOWTO (R_PPC64_PLTGOT16_DS, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_PLTGOT16_DS", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Like R_PPC64_PLTGOT16_LO, but for instructions with a DS field. */
+ /* FIXME: R_PPC64_PLTGOT16_LO not implemented. */
+ HOWTO (R_PPC64_PLTGOT16_LO_DS,/* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_PPC64_PLTGOT16_LO_DS",/* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xfffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* GNU extension to record C++ vtable hierarchy. */
+ HOWTO (R_PPC64_GNU_VTINHERIT, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ NULL, /* special_function */
+ "R_PPC64_GNU_VTINHERIT", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* GNU extension to record C++ vtable member usage. */
+ HOWTO (R_PPC64_GNU_VTENTRY, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ NULL, /* special_function */
+ "R_PPC64_GNU_VTENTRY", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+};
+
+
+/* Initialize the ppc64_elf_howto_table, so that linear accesses can
+ be done. */
+
+static void
+ppc_howto_init ()
+{
+ unsigned int i, type;
+
+ for (i = 0;
+ i < sizeof (ppc64_elf_howto_raw) / sizeof (ppc64_elf_howto_raw[0]);
+ i++)
+ {
+ type = ppc64_elf_howto_raw[i].type;
+ BFD_ASSERT (type < (sizeof (ppc64_elf_howto_table)
+ / sizeof (ppc64_elf_howto_table[0])));
+ ppc64_elf_howto_table[type] = &ppc64_elf_howto_raw[i];
+ }
+}
+
+static reloc_howto_type *
+ppc64_elf_reloc_type_lookup (abfd, code)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ bfd_reloc_code_real_type code;
+{
+ enum elf_ppc_reloc_type ppc_reloc = R_PPC_NONE;
+
+ if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
+ /* Initialize howto table if needed. */
+ ppc_howto_init ();
+
+ switch ((int) code)
+ {
+ default:
+ return (reloc_howto_type *) NULL;
+
+ case BFD_RELOC_NONE: ppc_reloc = R_PPC64_NONE;
+ break;
+ case BFD_RELOC_32: ppc_reloc = R_PPC64_ADDR32;
+ break;
+ case BFD_RELOC_PPC_BA26: ppc_reloc = R_PPC64_ADDR24;
+ break;
+ case BFD_RELOC_16: ppc_reloc = R_PPC64_ADDR16;
+ break;
+ case BFD_RELOC_LO16: ppc_reloc = R_PPC64_ADDR16_LO;
+ break;
+ case BFD_RELOC_HI16: ppc_reloc = R_PPC64_ADDR16_HI;
+ break;
+ case BFD_RELOC_HI16_S: ppc_reloc = R_PPC64_ADDR16_HA;
+ break;
+ case BFD_RELOC_PPC_BA16: ppc_reloc = R_PPC64_ADDR14;
+ break;
+ case BFD_RELOC_PPC_BA16_BRTAKEN: ppc_reloc = R_PPC64_ADDR14_BRTAKEN;
+ break;
+ case BFD_RELOC_PPC_BA16_BRNTAKEN: ppc_reloc = R_PPC64_ADDR14_BRNTAKEN;
+ break;
+ case BFD_RELOC_PPC_B26: ppc_reloc = R_PPC64_REL24;
+ break;
+ case BFD_RELOC_PPC_B16: ppc_reloc = R_PPC64_REL14;
+ break;
+ case BFD_RELOC_PPC_B16_BRTAKEN: ppc_reloc = R_PPC64_REL14_BRTAKEN;
+ break;
+ case BFD_RELOC_PPC_B16_BRNTAKEN: ppc_reloc = R_PPC64_REL14_BRNTAKEN;
+ break;
+ case BFD_RELOC_16_GOTOFF: ppc_reloc = R_PPC64_GOT16;
+ break;
+ case BFD_RELOC_LO16_GOTOFF: ppc_reloc = R_PPC64_GOT16_LO;
+ break;
+ case BFD_RELOC_HI16_GOTOFF: ppc_reloc = R_PPC64_GOT16_HI;
+ break;
+ case BFD_RELOC_HI16_S_GOTOFF: ppc_reloc = R_PPC64_GOT16_HA;
+ break;
+ case BFD_RELOC_PPC_COPY: ppc_reloc = R_PPC64_COPY;
+ break;
+ case BFD_RELOC_PPC_GLOB_DAT: ppc_reloc = R_PPC64_GLOB_DAT;
+ break;
+ case BFD_RELOC_32_PCREL: ppc_reloc = R_PPC64_REL32;
+ break;
+ case BFD_RELOC_32_PLTOFF: ppc_reloc = R_PPC64_PLT32;
+ break;
+ case BFD_RELOC_32_PLT_PCREL: ppc_reloc = R_PPC64_PLTREL32;
+ break;
+ case BFD_RELOC_LO16_PLTOFF: ppc_reloc = R_PPC64_PLT16_LO;
+ break;
+ case BFD_RELOC_HI16_PLTOFF: ppc_reloc = R_PPC64_PLT16_HI;
+ break;
+ case BFD_RELOC_HI16_S_PLTOFF: ppc_reloc = R_PPC64_PLT16_HA;
+ break;
+ case BFD_RELOC_32_BASEREL: ppc_reloc = R_PPC64_SECTOFF;
+ break;
+ case BFD_RELOC_LO16_BASEREL: ppc_reloc = R_PPC64_SECTOFF_LO;
+ break;
+ case BFD_RELOC_HI16_BASEREL: ppc_reloc = R_PPC64_SECTOFF_HI;
+ break;
+ case BFD_RELOC_HI16_S_BASEREL: ppc_reloc = R_PPC64_SECTOFF_HA;
+ break;
+ case BFD_RELOC_CTOR: ppc_reloc = R_PPC64_ADDR64;
+ break;
+ case BFD_RELOC_64: ppc_reloc = R_PPC64_ADDR64;
+ break;
+ case BFD_RELOC_PPC64_HIGHER: ppc_reloc = R_PPC64_ADDR16_HIGHER;
+ break;
+ case BFD_RELOC_PPC64_HIGHER_S: ppc_reloc = R_PPC64_ADDR16_HIGHERA;
+ break;
+ case BFD_RELOC_PPC64_HIGHEST: ppc_reloc = R_PPC64_ADDR16_HIGHEST;
+ break;
+ case BFD_RELOC_PPC64_HIGHEST_S: ppc_reloc = R_PPC64_ADDR16_HIGHESTA;
+ break;
+ case BFD_RELOC_64_PCREL: ppc_reloc = R_PPC64_REL64;
+ break;
+ case BFD_RELOC_64_PLTOFF: ppc_reloc = R_PPC64_PLT64;
+ break;
+ case BFD_RELOC_64_PLT_PCREL: ppc_reloc = R_PPC64_PLTREL64;
+ break;
+ case BFD_RELOC_PPC_TOC16: ppc_reloc = R_PPC64_TOC16;
+ break;
+ case BFD_RELOC_PPC64_TOC16_LO: ppc_reloc = R_PPC64_TOC16_LO;
+ break;
+ case BFD_RELOC_PPC64_TOC16_HI: ppc_reloc = R_PPC64_TOC16_HI;
+ break;
+ case BFD_RELOC_PPC64_TOC16_HA: ppc_reloc = R_PPC64_TOC16_HA;
+ break;
+ case BFD_RELOC_PPC64_TOC: ppc_reloc = R_PPC64_TOC;
+ break;
+ case BFD_RELOC_PPC64_PLTGOT16: ppc_reloc = R_PPC64_PLTGOT16;
+ break;
+ case BFD_RELOC_PPC64_PLTGOT16_LO: ppc_reloc = R_PPC64_PLTGOT16_LO;
+ break;
+ case BFD_RELOC_PPC64_PLTGOT16_HI: ppc_reloc = R_PPC64_PLTGOT16_HI;
+ break;
+ case BFD_RELOC_PPC64_PLTGOT16_HA: ppc_reloc = R_PPC64_PLTGOT16_HA;
+ break;
+ case BFD_RELOC_PPC64_ADDR16_DS: ppc_reloc = R_PPC64_ADDR16_DS;
+ break;
+ case BFD_RELOC_PPC64_ADDR16_LO_DS: ppc_reloc = R_PPC64_ADDR16_LO_DS;
+ break;
+ case BFD_RELOC_PPC64_GOT16_DS: ppc_reloc = R_PPC64_GOT16_DS;
+ break;
+ case BFD_RELOC_PPC64_GOT16_LO_DS: ppc_reloc = R_PPC64_GOT16_LO_DS;
+ break;
+ case BFD_RELOC_PPC64_PLT16_LO_DS: ppc_reloc = R_PPC64_PLT16_LO_DS;
+ break;
+ case BFD_RELOC_PPC64_SECTOFF_DS: ppc_reloc = R_PPC64_SECTOFF_DS;
+ break;
+ case BFD_RELOC_PPC64_SECTOFF_LO_DS: ppc_reloc = R_PPC64_SECTOFF_LO_DS;
+ break;
+ case BFD_RELOC_PPC64_TOC16_DS: ppc_reloc = R_PPC64_TOC16_DS;
+ break;
+ case BFD_RELOC_PPC64_TOC16_LO_DS: ppc_reloc = R_PPC64_TOC16_LO_DS;
+ break;
+ case BFD_RELOC_PPC64_PLTGOT16_DS: ppc_reloc = R_PPC64_PLTGOT16_DS;
+ break;
+ case BFD_RELOC_PPC64_PLTGOT16_LO_DS: ppc_reloc = R_PPC64_PLTGOT16_LO_DS;
+ break;
+ case BFD_RELOC_VTABLE_INHERIT: ppc_reloc = R_PPC64_GNU_VTINHERIT;
+ break;
+ case BFD_RELOC_VTABLE_ENTRY: ppc_reloc = R_PPC64_GNU_VTENTRY;
+ break;
+ }
+
+ return ppc64_elf_howto_table[(int) ppc_reloc];
+};
+
+/* Set the howto pointer for a PowerPC ELF reloc. */
+
+static void
+ppc64_elf_info_to_howto (abfd, cache_ptr, dst)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ arelent *cache_ptr;
+ Elf64_Internal_Rela *dst;
+{
+ unsigned int type;
+
+ if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
+ /* Initialize howto table if needed. */
+ ppc_howto_init ();
+
+ type = ELF64_R_TYPE (dst->r_info);
+ BFD_ASSERT (type < (sizeof (ppc64_elf_howto_table)
+ / sizeof (ppc64_elf_howto_table[0])));
+ cache_ptr->howto = ppc64_elf_howto_table[type];
+}
+
+/* Handle the R_PPC_ADDR16_HA and similar relocs. */
+
+static bfd_reloc_status_type
+ppc64_elf_addr16_ha_reloc (abfd, reloc_entry, symbol, data, input_section,
+ output_bfd, error_message)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data ATTRIBUTE_UNUSED;
+ asection *input_section;
+ bfd *output_bfd;
+ char **error_message ATTRIBUTE_UNUSED;
+{
+ bfd_vma relocation;
+
+ if (output_bfd != NULL)
+ {
+ reloc_entry->address += input_section->output_offset;
+ return bfd_reloc_ok;
+ }
+
+ if (reloc_entry->address > input_section->_cooked_size)
+ return bfd_reloc_outofrange;
+
+ if (bfd_is_com_section (symbol->section))
+ relocation = 0;
+ else
+ relocation = symbol->value;
+
+ relocation += symbol->section->output_section->vma;
+ relocation += symbol->section->output_offset;
+ relocation += reloc_entry->addend;
+
+ reloc_entry->addend += (relocation & 0x8000) << 1;
+
+ return bfd_reloc_continue;
+}
+
+/* Function to set whether a module needs the -mrelocatable bit set. */
+
+static boolean
+ppc64_elf_set_private_flags (abfd, flags)
+ bfd *abfd;
+ flagword flags;
+{
+ BFD_ASSERT (!elf_flags_init (abfd)
+ || elf_elfheader (abfd)->e_flags == flags);
+
+ elf_elfheader (abfd)->e_flags = flags;
+ elf_flags_init (abfd) = true;
+ return true;
+}
+
+/* Merge backend specific data from an object file to the output
+ object file when linking. */
+static boolean
+ppc64_elf_merge_private_bfd_data (ibfd, obfd)
+ bfd *ibfd;
+ bfd *obfd;
+{
+ flagword old_flags;
+ flagword new_flags;
+ boolean error;
+
+ /* Check if we have the same endianess. */
+ if (ibfd->xvec->byteorder != obfd->xvec->byteorder
+ && obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
+ {
+ const char *msg;
+
+ if (bfd_big_endian (ibfd))
+ msg = _("%s: compiled for a big endian system and target is little endian");
+ else
+ msg = _("%s: compiled for a little endian system and target is big endian");
+
+ (*_bfd_error_handler) (msg, bfd_archive_filename (ibfd));
+
+ bfd_set_error (bfd_error_wrong_format);
+ return false;
+ }
+
+ if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
+ || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
+ return true;
+
+ new_flags = elf_elfheader (ibfd)->e_flags;
+ old_flags = elf_elfheader (obfd)->e_flags;
+ if (!elf_flags_init (obfd))
+ {
+ /* First call, no flags set. */
+ elf_flags_init (obfd) = true;
+ elf_elfheader (obfd)->e_flags = new_flags;
+ }
+
+ else if (new_flags == old_flags)
+ /* Compatible flags are ok. */
+ ;
+
+ else
+ {
+ /* Incompatible flags. Warn about -mrelocatable mismatch.
+ Allow -mrelocatable-lib to be linked with either. */
+ error = false;
+ if ((new_flags & EF_PPC_RELOCATABLE) != 0
+ && (old_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0)
+ {
+ error = true;
+ (*_bfd_error_handler)
+ (_("%s: compiled with -mrelocatable and linked with modules compiled normally"),
+ bfd_archive_filename (ibfd));
+ }
+ else if ((new_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0
+ && (old_flags & EF_PPC_RELOCATABLE) != 0)
+ {
+ error = true;
+ (*_bfd_error_handler)
+ (_("%s: compiled normally and linked with modules compiled with -mrelocatable"),
+ bfd_archive_filename (ibfd));
+ }
+
+ /* The output is -mrelocatable-lib iff both the input files are. */
+ if (! (new_flags & EF_PPC_RELOCATABLE_LIB))
+ elf_elfheader (obfd)->e_flags &= ~EF_PPC_RELOCATABLE_LIB;
+
+ /* The output is -mrelocatable iff it can't be -mrelocatable-lib,
+ but each input file is either -mrelocatable or -mrelocatable-lib. */
+ if (! (elf_elfheader (obfd)->e_flags & EF_PPC_RELOCATABLE_LIB)
+ && (new_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE))
+ && (old_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE)))
+ elf_elfheader (obfd)->e_flags |= EF_PPC_RELOCATABLE;
+
+ /* Do not warn about eabi vs. V.4 mismatch, just or in the bit
+ if any module uses it. */
+ elf_elfheader (obfd)->e_flags |= (new_flags & EF_PPC_EMB);
+
+ new_flags &= ~(EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB);
+ old_flags &= ~(EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB);
+
+ /* Warn about any other mismatches. */
+ if (new_flags != old_flags)
+ {
+ error = true;
+ (*_bfd_error_handler)
+ (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"),
+ bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags);
+ }
+
+ if (error)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+/* Handle a PowerPC specific section when reading an object file. This
+ is called when elfcode.h finds a section with an unknown type. */
+
+static boolean
+ppc64_elf_section_from_shdr (abfd, hdr, name)
+ bfd *abfd;
+ Elf64_Internal_Shdr *hdr;
+ char *name;
+{
+ asection *newsect;
+ flagword flags;
+
+ if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
+ return false;
+
+ newsect = hdr->bfd_section;
+ flags = bfd_get_section_flags (abfd, newsect);
+ if (hdr->sh_flags & SHF_EXCLUDE)
+ flags |= SEC_EXCLUDE;
+
+ if (hdr->sh_type == SHT_ORDERED)
+ flags |= SEC_SORT_ENTRIES;
+
+ bfd_set_section_flags (abfd, newsect, flags);
+ return true;
+}
+
+/* The following functions are specific to the ELF linker, while
+ functions above are used generally. Those named ppc64_elf_* are
+ called by the main ELF linker code. They appear in this file more
+ or less in the order in which they are called. eg.
+ ppc64_elf_check_relocs is called early in the link process,
+ ppc64_elf_finish_dynamic_sections is one of the last functions
+ called.
+
+ PowerPC64-ELF uses a similar scheme to PowerPC64-XCOFF in that
+ functions have both a function code symbol and a function descriptor
+ symbol. A call to foo in a relocatable object file looks like:
+
+ . .text
+ . x:
+ . bl .foo
+ . nop
+
+ The function definition in another object file might be:
+
+ . .section .opd
+ . foo: .quad .foo
+ . .quad .TOC.@tocbase
+ . .quad 0
+ .
+ . .text
+ . .foo: blr
+
+ When the linker resolves the call during a static link, the branch
+ unsurprisingly just goes to .foo and the .opd information is unused.
+ If the function definition is in a shared library, things are a little
+ different: The call goes via a plt call stub, the opd information gets
+ copied to the plt, and the linker patches the nop.
+
+ . x:
+ . bl .foo_stub
+ . ld 2,40(1)
+ .
+ .
+ . .foo_stub:
+ . addis 12,2,Lfoo@toc@ha # in practice, the call stub
+ . addi 12,12,Lfoo@toc@l # is slightly optimised, but
+ . std 2,40(1) # this is the general idea
+ . ld 11,0(12)
+ . ld 2,8(12)
+ . mtctr 11
+ . ld 11,16(12)
+ . bctr
+ .
+ . .section .plt
+ . Lfoo: reloc (R_PPC64_JMP_SLOT, foo)
+
+ The "reloc ()" notation is supposed to indicate that the linker emits
+ an R_PPC64_JMP_SLOT reloc against foo. The dynamic linker does the opd
+ copying.
+
+ What are the difficulties here? Well, firstly, the relocations
+ examined by the linker in check_relocs are against the function code
+ sym .foo, while the dynamic relocation in the plt is emitted against
+ the function descriptor symbol, foo. Somewhere along the line, we need
+ to carefully copy dynamic link information from one symbol to the other.
+ Secondly, the generic part of the elf linker will make .foo a dynamic
+ symbol as is normal for most other backends. We need foo dynamic
+ instead, at least for an application final link. However, when
+ creating a shared library containing foo, we need to have both symbols
+ dynamic so that references to .foo are satisfied during the early
+ stages of linking. Otherwise the linker might decide to pull in a
+ definition from some other object, eg. a static library. */
+
+/* The linker needs to keep track of the number of relocs that it
+ decides to copy as dynamic relocs in check_relocs for each symbol.
+ This is so that it can later discard them if they are found to be
+ unnecessary. We store the information in a field extending the
+ regular ELF linker hash table. */
+
+struct ppc_dyn_relocs
+{
+ struct ppc_dyn_relocs *next;
+
+ /* The input section of the reloc. */
+ asection *sec;
+
+ /* Total number of relocs copied for the input section. */
+ bfd_size_type count;
+
+ /* Number of pc-relative relocs copied for the input section. */
+ bfd_size_type pc_count;
+};
+
+/* Of those relocs that might be copied as dynamic relocs, this macro
+ selects between relative and absolute types. */
+
+#define IS_ABSOLUTE_RELOC(RTYPE) \
+ ((RTYPE) != R_PPC64_REL14 \
+ && (RTYPE) != R_PPC64_REL14_BRNTAKEN \
+ && (RTYPE) != R_PPC64_REL14_BRTAKEN \
+ && (RTYPE) != R_PPC64_REL24 \
+ && (RTYPE) != R_PPC64_REL32 \
+ && (RTYPE) != R_PPC64_REL64)
+
+/* ppc64 ELF linker hash entry. */
+
+struct ppc_link_hash_entry
+{
+ struct elf_link_hash_entry elf;
+
+ /* Track dynamic relocs copied for this symbol. */
+ struct ppc_dyn_relocs *dyn_relocs;
+
+ /* Flag function code and descriptor symbols. */
+ unsigned int is_func:1;
+ unsigned int is_func_descriptor:1;
+};
+
+/* ppc64 ELF linker hash table. */
+
+struct ppc_link_hash_table
+{
+ struct elf_link_hash_table elf;
+
+ /* Short-cuts to get to dynamic linker sections. */
+ asection *sgot;
+ asection *srelgot;
+ asection *splt;
+ asection *srelplt;
+ asection *sdynbss;
+ asection *srelbss;
+ asection *sstub;
+ asection *sglink;
+
+ /* Set on error. */
+ int plt_overflow;
+
+ /* Small local sym to section mapping cache. */
+ struct sym_sec_cache sym_sec;
+};
+
+/* Get the ppc64 ELF linker hash table from a link_info structure. */
+
+#define ppc_hash_table(p) \
+ ((struct ppc_link_hash_table *) ((p)->hash))
+
+/* Create an entry in a ppc64 ELF linker hash table. */
+
+static struct bfd_hash_entry *
+link_hash_newfunc (entry, table, string)
+ struct bfd_hash_entry *entry;
+ struct bfd_hash_table *table;
+ const char *string;
+{
+ /* Allocate the structure if it has not already been allocated by a
+ subclass. */
+ if (entry == NULL)
+ {
+ entry = bfd_hash_allocate (table, sizeof (struct ppc_link_hash_entry));
+ if (entry == NULL)
+ return entry;
+ }
+
+ /* Call the allocation method of the superclass. */
+ entry = _bfd_elf_link_hash_newfunc (entry, table, string);
+ if (entry != NULL)
+ {
+ struct ppc_link_hash_entry *eh = (struct ppc_link_hash_entry *) entry;
+
+ eh->dyn_relocs = NULL;
+ eh->is_func = 0;
+ eh->is_func_descriptor = 0;
+ }
+
+ return entry;
+}
+
+/* Create a ppc64 ELF linker hash table. */
+
+static struct bfd_link_hash_table *
+ppc64_elf_link_hash_table_create (abfd)
+ bfd *abfd;
+{
+ struct ppc_link_hash_table *htab;
+ bfd_size_type amt = sizeof (struct ppc_link_hash_table);
+
+ htab = (struct ppc_link_hash_table *) bfd_alloc (abfd, amt);
+ if (htab == NULL)
+ return NULL;
+
+ if (! _bfd_elf_link_hash_table_init (&htab->elf, abfd, link_hash_newfunc))
+ {
+ bfd_release (abfd, htab);
+ return NULL;
+ }
+
+ htab->sgot = NULL;
+ htab->srelgot = NULL;
+ htab->splt = NULL;
+ htab->srelplt = NULL;
+ htab->sdynbss = NULL;
+ htab->srelbss = NULL;
+ htab->sstub = NULL;
+ htab->sglink = NULL;
+ htab->plt_overflow = 0;
+ htab->sym_sec.abfd = NULL;
+
+ return &htab->elf.root;
+}
+
+/* Create .got and .rela.got sections in DYNOBJ, and set up
+ shortcuts to them in our hash table. */
+
+static boolean
+create_got_section (dynobj, info)
+ bfd *dynobj;
+ struct bfd_link_info *info;
+{
+ struct ppc_link_hash_table *htab;
+
+ if (! _bfd_elf_create_got_section (dynobj, info))
+ return false;
+
+ htab = ppc_hash_table (info);
+ htab->sgot = bfd_get_section_by_name (dynobj, ".got");
+ if (!htab->sgot)
+ abort ();
+
+ htab->srelgot = bfd_make_section (dynobj, ".rela.got");
+ if (!htab->srelgot
+ || ! bfd_set_section_flags (dynobj, htab->srelgot,
+ (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED
+ | SEC_READONLY))
+ || ! bfd_set_section_alignment (dynobj, htab->srelgot, 3))
+ return false;
+ return true;
+}
+
+/* Create the .stub and .glink sections as well as the ordinary
+ dynamic sections. */
+
+static boolean
+ppc64_elf_create_dynamic_sections (dynobj, info)
+ bfd *dynobj;
+ struct bfd_link_info *info;
+{
+ struct ppc_link_hash_table *htab;
+ flagword flags;
+
+ htab = ppc_hash_table (info);
+ if (!htab->sgot && !create_got_section (dynobj, info))
+ return false;
+
+ if (!_bfd_elf_create_dynamic_sections (dynobj, info))
+ return false;
+
+ htab->splt = bfd_get_section_by_name (dynobj, ".plt");
+ htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
+ htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
+ if (!info->shared)
+ htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss");
+
+ if (!htab->splt || !htab->srelplt || !htab->sdynbss
+ || (!info->shared && !htab->srelbss))
+ abort ();
+
+ /* Create .stub and .glink for global linkage functions. */
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_READONLY
+ | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+ htab->sstub = bfd_make_section (dynobj, ".stub");
+ if (htab->sstub == NULL
+ || ! bfd_set_section_flags (dynobj, htab->sstub, flags)
+ || ! bfd_set_section_alignment (dynobj, htab->sstub, 2))
+ return false;
+ htab->sglink = bfd_make_section (dynobj, ".glink");
+ if (htab->sglink == NULL
+ || ! bfd_set_section_flags (dynobj, htab->sglink, flags)
+ || ! bfd_set_section_alignment (dynobj, htab->sglink, 3))
+ return false;
+
+ return true;
+}
+
+/* Copy the extra info we tack onto an elf_link_hash_entry. */
+
+static void
+ppc64_elf_copy_indirect_symbol (dir, ind)
+ struct elf_link_hash_entry *dir, *ind;
+{
+ struct ppc_link_hash_entry *edir, *eind;
+
+ edir = (struct ppc_link_hash_entry *) dir;
+ eind = (struct ppc_link_hash_entry *) ind;
+
+ if (eind->dyn_relocs != NULL)
+ {
+ if (edir->dyn_relocs != NULL)
+ {
+ struct ppc_dyn_relocs **pp;
+ struct ppc_dyn_relocs *p;
+
+ if (ind->root.type == bfd_link_hash_indirect)
+ abort ();
+
+ /* Add reloc counts against the weak sym to the strong sym
+ list. Merge any entries against the same section. */
+ for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
+ {
+ struct ppc_dyn_relocs *q;
+
+ for (q = edir->dyn_relocs; q != NULL; q = q->next)
+ if (q->sec == p->sec)
+ {
+ q->pc_count += p->pc_count;
+ q->count += p->count;
+ *pp = p->next;
+ break;
+ }
+ if (q == NULL)
+ pp = &p->next;
+ }
+ *pp = edir->dyn_relocs;
+ }
+
+ edir->dyn_relocs = eind->dyn_relocs;
+ eind->dyn_relocs = NULL;
+ }
+
+ edir->is_func |= eind->is_func;
+ edir->is_func_descriptor |= eind->is_func_descriptor;
+
+ _bfd_elf_link_hash_copy_indirect (dir, ind);
+}
+
+/* Look through the relocs for a section during the first phase, and
+ calculate needed space in the global offset table, procedure
+ linkage table, and dynamic reloc sections. */
+
+static boolean
+ppc64_elf_check_relocs (abfd, info, sec, relocs)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ asection *sec;
+ const Elf_Internal_Rela *relocs;
+{
+ struct ppc_link_hash_table *htab;
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
+ const Elf_Internal_Rela *rel;
+ const Elf_Internal_Rela *rel_end;
+ asection *sreloc;
+ boolean is_opd;
+
+ if (info->relocateable)
+ return true;
+
+ htab = ppc_hash_table (info);
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+
+ sym_hashes = elf_sym_hashes (abfd);
+ sym_hashes_end = (sym_hashes
+ + symtab_hdr->sh_size / sizeof (Elf64_External_Sym));
+ if (!elf_bad_symtab (abfd))
+ sym_hashes_end -= symtab_hdr->sh_info;
+
+ sreloc = NULL;
+ is_opd = strcmp (bfd_get_section_name (abfd, sec), ".opd") == 0;
+
+ rel_end = relocs + sec->reloc_count;
+ for (rel = relocs; rel < rel_end; rel++)
+ {
+ unsigned long r_symndx;
+ struct elf_link_hash_entry *h;
+ enum elf_ppc_reloc_type r_type;
+
+ r_symndx = ELF64_R_SYM (rel->r_info);
+ if (r_symndx < symtab_hdr->sh_info)
+ h = NULL;
+ else
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+
+ r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info);
+ switch (r_type)
+ {
+ /* GOT16 relocations */
+ case R_PPC64_GOT16:
+ case R_PPC64_GOT16_DS:
+ case R_PPC64_GOT16_HA:
+ case R_PPC64_GOT16_HI:
+ case R_PPC64_GOT16_LO:
+ case R_PPC64_GOT16_LO_DS:
+
+ /* This symbol requires a global offset table entry. */
+ if (htab->sgot == NULL)
+ {
+ if (htab->elf.dynobj == NULL)
+ htab->elf.dynobj = abfd;
+ if (!create_got_section (htab->elf.dynobj, info))
+ return false;
+ }
+
+ if (h != NULL)
+ {
+ h->got.refcount += 1;
+ }
+ else
+ {
+ bfd_signed_vma *local_got_refcounts;
+
+ /* This is a global offset table entry for a local symbol. */
+ local_got_refcounts = elf_local_got_refcounts (abfd);
+ if (local_got_refcounts == NULL)
+ {
+ bfd_size_type size;
+
+ size = symtab_hdr->sh_info;
+ size *= sizeof (bfd_signed_vma);
+ local_got_refcounts = ((bfd_signed_vma *)
+ bfd_zalloc (abfd, size));
+ if (local_got_refcounts == NULL)
+ return false;
+ elf_local_got_refcounts (abfd) = local_got_refcounts;
+ }
+ local_got_refcounts[r_symndx] += 1;
+ }
+ break;
+
+ case R_PPC64_PLT16_HA:
+ case R_PPC64_PLT16_HI:
+ case R_PPC64_PLT16_LO:
+ case R_PPC64_PLT32:
+ case R_PPC64_PLT64:
+ /* This symbol requires a procedure linkage table entry. We
+ actually build the entry in adjust_dynamic_symbol,
+ because this might be a case of linking PIC code without
+ linking in any dynamic objects, in which case we don't
+ need to generate a procedure linkage table after all. */
+ if (h == NULL)
+ {
+ /* It does not make sense to have a procedure linkage
+ table entry for a local symbol. */
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
+
+ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->plt.refcount += 1;
+ ((struct ppc_link_hash_entry *) h)->is_func = 1;
+ break;
+
+ /* The following relocations don't need to propagate the
+ relocation if linking a shared object since they are
+ section relative. */
+ case R_PPC64_SECTOFF:
+ case R_PPC64_SECTOFF_LO:
+ case R_PPC64_SECTOFF_HI:
+ case R_PPC64_SECTOFF_HA:
+ case R_PPC64_SECTOFF_DS:
+ case R_PPC64_SECTOFF_LO_DS:
+ case R_PPC64_TOC16:
+ case R_PPC64_TOC16_LO:
+ case R_PPC64_TOC16_HI:
+ case R_PPC64_TOC16_HA:
+ case R_PPC64_TOC16_DS:
+ case R_PPC64_TOC16_LO_DS:
+ break;
+
+ /* This relocation describes the C++ object vtable hierarchy.
+ Reconstruct it for later use during GC. */
+ case R_PPC64_GNU_VTINHERIT:
+ if (!_bfd_elf64_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+ return false;
+ break;
+
+ /* This relocation describes which C++ vtable entries are actually
+ used. Record for later use during GC. */
+ case R_PPC64_GNU_VTENTRY:
+ if (!_bfd_elf64_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+ return false;
+ break;
+
+ case R_PPC64_REL24:
+ if (h != NULL
+ && h->root.root.string[0] == '.'
+ && h->root.root.string[1] != 0)
+ {
+ /* We may need a .plt entry if the function this reloc
+ refers to is in a shared lib. */
+ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->plt.refcount += 1;
+ ((struct ppc_link_hash_entry *) h)->is_func = 1;
+ }
+ break;
+
+ case R_PPC64_ADDR64:
+ if (is_opd
+ && h != NULL
+ && h->root.root.string[0] == '.'
+ && h->root.root.string[1] != 0)
+ {
+ struct elf_link_hash_entry *fdh;
+
+ fdh = elf_link_hash_lookup (&htab->elf, h->root.root.string + 1,
+ false, false, false);
+ if (fdh != NULL)
+ {
+ /* Ensure the function descriptor symbol string is
+ part of the code symbol string. We aren't
+ changing the name here, just allowing some tricks
+ in ppc64_elf_hide_symbol. */
+ fdh->root.root.string = h->root.root.string + 1;
+ ((struct ppc_link_hash_entry *) fdh)->is_func_descriptor = 1;
+ ((struct ppc_link_hash_entry *) h)->is_func = 1;
+ }
+ }
+ /* Fall through. */
+
+ case R_PPC64_REL64:
+ case R_PPC64_REL32:
+ case R_PPC64_REL14:
+ case R_PPC64_REL14_BRTAKEN:
+ case R_PPC64_REL14_BRNTAKEN:
+ case R_PPC64_ADDR14:
+ case R_PPC64_ADDR14_BRNTAKEN:
+ case R_PPC64_ADDR14_BRTAKEN:
+ case R_PPC64_ADDR16:
+ case R_PPC64_ADDR16_DS:
+ case R_PPC64_ADDR16_HA:
+ case R_PPC64_ADDR16_HI:
+ case R_PPC64_ADDR16_HIGHER:
+ case R_PPC64_ADDR16_HIGHERA:
+ case R_PPC64_ADDR16_HIGHEST:
+ case R_PPC64_ADDR16_HIGHESTA:
+ case R_PPC64_ADDR16_LO:
+ case R_PPC64_ADDR16_LO_DS:
+ case R_PPC64_ADDR24:
+ case R_PPC64_ADDR30:
+ case R_PPC64_ADDR32:
+ case R_PPC64_UADDR16:
+ case R_PPC64_UADDR32:
+ case R_PPC64_UADDR64:
+ case R_PPC64_TOC:
+ /* Don't propagate .opd relocs. */
+ if (NO_OPD_RELOCS && is_opd)
+ break;
+
+ /* If we are creating a shared library, and this is a reloc
+ against a global symbol, or a non PC relative reloc
+ against a local symbol, then we need to copy the reloc
+ into the shared library. However, if we are linking with
+ -Bsymbolic, we do not need to copy a reloc against a
+ global symbol which is defined in an object we are
+ including in the link (i.e., DEF_REGULAR is set). At
+ this point we have not seen all the input files, so it is
+ possible that DEF_REGULAR is not set now but will be set
+ later (it is never cleared). In case of a weak definition,
+ DEF_REGULAR may be cleared later by a strong definition in
+ a shared library. We account for that possibility below by
+ storing information in the relocs_copied field of the hash
+ table entry. A similar situation occurs when creating
+ shared libraries and symbol visibility changes render the
+ symbol local.
+
+ If on the other hand, we are creating an executable, we
+ may need to keep relocations for symbols satisfied by a
+ dynamic library if we manage to avoid copy relocs for the
+ symbol. */
+ if ((info->shared
+ && (sec->flags & SEC_ALLOC) != 0
+ && (IS_ABSOLUTE_RELOC (r_type)
+ || (h != NULL
+ && (! info->symbolic
+ || h->root.type == bfd_link_hash_defweak
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ || (!info->shared
+ && (sec->flags & SEC_ALLOC) != 0
+ && h != NULL
+ && (h->root.type == bfd_link_hash_defweak
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0)))
+ {
+ struct ppc_dyn_relocs *p;
+ struct ppc_dyn_relocs **head;
+
+ /* We must copy these reloc types into the output file.
+ Create a reloc section in dynobj and make room for
+ this reloc. */
+ if (sreloc == NULL)
+ {
+ const char *name;
+ bfd *dynobj;
+
+ name = (bfd_elf_string_from_elf_section
+ (abfd,
+ elf_elfheader (abfd)->e_shstrndx,
+ elf_section_data (sec)->rel_hdr.sh_name));
+ if (name == NULL)
+ return false;
+
+ if (strncmp (name, ".rela", 5) != 0
+ || strcmp (bfd_get_section_name (abfd, sec),
+ name + 5) != 0)
+ {
+ (*_bfd_error_handler)
+ (_("%s: bad relocation section name `%s\'"),
+ bfd_archive_filename (abfd), name);
+ bfd_set_error (bfd_error_bad_value);
+ }
+
+ if (htab->elf.dynobj == NULL)
+ htab->elf.dynobj = abfd;
+
+ dynobj = htab->elf.dynobj;
+ sreloc = bfd_get_section_by_name (dynobj, name);
+ if (sreloc == NULL)
+ {
+ flagword flags;
+
+ sreloc = bfd_make_section (dynobj, name);
+ flags = (SEC_HAS_CONTENTS | SEC_READONLY
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+ if ((sec->flags & SEC_ALLOC) != 0)
+ flags |= SEC_ALLOC | SEC_LOAD;
+ if (sreloc == NULL
+ || ! bfd_set_section_flags (dynobj, sreloc, flags)
+ || ! bfd_set_section_alignment (dynobj, sreloc, 3))
+ return false;
+ }
+ elf_section_data (sec)->sreloc = sreloc;
+ }
+
+ /* If this is a global symbol, we count the number of
+ relocations we need for this symbol. */
+ if (h != NULL)
+ {
+ head = &((struct ppc_link_hash_entry *) h)->dyn_relocs;
+ }
+ else
+ {
+ /* Track dynamic relocs needed for local syms too.
+ We really need local syms available to do this
+ easily. Oh well. */
+
+ asection *s;
+ s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
+ sec, r_symndx);
+ if (s == NULL)
+ return false;
+
+ head = ((struct ppc_dyn_relocs **)
+ &elf_section_data (s)->local_dynrel);
+ }
+
+ p = *head;
+ if (p == NULL || p->sec != sec)
+ {
+ p = ((struct ppc_dyn_relocs *)
+ bfd_alloc (htab->elf.dynobj,
+ (bfd_size_type) sizeof *p));
+ if (p == NULL)
+ return false;
+ p->next = *head;
+ *head = p;
+ p->sec = sec;
+ p->count = 0;
+ p->pc_count = 0;
+ }
+
+ p->count += 1;
+ if (!IS_ABSOLUTE_RELOC (r_type))
+ p->pc_count += 1;
+ }
+ break;
+
+ default:
+ }
+ }
+
+ return true;
+}
+
+/* Return the section that should be marked against GC for a given
+ relocation. */
+
+static asection *
+ppc64_elf_gc_mark_hook (abfd, info, rel, h, sym)
+ bfd *abfd;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *rel;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
+{
+ if (h != NULL)
+ {
+ enum elf_ppc_reloc_type r_type;
+
+ r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info);
+ switch (r_type)
+ {
+ case R_PPC64_GNU_VTINHERIT:
+ case R_PPC64_GNU_VTENTRY:
+ break;
+
+ default:
+ switch (h->root.type)
+ {
+ case bfd_link_hash_defined:
+ case bfd_link_hash_defweak:
+ return h->root.u.def.section;
+
+ case bfd_link_hash_common:
+ return h->root.u.c.p->section;
+
+ default:
+ break;
+ }
+ }
+ }
+ else
+ {
+ return bfd_section_from_elf_index (abfd, sym->st_shndx);
+ }
+
+ return NULL;
+}
+
+/* Update the .got, .plt. and dynamic reloc reference counts for the
+ section being removed. */
+
+static boolean
+ppc64_elf_gc_sweep_hook (abfd, info, sec, relocs)
+ bfd *abfd;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
+ asection *sec;
+ const Elf_Internal_Rela *relocs;
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ bfd_signed_vma *local_got_refcounts;
+ const Elf_Internal_Rela *rel, *relend;
+
+ elf_section_data (sec)->local_dynrel = NULL;
+
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (abfd);
+ local_got_refcounts = elf_local_got_refcounts (abfd);
+
+ relend = relocs + sec->reloc_count;
+ for (rel = relocs; rel < relend; rel++)
+ {
+ unsigned long r_symndx;
+ enum elf_ppc_reloc_type r_type;
+ struct elf_link_hash_entry *h;
+
+ r_symndx = ELF64_R_SYM (rel->r_info);
+ r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info);
+ switch (r_type)
+ {
+ case R_PPC64_GOT16:
+ case R_PPC64_GOT16_DS:
+ case R_PPC64_GOT16_HA:
+ case R_PPC64_GOT16_HI:
+ case R_PPC64_GOT16_LO:
+ case R_PPC64_GOT16_LO_DS:
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ if (h->got.refcount > 0)
+ h->got.refcount--;
+ }
+ else
+ {
+ if (local_got_refcounts[r_symndx] > 0)
+ local_got_refcounts[r_symndx]--;
+ }
+ break;
+
+ case R_PPC64_PLT16_HA:
+ case R_PPC64_PLT16_HI:
+ case R_PPC64_PLT16_LO:
+ case R_PPC64_PLT32:
+ case R_PPC64_PLT64:
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ if (h->plt.refcount > 0)
+ h->plt.refcount--;
+ }
+ break;
+
+ case R_PPC64_REL24:
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ if (h->plt.refcount > 0)
+ h->plt.refcount--;
+ }
+ break;
+
+ case R_PPC64_REL14:
+ case R_PPC64_REL14_BRNTAKEN:
+ case R_PPC64_REL14_BRTAKEN:
+ case R_PPC64_REL32:
+ case R_PPC64_REL64:
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ struct ppc_link_hash_entry *eh;
+ struct ppc_dyn_relocs **pp;
+ struct ppc_dyn_relocs *p;
+
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ eh = (struct ppc_link_hash_entry *) h;
+
+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+ if (p->sec == sec)
+ {
+ p->pc_count -= 1;
+ p->count -= 1;
+ if (p->count == 0)
+ *pp = p->next;
+ break;
+ }
+ }
+ break;
+
+ case R_PPC64_ADDR14:
+ case R_PPC64_ADDR14_BRNTAKEN:
+ case R_PPC64_ADDR14_BRTAKEN:
+ case R_PPC64_ADDR16:
+ case R_PPC64_ADDR16_DS:
+ case R_PPC64_ADDR16_HA:
+ case R_PPC64_ADDR16_HI:
+ case R_PPC64_ADDR16_HIGHER:
+ case R_PPC64_ADDR16_HIGHERA:
+ case R_PPC64_ADDR16_HIGHEST:
+ case R_PPC64_ADDR16_HIGHESTA:
+ case R_PPC64_ADDR16_LO:
+ case R_PPC64_ADDR16_LO_DS:
+ case R_PPC64_ADDR24:
+ case R_PPC64_ADDR30:
+ case R_PPC64_ADDR32:
+ case R_PPC64_ADDR64:
+ case R_PPC64_UADDR16:
+ case R_PPC64_UADDR32:
+ case R_PPC64_UADDR64:
+ case R_PPC64_TOC:
+ if (r_symndx >= symtab_hdr->sh_info)
+ {
+ struct ppc_link_hash_entry *eh;
+ struct ppc_dyn_relocs **pp;
+ struct ppc_dyn_relocs *p;
+
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ eh = (struct ppc_link_hash_entry *) h;
+
+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+ if (p->sec == sec)
+ {
+ p->count -= 1;
+ if (p->count == 0)
+ *pp = p->next;
+ break;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ return true;
+}
+
+/* Called via elf_link_hash_traverse to transfer dynamic linking
+ information on function code symbol entries to their corresponding
+ function descriptor symbol entries. */
+static boolean
+func_desc_adjust (h, inf)
+ struct elf_link_hash_entry *h;
+ PTR inf;
+{
+ struct bfd_link_info *info;
+ struct ppc_link_hash_table *htab;
+
+ if (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ return true;
+
+ info = (struct bfd_link_info *) inf;
+ htab = ppc_hash_table (info);
+
+ /* If this is a function code symbol, transfer dynamic linking
+ information to the function descriptor symbol. */
+ if (!((struct ppc_link_hash_entry *) h)->is_func)
+ return true;
+
+ if (h->plt.refcount > 0
+ && h->root.root.string[0] == '.'
+ && h->root.root.string[1] != '\0')
+ {
+ struct elf_link_hash_entry *fdh;
+ boolean force_local;
+
+ /* Find the corresponding function descriptor symbol. Create it
+ as undefined if necessary. */
+
+ fdh = elf_link_hash_lookup (&htab->elf, h->root.root.string + 1,
+ false, false, true);
+
+ if (fdh == NULL && info->shared)
+ {
+ bfd *abfd;
+ asymbol *newsym;
+
+ /* Create it as undefined. */
+ if (h->root.type == bfd_link_hash_undefined
+ || h->root.type == bfd_link_hash_undefweak)
+ abfd = h->root.u.undef.abfd;
+ else if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ abfd = h->root.u.def.section->owner;
+ else
+ abort ();
+ newsym = bfd_make_empty_symbol (abfd);
+ newsym->name = h->root.root.string + 1;
+ newsym->section = bfd_und_section_ptr;
+ newsym->value = 0;
+ newsym->flags = BSF_OBJECT;
+ if (h->root.type == bfd_link_hash_undefweak)
+ newsym->flags |= BSF_WEAK;
+
+ if ( !(_bfd_generic_link_add_one_symbol
+ (info, abfd, newsym->name, newsym->flags,
+ newsym->section, newsym->value, NULL, false, false,
+ (struct bfd_link_hash_entry **) &fdh)))
+ {
+ return false;
+ }
+ }
+
+ if (fdh != NULL
+ && (fdh->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0
+ && (info->shared
+ || (fdh->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ || (fdh->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0))
+ {
+ if (fdh->dynindx == -1)
+ if (! bfd_elf64_link_record_dynamic_symbol (info, fdh))
+ return false;
+ fdh->plt.refcount = h->plt.refcount;
+ fdh->elf_link_hash_flags |= (h->elf_link_hash_flags
+ & (ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_REF_DYNAMIC
+ | ELF_LINK_HASH_REF_REGULAR_NONWEAK
+ | ELF_LINK_NON_GOT_REF));
+ fdh->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ ((struct ppc_link_hash_entry *) fdh)->is_func_descriptor = 1;
+ fdh->root.root.string = h->root.root.string + 1;
+ }
+
+ /* Now that the info is on the function descriptor, clear the
+ function code sym info. Any function code syms for which we
+ don't have a definition in a regular file, we force local.
+ This prevents a shared library from exporting syms that have
+ been imported from another library. Function code syms that
+ are really in the library we must leave global to prevent the
+ linker dragging a definition in from a static library. */
+ force_local = (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0;
+ _bfd_elf_link_hash_hide_symbol (info, h, force_local);
+ }
+
+ return true;
+}
+
+/* Called near the start of bfd_elf_size_dynamic_sections. We use
+ this hook to transfer dynamic linking information gathered so far
+ on function code symbol entries, to their corresponding function
+ descriptor symbol entries. */
+static boolean
+ppc64_elf_func_desc_adjust (obfd, info)
+ bfd *obfd ATTRIBUTE_UNUSED;
+ struct bfd_link_info *info;
+{
+ struct ppc_link_hash_table *htab;
+
+ htab = ppc_hash_table (info);
+ elf_link_hash_traverse (&htab->elf, func_desc_adjust, (PTR) info);
+ return true;
+}
+
+/* Adjust a symbol defined by a dynamic object and referenced by a
+ regular object. The current definition is in some section of the
+ dynamic object, but we're not including those sections. We have to
+ change the definition to something the rest of the link can
+ understand. */
+
+static boolean
+ppc64_elf_adjust_dynamic_symbol (info, h)
+ struct bfd_link_info *info;
+ struct elf_link_hash_entry *h;
+{
+ struct ppc_link_hash_table *htab;
+ struct ppc_link_hash_entry * eh;
+ struct ppc_dyn_relocs *p;
+ asection *s;
+ unsigned int power_of_two;
+
+ htab = ppc_hash_table (info);
+
+ /* Deal with function syms. */
+ if (h->type == STT_FUNC
+ || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
+ {
+ /* Clear procedure linkage table information for any symbol that
+ won't need a .plt entry. */
+ if (!((struct ppc_link_hash_entry *) h)->is_func_descriptor
+ || h->plt.refcount <= 0
+ || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
+ || (! info->shared
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0))
+ {
+ h->plt.offset = (bfd_vma) -1;
+ h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ }
+ return true;
+ }
+ else
+ h->plt.offset = (bfd_vma) -1;
+
+ /* If this is a weak symbol, and there is a real definition, the
+ processor independent code will have arranged for us to see the
+ real definition first, and we can just use the same value. */
+ if (h->weakdef != NULL)
+ {
+ BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
+ || h->weakdef->root.type == bfd_link_hash_defweak);
+ h->root.u.def.section = h->weakdef->root.u.def.section;
+ h->root.u.def.value = h->weakdef->root.u.def.value;
+ return true;
+ }
+
+ /* This is a reference to a symbol defined by a dynamic object which
+ is not a function. */
+
+ /* If we are creating a shared library, we must presume that the
+ only references to the symbol are via the global offset table.
+ For such cases we need not do anything here; the relocations will
+ be handled correctly by relocate_section. */
+ if (info->shared)
+ return true;
+
+ /* If there are no references to this symbol that do not use the
+ GOT, we don't need to generate a copy reloc. */
+ if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
+ return true;
+
+ eh = (struct ppc_link_hash_entry *) h;
+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ {
+ s = p->sec->output_section;
+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
+ break;
+ }
+
+ /* If we didn't find any dynamic relocs in read-only sections, then
+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */
+ if (p == NULL)
+ {
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
+ return true;
+ }
+
+ /* We must allocate the symbol in our .dynbss section, which will
+ become part of the .bss section of the executable. There will be
+ an entry for this symbol in the .dynsym section. The dynamic
+ object will contain position independent code, so all references
+ from the dynamic object to this symbol will go through the global
+ offset table. The dynamic linker will use the .dynsym entry to
+ determine the address it must put in the global offset table, so
+ both the dynamic object and the regular object will refer to the
+ same memory location for the variable. */
+
+ /* We must generate a R_PPC_COPY reloc to tell the dynamic linker to
+ copy the initial value out of the dynamic object and into the
+ runtime process image. We need to remember the offset into the
+ .rela.bss section we are going to use. */
+ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
+ {
+ htab->srelbss->_raw_size += sizeof (Elf64_External_Rela);
+ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
+ }
+
+ /* We need to figure out the alignment required for this symbol. I
+ have no idea how ELF linkers handle this. */
+ power_of_two = bfd_log2 (h->size);
+ if (power_of_two > 4)
+ power_of_two = 4;
+
+ /* Apply the required alignment. */
+ s = htab->sdynbss;
+ s->_raw_size = BFD_ALIGN (s->_raw_size, (bfd_size_type) (1 << power_of_two));
+ if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s))
+ {
+ if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two))
+ return false;
+ }
+
+ /* Define the symbol as being at this point in the section. */
+ h->root.u.def.section = s;
+ h->root.u.def.value = s->_raw_size;
+
+ /* Increment the section size to make room for the symbol. */
+ s->_raw_size += h->size;
+
+ return true;
+}
+
+/* If given a function descriptor symbol, hide both the function code
+ sym and the descriptor. */
+static void
+ppc64_elf_hide_symbol (info, h, force_local)
+ struct bfd_link_info *info;
+ struct elf_link_hash_entry *h;
+ boolean force_local;
+{
+ _bfd_elf_link_hash_hide_symbol (info, h, force_local);
+
+ if (((struct ppc_link_hash_entry *) h)->is_func_descriptor)
+ {
+ const char *name;
+ struct elf_link_hash_entry *fh;
+ struct ppc_link_hash_table *htab;
+
+ name = h->root.root.string - 1;
+ htab = ppc_hash_table (info);
+ fh = elf_link_hash_lookup (&htab->elf, name, false, false, false);
+ if (fh != NULL)
+ _bfd_elf_link_hash_hide_symbol (info, fh, force_local);
+ }
+}
+
+/* This is the condition under which ppc64_elf_finish_dynamic_symbol
+ will be called from elflink.h. If elflink.h doesn't call our
+ finish_dynamic_symbol routine, we'll need to do something about
+ initializing any .plt and .got entries in ppc64_elf_relocate_section. */
+#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \
+ ((DYN) \
+ && ((INFO)->shared \
+ || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \
+ && ((H)->dynindx != -1 \
+ || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
+
+/* Allocate space in .plt, .got and associated reloc sections for
+ dynamic relocs. */
+
+static boolean
+allocate_dynrelocs (h, inf)
+ struct elf_link_hash_entry *h;
+ PTR inf;
+{
+ struct bfd_link_info *info;
+ struct ppc_link_hash_table *htab;
+ asection *s;
+ struct ppc_link_hash_entry *eh;
+ struct ppc_dyn_relocs *p;
+
+ if (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ return true;
+
+ info = (struct bfd_link_info *) inf;
+ htab = ppc_hash_table (info);
+
+ if (htab->elf.dynamic_sections_created
+ && h->plt.refcount > 0
+ && h->dynindx != -1)
+ {
+ BFD_ASSERT (((struct ppc_link_hash_entry *) h)->is_func_descriptor);
+
+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
+ {
+ /* If this is the first .plt entry, make room for the special
+ first entry. */
+ s = htab->splt;
+ if (s->_raw_size == 0)
+ s->_raw_size += PLT_INITIAL_ENTRY_SIZE;
+
+ h->plt.offset = s->_raw_size;
+
+ /* Make room for this entry. */
+ s->_raw_size += PLT_ENTRY_SIZE;
+
+ /* Make room for the .stub and .glink code. */
+ s = htab->sstub;
+ s->_raw_size += PLT_CALL_STUB_SIZE;
+
+ s = htab->sglink;
+ if (s->_raw_size == 0)
+ s->_raw_size += GLINK_CALL_STUB_SIZE;
+ /* We need bigger stubs past index 32767. */
+ if (s->_raw_size >= GLINK_CALL_STUB_SIZE + 32768*2*4)
+ s->_raw_size += 4;
+ s->_raw_size += 2*4;
+
+ /* We also need to make an entry in the .rela.plt section. */
+ s = htab->srelplt;
+ s->_raw_size += sizeof (Elf64_External_Rela);
+ }
+ else
+ {
+ h->plt.offset = (bfd_vma) -1;
+ h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ }
+ }
+ else
+ {
+ h->plt.offset = (bfd_vma) -1;
+ h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ }
+
+ if (h->got.refcount > 0)
+ {
+ boolean dyn;
+
+ /* Make sure this symbol is output as a dynamic symbol.
+ Undefined weak syms won't yet be marked as dynamic. */
+ if (h->dynindx == -1
+ && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ {
+ if (! bfd_elf64_link_record_dynamic_symbol (info, h))
+ return false;
+ }
+
+ s = htab->sgot;
+ h->got.offset = s->_raw_size;
+ s->_raw_size += 8;
+ dyn = htab->elf.dynamic_sections_created;
+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h))
+ htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
+ }
+ else
+ h->got.offset = (bfd_vma) -1;
+
+ eh = (struct ppc_link_hash_entry *) h;
+ if (eh->dyn_relocs == NULL)
+ return true;
+
+ /* In the shared -Bsymbolic case, discard space allocated for
+ dynamic pc-relative relocs against symbols which turn out to be
+ defined in regular objects. For the normal shared case, discard
+ space for relocs that have become local due to symbol visibility
+ changes. */
+
+ if (info->shared)
+ {
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
+ && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
+ || info->symbolic))
+ {
+ struct ppc_dyn_relocs **pp;
+
+ for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
+ {
+ p->count -= p->pc_count;
+ p->pc_count = 0;
+ if (p->count == 0)
+ *pp = p->next;
+ else
+ pp = &p->next;
+ }
+ }
+ }
+ else
+ {
+ /* For the non-shared case, discard space for relocs against
+ symbols which turn out to need copy relocs or are not
+ dynamic. */
+
+ if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
+ && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ || (htab->elf.dynamic_sections_created
+ && (h->root.type == bfd_link_hash_undefweak
+ || h->root.type == bfd_link_hash_undefined))))
+ {
+ /* Make sure this symbol is output as a dynamic symbol.
+ Undefined weak syms won't yet be marked as dynamic. */
+ if (h->dynindx == -1
+ && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ {
+ if (! bfd_elf64_link_record_dynamic_symbol (info, h))
+ return false;
+ }
+
+ /* If that succeeded, we know we'll be keeping all the
+ relocs. */
+ if (h->dynindx != -1)
+ goto keep;
+ }
+
+ eh->dyn_relocs = NULL;
+
+ keep: ;
+ }
+
+ /* Finally, allocate space. */
+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ {
+ asection *sreloc = elf_section_data (p->sec)->sreloc;
+ sreloc->_raw_size += p->count * sizeof (Elf64_External_Rela);
+ }
+
+ return true;
+}
+
+/* Find any dynamic relocs that apply to read-only sections. */
+
+static boolean
+readonly_dynrelocs (h, inf)
+ struct elf_link_hash_entry *h;
+ PTR inf;
+{
+ struct ppc_link_hash_entry *eh;
+ struct ppc_dyn_relocs *p;
+
+ eh = (struct ppc_link_hash_entry *) h;
+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ {
+ asection *s = p->sec->output_section;
+
+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
+ {
+ struct bfd_link_info *info = (struct bfd_link_info *) inf;
+
+ info->flags |= DF_TEXTREL;
+
+ /* Not an error, just cut short the traversal. */
+ return false;
+ }
+ }
+ return true;
+}
+
+/* Set the sizes of the dynamic sections. */
+
+static boolean
+ppc64_elf_size_dynamic_sections (output_bfd, info)
+ bfd *output_bfd ATTRIBUTE_UNUSED;
+ struct bfd_link_info *info;
+{
+ struct ppc_link_hash_table *htab;
+ bfd *dynobj;
+ asection *s;
+ boolean relocs;
+ bfd *ibfd;
+
+ htab = ppc_hash_table (info);
+ dynobj = htab->elf.dynobj;
+ if (dynobj == NULL)
+ abort ();
+
+ if (htab->elf.dynamic_sections_created)
+ {
+ /* Set the contents of the .interp section to the interpreter. */
+ if (! info->shared)
+ {
+ s = bfd_get_section_by_name (dynobj, ".interp");
+ if (s == NULL)
+ abort ();
+ s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
+ s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
+ }
+ }
+
+ /* Set up .got offsets for local syms, and space for local dynamic
+ relocs. */
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ {
+ bfd_signed_vma *local_got;
+ bfd_signed_vma *end_local_got;
+ bfd_size_type locsymcount;
+ Elf_Internal_Shdr *symtab_hdr;
+ asection *srel;
+
+ if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
+ continue;
+
+ for (s = ibfd->sections; s != NULL; s = s->next)
+ {
+ struct ppc_dyn_relocs *p;
+
+ for (p = *((struct ppc_dyn_relocs **)
+ &elf_section_data (s)->local_dynrel);
+ p != NULL;
+ p = p->next)
+ {
+ if (!bfd_is_abs_section (p->sec)
+ && bfd_is_abs_section (p->sec->output_section))
+ {
+ /* Input section has been discarded, either because
+ it is a copy of a linkonce section or due to
+ linker script /DISCARD/, so we'll be discarding
+ the relocs too. */
+ }
+ else
+ {
+ srel = elf_section_data (p->sec)->sreloc;
+ srel->_raw_size += p->count * sizeof (Elf64_External_Rela);
+ }
+ }
+ }
+
+ local_got = elf_local_got_refcounts (ibfd);
+ if (!local_got)
+ continue;
+
+ symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+ locsymcount = symtab_hdr->sh_info;
+ end_local_got = local_got + locsymcount;
+ s = htab->sgot;
+ srel = htab->srelgot;
+ for (; local_got < end_local_got; ++local_got)
+ {
+ if (*local_got > 0)
+ {
+ *local_got = s->_raw_size;
+ s->_raw_size += 8;
+ if (info->shared)
+ srel->_raw_size += sizeof (Elf64_External_Rela);
+ }
+ else
+ *local_got = (bfd_vma) -1;
+ }
+ }
+
+ /* Allocate global sym .plt and .got entries, and space for global
+ sym dynamic relocs. */
+ elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
+
+ /* We now have determined the sizes of the various dynamic sections.
+ Allocate memory for them. */
+ relocs = false;
+ for (s = dynobj->sections; s != NULL; s = s->next)
+ {
+ bfd_vma size;
+
+ if ((s->flags & SEC_LINKER_CREATED) == 0)
+ continue;
+
+ if (s == htab->splt
+ || s == htab->sgot
+ || s == htab->sstub
+ || s == htab->sglink)
+ {
+ /* Strip this section if we don't need it; see the
+ comment below. */
+ }
+ else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
+ {
+ if (s->_raw_size == 0)
+ {
+ /* If we don't need this section, strip it from the
+ output file. This is mostly to handle .rela.bss and
+ .rela.plt. We must create both sections in
+ create_dynamic_sections, because they must be created
+ before the linker maps input sections to output
+ sections. The linker does that before
+ adjust_dynamic_symbol is called, and it is that
+ function which decides whether anything needs to go
+ into these sections. */
+ }
+ else
+ {
+ if (s != htab->srelplt)
+ relocs = true;
+
+ /* We use the reloc_count field as a counter if we need
+ to copy relocs into the output file. */
+ s->reloc_count = 0;
+ }
+ }
+ else
+ {
+ /* It's not one of our sections, so don't allocate space. */
+ continue;
+ }
+
+ if (s->_raw_size == 0)
+ {
+ _bfd_strip_section_from_output (info, s);
+ continue;
+ }
+
+ /* Allocate memory for the section contents. We use bfd_zalloc
+ here in case unused entries are not reclaimed before the
+ section's contents are written out. This should not happen,
+ but this way if it does, we get a R_PPC64_NONE reloc instead
+ of garbage. */
+ size = s->_raw_size;
+ if (s == htab->sstub)
+ {
+ /* .stub may grow. Allocate enough for the maximum growth. */
+ size += (size + 65536 + 65535) / 65536 * 4;
+ }
+ s->contents = (bfd_byte *) bfd_zalloc (dynobj, size);
+ if (s->contents == NULL)
+ return false;
+ }
+
+ if (htab->elf.dynamic_sections_created)
+ {
+ /* Add some entries to the .dynamic section. We fill in the
+ values later, in ppc64_elf_finish_dynamic_sections, but we
+ must add the entries now so that we get the correct size for
+ the .dynamic section. The DT_DEBUG entry is filled in by the
+ dynamic linker and used by the debugger. */
+#define add_dynamic_entry(TAG, VAL) \
+ bfd_elf64_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+
+ if (!info->shared)
+ {
+ if (!add_dynamic_entry (DT_DEBUG, 0))
+ return false;
+ }
+
+ if (htab->splt->_raw_size != 0)
+ {
+ if (!add_dynamic_entry (DT_PLTGOT, 0)
+ || !add_dynamic_entry (DT_PLTRELSZ, 0)
+ || !add_dynamic_entry (DT_PLTREL, DT_RELA)
+ || !add_dynamic_entry (DT_JMPREL, 0)
+ || !add_dynamic_entry (DT_PPC64_GLINK, 0))
+ return false;
+ }
+
+ if (relocs)
+ {
+ if (!add_dynamic_entry (DT_RELA, 0)
+ || !add_dynamic_entry (DT_RELASZ, 0)
+ || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela)))
+ return false;
+
+ /* If any dynamic relocs apply to a read-only section,
+ then we need a DT_TEXTREL entry. */
+ elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, (PTR) info);
+
+ if ((info->flags & DF_TEXTREL) != 0)
+ {
+ if (!add_dynamic_entry (DT_TEXTREL, 0))
+ return false;
+ }
+ }
+ }
+#undef add_dynamic_entry
+
+ return true;
+}
+
+/* Called after we have seen all the input files/sections, but before
+ final symbol resolution and section placement has been determined.
+
+ We use this hook to provide a value for TOCstart, which we store in
+ the output bfd elf_gp. */
+
+boolean
+ppc64_elf_set_toc (obfd, info)
+ bfd *obfd;
+ struct bfd_link_info *info;
+{
+ if (!info->relocateable)
+ {
+ asection *s;
+ bfd_vma TOCstart;
+
+ /* The TOC consists of sections .got, .toc, .tocbss, .plt in that
+ order. The TOC starts where the first of these sections starts. */
+ s = bfd_get_section_by_name (obfd, ".got");
+ if (s == NULL)
+ s = bfd_get_section_by_name (obfd, ".toc");
+ if (s == NULL)
+ s = bfd_get_section_by_name (obfd, ".tocbss");
+ if (s == NULL)
+ s = bfd_get_section_by_name (obfd, ".plt");
+ if (s == NULL)
+ {
+ /* This may happen for
+ o references to TOC base (SYM@toc / TOC[tc0]) without a
+ .toc directive
+ o bad linker script
+ o --gc-sections and empty TOC sections
+
+ FIXME: Warn user? */
+
+ /* Look for a likely section. We probably won't even be
+ using TOCstart. */
+ for (s = obfd->sections; s != NULL; s = s->next)
+ if ((s->flags & (SEC_ALLOC | SEC_SMALL_DATA | SEC_READONLY))
+ == (SEC_ALLOC | SEC_SMALL_DATA))
+ break;
+ if (s == NULL)
+ for (s = obfd->sections; s != NULL; s = s->next)
+ if ((s->flags & (SEC_ALLOC | SEC_SMALL_DATA))
+ == (SEC_ALLOC | SEC_SMALL_DATA))
+ break;
+ if (s == NULL)
+ for (s = obfd->sections; s != NULL; s = s->next)
+ if ((s->flags & (SEC_ALLOC | SEC_READONLY)) == SEC_ALLOC)
+ break;
+ if (s == NULL)
+ for (s = obfd->sections; s != NULL; s = s->next)
+ if ((s->flags & SEC_ALLOC) == SEC_ALLOC)
+ break;
+ }
+
+ TOCstart = 0;
+ if (s != NULL)
+ TOCstart = s->output_section->vma + s->output_offset;
+
+ elf_gp (obfd) = TOCstart;
+ }
+ return true;
+}
+
+/* PowerPC64 .plt entries are 24 bytes long, which doesn't divide
+ evenly into 64k. Sometimes with a large enough .plt, we'll need to
+ use offsets differing in the high 16 bits when accessing a .plt
+ entry from a .plt call stub. This function adjusts the size of
+ .stub to accommodate the extra stub instruction needed in such
+ cases. */
+
+boolean
+ppc64_elf_size_stubs (obfd, info, changed)
+ bfd *obfd;
+ struct bfd_link_info *info;
+ int *changed;
+{
+ struct ppc_link_hash_table *htab = ppc_hash_table (info);
+ bfd_vma plt_offset, next_64k;
+ long base, num, extra;
+
+ /* .plt and .stub should be both present, or both absent. */
+ if ((htab->splt == NULL || htab->splt->_raw_size == 0)
+ != (htab->sstub == NULL || htab->sstub->_raw_size == 0))
+ abort ();
+
+ /* If no .plt, then nothing to do. */
+ if (htab->splt == NULL || htab->splt->_raw_size == 0)
+ return true;
+
+ plt_offset = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ - elf_gp (obfd));
+ next_64k = (plt_offset + 65535) & -65536;
+
+ /* If the .plt doesn't have any entries crossing a 64k boundary,
+ then there is no need for bigger stubs. */
+ if (next_64k <= plt_offset + htab->splt->_raw_size)
+ return true;
+
+ /* OK, so we have at least one transition. Since .plt entries are
+ 24 bytes long, we'll strike it lucky every 3*64k, with the 64k
+ boundary between .plt entries. */
+ base = next_64k / 65536;
+ num = (plt_offset + htab->splt->_raw_size - next_64k) / 65536;
+ extra = (base % 3 + num + 1) * 2 / 3;
+
+ /* Allow one extra instruction for each EXTRA. The change in .stub
+ may change the location of .toc and .plt. .toc and .plt ought to
+ move as a group, but someone might be playing with eg. .plt
+ alignment, so don't allow .stub size to decrease. */
+ if (htab->sstub->_cooked_size < htab->sstub->_raw_size + extra * 4)
+ {
+ htab->sstub->_cooked_size = htab->sstub->_raw_size + extra * 4;
+ *changed = true;
+ }
+ return true;
+}
+
+/* Build a .plt call stub. */
+
+static bfd_byte *
+build_plt_stub (obfd, p, offset, glink)
+ bfd *obfd;
+ bfd_byte *p;
+ int offset;
+ int glink;
+{
+#define PPC_LO(v) ((v) & 0xffff)
+#define PPC_HI(v) (((v) >> 16) & 0xffff)
+#define PPC_HA(v) PPC_HI ((v) + 0x8000)
+
+ if (glink)
+ bfd_put_32 (obfd, LD_R2_40R1, p), p += 4;
+ bfd_put_32 (obfd, ADDIS_R12_R2 | PPC_HA (offset), p), p += 4;
+ if (!glink)
+ bfd_put_32 (obfd, STD_R2_40R1, p), p += 4;
+ bfd_put_32 (obfd, LD_R11_0R12 | PPC_LO (offset), p), p += 4;
+ if (PPC_HA (offset + 8) != PPC_HA (offset))
+ bfd_put_32 (obfd, ADDIS_R12_R12_1, p), p += 4;
+ offset += 8;
+ bfd_put_32 (obfd, LD_R2_0R12 | PPC_LO (offset), p), p += 4;
+ if (PPC_HA (offset + 8) != PPC_HA (offset))
+ bfd_put_32 (obfd, ADDIS_R12_R12_1, p), p += 4;
+ offset += 8;
+ bfd_put_32 (obfd, MTCTR_R11, p), p += 4;
+ bfd_put_32 (obfd, LD_R11_0R12 | PPC_LO (offset), p), p += 4;
+ bfd_put_32 (obfd, BCTR, p), p += 4;
+ return p;
+}
+
+/* Build the stubs for one function call. */
+
+static boolean
+build_one_stub (h, inf)
+ struct elf_link_hash_entry *h;
+ PTR inf;
+{
+ struct bfd_link_info *info;
+ struct ppc_link_hash_table *htab;
+
+ if (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ return true;
+
+ info = (struct bfd_link_info *) inf;
+ htab = ppc_hash_table (info);
+
+ if (htab->elf.dynamic_sections_created
+ && h->plt.offset != (bfd_vma) -1
+ && ((struct ppc_link_hash_entry *) h)->is_func_descriptor)
+ {
+ struct elf_link_hash_entry *fh;
+ asection *s;
+ bfd_vma plt_r2;
+ bfd_byte *p;
+ unsigned int indx;
+
+ fh = elf_link_hash_lookup (&htab->elf, h->root.root.string - 1,
+ false, false, true);
+
+ if (fh == NULL)
+ abort ();
+
+ BFD_ASSERT (((struct ppc_link_hash_entry *) fh)->is_func);
+
+ /* Build the .plt call stub. */
+ plt_r2 = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ + h->plt.offset
+ - elf_gp (htab->splt->output_section->owner)
+ - TOC_BASE_OFF);
+
+ if (plt_r2 + 0x80000000 > 0xffffffff
+ || (plt_r2 & 3) != 0)
+ {
+ (*_bfd_error_handler)
+ (_("linkage table error against `%s'"),
+ h->root.root.string);
+ bfd_set_error (bfd_error_bad_value);
+ htab->plt_overflow = true;
+ return false;
+ }
+
+ s = htab->sstub;
+ /* Steal plt.offset to store the stub offset. */
+ fh->plt.offset = s->_cooked_size;
+ p = s->contents + s->_cooked_size;
+ p = build_plt_stub (s->owner, p, (int) plt_r2, 0);
+ s->_cooked_size = p - s->contents;
+
+ /* Build the .glink lazy link call stub. */
+ s = htab->sglink;
+ p = s->contents + s->_cooked_size;
+ indx = s->reloc_count;
+ if (indx < 0x8000)
+ {
+ bfd_put_32 (s->owner, LI_R0_0 | indx, p);
+ p += 4;
+ }
+ else
+ {
+ bfd_put_32 (s->owner, LIS_R0_0 | PPC_HI (indx), p);
+ p += 4;
+ bfd_put_32 (s->owner, ORI_R0_R0_0 | PPC_LO (indx), p);
+ p += 4;
+ }
+ bfd_put_32 (s->owner, B_DOT | ((s->contents - p) & 0x3fffffc), p);
+ p += 4;
+ s->_cooked_size = p - s->contents;
+ s->reloc_count += 1;
+ }
+ return true;
+}
+
+boolean
+ppc64_elf_build_stubs (obfd, info)
+ bfd *obfd;
+ struct bfd_link_info *info;
+{
+ struct ppc_link_hash_table *htab = ppc_hash_table (info);
+ bfd_vma old_stub_size;
+ bfd_vma plt_r2;
+ bfd_byte *p;
+
+ /* If no .plt stubs, then nothing to do. */
+ if (htab->sstub == NULL || htab->sstub->_raw_size == 0)
+ return true;
+
+ old_stub_size = htab->sstub->_cooked_size;
+ htab->sstub->_cooked_size = 0;
+
+ /* Build the .glink plt call stub. */
+ plt_r2 = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ - elf_gp (obfd)
+ - TOC_BASE_OFF);
+ p = htab->sglink->contents;
+ p = build_plt_stub (htab->sglink->owner, p, (int) plt_r2, 1);
+ while (p - htab->sglink->contents < GLINK_CALL_STUB_SIZE)
+ {
+ bfd_put_32 (htab->sglink->owner, NOP, p);
+ p += 4;
+ }
+ htab->sglink->_cooked_size = p - htab->sglink->contents;
+
+ /* Use reloc_count to count entries. */
+ htab->sglink->reloc_count = 0;
+
+ elf_link_hash_traverse (&htab->elf, build_one_stub, (PTR) info);
+ htab->sglink->reloc_count = 0;
+
+ if (htab->plt_overflow)
+ return false;
+
+ if (old_stub_size != htab->sstub->_cooked_size
+ || htab->sglink->_raw_size != htab->sglink->_cooked_size)
+ {
+ (*_bfd_error_handler)
+ (_("stub section size doesn't match calculated size"));
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
+ return true;
+}
+
+/* Set up any other section flags and such that may be necessary. */
+
+static boolean
+ppc64_elf_fake_sections (abfd, shdr, asect)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ Elf64_Internal_Shdr *shdr;
+ asection *asect;
+{
+ if ((asect->flags & SEC_EXCLUDE) != 0)
+ shdr->sh_flags |= SHF_EXCLUDE;
+
+ if ((asect->flags & SEC_SORT_ENTRIES) != 0)
+ shdr->sh_type = SHT_ORDERED;
+
+ return true;
+}
+
+/* The RELOCATE_SECTION function is called by the ELF backend linker
+ to handle the relocations for a section.
+
+ The relocs are always passed as Rela structures; if the section
+ actually uses Rel structures, the r_addend field will always be
+ zero.
+
+ This function is responsible for adjust the section contents as
+ necessary, and (if using Rela relocs and generating a
+ relocateable output file) adjusting the reloc addend as
+ necessary.
+
+ This function does not have to worry about setting the reloc
+ address or the reloc symbol index.
+
+ LOCAL_SYMS is a pointer to the swapped in local symbols.
+
+ LOCAL_SECTIONS is an array giving the section in the input file
+ corresponding to the st_shndx field of each local symbol.
+
+ The global hash table entry for the global symbols can be found
+ via elf_sym_hashes (input_bfd).
+
+ When generating relocateable output, this function must handle
+ STB_LOCAL/STT_SECTION symbols specially. The output symbol is
+ going to be the section symbol corresponding to the output
+ section, which means that the addend must be adjusted
+ accordingly. */
+
+static boolean
+ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
+ contents, relocs, local_syms, local_sections)
+ bfd *output_bfd;
+ struct bfd_link_info *info;
+ bfd *input_bfd;
+ asection *input_section;
+ bfd_byte *contents;
+ Elf_Internal_Rela *relocs;
+ Elf_Internal_Sym *local_syms;
+ asection **local_sections;
+{
+ struct ppc_link_hash_table *htab;
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ Elf_Internal_Rela *rel;
+ Elf_Internal_Rela *relend;
+ bfd_vma *local_got_offsets;
+ bfd_vma TOCstart;
+ boolean ret = true;
+ boolean is_opd;
+
+ /* Initialize howto table if needed. */
+ if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
+ ppc_howto_init ();
+
+ htab = ppc_hash_table (info);
+ local_got_offsets = elf_local_got_offsets (input_bfd);
+ TOCstart = elf_gp (output_bfd);
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ sym_hashes = elf_sym_hashes (input_bfd);
+ is_opd = strcmp (bfd_get_section_name (abfd, input_section), ".opd") == 0;
+
+ rel = relocs;
+ relend = relocs + input_section->reloc_count;
+ for (; rel < relend; rel++)
+ {
+ enum elf_ppc_reloc_type r_type;
+ bfd_vma offset;
+ bfd_vma addend;
+ bfd_reloc_status_type r;
+ Elf_Internal_Sym *sym;
+ asection *sec;
+ struct elf_link_hash_entry *h;
+ const char *sym_name;
+ unsigned long r_symndx;
+ bfd_vma relocation;
+ boolean unresolved_reloc;
+ boolean has_nop;
+ long insn;
+
+ r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info);
+ r_symndx = ELF64_R_SYM (rel->r_info);
+
+ if (info->relocateable)
+ {
+ /* This is a relocatable link. We don't have to change
+ anything, unless the reloc is against a section symbol,
+ in which case we have to adjust according to where the
+ section symbol winds up in the output section. */
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ sym = local_syms + r_symndx;
+ if ((unsigned) ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ {
+ sec = local_sections[r_symndx];
+ rel->r_addend += sec->output_offset + sym->st_value;
+ }
+ }
+ continue;
+ }
+
+ /* This is a final link. */
+
+ offset = rel->r_offset;
+ addend = rel->r_addend;
+ r = bfd_reloc_other;
+ sym = (Elf_Internal_Sym *) 0;
+ sec = (asection *) 0;
+ h = (struct elf_link_hash_entry *) 0;
+ sym_name = (const char *) 0;
+ unresolved_reloc = false;
+
+ if (r_type == R_PPC64_TOC)
+ {
+ /* Relocation value is TOC base. Symbol is ignored. */
+ relocation = TOCstart + TOC_BASE_OFF;
+ }
+ else if (r_symndx < symtab_hdr->sh_info)
+ {
+ /* It's a local symbol. */
+ sym = local_syms + r_symndx;
+ sec = local_sections[r_symndx];
+ sym_name = "<local symbol>";
+
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ addend = rel->r_addend;
+ }
+ else
+ {
+ /* It's a global symbol. */
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ sym_name = h->root.root.string;
+ relocation = 0;
+ if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ {
+ sec = h->root.u.def.section;
+ if (sec->output_section == NULL)
+ /* Set a flag that will be cleared later if we find a
+ relocation value for this symbol. output_section
+ is typically NULL for symbols satisfied by a shared
+ library. */
+ unresolved_reloc = true;
+ else
+ relocation = (h->root.u.def.value
+ + sec->output_section->vma
+ + sec->output_offset);
+ }
+ else if (h->root.type == bfd_link_hash_undefweak)
+ ;
+ else if (info->shared
+ && (!info->symbolic || info->allow_shlib_undefined)
+ && !info->no_undefined
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
+ ;
+ else
+ {
+ if (! ((*info->callbacks->undefined_symbol)
+ (info, h->root.root.string, input_bfd, input_section,
+ offset, (!info->shared
+ || info->no_undefined
+ || ELF_ST_VISIBILITY (h->other)))))
+ return false;
+ }
+ }
+
+ /* First handle relocations that tweak non-addend part of insn. */
+ insn = 0;
+ switch (r_type)
+ {
+ default:
+ break;
+
+ /* Branch taken prediction relocations. */
+ case R_PPC64_ADDR14_BRTAKEN:
+ case R_PPC64_REL14_BRTAKEN:
+ insn = 0x01 << 21; /* Set 't' bit, lowest bit of BO field. */
+ /* Fall thru. */
+
+ /* Branch not taken prediction relocations. */
+ case R_PPC64_ADDR14_BRNTAKEN:
+ case R_PPC64_REL14_BRNTAKEN:
+ insn |= bfd_get_32 (output_bfd, contents + offset) & ~(0x01 << 21);
+ /* Set 'a' bit. This is 0b00010 in BO field for branch on CR(BI)
+ insns (BO == 001at or 011at), and 0b01000 for branch on CTR
+ insns (BO == 1a00t or 1a01t). */
+ if ((insn & (0x14 << 21)) == (0x04 << 21))
+ insn |= 0x02 << 21;
+ else if ((insn & (0x14 << 21)) == (0x10 << 21))
+ insn |= 0x08 << 21;
+ else
+ break;
+
+ bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset);
+ break;
+
+ case R_PPC64_REL24:
+ case R_PPC64_ADDR24:
+ /* An ADDR24 or REL24 branching to a linkage function may be
+ followed by a nop that we have to replace with a ld in
+ order to restore the TOC base pointer. Only calls to
+ shared objects need to alter the TOC base. These are
+ recognized by their need for a PLT entry. */
+ has_nop = 0;
+ if (h != NULL
+ && h->plt.offset != (bfd_vma) -1
+ && htab->sstub != NULL)
+ {
+ /* plt.offset here is the offset into the stub section. */
+ relocation = (htab->sstub->output_section->vma
+ + htab->sstub->output_offset
+ + h->plt.offset);
+ unresolved_reloc = false;
+
+ /* Make sure that there really is an instruction after
+ the branch that we can decode. */
+ if (offset + 8 <= input_section->_cooked_size)
+ {
+ bfd_byte *pnext;
+
+ pnext = contents + offset + 4;
+ insn = bfd_get_32 (input_bfd, pnext);
+
+ if (insn == 0x60000000 /* nop (ori r0,r0,0) */
+ || insn == 0x4def7b82 /* cror 15,15,15 */
+ || insn == 0x4ffffb82) /* cror 31,31,31 */
+ {
+ bfd_put_32 (input_bfd,
+ (bfd_vma) 0xe8410028, /* ld r2,40(r1) */
+ pnext);
+ has_nop = 1;
+ }
+ }
+ }
+
+ if (h != NULL
+ && h->root.type == bfd_link_hash_undefweak
+ && r_type == R_PPC64_REL24
+ && addend == 0
+ && relocation == 0)
+ {
+ /* Tweak calls to undefined weak functions to behave as
+ if the "called" function immediately returns. We can
+ thus call to a weak function without first checking
+ whether the function is defined. */
+ relocation = 4;
+ if (has_nop)
+ relocation = 8;
+ }
+ break;
+ }
+
+ /* Set `addend'. */
+ switch (r_type)
+ {
+ default:
+ (*_bfd_error_handler)
+ (_("%s: unknown relocation type %d for symbol %s"),
+ bfd_archive_filename (input_bfd), (int) r_type, sym_name);
+
+ bfd_set_error (bfd_error_bad_value);
+ ret = false;
+ continue;
+
+ case R_PPC64_NONE:
+ case R_PPC_GNU_VTINHERIT:
+ case R_PPC_GNU_VTENTRY:
+ continue;
+
+ /* GOT16 relocations. Like an ADDR16 using the symbol's
+ address in the GOT as relocation value instead of the
+ symbols value itself. Also, create a GOT entry for the
+ symbol and put the symbol value there. */
+ case R_PPC64_GOT16:
+ case R_PPC64_GOT16_LO:
+ case R_PPC64_GOT16_HI:
+ case R_PPC64_GOT16_HA:
+ case R_PPC64_GOT16_DS:
+ case R_PPC64_GOT16_LO_DS:
+ {
+ /* Relocation is to the entry for this symbol in the global
+ offset table. */
+ bfd_vma off;
+
+ if (htab->sgot == NULL)
+ abort ();
+
+ if (h != NULL)
+ {
+ boolean dyn;
+
+ off = h->got.offset;
+ dyn = htab->elf.dynamic_sections_created;
+ if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)
+ || (info->shared
+ && (info->symbolic
+ || h->dynindx == -1
+ || (h->elf_link_hash_flags
+ & ELF_LINK_FORCED_LOCAL))
+ && (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR)))
+ {
+ /* This is actually a static link, or it is a
+ -Bsymbolic link and the symbol is defined
+ locally, or the symbol was forced to be local
+ because of a version file. We must initialize
+ this entry in the global offset table. Since the
+ offset must always be a multiple of 8, we use the
+ least significant bit to record whether we have
+ initialized it already.
+
+ When doing a dynamic link, we create a .rel.got
+ relocation entry to initialize the value. This
+ is done in the finish_dynamic_symbol routine. */
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
+ bfd_put_64 (output_bfd, relocation,
+ htab->sgot->contents + off);
+ h->got.offset |= 1;
+ }
+ }
+ else
+ unresolved_reloc = false;
+ }
+ else
+ {
+ if (local_got_offsets == NULL)
+ abort ();
+
+ off = local_got_offsets[r_symndx];
+
+ /* The offset must always be a multiple of 8. We use
+ the least significant bit to record whether we have
+ already processed this entry. */
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
+ bfd_put_64 (output_bfd, relocation,
+ htab->sgot->contents + off);
+
+ if (info->shared)
+ {
+ Elf_Internal_Rela outrel;
+ Elf64_External_Rela *loc;
+
+ /* We need to generate a R_PPC64_RELATIVE reloc
+ for the dynamic linker. */
+ outrel.r_offset = (htab->sgot->output_section->vma
+ + htab->sgot->output_offset
+ + off);
+ outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
+ outrel.r_addend = relocation;
+ loc = (Elf64_External_Rela *) htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++;
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+ }
+
+ local_got_offsets[r_symndx] |= 1;
+ }
+ }
+
+ if (off >= (bfd_vma) -2)
+ abort ();
+
+ relocation = htab->sgot->output_offset + off;
+
+ /* TOC base (r2) is TOC start plus 0x8000. */
+ addend -= TOC_BASE_OFF;
+ }
+ break;
+
+ case R_PPC64_PLT16_HA:
+ case R_PPC64_PLT16_HI:
+ case R_PPC64_PLT16_LO:
+ case R_PPC64_PLT32:
+ case R_PPC64_PLT64:
+ /* Relocation is to the entry for this symbol in the
+ procedure linkage table. */
+
+ /* Resolve a PLT reloc against a local symbol directly,
+ without using the procedure linkage table. */
+ if (h == NULL)
+ break;
+
+ if (h->plt.offset == (bfd_vma) -1
+ || htab->splt == NULL)
+ {
+ /* We didn't make a PLT entry for this symbol. This
+ happens when statically linking PIC code, or when
+ using -Bsymbolic. */
+ break;
+ }
+
+ relocation = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ + h->plt.offset);
+ unresolved_reloc = false;
+ break;
+
+ /* TOC16 relocs. We want the offset relative to the TOC base,
+ which is the address of the start of the TOC plus 0x8000.
+ The TOC consists of sections .got, .toc, .tocbss, and .plt,
+ in this order. */
+ case R_PPC64_TOC16:
+ case R_PPC64_TOC16_LO:
+ case R_PPC64_TOC16_HI:
+ case R_PPC64_TOC16_DS:
+ case R_PPC64_TOC16_LO_DS:
+ case R_PPC64_TOC16_HA:
+ addend -= TOCstart + TOC_BASE_OFF;
+ break;
+
+ /* Relocate against the beginning of the section. */
+ case R_PPC64_SECTOFF:
+ case R_PPC64_SECTOFF_LO:
+ case R_PPC64_SECTOFF_HI:
+ case R_PPC64_SECTOFF_DS:
+ case R_PPC64_SECTOFF_LO_DS:
+ case R_PPC64_SECTOFF_HA:
+ if (sec != (asection *) 0)
+ addend -= sec->output_section->vma;
+ break;
+
+ case R_PPC64_REL24:
+ break;
+
+ /* Relocations that may need to be propagated if this is a
+ dynamic object. */
+ case R_PPC64_REL14:
+ case R_PPC64_REL14_BRNTAKEN:
+ case R_PPC64_REL14_BRTAKEN:
+ case R_PPC64_REL32:
+ case R_PPC64_REL64:
+ case R_PPC64_ADDR14:
+ case R_PPC64_ADDR14_BRNTAKEN:
+ case R_PPC64_ADDR14_BRTAKEN:
+ case R_PPC64_ADDR16:
+ case R_PPC64_ADDR16_DS:
+ case R_PPC64_ADDR16_HA:
+ case R_PPC64_ADDR16_HI:
+ case R_PPC64_ADDR16_HIGHER:
+ case R_PPC64_ADDR16_HIGHERA:
+ case R_PPC64_ADDR16_HIGHEST:
+ case R_PPC64_ADDR16_HIGHESTA:
+ case R_PPC64_ADDR16_LO:
+ case R_PPC64_ADDR16_LO_DS:
+ case R_PPC64_ADDR24:
+ case R_PPC64_ADDR30:
+ case R_PPC64_ADDR32:
+ case R_PPC64_ADDR64:
+ case R_PPC64_UADDR16:
+ case R_PPC64_UADDR32:
+ case R_PPC64_UADDR64:
+ /* r_symndx will be zero only for relocs against symbols
+ from removed linkonce sections, or sections discarded by
+ a linker script. */
+ if (r_symndx == 0)
+ break;
+ /* Fall thru. */
+
+ case R_PPC64_TOC:
+ if ((input_section->flags & SEC_ALLOC) == 0)
+ break;
+
+ if (NO_OPD_RELOCS && is_opd)
+ break;
+
+ if ((info->shared
+ && (IS_ABSOLUTE_RELOC (r_type)
+ || (h != NULL
+ && h->dynindx != -1
+ && (! info->symbolic
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ || (!info->shared
+ && h != NULL
+ && h->dynindx != -1
+ && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
+ && (((h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ && (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ || h->root.type == bfd_link_hash_undefweak
+ || h->root.type == bfd_link_hash_undefined)))
+ {
+ Elf_Internal_Rela outrel;
+ boolean skip, relocate;
+ asection *sreloc;
+ Elf64_External_Rela *loc;
+
+ /* When generating a dynamic object, these relocations
+ are copied into the output file to be resolved at run
+ time. */
+
+ skip = false;
+
+ outrel.r_offset =
+ _bfd_elf_section_offset (output_bfd, info, input_section,
+ rel->r_offset);
+ if (outrel.r_offset == (bfd_vma) -1)
+ skip = true;
+
+ outrel.r_offset += (input_section->output_section->vma
+ + input_section->output_offset);
+ outrel.r_addend = addend;
+
+ if (skip)
+ {
+ relocate = false;
+ memset (&outrel, 0, sizeof outrel);
+ }
+ else if (h != NULL
+ && h->dynindx != -1
+ && !is_opd
+ && (!IS_ABSOLUTE_RELOC (r_type)
+ || !info->shared
+ || !info->symbolic
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))
+ {
+ relocate = false;
+ outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
+ }
+ else
+ {
+ /* This symbol is local, or marked to become local,
+ or this is an opd section reloc which must point
+ at a local function. */
+ outrel.r_addend += relocation;
+ relocate = true;
+ if (r_type == R_PPC64_ADDR64 || r_type == R_PPC64_TOC)
+ {
+ outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
+ }
+ else
+ {
+ long indx = 0;
+
+ if (bfd_is_abs_section (sec))
+ ;
+ else if (sec == NULL || sec->owner == NULL)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
+ else
+ {
+ asection *osec;
+
+ osec = sec->output_section;
+ indx = elf_section_data (osec)->dynindx;
+
+ /* We are turning this relocation into one
+ against a section symbol, so subtract out
+ the output section's address but not the
+ offset of the input section in the output
+ section. */
+ outrel.r_addend -= osec->vma;
+ }
+
+ outrel.r_info = ELF64_R_INFO (indx, r_type);
+ }
+ }
+
+ sreloc = elf_section_data (input_section)->sreloc;
+ if (sreloc == NULL)
+ abort ();
+
+ loc = (Elf64_External_Rela *) sreloc->contents;
+ loc += sreloc->reloc_count++;
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+
+ /* If this reloc is against an external symbol, it will
+ be computed at runtime, so there's no need to do
+ anything now. */
+ if (! relocate)
+ continue;
+ }
+ break;
+
+ case R_PPC64_COPY:
+ case R_PPC64_GLOB_DAT:
+ case R_PPC64_JMP_SLOT:
+ case R_PPC64_RELATIVE:
+ /* We shouldn't ever see these dynamic relocs in relocatable
+ files. */
+ /* Fall thru */
+
+ case R_PPC64_PLTGOT16:
+ case R_PPC64_PLTGOT16_DS:
+ case R_PPC64_PLTGOT16_HA:
+ case R_PPC64_PLTGOT16_HI:
+ case R_PPC64_PLTGOT16_LO:
+ case R_PPC64_PLTGOT16_LO_DS:
+ case R_PPC64_PLTREL32:
+ case R_PPC64_PLTREL64:
+ /* These ones haven't been implemented yet. */
+
+ (*_bfd_error_handler)
+ (_("%s: Relocation %s is not supported for symbol %s."),
+ bfd_archive_filename (input_bfd),
+ ppc64_elf_howto_table[(int) r_type]->name, sym_name);
+
+ bfd_set_error (bfd_error_invalid_operation);
+ ret = false;
+ continue;
+ }
+
+ /* Do any further special processing. */
+ switch (r_type)
+ {
+ default:
+ break;
+
+ case R_PPC64_ADDR16_HA:
+ case R_PPC64_ADDR16_HIGHERA:
+ case R_PPC64_ADDR16_HIGHESTA:
+ case R_PPC64_PLT16_HA:
+ case R_PPC64_TOC16_HA:
+ case R_PPC64_SECTOFF_HA:
+ /* It's just possible that this symbol is a weak symbol
+ that's not actually defined anywhere. In that case,
+ 'sec' would be NULL, and we should leave the symbol
+ alone (it will be set to zero elsewhere in the link). */
+ if (sec != NULL)
+ /* Add 0x10000 if sign bit in 0:15 is set. */
+ addend += ((relocation + addend) & 0x8000) << 1;
+ break;
+
+ case R_PPC64_ADDR16_DS:
+ case R_PPC64_ADDR16_LO_DS:
+ case R_PPC64_GOT16_DS:
+ case R_PPC64_GOT16_LO_DS:
+ case R_PPC64_PLT16_LO_DS:
+ case R_PPC64_SECTOFF_DS:
+ case R_PPC64_SECTOFF_LO_DS:
+ case R_PPC64_TOC16_DS:
+ case R_PPC64_TOC16_LO_DS:
+ case R_PPC64_PLTGOT16_DS:
+ case R_PPC64_PLTGOT16_LO_DS:
+ if (((relocation + addend) & 3) != 0)
+ {
+ (*_bfd_error_handler)
+ (_("%s: error: relocation %s not a multiple of 4"),
+ bfd_archive_filename (input_bfd),
+ ppc64_elf_howto_table[(int) r_type]->name);
+ bfd_set_error (bfd_error_bad_value);
+ ret = false;
+ continue;
+ }
+ break;
+ }
+
+ /* FIXME: Why do we allow debugging sections to escape this error?
+ More importantly, why do we not emit dynamic relocs above in
+ debugging sections (which are ! SEC_ALLOC)? If we had
+ emitted the dynamic reloc, we could remove the fudge here. */
+ if (unresolved_reloc
+ && !(info->shared
+ && (input_section->flags & SEC_DEBUGGING) != 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
+ (*_bfd_error_handler)
+ (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
+ bfd_archive_filename (input_bfd),
+ bfd_get_section_name (input_bfd, input_section),
+ (long) rel->r_offset,
+ h->root.root.string);
+
+ r = _bfd_final_link_relocate (ppc64_elf_howto_table[(int) r_type],
+ input_bfd,
+ input_section,
+ contents,
+ offset,
+ relocation,
+ addend);
+
+ if (r == bfd_reloc_ok)
+ ;
+ else if (r == bfd_reloc_overflow)
+ {
+ const char *name;
+
+ if (h != NULL)
+ {
+ if (h->root.type == bfd_link_hash_undefweak
+ && ppc64_elf_howto_table[(int) r_type]->pc_relative)
+ {
+ /* Assume this is a call protected by other code that
+ detects the symbol is undefined. If this is the case,
+ we can safely ignore the overflow. If not, the
+ program is hosed anyway, and a little warning isn't
+ going to help. */
+
+ continue;
+ }
+
+ name = h->root.root.string;
+ }
+ else
+ {
+ name = bfd_elf_string_from_elf_section (input_bfd,
+ symtab_hdr->sh_link,
+ sym->st_name);
+ if (name == NULL)
+ continue;
+ if (*name == '\0')
+ name = bfd_section_name (input_bfd, sec);
+ }
+
+ if (! ((*info->callbacks->reloc_overflow)
+ (info, name, ppc64_elf_howto_table[(int) r_type]->name,
+ (bfd_vma) 0, input_bfd, input_section, offset)))
+ return false;
+ }
+ else
+ ret = false;
+ }
+
+ return ret;
+}
+
+/* Finish up dynamic symbol handling. We set the contents of various
+ dynamic sections here. */
+
+static boolean
+ppc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
+ bfd *output_bfd;
+ struct bfd_link_info *info;
+ struct elf_link_hash_entry *h;
+ Elf_Internal_Sym *sym;
+{
+ struct ppc_link_hash_table *htab;
+ bfd *dynobj;
+
+ htab = ppc_hash_table (info);
+ dynobj = htab->elf.dynobj;
+
+ if (h->plt.offset != (bfd_vma) -1
+ && ((struct ppc_link_hash_entry *) h)->is_func_descriptor)
+ {
+ Elf_Internal_Rela rela;
+ Elf64_External_Rela *loc;
+
+ /* This symbol has an entry in the procedure linkage table. Set
+ it up. */
+
+ if (htab->splt == NULL
+ || htab->srelplt == NULL
+ || htab->sglink == NULL)
+ abort ();
+
+ /* Create a JMP_SLOT reloc to inform the dynamic linker to
+ fill in the PLT entry. */
+
+ rela.r_offset = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ + h->plt.offset);
+ rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_JMP_SLOT);
+ rela.r_addend = 0;
+
+ loc = (Elf64_External_Rela *) htab->srelplt->contents;
+ loc += (h->plt.offset - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE;
+ bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
+ }
+
+ if (h->got.offset != (bfd_vma) -1)
+ {
+ Elf_Internal_Rela rela;
+ Elf64_External_Rela *loc;
+
+ /* This symbol has an entry in the global offset table. Set it
+ up. */
+
+ if (htab->sgot == NULL || htab->srelgot == NULL)
+ abort ();
+
+ rela.r_offset = (htab->sgot->output_section->vma
+ + htab->sgot->output_offset
+ + (h->got.offset &~ (bfd_vma) 1));
+
+ /* If this is a static link, or it is a -Bsymbolic link and the
+ symbol is defined locally or was forced to be local because
+ of a version file, we just want to emit a RELATIVE reloc.
+ The entry in the global offset table will already have been
+ initialized in the relocate_section function. */
+ if (info->shared
+ && (info->symbolic
+ || h->dynindx == -1
+ || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+ {
+ BFD_ASSERT((h->got.offset & 1) != 0);
+ rela.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
+ rela.r_addend = (h->root.u.def.value
+ + h->root.u.def.section->output_section->vma
+ + h->root.u.def.section->output_offset);
+ }
+ else
+ {
+ BFD_ASSERT ((h->got.offset & 1) == 0);
+ bfd_put_64 (output_bfd, (bfd_vma) 0,
+ htab->sgot->contents + h->got.offset);
+ rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_GLOB_DAT);
+ rela.r_addend = 0;
+ }
+
+ loc = (Elf64_External_Rela *) htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++;
+ bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
+ }
+
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
+ {
+ Elf_Internal_Rela rela;
+ Elf64_External_Rela *loc;
+
+ /* This symbol needs a copy reloc. Set it up. */
+
+ if (h->dynindx == -1
+ || (h->root.type != bfd_link_hash_defined
+ && h->root.type != bfd_link_hash_defweak)
+ || htab->srelbss == NULL)
+ abort ();
+
+ rela.r_offset = (h->root.u.def.value
+ + h->root.u.def.section->output_section->vma
+ + h->root.u.def.section->output_offset);
+ rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_COPY);
+ rela.r_addend = 0;
+ loc = (Elf64_External_Rela *) htab->srelbss->contents;
+ loc += htab->srelbss->reloc_count++;
+ bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
+ }
+
+ /* Mark some specially defined symbols as absolute. */
+ if (strcmp (h->root.root.string, "_DYNAMIC") == 0)
+ sym->st_shndx = SHN_ABS;
+
+ return true;
+}
+
+/* Used to decide how to sort relocs in an optimal manner for the
+ dynamic linker, before writing them out. */
+
+static enum elf_reloc_type_class
+ppc64_elf_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
+{
+ enum elf_ppc_reloc_type r_type;
+
+ r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rela->r_info);
+ switch (r_type)
+ {
+ case R_PPC64_RELATIVE:
+ return reloc_class_relative;
+ case R_PPC64_JMP_SLOT:
+ return reloc_class_plt;
+ case R_PPC64_COPY:
+ return reloc_class_copy;
+ default:
+ return reloc_class_normal;
+ }
+}
+
+/* Finish up the dynamic sections. */
+
+static boolean
+ppc64_elf_finish_dynamic_sections (output_bfd, info)
+ bfd *output_bfd;
+ struct bfd_link_info *info;
+{
+ struct ppc_link_hash_table *htab;
+ bfd *dynobj;
+ asection *sdyn;
+
+ htab = ppc_hash_table (info);
+ dynobj = htab->elf.dynobj;
+ sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
+
+ if (htab->elf.dynamic_sections_created)
+ {
+ Elf64_External_Dyn *dyncon, *dynconend;
+
+ if (sdyn == NULL || htab->sgot == NULL)
+ abort ();
+
+ dyncon = (Elf64_External_Dyn *) sdyn->contents;
+ dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size);
+ for (; dyncon < dynconend; dyncon++)
+ {
+ Elf_Internal_Dyn dyn;
+
+ bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn);
+
+ switch (dyn.d_tag)
+ {
+ default:
+ continue;
+
+ case DT_PPC64_GLINK:
+ dyn.d_un.d_ptr = (htab->sglink->output_section->vma
+ + htab->sglink->output_offset);
+ break;
+
+ case DT_PLTGOT:
+ dyn.d_un.d_ptr = (htab->splt->output_section->vma
+ + htab->splt->output_offset);
+ break;
+
+ case DT_JMPREL:
+ dyn.d_un.d_ptr = (htab->srelplt->output_section->vma
+ + htab->srelplt->output_offset);
+ break;
+
+ case DT_PLTRELSZ:
+ dyn.d_un.d_val = htab->srelplt->_raw_size;
+ break;
+
+ case DT_RELASZ:
+ /* Don't count procedure linkage table relocs in the
+ overall reloc count. */
+ if (htab->srelplt != NULL)
+ dyn.d_un.d_val -= htab->srelplt->_raw_size;
+ break;
+ }
+
+ bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
+ }
+ }
+
+ if (htab->sgot != NULL && htab->sgot->_raw_size != 0)
+ {
+ /* Fill in the first entry in the global offset table.
+ We use it to hold the link-time TOCbase. */
+ bfd_put_64 (output_bfd,
+ elf_gp (output_bfd) + TOC_BASE_OFF,
+ htab->sgot->contents);
+
+ /* Set .got entry size. */
+ elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize = 8;
+ }
+
+ if (htab->splt != NULL && htab->splt->_raw_size != 0)
+ {
+ /* Set .plt entry size. */
+ elf_section_data (htab->splt->output_section)->this_hdr.sh_entsize
+ = PLT_ENTRY_SIZE;
+ }
+
+ return true;
+}
+
+#define TARGET_LITTLE_SYM bfd_elf64_powerpcle_vec
+#define TARGET_LITTLE_NAME "elf64-powerpcle"
+#define TARGET_BIG_SYM bfd_elf64_powerpc_vec
+#define TARGET_BIG_NAME "elf64-powerpc"
+#define ELF_ARCH bfd_arch_powerpc
+#define ELF_MACHINE_CODE EM_PPC64
+#define ELF_MAXPAGESIZE 0x10000
+#define elf_info_to_howto ppc64_elf_info_to_howto
+
+#ifdef EM_CYGNUS_POWERPC
+#define ELF_MACHINE_ALT1 EM_CYGNUS_POWERPC
+#endif
+
+#ifdef EM_PPC_OLD
+#define ELF_MACHINE_ALT2 EM_PPC_OLD
+#endif
+
+#define elf_backend_want_got_sym 0
+#define elf_backend_want_plt_sym 0
+#define elf_backend_plt_alignment 3
+#define elf_backend_plt_not_loaded 1
+#define elf_backend_got_symbol_offset 0
+#define elf_backend_got_header_size 8
+#define elf_backend_plt_header_size PLT_INITIAL_ENTRY_SIZE
+#define elf_backend_can_gc_sections 1
+#define elf_backend_can_refcount 1
+
+#define bfd_elf64_bfd_reloc_type_lookup ppc64_elf_reloc_type_lookup
+#define bfd_elf64_bfd_set_private_flags ppc64_elf_set_private_flags
+#define bfd_elf64_bfd_merge_private_bfd_data ppc64_elf_merge_private_bfd_data
+#define bfd_elf64_bfd_link_hash_table_create ppc64_elf_link_hash_table_create
+
+#define elf_backend_section_from_shdr ppc64_elf_section_from_shdr
+#define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections
+#define elf_backend_copy_indirect_symbol ppc64_elf_copy_indirect_symbol
+#define elf_backend_check_relocs ppc64_elf_check_relocs
+#define elf_backend_gc_mark_hook ppc64_elf_gc_mark_hook
+#define elf_backend_gc_sweep_hook ppc64_elf_gc_sweep_hook
+#define elf_backend_adjust_dynamic_symbol ppc64_elf_adjust_dynamic_symbol
+#define elf_backend_hide_symbol ppc64_elf_hide_symbol
+#define elf_backend_always_size_sections ppc64_elf_func_desc_adjust
+#define elf_backend_size_dynamic_sections ppc64_elf_size_dynamic_sections
+#define elf_backend_fake_sections ppc64_elf_fake_sections
+#define elf_backend_relocate_section ppc64_elf_relocate_section
+#define elf_backend_finish_dynamic_symbol ppc64_elf_finish_dynamic_symbol
+#define elf_backend_reloc_type_class ppc64_elf_reloc_type_class
+#define elf_backend_finish_dynamic_sections ppc64_elf_finish_dynamic_sections
+
+#include "elf64-target.h"
diff --git a/contrib/binutils/bfd/elf64-ppc.h b/contrib/binutils/bfd/elf64-ppc.h
new file mode 100644
index 0000000..b261a58
--- /dev/null
+++ b/contrib/binutils/bfd/elf64-ppc.h
@@ -0,0 +1,22 @@
+/* PowerPC64-specific support for 64-bit ELF.
+ Copyright 2002 Free Software Foundation, Inc.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+boolean ppc64_elf_set_toc PARAMS ((bfd *, struct bfd_link_info *));
+boolean ppc64_elf_size_stubs PARAMS ((bfd *, struct bfd_link_info *, int *));
+boolean ppc64_elf_build_stubs PARAMS ((bfd *, struct bfd_link_info *));
diff --git a/contrib/binutils/bfd/elf64-sparc.c b/contrib/binutils/bfd/elf64-sparc.c
index bd32b6e..07c78bc 100644
--- a/contrib/binutils/bfd/elf64-sparc.c
+++ b/contrib/binutils/bfd/elf64-sparc.c
@@ -35,44 +35,55 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define MINUS_ONE (~ (bfd_vma) 0)
static struct bfd_link_hash_table * sparc64_elf_bfd_link_hash_table_create
- PARAMS((bfd *));
+ PARAMS ((bfd *));
+static bfd_reloc_status_type init_insn_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *,
+ bfd *, bfd_vma *, bfd_vma *));
static reloc_howto_type *sparc64_elf_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void sparc64_elf_info_to_howto
PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static void sparc64_elf_build_plt
- PARAMS((bfd *, unsigned char *, int));
+ PARAMS ((bfd *, unsigned char *, int));
static bfd_vma sparc64_elf_plt_entry_offset
- PARAMS((int));
+ PARAMS ((bfd_vma));
static bfd_vma sparc64_elf_plt_ptr_offset
- PARAMS((int, int));
+ PARAMS ((bfd_vma, bfd_vma));
static boolean sparc64_elf_check_relocs
- PARAMS((bfd *, struct bfd_link_info *, asection *sec,
- const Elf_Internal_Rela *));
+ PARAMS ((bfd *, struct bfd_link_info *, asection *sec,
+ const Elf_Internal_Rela *));
static boolean sparc64_elf_adjust_dynamic_symbol
- PARAMS((struct bfd_link_info *, struct elf_link_hash_entry *));
+ PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
static boolean sparc64_elf_size_dynamic_sections
- PARAMS((bfd *, struct bfd_link_info *));
+ PARAMS ((bfd *, struct bfd_link_info *));
static int sparc64_elf_get_symbol_type
PARAMS (( Elf_Internal_Sym *, int));
static boolean sparc64_elf_add_symbol_hook
PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
- const char **, flagword *, asection **, bfd_vma *));
+ const char **, flagword *, asection **, bfd_vma *));
+static boolean sparc64_elf_output_arch_syms
+ PARAMS ((bfd *, struct bfd_link_info *, PTR,
+ boolean (*) (PTR, const char *, Elf_Internal_Sym *, asection *)));
static void sparc64_elf_symbol_processing
PARAMS ((bfd *, asymbol *));
-static boolean sparc64_elf_copy_private_bfd_data
- PARAMS ((bfd *, bfd *));
static boolean sparc64_elf_merge_private_bfd_data
PARAMS ((bfd *, bfd *));
+static const char *sparc64_elf_print_symbol_all
+ PARAMS ((bfd *, PTR, asymbol *));
static boolean sparc64_elf_relax_section
PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
static boolean sparc64_elf_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+static boolean sparc64_elf_finish_dynamic_symbol
+ PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
+ Elf_Internal_Sym *));
+static boolean sparc64_elf_finish_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
static boolean sparc64_elf_object_p PARAMS ((bfd *));
static long sparc64_elf_get_reloc_upper_bound PARAMS ((bfd *, asection *));
static long sparc64_elf_get_dynamic_reloc_upper_bound PARAMS ((bfd *));
@@ -83,6 +94,8 @@ static boolean sparc64_elf_slurp_reloc_table
static long sparc64_elf_canonicalize_dynamic_reloc
PARAMS ((bfd *, arelent **, asymbol **));
static void sparc64_elf_write_relocs PARAMS ((bfd *, asection *, PTR));
+static enum elf_reloc_type_class sparc64_elf_reloc_type_class
+ PARAMS ((const Elf_Internal_Rela *));
/* The relocation "howto" table. */
@@ -103,7 +116,7 @@ static reloc_howto_type sparc64_elf_howto_table[] =
HOWTO(R_SPARC_32, 0,2,32,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_32", false,0,0xffffffff,true),
HOWTO(R_SPARC_DISP8, 0,0, 8,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP8", false,0,0x000000ff,true),
HOWTO(R_SPARC_DISP16, 0,1,16,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP16", false,0,0x0000ffff,true),
- HOWTO(R_SPARC_DISP32, 0,2,32,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP32", false,0,0x00ffffff,true),
+ HOWTO(R_SPARC_DISP32, 0,2,32,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP32", false,0,0xffffffff,true),
HOWTO(R_SPARC_WDISP30, 2,2,30,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP30", false,0,0x3fffffff,true),
HOWTO(R_SPARC_WDISP22, 2,2,22,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP22", false,0,0x003fffff,true),
HOWTO(R_SPARC_HI22, 10,2,22,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_HI22", false,0,0x003fffff,true),
@@ -122,8 +135,8 @@ static reloc_howto_type sparc64_elf_howto_table[] =
HOWTO(R_SPARC_RELATIVE, 0,0,00,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_RELATIVE",false,0,0x00000000,true),
HOWTO(R_SPARC_UA32, 0,2,32,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA32", false,0,0xffffffff,true),
#ifndef SPARC64_OLD_RELOCS
+ HOWTO(R_SPARC_PLT32, 0,2,32,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_PLT32", false,0,0xffffffff,true),
/* These aren't implemented yet. */
- HOWTO(R_SPARC_PLT32, 0,0,00,false,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_PLT32", false,0,0x00000000,true),
HOWTO(R_SPARC_HIPLT22, 0,0,00,false,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_HIPLT22", false,0,0x00000000,true),
HOWTO(R_SPARC_LOPLT10, 0,0,00,false,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_LOPLT10", false,0,0x00000000,true),
HOWTO(R_SPARC_PCPLT32, 0,0,00,false,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_PCPLT32", false,0,0x00000000,true),
@@ -147,7 +160,7 @@ static reloc_howto_type sparc64_elf_howto_table[] =
HOWTO(R_SPARC_5, 0,2, 5,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_5", false,0,0x0000001f,true),
HOWTO(R_SPARC_6, 0,2, 6,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_6", false,0,0x0000003f,true),
HOWTO(R_SPARC_DISP64, 0,4,64,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP64", false,0,MINUS_ONE, true),
- HOWTO(R_SPARC_PLT64, 0,4,64,false,0,complain_overflow_bitfield,sparc_elf_notsup_reloc, "R_SPARC_PLT64", false,0,MINUS_ONE, false),
+ HOWTO(R_SPARC_PLT64, 0,4,64,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_PLT64", false,0,MINUS_ONE, true),
HOWTO(R_SPARC_HIX22, 0,4, 0,false,0,complain_overflow_bitfield,sparc_elf_hix22_reloc, "R_SPARC_HIX22", false,0,MINUS_ONE, false),
HOWTO(R_SPARC_LOX10, 0,4, 0,false,0,complain_overflow_dont, sparc_elf_lox10_reloc, "R_SPARC_LOX10", false,0,MINUS_ONE, false),
HOWTO(R_SPARC_H44, 22,2,22,false,0,complain_overflow_unsigned,bfd_elf_generic_reloc, "R_SPARC_H44", false,0,0x003fffff,false),
@@ -163,10 +176,11 @@ struct elf_reloc_map {
unsigned char elf_reloc_val;
};
-static CONST struct elf_reloc_map sparc_reloc_map[] =
+static const struct elf_reloc_map sparc_reloc_map[] =
{
{ BFD_RELOC_NONE, R_SPARC_NONE, },
{ BFD_RELOC_16, R_SPARC_16, },
+ { BFD_RELOC_16_PCREL, R_SPARC_DISP16 },
{ BFD_RELOC_8, R_SPARC_8 },
{ BFD_RELOC_8_PCREL, R_SPARC_DISP8 },
{ BFD_RELOC_CTOR, R_SPARC_64 },
@@ -175,6 +189,7 @@ static CONST struct elf_reloc_map sparc_reloc_map[] =
{ BFD_RELOC_HI22, R_SPARC_HI22 },
{ BFD_RELOC_LO10, R_SPARC_LO10, },
{ BFD_RELOC_32_PCREL_S2, R_SPARC_WDISP30 },
+ { BFD_RELOC_64_PCREL, R_SPARC_DISP64 },
{ BFD_RELOC_SPARC22, R_SPARC_22 },
{ BFD_RELOC_SPARC13, R_SPARC_13 },
{ BFD_RELOC_SPARC_GOT10, R_SPARC_GOT10 },
@@ -207,6 +222,9 @@ static CONST struct elf_reloc_map sparc_reloc_map[] =
{ BFD_RELOC_SPARC_5, R_SPARC_5 },
{ BFD_RELOC_SPARC_6, R_SPARC_6 },
{ BFD_RELOC_SPARC_DISP64, R_SPARC_DISP64 },
+#ifndef SPARC64_OLD_RELOCS
+ { BFD_RELOC_SPARC_PLT32, R_SPARC_PLT32 },
+#endif
{ BFD_RELOC_SPARC_PLT64, R_SPARC_PLT64 },
{ BFD_RELOC_SPARC_HIX22, R_SPARC_HIX22 },
{ BFD_RELOC_SPARC_LOX10, R_SPARC_LOX10 },
@@ -280,13 +298,12 @@ sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic)
bfd_size_type count;
arelent *relents;
- allocated = (PTR) bfd_malloc ((size_t) rel_hdr->sh_size);
+ allocated = (PTR) bfd_malloc (rel_hdr->sh_size);
if (allocated == NULL)
goto error_return;
if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0
- || (bfd_read (allocated, 1, rel_hdr->sh_size, abfd)
- != rel_hdr->sh_size))
+ || bfd_bread (allocated, rel_hdr->sh_size, abfd) != rel_hdr->sh_size)
goto error_return;
native_relocs = (bfd_byte *) allocated;
@@ -371,6 +388,7 @@ sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
struct bfd_elf_section_data * const d = elf_section_data (asect);
Elf_Internal_Shdr *rel_hdr;
Elf_Internal_Shdr *rel_hdr2;
+ bfd_size_type amt;
if (asect->relocation != NULL)
return true;
@@ -401,9 +419,9 @@ sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
rel_hdr2 = NULL;
}
- asect->relocation = ((arelent *)
- bfd_alloc (abfd,
- asect->reloc_count * 2 * sizeof (arelent)));
+ amt = asect->reloc_count;
+ amt *= 2 * sizeof (arelent);
+ asect->relocation = (arelent *) bfd_alloc (abfd, amt);
if (asect->relocation == NULL)
return false;
@@ -639,9 +657,9 @@ sparc64_elf_bfd_link_hash_table_create (abfd)
bfd *abfd;
{
struct sparc64_elf_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct sparc64_elf_link_hash_table);
- ret = ((struct sparc64_elf_link_hash_table *)
- bfd_zalloc (abfd, sizeof (struct sparc64_elf_link_hash_table)));
+ ret = (struct sparc64_elf_link_hash_table *) bfd_zalloc (abfd, amt);
if (ret == (struct sparc64_elf_link_hash_table *) NULL)
return NULL;
@@ -759,8 +777,8 @@ sparc_elf_wdisp16_reloc (abfd, reloc_entry, symbol, data, input_section,
if (status != bfd_reloc_other)
return status;
- insn = (insn & ~0x303fff) | ((((relocation >> 2) & 0xc000) << 6)
- | ((relocation >> 2) & 0x3fff));
+ insn &= ~ (bfd_vma) 0x303fff;
+ insn |= (((relocation >> 2) & 0xc000) << 6) | ((relocation >> 2) & 0x3fff);
bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
if ((bfd_signed_vma) relocation < - 0x40000
@@ -798,7 +816,7 @@ sparc_elf_hix22_reloc (abfd,
return status;
relocation ^= MINUS_ONE;
- insn = (insn & ~0x3fffff) | ((relocation >> 10) & 0x3fffff);
+ insn = (insn &~ (bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff);
bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
if ((relocation & ~ (bfd_vma) 0xffffffff) != 0)
@@ -834,7 +852,7 @@ sparc_elf_lox10_reloc (abfd,
if (status != bfd_reloc_other)
return status;
- insn = (insn & ~0x1fff) | 0x1c00 | (relocation & 0x3ff);
+ insn = (insn &~ (bfd_vma) 0x1fff) | 0x1c00 | (relocation & 0x3ff);
bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
return bfd_reloc_ok;
@@ -865,7 +883,7 @@ sparc64_elf_build_plt (output_bfd, contents, nentries)
We fill them with `illtrap 0' to force ld.so to do something. */
for (i = 0; i < PLT_HEADER_SIZE/4; ++i)
- bfd_put_32 (output_bfd, 0, contents+i*4);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, contents+i*4);
/* The first 32768 entries are close enough to plt1 to get there via
a straight branch. */
@@ -881,14 +899,14 @@ sparc64_elf_build_plt (output_bfd, contents, nentries)
/* ba,a,pt %xcc, plt1 */
ba = 0x30680000 | (((contents+PLT_ENTRY_SIZE) - (entry+4)) / 4 & 0x7ffff);
- bfd_put_32 (output_bfd, sethi, entry);
- bfd_put_32 (output_bfd, ba, entry+4);
- bfd_put_32 (output_bfd, nop, entry+8);
- bfd_put_32 (output_bfd, nop, entry+12);
- bfd_put_32 (output_bfd, nop, entry+16);
- bfd_put_32 (output_bfd, nop, entry+20);
- bfd_put_32 (output_bfd, nop, entry+24);
- bfd_put_32 (output_bfd, nop, entry+28);
+ bfd_put_32 (output_bfd, (bfd_vma) sethi, entry);
+ bfd_put_32 (output_bfd, (bfd_vma) ba, entry + 4);
+ bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 8);
+ bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 12);
+ bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 16);
+ bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 20);
+ bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 24);
+ bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 28);
}
/* Now the tricky bit. Entries 32768 and higher are grouped in blocks of
@@ -906,17 +924,23 @@ sparc64_elf_build_plt (output_bfd, contents, nentries)
entry = contents + i*PLT_ENTRY_SIZE + j*4*6;
ptr = contents + i*PLT_ENTRY_SIZE + block*4*6 + j*8;
- /* ldx [%o7 + ptr - entry+4], %g1 */
- ldx = 0xc25be000 | ((ptr - entry+4) & 0x1fff);
-
- bfd_put_32 (output_bfd, 0x8a10000f, entry); /* mov %o7,%g5 */
- bfd_put_32 (output_bfd, 0x40000002, entry+4); /* call .+8 */
- bfd_put_32 (output_bfd, nop, entry+8); /* nop */
- bfd_put_32 (output_bfd, ldx, entry+12); /* ldx [%o7+P],%g1 */
- bfd_put_32 (output_bfd, 0x83c3c001, entry+16); /* jmpl %o7+%g1,%g1 */
- bfd_put_32 (output_bfd, 0x9e100005, entry+20); /* mov %g5,%o7 */
-
- bfd_put_64 (output_bfd, contents - (entry+4), ptr);
+ /* ldx [%o7 + ptr - (entry+4)], %g1 */
+ ldx = 0xc25be000 | ((ptr - (entry+4)) & 0x1fff);
+
+ /* mov %o7,%g5
+ call .+8
+ nop
+ ldx [%o7+P],%g1
+ jmpl %o7+%g1,%g1
+ mov %g5,%o7 */
+ bfd_put_32 (output_bfd, (bfd_vma) 0x8a10000f, entry);
+ bfd_put_32 (output_bfd, (bfd_vma) 0x40000002, entry + 4);
+ bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 8);
+ bfd_put_32 (output_bfd, (bfd_vma) ldx, entry + 12);
+ bfd_put_32 (output_bfd, (bfd_vma) 0x83c3c001, entry + 16);
+ bfd_put_32 (output_bfd, (bfd_vma) 0x9e100005, entry + 20);
+
+ bfd_put_64 (output_bfd, (bfd_vma) (contents - (entry + 4)), ptr);
}
}
}
@@ -925,9 +949,9 @@ sparc64_elf_build_plt (output_bfd, contents, nentries)
static bfd_vma
sparc64_elf_plt_entry_offset (index)
- int index;
+ bfd_vma index;
{
- int block, ofs;
+ bfd_vma block, ofs;
if (index < LARGE_PLT_THRESHOLD)
return index * PLT_ENTRY_SIZE;
@@ -937,22 +961,21 @@ sparc64_elf_plt_entry_offset (index)
block = (index - LARGE_PLT_THRESHOLD) / 160;
ofs = (index - LARGE_PLT_THRESHOLD) % 160;
- return ((bfd_vma) (LARGE_PLT_THRESHOLD + block*160) * PLT_ENTRY_SIZE
- + ofs * 6*4);
+ return (LARGE_PLT_THRESHOLD + block * 160) * PLT_ENTRY_SIZE + ofs * 6 * 4;
}
static bfd_vma
sparc64_elf_plt_ptr_offset (index, max)
- int index, max;
+ bfd_vma index;
+ bfd_vma max;
{
- int block, ofs, last;
+ bfd_vma block, ofs, last;
BFD_ASSERT(index >= LARGE_PLT_THRESHOLD);
/* See above for details. */
- block = (((index - LARGE_PLT_THRESHOLD) / 160) * 160)
- + LARGE_PLT_THRESHOLD;
+ block = (((index - LARGE_PLT_THRESHOLD) / 160) * 160) + LARGE_PLT_THRESHOLD;
ofs = index - block;
if (block + 160 > max)
last = (max - LARGE_PLT_THRESHOLD) % 160;
@@ -1073,10 +1096,11 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs)
symbol. */
if (local_got_offsets == NULL)
{
- size_t size;
+ bfd_size_type size;
register unsigned int i;
- size = symtab_hdr->sh_info * sizeof (bfd_vma);
+ size = symtab_hdr->sh_info;
+ size *= sizeof (bfd_vma);
local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size);
if (local_got_offsets == NULL)
return false;
@@ -1148,8 +1172,10 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs)
}
h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- break;
-
+ if (ELF64_R_TYPE_ID (rel->r_info) != R_SPARC_PLT32
+ && ELF64_R_TYPE_ID (rel->r_info) != R_SPARC_PLT64)
+ break;
+ /* Fall through. */
case R_SPARC_PC10:
case R_SPARC_PC22:
case R_SPARC_PC_HH22:
@@ -1235,6 +1261,8 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs)
|| ! bfd_set_section_alignment (dynobj, sreloc, 3))
return false;
}
+ if (sec->flags & SEC_READONLY)
+ info->flags |= DF_TEXTREL;
}
sreloc->_raw_size += sizeof (Elf64_External_Rela);
@@ -1247,7 +1275,7 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs)
default:
(*_bfd_error_handler) (_("%s: check_relocs: unhandled reloc type %d"),
- bfd_get_filename(abfd),
+ bfd_archive_filename (abfd),
ELF64_R_TYPE_ID (rel->r_info));
return false;
}
@@ -1269,7 +1297,7 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
asection **secp ATTRIBUTE_UNUSED;
bfd_vma *valp ATTRIBUTE_UNUSED;
{
- static char *stt_types[] = { "NOTYPE", "OBJECT", "FUNCTION" };
+ static const char *const stt_types[] = { "NOTYPE", "OBJECT", "FUNCTION" };
if (ELF_ST_TYPE (sym->st_info) == STT_REGISTER)
{
@@ -1284,7 +1312,7 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
default:
(*_bfd_error_handler)
(_("%s: Only registers %%g[2367] can be declared using STT_REGISTER"),
- bfd_get_filename (abfd));
+ bfd_archive_filename (abfd));
return false;
}
@@ -1303,11 +1331,12 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
if (p->name != NULL && strcmp (p->name, *namep))
{
(*_bfd_error_handler)
- (_("Register %%g%d used incompatibly: "
- "previously declared in %s to %s, in %s redefined to %s"),
- (int)sym->st_value,
- bfd_get_filename (p->abfd), *p->name ? p->name : "#scratch",
- bfd_get_filename (abfd), **namep ? *namep : "#scratch");
+ (_("Register %%g%d used incompatibly: %s in %s"),
+ (int) sym->st_value,
+ **namep ? *namep : "#scratch", bfd_archive_filename (abfd));
+ (*_bfd_error_handler)
+ (_(" previously %s in %s"),
+ *p->name ? p->name : "#scratch", bfd_archive_filename (p->abfd));
return false;
}
@@ -1324,11 +1353,14 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
{
unsigned char type = h->type;
- if (type > STT_FUNC) type = 0;
+ if (type > STT_FUNC)
+ type = 0;
+ (*_bfd_error_handler)
+ (_("Symbol `%s' has differing types: %s in %s"),
+ *namep, "REGISTER", bfd_archive_filename (abfd));
(*_bfd_error_handler)
- (_("Symbol `%s' has differing types: "
- "previously %s, REGISTER in %s"),
- *namep, stt_types [type], bfd_get_filename (abfd));
+ (_(" previously %s in %s"),
+ stt_types[type], bfd_archive_filename (p->abfd));
return false;
}
@@ -1370,12 +1402,14 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
{
unsigned char type = ELF_ST_TYPE (sym->st_info);
- if (type > STT_FUNC) type = 0;
+ if (type > STT_FUNC)
+ type = 0;
+ (*_bfd_error_handler)
+ (_("Symbol `%s' has differing types: %s in %s"),
+ *namep, stt_types[type], bfd_archive_filename (abfd));
(*_bfd_error_handler)
- (_("Symbol `%s' has differing types: "
- "REGISTER in %s, %s in %s"),
- *namep, bfd_get_filename (p->abfd), stt_types [type],
- bfd_get_filename (abfd));
+ (_(" previously %s in %s"),
+ "REGISTER", bfd_archive_filename (p->abfd));
return false;
}
}
@@ -1653,7 +1687,6 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
{
bfd *dynobj;
asection *s;
- boolean reltext;
boolean relplt;
dynobj = elf_hash_table (info)->dynobj;
@@ -1685,7 +1718,6 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
/* The check_relocs and adjust_dynamic_symbol entry points have
determined the sizes of the various dynamic sections. Allocate
memory for them. */
- reltext = false;
relplt = false;
for (s = dynobj->sections; s != NULL; s = s->next)
{
@@ -1718,18 +1750,6 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
}
else
{
- const char *outname;
- asection *target;
-
- /* If this relocation section applies to a read only
- section, then we probably need a DT_TEXTREL entry. */
- outname = bfd_get_section_name (output_bfd,
- s->output_section);
- target = bfd_get_section_by_name (output_bfd, outname + 5);
- if (target != NULL
- && (target->flags & SEC_READONLY) != 0)
- reltext = true;
-
if (strcmp (name, ".rela.plt") == 0)
relplt = true;
@@ -1766,37 +1786,38 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
must add the entries now so that we get the correct size for
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
+#define add_dynamic_entry(TAG, VAL) \
+ bfd_elf64_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+
int reg;
struct sparc64_elf_app_reg * app_regs;
- struct bfd_strtab_hash *dynstr;
+ struct elf_strtab_hash *dynstr;
struct elf_link_hash_table *eht = elf_hash_table (info);
- if (! info->shared)
+ if (!info->shared)
{
- if (! bfd_elf64_add_dynamic_entry (info, DT_DEBUG, 0))
+ if (!add_dynamic_entry (DT_DEBUG, 0))
return false;
}
if (relplt)
{
- if (! bfd_elf64_add_dynamic_entry (info, DT_PLTGOT, 0)
- || ! bfd_elf64_add_dynamic_entry (info, DT_PLTRELSZ, 0)
- || ! bfd_elf64_add_dynamic_entry (info, DT_PLTREL, DT_RELA)
- || ! bfd_elf64_add_dynamic_entry (info, DT_JMPREL, 0))
+ if (!add_dynamic_entry (DT_PLTGOT, 0)
+ || !add_dynamic_entry (DT_PLTRELSZ, 0)
+ || !add_dynamic_entry (DT_PLTREL, DT_RELA)
+ || !add_dynamic_entry (DT_JMPREL, 0))
return false;
}
- if (! bfd_elf64_add_dynamic_entry (info, DT_RELA, 0)
- || ! bfd_elf64_add_dynamic_entry (info, DT_RELASZ, 0)
- || ! bfd_elf64_add_dynamic_entry (info, DT_RELAENT,
- sizeof (Elf64_External_Rela)))
+ if (!add_dynamic_entry (DT_RELA, 0)
+ || !add_dynamic_entry (DT_RELASZ, 0)
+ || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela)))
return false;
- if (reltext)
+ if (info->flags & DF_TEXTREL)
{
- if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
+ if (!add_dynamic_entry (DT_TEXTREL, 0))
return false;
- info->flags |= DF_TEXTREL;
}
/* Add dynamic STT_REGISTER symbols and corresponding DT_SPARC_REGISTER
@@ -1809,7 +1830,7 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
{
struct elf_link_local_dynamic_entry *entry, *e;
- if (! bfd_elf64_add_dynamic_entry (info, DT_SPARC_REGISTER, 0))
+ if (!add_dynamic_entry (DT_SPARC_REGISTER, 0))
return false;
entry = (struct elf_link_local_dynamic_entry *)
@@ -1824,7 +1845,7 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
entry->isym.st_size = 0;
if (*app_regs [reg].name != '\0')
entry->isym.st_name
- = _bfd_stringtab_add (dynstr, app_regs[reg].name, true, false);
+ = _bfd_elf_strtab_add (dynstr, app_regs[reg].name, false);
else
entry->isym.st_name = 0;
entry->isym.st_other = 0;
@@ -1846,6 +1867,7 @@ sparc64_elf_size_dynamic_sections (output_bfd, info)
eht->dynsymcount++;
}
}
+#undef add_dynamic_entry
return true;
}
@@ -1914,6 +1936,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
asection *sec;
bfd_vma relocation;
bfd_reloc_status_type r;
+ boolean is_plt = false;
r_type = ELF64_R_TYPE_ID (rel->r_info);
if (r_type < 0 || r_type >= (int) R_SPARC_max_std)
@@ -1952,9 +1975,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = (sec->output_section->vma
- + sec->output_offset
- + sym->st_value);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
}
else
{
@@ -2038,7 +2059,15 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
if (info->shared
&& ((!info->symbolic && h->dynindx != -1)
|| !(h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR)))
+ & ELF_LINK_HASH_DEF_REGULAR))
+ && ((input_section->flags & SEC_ALLOC) != 0
+ /* DWARF will emit R_SPARC_{32,64} relocations in
+ its sections against symbols defined externally
+ in shared libraries. We can't do anything
+ with them here. */
+ || ((input_section->flags & SEC_DEBUGGING) != 0
+ && (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_DYNAMIC) != 0)))
skip_it = true;
break;
}
@@ -2059,7 +2088,8 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
}
else if (h->root.type == bfd_link_hash_undefweak)
relocation = 0;
- else if (info->shared && !info->symbolic
+ else if (info->shared
+ && (!info->symbolic || info->allow_shlib_undefined)
&& !info->no_undefined
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
relocation = 0;
@@ -2083,9 +2113,10 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
}
}
+do_dynreloc:
/* When generating a shared object, these relocations are copied
into the output file to be resolved at run time. */
- if (info->shared && (input_section->flags & SEC_ALLOC))
+ if (info->shared && r_symndx != 0 && (input_section->flags & SEC_ALLOC))
{
switch (r_type)
{
@@ -2160,21 +2191,11 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
skip = false;
- if (elf_section_data (input_section)->stab_info == NULL)
- outrel.r_offset = rel->r_offset;
- else
- {
- bfd_vma off;
-
- off = (_bfd_stab_section_offset
- (output_bfd, &elf_hash_table (info)->stab_info,
- input_section,
- &elf_section_data (input_section)->stab_info,
- rel->r_offset));
- if (off == MINUS_ONE)
- skip = true;
- outrel.r_offset = off;
- }
+ outrel.r_offset =
+ _bfd_elf_section_offset (output_bfd, info, input_section,
+ rel->r_offset);
+ if (outrel.r_offset == (bfd_vma) -1)
+ skip = true;
outrel.r_offset += (input_section->output_section->vma
+ input_section->output_offset);
@@ -2207,7 +2228,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
memset (&outrel, 0, sizeof outrel);
/* h->dynindx may be -1 if the symbol was marked to
become local. */
- else if (h != NULL
+ else if (h != NULL && ! is_plt
&& ((! info->symbolic && h->dynindx != -1)
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))
@@ -2231,7 +2252,9 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
long indx;
- if (h == NULL)
+ if (is_plt)
+ sec = splt;
+ else if (h == NULL)
sec = local_sections[r_symndx];
else
{
@@ -2261,7 +2284,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
BFD_FAIL ();
(*_bfd_error_handler)
(_("%s: probably compiled without -fPIC?"),
- bfd_get_filename (input_bfd));
+ bfd_archive_filename (input_bfd));
bfd_set_error (bfd_error_bad_value);
return false;
}
@@ -2283,12 +2306,8 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
++sreloc->reloc_count;
/* This reloc will be computed at runtime, so there's no
- need to do anything now, unless this is a RELATIVE
- reloc in an unallocated section. */
- if (skip
- || (input_section->flags & SEC_ALLOC) != 0
- || ELF64_R_TYPE_ID (outrel.r_info) != R_SPARC_RELATIVE)
- continue;
+ need to do anything now. */
+ continue;
}
break;
}
@@ -2368,7 +2387,8 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
Note this is different behaviour to the
32-bit linker, which both adds the contents
and ignores the addend. So clear the location. */
- bfd_put_64 (output_bfd, 0, sgot->contents + off);
+ bfd_put_64 (output_bfd, (bfd_vma) 0,
+ sgot->contents + off);
/* We need to generate a R_SPARC_RELATIVE reloc
for the dynamic linker. */
@@ -2424,6 +2444,12 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
+ sparc64_elf_plt_entry_offset (h->plt.offset));
if (r_type == R_SPARC_WPLT30)
goto do_wplt30;
+ if (r_type == R_SPARC_PLT32 || r_type == R_SPARC_PLT64)
+ {
+ r_type = r_type == R_SPARC_PLT32 ? R_SPARC_32 : R_SPARC_64;
+ is_plt = true;
+ goto do_dynreloc;
+ }
goto do_default;
case R_SPARC_OLO10:
@@ -2434,7 +2460,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
relocation = (relocation & 0x3ff) + ELF64_R_TYPE_DATA (rel->r_info);
x = bfd_get_32 (input_bfd, contents + rel->r_offset);
- x = (x & ~0x1fff) | (relocation & 0x1fff);
+ x = (x & ~(bfd_vma) 0x1fff) | (relocation & 0x1fff);
bfd_put_32 (input_bfd, x, contents + rel->r_offset);
r = bfd_check_overflow (howto->complain_on_overflow,
@@ -2455,8 +2481,9 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
relocation -= rel->r_offset;
x = bfd_get_32 (input_bfd, contents + rel->r_offset);
- x = (x & ~0x303fff) | ((((relocation >> 2) & 0xc000) << 6)
- | ((relocation >> 2) & 0x3fff));
+ x &= ~(bfd_vma) 0x303fff;
+ x |= ((((relocation >> 2) & 0xc000) << 6)
+ | ((relocation >> 2) & 0x3fff));
bfd_put_32 (input_bfd, x, contents + rel->r_offset);
r = bfd_check_overflow (howto->complain_on_overflow,
@@ -2474,7 +2501,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
relocation = relocation ^ MINUS_ONE;
x = bfd_get_32 (input_bfd, contents + rel->r_offset);
- x = (x & ~0x3fffff) | ((relocation >> 10) & 0x3fffff);
+ x = (x & ~(bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff);
bfd_put_32 (input_bfd, x, contents + rel->r_offset);
r = bfd_check_overflow (howto->complain_on_overflow,
@@ -2492,7 +2519,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
relocation = (relocation & 0x3ff) | 0x1c00;
x = bfd_get_32 (input_bfd, contents + rel->r_offset);
- x = (x & ~0x1fff) | relocation;
+ x = (x & ~(bfd_vma) 0x1fff) | relocation;
bfd_put_32 (input_bfd, x, contents + rel->r_offset);
r = bfd_reloc_ok;
@@ -2581,7 +2608,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|| reg == G0 || reg == O7)
break;
- bfd_put_32 (input_bfd, INSN_NOP,
+ bfd_put_32 (input_bfd, (bfd_vma) INSN_NOP,
contents + rel->r_offset + 4);
}
break;
@@ -2611,6 +2638,16 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
const char *name;
+ /* The Solaris native linker silently disregards
+ overflows. We don't, but this breaks stabs debugging
+ info, whose relocations are only 32-bits wide. Ignore
+ overflows in this case. */
+ if (r_type == R_SPARC_32
+ && (input_section->flags & SEC_DEBUGGING) != 0
+ && strcmp (bfd_section_name (input_bfd, input_section),
+ ".stab") == 0)
+ break;
+
if (h != NULL)
{
if (h->root.type == bfd_link_hash_undefweak
@@ -2686,7 +2723,7 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
}
else
{
- int max = splt->_raw_size / PLT_ENTRY_SIZE;
+ bfd_vma max = splt->_raw_size / PLT_ENTRY_SIZE;
rela.r_offset = sparc64_elf_plt_ptr_offset (h->plt.offset, max);
rela.r_addend = -(sparc64_elf_plt_entry_offset (h->plt.offset) + 4)
-(splt->output_section->vma + splt->output_offset);
@@ -2732,7 +2769,7 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
rela.r_offset = (sgot->output_section->vma
+ sgot->output_offset
- + (h->got.offset &~ 1));
+ + (h->got.offset &~ (bfd_vma) 1));
/* If this is a -Bsymbolic link, and the symbol is defined
locally, we just want to emit a RELATIVE reloc. Likewise if
@@ -2874,8 +2911,8 @@ sparc64_elf_finish_dynamic_sections (output_bfd, info)
/* Initialize the contents of the .plt section. */
if (splt->_raw_size > 0)
{
- sparc64_elf_build_plt(output_bfd, splt->contents,
- splt->_raw_size / PLT_ENTRY_SIZE);
+ sparc64_elf_build_plt (output_bfd, splt->contents,
+ (int) (splt->_raw_size / PLT_ENTRY_SIZE));
}
elf_section_data (splt->output_section)->this_hdr.sh_entsize =
@@ -2900,26 +2937,25 @@ sparc64_elf_finish_dynamic_sections (output_bfd, info)
return true;
}
-
-/* Functions for dealing with the e_flags field. */
-/* Copy backend specific data from one object module to another */
-static boolean
-sparc64_elf_copy_private_bfd_data (ibfd, obfd)
- bfd *ibfd, *obfd;
+static enum elf_reloc_type_class
+sparc64_elf_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
{
- if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour
- || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return true;
-
- BFD_ASSERT (!elf_flags_init (obfd)
- || (elf_elfheader (obfd)->e_flags
- == elf_elfheader (ibfd)->e_flags));
-
- elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
- elf_flags_init (obfd) = true;
- return true;
+ switch ((int) ELF64_R_TYPE (rela->r_info))
+ {
+ case R_SPARC_RELATIVE:
+ return reloc_class_relative;
+ case R_SPARC_JMP_SLOT:
+ return reloc_class_plt;
+ case R_SPARC_COPY:
+ return reloc_class_copy;
+ default:
+ return reloc_class_normal;
+ }
}
+
+/* Functions for dealing with the e_flags field. */
/* Merge backend specific data from an object file to the output
object file when linking. */
@@ -2976,7 +3012,7 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd)
error = true;
(*_bfd_error_handler)
(_("%s: linking UltraSPARC specific with HAL specific code"),
- bfd_get_filename (ibfd));
+ bfd_archive_filename (ibfd));
}
/* Choose the most restrictive memory ordering. */
old_mm = (old_flags & EF_SPARCV9_MM);
@@ -2995,7 +3031,7 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd)
error = true;
(*_bfd_error_handler)
(_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"),
- bfd_get_filename (ibfd), (long)new_flags, (long)old_flags);
+ bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags);
}
elf_elfheader (obfd)->e_flags = old_flags;
@@ -3029,8 +3065,8 @@ sparc64_elf_print_symbol_all (abfd, filep, symbol)
fprintf (file, "REG_%c%c%11s%c%c R", "GOLI" [reg / 8], '0' + (reg & 7), "",
((type & BSF_LOCAL)
? (type & BSF_GLOBAL) ? '!' : 'l'
- : (type & BSF_GLOBAL) ? 'g' : ' '),
- (type & BSF_WEAK) ? 'w' : ' ');
+ : (type & BSF_GLOBAL) ? 'g' : ' '),
+ (type & BSF_WEAK) ? 'w' : ' ');
if (symbol->name == NULL || symbol->name [0] == '\0')
return "#scratch";
else
@@ -3142,8 +3178,6 @@ const struct elf_size_info sparc64_elf_size_info =
sparc64_elf_print_symbol_all
#define elf_backend_output_arch_syms \
sparc64_elf_output_arch_syms
-#define bfd_elf64_bfd_copy_private_bfd_data \
- sparc64_elf_copy_private_bfd_data
#define bfd_elf64_bfd_merge_private_bfd_data \
sparc64_elf_merge_private_bfd_data
@@ -3151,6 +3185,8 @@ const struct elf_size_info sparc64_elf_size_info =
sparc64_elf_size_info
#define elf_backend_object_p \
sparc64_elf_object_p
+#define elf_backend_reloc_type_class \
+ sparc64_elf_reloc_type_class
#define elf_backend_want_got_plt 0
#define elf_backend_plt_readonly 0
diff --git a/contrib/binutils/bfd/elf64-x86-64.c b/contrib/binutils/bfd/elf64-x86-64.c
index 6153468..4bbbb08 100644
--- a/contrib/binutils/bfd/elf64-x86-64.c
+++ b/contrib/binutils/bfd/elf64-x86-64.c
@@ -79,7 +79,16 @@ static reloc_howto_type x86_64_elf_howto_table[] =
HOWTO(R_X86_64_8, 0, 0, 8, false, 0, complain_overflow_signed,
bfd_elf_generic_reloc, "R_X86_64_8", false, 0xff, 0xff, false),
HOWTO(R_X86_64_PC8, 0, 0, 8, true, 0, complain_overflow_signed,
- bfd_elf_generic_reloc, "R_X86_64_PC8", false, 0xff, 0xff, true)
+ bfd_elf_generic_reloc, "R_X86_64_PC8", false, 0xff, 0xff, true),
+
+/* GNU extension to record C++ vtable hierarchy. */
+ HOWTO (R_X86_64_GNU_VTINHERIT, 0, 4, 0, false, 0, complain_overflow_dont,
+ NULL, "R_X86_64_GNU_VTINHERIT", false, 0, 0, false),
+
+/* GNU extension to record C++ vtable member usage. */
+ HOWTO (R_X86_64_GNU_VTENTRY, 0, 4, 0, false, 0, complain_overflow_dont,
+ _bfd_elf_rel_vtable_reloc_fn, "R_X86_64_GNU_VTENTRY", false, 0, 0,
+ false)
};
/* Map BFD relocs to the x86_64 elf relocs. */
@@ -89,7 +98,7 @@ struct elf_reloc_map
unsigned char elf_reloc_val;
};
-static CONST struct elf_reloc_map x86_64_reloc_map[] =
+static const struct elf_reloc_map x86_64_reloc_map[] =
{
{ BFD_RELOC_NONE, R_X86_64_NONE, },
{ BFD_RELOC_64, R_X86_64_64, },
@@ -107,6 +116,8 @@ static CONST struct elf_reloc_map x86_64_reloc_map[] =
{ BFD_RELOC_16_PCREL, R_X86_64_PC16, },
{ BFD_RELOC_8, R_X86_64_8, },
{ BFD_RELOC_8_PCREL, R_X86_64_PC8, },
+ { BFD_RELOC_VTABLE_INHERIT, R_X86_64_GNU_VTINHERIT, },
+ { BFD_RELOC_VTABLE_ENTRY, R_X86_64_GNU_VTENTRY, },
};
static reloc_howto_type *elf64_x86_64_reloc_type_lookup
@@ -115,6 +126,17 @@ static void elf64_x86_64_info_to_howto
PARAMS ((bfd *, arelent *, Elf64_Internal_Rela *));
static struct bfd_link_hash_table *elf64_x86_64_link_hash_table_create
PARAMS ((bfd *));
+static boolean elf64_x86_64_elf_object_p PARAMS ((bfd *abfd));
+static boolean elf64_x86_64_check_relocs
+ PARAMS ((bfd *, struct bfd_link_info *, asection *sec,
+ const Elf_Internal_Rela *));
+static asection *elf64_x86_64_gc_mark_hook
+ PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
+ struct elf_link_hash_entry *, Elf_Internal_Sym *));
+
+static boolean elf64_x86_64_gc_sweep_hook
+ PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ const Elf_Internal_Rela *));
static struct bfd_hash_entry *elf64_x86_64_link_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
@@ -131,6 +153,8 @@ static boolean elf64_x86_64_finish_dynamic_symbol
Elf_Internal_Sym *sym));
static boolean elf64_x86_64_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
+static enum elf_reloc_type_class elf64_x86_64_reloc_type_class
+ PARAMS ((const Elf_Internal_Rela *));
/* Given a BFD reloc type, return a HOWTO structure. */
static reloc_howto_type *
@@ -143,8 +167,7 @@ elf64_x86_64_reloc_type_lookup (abfd, code)
i++)
{
if (x86_64_reloc_map[i].bfd_reloc_val == code)
- return &x86_64_elf_howto_table[(int)
- x86_64_reloc_map[i].elf_reloc_val];
+ return &x86_64_elf_howto_table[i];
}
return 0;
}
@@ -157,11 +180,20 @@ elf64_x86_64_info_to_howto (abfd, cache_ptr, dst)
arelent *cache_ptr;
Elf64_Internal_Rela *dst;
{
- unsigned r_type;
+ unsigned r_type, i;
r_type = ELF64_R_TYPE (dst->r_info);
- BFD_ASSERT (r_type < (unsigned int) R_X86_64_max);
- cache_ptr->howto = &x86_64_elf_howto_table[r_type];
+ if (r_type < (unsigned int) R_X86_64_GNU_VTINHERIT)
+ {
+ BFD_ASSERT (r_type <= (unsigned int) R_X86_64_PC8);
+ i = r_type;
+ }
+ else
+ {
+ BFD_ASSERT (r_type < (unsigned int) R_X86_64_max);
+ i = r_type - ((unsigned int) R_X86_64_GNU_VTINHERIT - R_X86_64_PC8 - 1);
+ }
+ cache_ptr->howto = &x86_64_elf_howto_table[i];
BFD_ASSERT (r_type == cache_ptr->howto->type);
}
@@ -295,9 +327,9 @@ elf64_x86_64_link_hash_table_create (abfd)
bfd *abfd;
{
struct elf64_x86_64_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct elf64_x86_64_link_hash_table);
- ret = ((struct elf64_x86_64_link_hash_table *)
- bfd_alloc (abfd, sizeof (struct elf64_x86_64_link_hash_table)));
+ ret = ((struct elf64_x86_64_link_hash_table *) bfd_alloc (abfd, amt));
if (ret == (struct elf64_x86_64_link_hash_table *) NULL)
return NULL;
@@ -311,7 +343,7 @@ elf64_x86_64_link_hash_table_create (abfd)
return &ret->root.root;
}
-boolean
+static boolean
elf64_x86_64_elf_object_p (abfd)
bfd *abfd;
{
@@ -409,10 +441,8 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
if (h != NULL)
{
- if (h->got.refcount == -1)
+ if (h->got.refcount == 0)
{
- h->got.refcount = 1;
-
/* Make sure this symbol is output as a dynamic symbol. */
if (h->dynindx == -1)
{
@@ -423,28 +453,25 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
sgot->_raw_size += GOT_ENTRY_SIZE;
srelgot->_raw_size += sizeof (Elf64_External_Rela);
}
- else
- h->got.refcount += 1;
+ h->got.refcount += 1;
}
else
{
/* This is a global offset table entry for a local symbol. */
if (local_got_refcounts == NULL)
{
- size_t size;
+ bfd_size_type size;
- size = symtab_hdr->sh_info * sizeof (bfd_signed_vma);
+ size = symtab_hdr->sh_info;
+ size *= sizeof (bfd_signed_vma);
local_got_refcounts = ((bfd_signed_vma *)
- bfd_alloc (abfd, size));
+ bfd_zalloc (abfd, size));
if (local_got_refcounts == NULL)
return false;
elf_local_got_refcounts (abfd) = local_got_refcounts;
- memset (local_got_refcounts, -1, size);
}
- if (local_got_refcounts[r_symndx] == -1)
+ if (local_got_refcounts[r_symndx] == 0)
{
- local_got_refcounts[r_symndx] = 1;
-
sgot->_raw_size += GOT_ENTRY_SIZE;
if (info->shared)
{
@@ -454,8 +481,7 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
srelgot->_raw_size += sizeof (Elf64_External_Rela);
}
}
- else
- local_got_refcounts[r_symndx] += 1;
+ local_got_refcounts[r_symndx] += 1;
}
break;
@@ -473,10 +499,7 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
continue;
h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
- if (h->plt.refcount == -1)
- h->plt.refcount = 1;
- else
- h->plt.refcount += 1;
+ h->plt.refcount += 1;
break;
case R_X86_64_8:
@@ -545,6 +568,8 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
|| ! bfd_set_section_alignment (dynobj, sreloc, 3))
return false;
}
+ if (sec->flags & SEC_READONLY)
+ info->flags |= DF_TEXTREL;
}
sreloc->_raw_size += sizeof (Elf64_External_Rela);
@@ -572,7 +597,7 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
if (p == NULL)
{
p = ((struct elf64_x86_64_pcrel_relocs_copied *)
- bfd_alloc (dynobj, sizeof *p));
+ bfd_alloc (dynobj, (bfd_size_type) sizeof *p));
if (p == NULL)
return false;
p->next = eh->pcrel_relocs_copied;
@@ -585,6 +610,20 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
}
}
break;
+
+ /* This relocation describes the C++ object vtable hierarchy.
+ Reconstruct it for later use during GC. */
+ case R_X86_64_GNU_VTINHERIT:
+ if (!_bfd_elf64_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+ return false;
+ break;
+
+ /* This relocation describes which C++ vtable entries are actually
+ used. Record for later use during GC. */
+ case R_X86_64_GNU_VTENTRY:
+ if (!_bfd_elf64_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+ return false;
+ break;
}
}
@@ -604,28 +643,30 @@ elf64_x86_64_gc_mark_hook (abfd, info, rel, h, sym)
{
if (h != NULL)
{
- switch (h->root.type)
+ switch (ELF64_R_TYPE (rel->r_info))
{
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- return h->root.u.def.section;
-
- case bfd_link_hash_common:
- return h->root.u.c.p->section;
+ case R_X86_64_GNU_VTINHERIT:
+ case R_X86_64_GNU_VTENTRY:
+ break;
default:
- break;
+ switch (h->root.type)
+ {
+ case bfd_link_hash_defined:
+ case bfd_link_hash_defweak:
+ return h->root.u.def.section;
+
+ case bfd_link_hash_common:
+ return h->root.u.c.p->section;
+
+ default:
+ break;
+ }
}
}
else
{
- if (!(elf_bad_symtab (abfd)
- && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
- && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
- && sym->st_shndx != SHN_COMMON))
- {
- return bfd_section_from_elf_index (abfd, sym->st_shndx);
- }
+ return bfd_section_from_elf_index (abfd, sym->st_shndx);
}
return NULL;
@@ -807,6 +848,8 @@ elf64_x86_64_adjust_dynamic_symbol (info, h)
return true;
}
+ else
+ h->plt.offset = (bfd_vma) -1;
/* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the
@@ -893,14 +936,13 @@ elf64_x86_64_adjust_dynamic_symbol (info, h)
static boolean
elf64_x86_64_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
+ bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
{
bfd *dynobj;
asection *s;
boolean plt;
boolean relocs;
- boolean reltext;
dynobj = elf_hash_table (info)->dynobj;
BFD_ASSERT (dynobj != NULL);
@@ -940,7 +982,7 @@ elf64_x86_64_size_dynamic_sections (output_bfd, info)
/* The check_relocs and adjust_dynamic_symbol entry points have
determined the sizes of the various dynamic sections. Allocate
memory for them. */
- plt = relocs = reltext = false;
+ plt = relocs = false;
for (s = dynobj->sections; s != NULL; s = s->next)
{
const char *name;
@@ -985,29 +1027,8 @@ elf64_x86_64_size_dynamic_sections (output_bfd, info)
}
else
{
- asection *target;
-
- /* Remember whether there are any reloc sections other
- than .rela.plt. */
if (strcmp (name, ".rela.plt") != 0)
- {
- const char *outname;
-
- relocs = true;
-
- /* If this relocation section applies to a read only
- section, then we probably need a DT_TEXTREL
- entry. The entries in the .rela.plt section
- really apply to the .got section, which we
- created ourselves and so know is not readonly. */
- outname = bfd_get_section_name (output_bfd,
- s->output_section);
- target = bfd_get_section_by_name (output_bfd, outname + 5);
- if (target != NULL
- && (target->flags & SEC_READONLY) != 0
- && (target->flags & SEC_ALLOC) != 0)
- reltext = true;
- }
+ relocs = true;
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
@@ -1043,37 +1064,39 @@ elf64_x86_64_size_dynamic_sections (output_bfd, info)
must add the entries now so that we get the correct size for
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
+#define add_dynamic_entry(TAG, VAL) \
+ bfd_elf64_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+
if (! info->shared)
{
- if (! bfd_elf64_add_dynamic_entry (info, DT_DEBUG, 0))
+ if (!add_dynamic_entry (DT_DEBUG, 0))
return false;
}
if (plt)
{
- if (! bfd_elf64_add_dynamic_entry (info, DT_PLTGOT, 0)
- || ! bfd_elf64_add_dynamic_entry (info, DT_PLTRELSZ, 0)
- || ! bfd_elf64_add_dynamic_entry (info, DT_PLTREL, DT_RELA)
- || ! bfd_elf64_add_dynamic_entry (info, DT_JMPREL, 0))
+ if (!add_dynamic_entry (DT_PLTGOT, 0)
+ || !add_dynamic_entry (DT_PLTRELSZ, 0)
+ || !add_dynamic_entry (DT_PLTREL, DT_RELA)
+ || !add_dynamic_entry (DT_JMPREL, 0))
return false;
}
if (relocs)
{
- if (! bfd_elf64_add_dynamic_entry (info, DT_RELA, 0)
- || ! bfd_elf64_add_dynamic_entry (info, DT_RELASZ, 0)
- || ! bfd_elf64_add_dynamic_entry (info, DT_RELAENT,
- sizeof (Elf64_External_Rela)))
+ if (!add_dynamic_entry (DT_RELA, 0)
+ || !add_dynamic_entry (DT_RELASZ, 0)
+ || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela)))
return false;
}
- if (reltext)
+ if ((info->flags & DF_TEXTREL) != 0)
{
- if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
+ if (!add_dynamic_entry (DT_TEXTREL, 0))
return false;
- info->flags |= DF_TEXTREL;
}
}
+#undef add_dynamic_entry
return true;
}
@@ -1160,6 +1183,9 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
unsigned int indx;
r_type = ELF64_R_TYPE (rela->r_info);
+ if (r_type == (int) R_X86_64_GNU_VTINHERIT
+ || r_type == (int) R_X86_64_GNU_VTENTRY)
+ continue;
if ((indx = (unsigned) r_type) >= R_X86_64_max)
{
@@ -1197,9 +1223,7 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = (sec->output_section->vma
- + sec->output_offset
- + sym->st_value);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rela);
}
else
{
@@ -1249,7 +1273,7 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
{
(*_bfd_error_handler)
(_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
- bfd_get_filename (input_bfd), h->root.root.string,
+ bfd_archive_filename (input_bfd), h->root.root.string,
bfd_get_section_name (input_bfd, input_section));
relocation = 0;
}
@@ -1260,7 +1284,9 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
}
else if (h->root.type == bfd_link_hash_undefweak)
relocation = 0;
- else if (info->shared && !info->symbolic && !info->no_undefined
+ else if (info->shared
+ && (!info->symbolic || info->allow_shlib_undefined)
+ && !info->no_undefined
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
relocation = 0;
else
@@ -1408,7 +1434,9 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
case R_X86_64_64:
/* FIXME: The ABI says the linker should make sure the value is
the same when it's zeroextended to 64 bit. */
- if (info->shared && (input_section->flags & SEC_ALLOC) != 0)
+ if (info->shared
+ && r_symndx != 0
+ && (input_section->flags & SEC_ALLOC) != 0)
{
Elf_Internal_Rela outrel;
boolean skip, relocate;
@@ -1439,21 +1467,11 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
skip = false;
- if (elf_section_data (input_section)->stab_info == NULL)
- outrel.r_offset = rela->r_offset;
- else
- {
- bfd_vma off;
-
- off = (_bfd_stab_section_offset
- (output_bfd, &elf_hash_table (info)->stab_info,
- input_section,
- &elf_section_data (input_section)->stab_info,
- rela->r_offset));
- if (off == (bfd_vma) -1)
- skip = true;
- outrel.r_offset = off;
- }
+ outrel.r_offset =
+ _bfd_elf_section_offset (output_bfd, info, input_section,
+ rela->r_offset);
+ if (outrel.r_offset == (bfd_vma) -1)
+ skip = true;
outrel.r_offset += (input_section->output_section->vma
+ input_section->output_offset);
@@ -1485,7 +1503,7 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
}
else
{
- long indx;
+ long sindx;
if (h == NULL)
sec = local_sections[r_symndx];
@@ -1497,7 +1515,7 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
sec = h->root.u.def.section;
}
if (sec != NULL && bfd_is_abs_section (sec))
- indx = 0;
+ sindx = 0;
else if (sec == NULL || sec->owner == NULL)
{
bfd_set_error (bfd_error_bad_value);
@@ -1508,12 +1526,12 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
asection *osec;
osec = sec->output_section;
- indx = elf_section_data (osec)->dynindx;
- BFD_ASSERT (indx > 0);
+ sindx = elf_section_data (osec)->dynindx;
+ BFD_ASSERT (sindx > 0);
}
relocate = false;
- outrel.r_info = ELF64_R_INFO (indx, r_type);
+ outrel.r_info = ELF64_R_INFO (sindx, r_type);
outrel.r_addend = relocation + rela->r_addend;
}
@@ -1694,7 +1712,7 @@ elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym)
rela.r_offset = (sgot->output_section->vma
+ sgot->output_offset
- + (h->got.offset &~ 1));
+ + (h->got.offset &~ (bfd_vma) 1));
/* If this is a static link, or it is a -Bsymbolic link and the
symbol is defined locally or was forced to be local because
@@ -1893,6 +1911,22 @@ elf64_x86_64_finish_dynamic_sections (output_bfd, info)
return true;
}
+static enum elf_reloc_type_class
+elf64_x86_64_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
+{
+ switch ((int) ELF64_R_TYPE (rela->r_info))
+ {
+ case R_X86_64_RELATIVE:
+ return reloc_class_relative;
+ case R_X86_64_JUMP_SLOT:
+ return reloc_class_plt;
+ case R_X86_64_COPY:
+ return reloc_class_copy;
+ default:
+ return reloc_class_normal;
+ }
+}
#define TARGET_LITTLE_SYM bfd_elf64_x86_64_vec
#define TARGET_LITTLE_NAME "elf64-x86-64"
@@ -1901,6 +1935,7 @@ elf64_x86_64_finish_dynamic_sections (output_bfd, info)
#define ELF_MAXPAGESIZE 0x100000
#define elf_backend_can_gc_sections 1
+#define elf_backend_can_refcount 1
#define elf_backend_want_got_plt 1
#define elf_backend_plt_readonly 1
#define elf_backend_want_plt_sym 0
@@ -1925,5 +1960,6 @@ elf64_x86_64_finish_dynamic_sections (output_bfd, info)
#define elf_backend_relocate_section elf64_x86_64_relocate_section
#define elf_backend_size_dynamic_sections elf64_x86_64_size_dynamic_sections
#define elf_backend_object_p elf64_x86_64_elf_object_p
+#define elf_backend_reloc_type_class elf64_x86_64_reloc_type_class
#include "elf64-target.h"
diff --git a/contrib/binutils/bfd/elfarm-nabi.c b/contrib/binutils/bfd/elfarm-nabi.c
index ee91e36..7ced680 100644
--- a/contrib/binutils/bfd/elfarm-nabi.c
+++ b/contrib/binutils/bfd/elfarm-nabi.c
@@ -42,6 +42,10 @@
static reloc_howto_type * elf32_arm_reloc_type_lookup
PARAMS ((bfd * abfd, bfd_reloc_code_real_type code));
+static boolean elf32_arm_nabi_grok_prstatus
+ PARAMS ((bfd *abfd, Elf_Internal_Note *note));
+static boolean elf32_arm_nabi_grok_psinfo
+ PARAMS ((bfd *abfd, Elf_Internal_Note *note));
/* Note: code such as elf32_arm_reloc_type_lookup expect to use e.g.
R_ARM_PC24 as an index into this, and find the R_ARM_PC24 HOWTO
@@ -578,6 +582,9 @@ static reloc_howto_type elf32_arm_thm_pc9_howto =
0x000000ff, /* dst_mask */
true); /* pcrel_offset */
+static void elf32_arm_info_to_howto
+ PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+
static void
elf32_arm_info_to_howto (abfd, bfd_reloc, elf_reloc)
bfd * abfd ATTRIBUTE_UNUSED;
@@ -622,27 +629,27 @@ struct elf32_arm_reloc_map
};
static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] =
-{
- {BFD_RELOC_NONE, R_ARM_NONE},
- {BFD_RELOC_ARM_PCREL_BRANCH, R_ARM_PC24},
- {BFD_RELOC_ARM_PCREL_BLX, R_ARM_XPC25},
- {BFD_RELOC_THUMB_PCREL_BLX, R_ARM_THM_XPC22},
- {BFD_RELOC_32, R_ARM_ABS32},
- {BFD_RELOC_32_PCREL, R_ARM_REL32},
- {BFD_RELOC_8, R_ARM_ABS8},
- {BFD_RELOC_16, R_ARM_ABS16},
- {BFD_RELOC_ARM_OFFSET_IMM, R_ARM_ABS12},
- {BFD_RELOC_ARM_THUMB_OFFSET, R_ARM_THM_ABS5},
- {BFD_RELOC_THUMB_PCREL_BRANCH23, R_ARM_THM_PC22},
- {BFD_RELOC_ARM_COPY, R_ARM_COPY},
- {BFD_RELOC_ARM_GLOB_DAT, R_ARM_GLOB_DAT},
- {BFD_RELOC_ARM_JUMP_SLOT, R_ARM_JUMP_SLOT},
- {BFD_RELOC_ARM_RELATIVE, R_ARM_RELATIVE},
- {BFD_RELOC_ARM_GOTOFF, R_ARM_GOTOFF},
- {BFD_RELOC_ARM_GOTPC, R_ARM_GOTPC},
- {BFD_RELOC_ARM_GOT32, R_ARM_GOT32},
- {BFD_RELOC_ARM_PLT32, R_ARM_PLT32}
-};
+ {
+ {BFD_RELOC_NONE, R_ARM_NONE},
+ {BFD_RELOC_ARM_PCREL_BRANCH, R_ARM_PC24},
+ {BFD_RELOC_ARM_PCREL_BLX, R_ARM_XPC25},
+ {BFD_RELOC_THUMB_PCREL_BLX, R_ARM_THM_XPC22},
+ {BFD_RELOC_32, R_ARM_ABS32},
+ {BFD_RELOC_32_PCREL, R_ARM_REL32},
+ {BFD_RELOC_8, R_ARM_ABS8},
+ {BFD_RELOC_16, R_ARM_ABS16},
+ {BFD_RELOC_ARM_OFFSET_IMM, R_ARM_ABS12},
+ {BFD_RELOC_ARM_THUMB_OFFSET, R_ARM_THM_ABS5},
+ {BFD_RELOC_THUMB_PCREL_BRANCH23, R_ARM_THM_PC22},
+ {BFD_RELOC_ARM_COPY, R_ARM_COPY},
+ {BFD_RELOC_ARM_GLOB_DAT, R_ARM_GLOB_DAT},
+ {BFD_RELOC_ARM_JUMP_SLOT, R_ARM_JUMP_SLOT},
+ {BFD_RELOC_ARM_RELATIVE, R_ARM_RELATIVE},
+ {BFD_RELOC_ARM_GOTOFF, R_ARM_GOTOFF},
+ {BFD_RELOC_ARM_GOTPC, R_ARM_GOTPC},
+ {BFD_RELOC_ARM_GOT32, R_ARM_GOT32},
+ {BFD_RELOC_ARM_PLT32, R_ARM_PLT32}
+ };
static reloc_howto_type *
elf32_arm_reloc_type_lookup (abfd, code)
@@ -674,4 +681,72 @@ elf32_arm_reloc_type_lookup (abfd, code)
}
}
+/* Support for core dump NOTE sections */
+static boolean
+elf32_arm_nabi_grok_prstatus (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ int offset;
+ size_t raw_size;
+
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 148: /* Linux/ARM 32-bit*/
+ /* pr_cursig */
+ elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+
+ /* pr_pid */
+ elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+
+ /* pr_reg */
+ offset = 72;
+ raw_size = 72;
+
+ break;
+ }
+
+ /* Make a ".reg/999" section. */
+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
+ raw_size, note->descpos + offset);
+}
+
+static boolean
+elf32_arm_nabi_grok_psinfo (abfd, note)
+ bfd *abfd;
+ Elf_Internal_Note *note;
+{
+ switch (note->descsz)
+ {
+ default:
+ return false;
+
+ case 124: /* Linux/ARM elf_prpsinfo */
+ elf_tdata (abfd)->core_program
+ = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
+ elf_tdata (abfd)->core_command
+ = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
+ }
+
+ /* Note that for some reason, a spurious space is tacked
+ onto the end of the args in some (at least one anyway)
+ implementations, so strip it off if it exists. */
+
+ {
+ char *command = elf_tdata (abfd)->core_command;
+ int n = strlen (command);
+
+ if (0 < n && command[n - 1] == ' ')
+ command[n - 1] = '\0';
+ }
+
+ return true;
+}
+
+#define elf_backend_grok_prstatus elf32_arm_nabi_grok_prstatus
+#define elf_backend_grok_psinfo elf32_arm_nabi_grok_psinfo
+
#include "elf32-arm.h"
diff --git a/contrib/binutils/bfd/elfarm-oabi.c b/contrib/binutils/bfd/elfarm-oabi.c
index b4f93f0..25c4d89 100644
--- a/contrib/binutils/bfd/elfarm-oabi.c
+++ b/contrib/binutils/bfd/elfarm-oabi.c
@@ -42,305 +42,310 @@
#define ARM_ELF_ABI_VERSION 0
#define ARM_ELF_OS_ABI_VERSION 0
+static reloc_howto_type * find_howto PARAMS ((unsigned int));
+static void elf32_arm_info_to_howto PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+static reloc_howto_type * elf32_arm_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type));
+
static reloc_howto_type elf32_arm_howto_table[] =
-{
- /* No relocation */
- HOWTO (R_ARM_NONE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_NONE", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
-
- HOWTO (R_ARM_PC24, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 24, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_PC24", /* name */
- false, /* partial_inplace */
- 0x00ffffff, /* src_mask */
- 0x00ffffff, /* dst_mask */
- true), /* pcrel_offset */
-
- /* 32 bit absolute */
- HOWTO (R_ARM_ABS32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_ABS32", /* name */
- false, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* standard 32bit pc-relative reloc */
- HOWTO (R_ARM_REL32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_REL32", /* name */
- false, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- true), /* pcrel_offset */
-
- /* 8 bit absolute */
- HOWTO (R_ARM_ABS8, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_ABS8", /* name */
- false, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
- false), /* pcrel_offset */
-
- /* 16 bit absolute */
- HOWTO (R_ARM_ABS16, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_ABS16", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
-
- /* 12 bit absolute */
- HOWTO (R_ARM_ABS12, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 12, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_ABS12", /* name */
- false, /* partial_inplace */
- 0x000008ff, /* src_mask */
- 0x000008ff, /* dst_mask */
- false), /* pcrel_offset */
-
- HOWTO (R_ARM_THM_ABS5, /* type */
- 6, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 5, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_THM_ABS5", /* name */
- false, /* partial_inplace */
- 0x000007e0, /* src_mask */
- 0x000007e0, /* dst_mask */
- false), /* pcrel_offset */
-
- HOWTO (R_ARM_THM_PC22, /* type */
- 1, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 23, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_THM_PC22", /* name */
- false, /* partial_inplace */
- 0x07ff07ff, /* src_mask */
- 0x07ff07ff, /* dst_mask */
- true), /* pcrel_offset */
-
- HOWTO (R_ARM_SBREL32, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_SBREL32", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
-
- HOWTO (R_ARM_AMP_VCALL9, /* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_AMP_VCALL9", /* name */
- false, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
- true), /* pcrel_offset */
-
- /* 12 bit pc relative */
- HOWTO (R_ARM_THM_PC11, /* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 11, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_THM_PC11", /* name */
- false, /* partial_inplace */
- 0x000007ff, /* src_mask */
- 0x000007ff, /* dst_mask */
- true), /* pcrel_offset */
-
- /* 12 bit pc relative */
- HOWTO (R_ARM_THM_PC9, /* type */
- 1, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_THM_PC9", /* name */
- false, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
- true), /* pcrel_offset */
-
- /* GNU extension to record C++ vtable hierarchy */
- HOWTO (R_ARM_GNU_VTINHERIT, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- NULL, /* special_function */
- "R_ARM_GNU_VTINHERIT", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
-
- /* GNU extension to record C++ vtable member usage */
- HOWTO (R_ARM_GNU_VTENTRY, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- _bfd_elf_rel_vtable_reloc_fn, /* special_function */
- "R_ARM_GNU_VTENTRY", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
-
- /* XXX - gap in index numbering here. */
-
- HOWTO (R_ARM_PLT32, /* type */
- 2, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 26, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_bitfield,/* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_PLT32", /* name */
- true, /* partial_inplace */
- 0x00ffffff, /* src_mask */
- 0x00ffffff, /* dst_mask */
- true), /* pcrel_offset */
-
- /* XXX - gap in index numbering here. */
-
- HOWTO (R_ARM_RREL32, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_RREL32", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
-
- HOWTO (R_ARM_RABS32, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_RABS32", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
-
- HOWTO (R_ARM_RPC24, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_RPC24", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false), /* pcrel_offset */
-
- HOWTO (R_ARM_RBASE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 0, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- bfd_elf_generic_reloc, /* special_function */
- "R_ARM_RBASE", /* name */
- false, /* partial_inplace */
- 0, /* src_mask */
- 0, /* dst_mask */
- false) /* pcrel_offset */
-};
+ {
+ /* No relocation. */
+ HOWTO (R_ARM_NONE, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_NONE", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (R_ARM_PC24, /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 24, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_PC24", /* name */
+ false, /* partial_inplace */
+ 0x00ffffff, /* src_mask */
+ 0x00ffffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* 32 bit absolute. */
+ HOWTO (R_ARM_ABS32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ABS32", /* name */
+ false, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Standard 32bit pc-relative reloc. */
+ HOWTO (R_ARM_REL32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_REL32", /* name */
+ false, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* 8 bit absolute. */
+ HOWTO (R_ARM_ABS8, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ABS8", /* name */
+ false, /* partial_inplace */
+ 0x000000ff, /* src_mask */
+ 0x000000ff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 16 bit absolute. */
+ HOWTO (R_ARM_ABS16, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ABS16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* 12 bit absolute. */
+ HOWTO (R_ARM_ABS12, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_ABS12", /* name */
+ false, /* partial_inplace */
+ 0x000008ff, /* src_mask */
+ 0x000008ff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (R_ARM_THM_ABS5, /* type */
+ 6, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 5, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_THM_ABS5", /* name */
+ false, /* partial_inplace */
+ 0x000007e0, /* src_mask */
+ 0x000007e0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (R_ARM_THM_PC22, /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 23, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_THM_PC22", /* name */
+ false, /* partial_inplace */
+ 0x07ff07ff, /* src_mask */
+ 0x07ff07ff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ HOWTO (R_ARM_SBREL32, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_SBREL32", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (R_ARM_AMP_VCALL9, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_AMP_VCALL9", /* name */
+ false, /* partial_inplace */
+ 0x000000ff, /* src_mask */
+ 0x000000ff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* 12 bit pc relative. */
+ HOWTO (R_ARM_THM_PC11, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 11, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_THM_PC11", /* name */
+ false, /* partial_inplace */
+ 0x000007ff, /* src_mask */
+ 0x000007ff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* 12 bit pc relative. */
+ HOWTO (R_ARM_THM_PC9, /* type */
+ 1, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_THM_PC9", /* name */
+ false, /* partial_inplace */
+ 0x000000ff, /* src_mask */
+ 0x000000ff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* GNU extension to record C++ vtable hierarchy. */
+ HOWTO (R_ARM_GNU_VTINHERIT, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ NULL, /* special_function */
+ "R_ARM_GNU_VTINHERIT", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* GNU extension to record C++ vtable member usage. */
+ HOWTO (R_ARM_GNU_VTENTRY, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ _bfd_elf_rel_vtable_reloc_fn, /* special_function */
+ "R_ARM_GNU_VTENTRY", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* XXX - gap in index numbering here. */
+
+ HOWTO (R_ARM_PLT32, /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 26, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_PLT32", /* name */
+ true, /* partial_inplace */
+ 0x00ffffff, /* src_mask */
+ 0x00ffffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* XXX - gap in index numbering here. */
+
+ HOWTO (R_ARM_RREL32, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_RREL32", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (R_ARM_RABS32, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_RABS32", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (R_ARM_RPC24, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_RPC24", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (R_ARM_RBASE, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_ARM_RBASE", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false) /* pcrel_offset */
+ };
/* Locate a reloc in the howto table. This function must be used
when the entry number is is > R_ARM_GNU_VTINHERIT. */
+
static reloc_howto_type *
find_howto (r_type)
unsigned int r_type;
@@ -377,23 +382,23 @@ struct elf32_arm_reloc_map
};
static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] =
-{
- {BFD_RELOC_NONE, R_ARM_NONE },
- {BFD_RELOC_ARM_PCREL_BRANCH, R_ARM_PC24 },
- {BFD_RELOC_32, R_ARM_ABS32 },
- {BFD_RELOC_32_PCREL, R_ARM_REL32 },
- {BFD_RELOC_8, R_ARM_ABS8 },
- {BFD_RELOC_16, R_ARM_ABS16 },
- {BFD_RELOC_ARM_OFFSET_IMM, R_ARM_ABS12 },
- {BFD_RELOC_ARM_THUMB_OFFSET, R_ARM_THM_ABS5 },
- {BFD_RELOC_THUMB_PCREL_BRANCH23, R_ARM_THM_PC22 },
- {BFD_RELOC_NONE, R_ARM_SBREL32 },
- {BFD_RELOC_NONE, R_ARM_AMP_VCALL9 },
- {BFD_RELOC_THUMB_PCREL_BRANCH12, R_ARM_THM_PC11 },
- {BFD_RELOC_THUMB_PCREL_BRANCH9, R_ARM_THM_PC9 },
- {BFD_RELOC_VTABLE_INHERIT, R_ARM_GNU_VTINHERIT },
- {BFD_RELOC_VTABLE_ENTRY, R_ARM_GNU_VTENTRY }
-};
+ {
+ {BFD_RELOC_NONE, R_ARM_NONE },
+ {BFD_RELOC_ARM_PCREL_BRANCH, R_ARM_PC24 },
+ {BFD_RELOC_32, R_ARM_ABS32 },
+ {BFD_RELOC_32_PCREL, R_ARM_REL32 },
+ {BFD_RELOC_8, R_ARM_ABS8 },
+ {BFD_RELOC_16, R_ARM_ABS16 },
+ {BFD_RELOC_ARM_OFFSET_IMM, R_ARM_ABS12 },
+ {BFD_RELOC_ARM_THUMB_OFFSET, R_ARM_THM_ABS5 },
+ {BFD_RELOC_THUMB_PCREL_BRANCH23, R_ARM_THM_PC22 },
+ {BFD_RELOC_NONE, R_ARM_SBREL32 },
+ {BFD_RELOC_NONE, R_ARM_AMP_VCALL9 },
+ {BFD_RELOC_THUMB_PCREL_BRANCH12, R_ARM_THM_PC11 },
+ {BFD_RELOC_THUMB_PCREL_BRANCH9, R_ARM_THM_PC9 },
+ {BFD_RELOC_VTABLE_INHERIT, R_ARM_GNU_VTINHERIT },
+ {BFD_RELOC_VTABLE_ENTRY, R_ARM_GNU_VTENTRY }
+ };
static reloc_howto_type *
elf32_arm_reloc_type_lookup (abfd, code)
diff --git a/contrib/binutils/bfd/elfcode.h b/contrib/binutils/bfd/elfcode.h
index b02a399..203323c 100644
--- a/contrib/binutils/bfd/elfcode.h
+++ b/contrib/binutils/bfd/elfcode.h
@@ -66,6 +66,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
+#include "libiberty.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
@@ -122,6 +123,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define elf_slurp_reloc_table NAME(bfd_elf,slurp_reloc_table)
#define elf_link_create_dynamic_sections \
NAME(bfd_elf,link_create_dynamic_sections)
+#define elf_bfd_discard_info NAME(bfd_elf,discard_info)
+#define elf_reloc_symbol_deleted_p NAME(_bfd_elf,reloc_symbol_deleted_p)
#define elf_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
#define elf_bfd_final_link NAME(bfd_elf,bfd_final_link)
#define elf_create_pointer_linker_section NAME(bfd_elf,create_pointer_linker_section)
@@ -184,56 +187,73 @@ static char *elf_symbol_flags PARAMS ((flagword));
/* Should perhaps use put_offset, put_word, etc. For now, the two versions
can be handled by explicitly specifying 32 bits or "the long type". */
#if ARCH_SIZE == 64
-#define put_word bfd_h_put_64
-#define put_signed_word bfd_h_put_signed_64
-#define get_word bfd_h_get_64
-#define get_signed_word bfd_h_get_signed_64
+#define H_PUT_WORD H_PUT_64
+#define H_PUT_SIGNED_WORD H_PUT_S64
+#define H_GET_WORD H_GET_64
+#define H_GET_SIGNED_WORD H_GET_S64
#endif
#if ARCH_SIZE == 32
-#define put_word bfd_h_put_32
-#define put_signed_word bfd_h_put_signed_32
-#define get_word bfd_h_get_32
-#define get_signed_word bfd_h_get_signed_32
+#define H_PUT_WORD H_PUT_32
+#define H_PUT_SIGNED_WORD H_PUT_S32
+#define H_GET_WORD H_GET_32
+#define H_GET_SIGNED_WORD H_GET_S32
#endif
/* Translate an ELF symbol in external format into an ELF symbol in internal
format. */
void
-elf_swap_symbol_in (abfd, src, dst)
+elf_swap_symbol_in (abfd, src, shndx, dst)
bfd *abfd;
const Elf_External_Sym *src;
+ const Elf_External_Sym_Shndx *shndx;
Elf_Internal_Sym *dst;
{
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
- dst->st_name = bfd_h_get_32 (abfd, (bfd_byte *) src->st_name);
+ dst->st_name = H_GET_32 (abfd, src->st_name);
if (signed_vma)
- dst->st_value = get_signed_word (abfd, (bfd_byte *) src->st_value);
+ dst->st_value = H_GET_SIGNED_WORD (abfd, src->st_value);
else
- dst->st_value = get_word (abfd, (bfd_byte *) src->st_value);
- dst->st_size = get_word (abfd, (bfd_byte *) src->st_size);
- dst->st_info = bfd_h_get_8 (abfd, (bfd_byte *) src->st_info);
- dst->st_other = bfd_h_get_8 (abfd, (bfd_byte *) src->st_other);
- dst->st_shndx = bfd_h_get_16 (abfd, (bfd_byte *) src->st_shndx);
+ dst->st_value = H_GET_WORD (abfd, src->st_value);
+ dst->st_size = H_GET_WORD (abfd, src->st_size);
+ dst->st_info = H_GET_8 (abfd, src->st_info);
+ dst->st_other = H_GET_8 (abfd, src->st_other);
+ dst->st_shndx = H_GET_16 (abfd, src->st_shndx);
+ if (dst->st_shndx == SHN_XINDEX)
+ {
+ if (shndx == NULL)
+ abort ();
+ dst->st_shndx = H_GET_32 (abfd, shndx->est_shndx);
+ }
}
/* Translate an ELF symbol in internal format into an ELF symbol in external
format. */
void
-elf_swap_symbol_out (abfd, src, cdst)
+elf_swap_symbol_out (abfd, src, cdst, shndx)
bfd *abfd;
const Elf_Internal_Sym *src;
PTR cdst;
+ PTR shndx;
{
+ unsigned int tmp;
Elf_External_Sym *dst = (Elf_External_Sym *) cdst;
- bfd_h_put_32 (abfd, src->st_name, dst->st_name);
- put_word (abfd, src->st_value, dst->st_value);
- put_word (abfd, src->st_size, dst->st_size);
- bfd_h_put_8 (abfd, src->st_info, dst->st_info);
- bfd_h_put_8 (abfd, src->st_other, dst->st_other);
- bfd_h_put_16 (abfd, src->st_shndx, dst->st_shndx);
+ H_PUT_32 (abfd, src->st_name, dst->st_name);
+ H_PUT_WORD (abfd, src->st_value, dst->st_value);
+ H_PUT_WORD (abfd, src->st_size, dst->st_size);
+ H_PUT_8 (abfd, src->st_info, dst->st_info);
+ H_PUT_8 (abfd, src->st_other, dst->st_other);
+ tmp = src->st_shndx;
+ if (tmp > SHN_HIRESERVE)
+ {
+ if (shndx == NULL)
+ abort ();
+ H_PUT_32 (abfd, tmp, shndx);
+ tmp = SHN_XINDEX;
+ }
+ H_PUT_16 (abfd, tmp, dst->st_shndx);
}
/* Translate an ELF file header in external format into an ELF file header in
@@ -247,22 +267,22 @@ elf_swap_ehdr_in (abfd, src, dst)
{
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
memcpy (dst->e_ident, src->e_ident, EI_NIDENT);
- dst->e_type = bfd_h_get_16 (abfd, (bfd_byte *) src->e_type);
- dst->e_machine = bfd_h_get_16 (abfd, (bfd_byte *) src->e_machine);
- dst->e_version = bfd_h_get_32 (abfd, (bfd_byte *) src->e_version);
+ dst->e_type = H_GET_16 (abfd, src->e_type);
+ dst->e_machine = H_GET_16 (abfd, src->e_machine);
+ dst->e_version = H_GET_32 (abfd, src->e_version);
if (signed_vma)
- dst->e_entry = get_signed_word (abfd, (bfd_byte *) src->e_entry);
+ dst->e_entry = H_GET_SIGNED_WORD (abfd, src->e_entry);
else
- dst->e_entry = get_word (abfd, (bfd_byte *) src->e_entry);
- dst->e_phoff = get_word (abfd, (bfd_byte *) src->e_phoff);
- dst->e_shoff = get_word (abfd, (bfd_byte *) src->e_shoff);
- dst->e_flags = bfd_h_get_32 (abfd, (bfd_byte *) src->e_flags);
- dst->e_ehsize = bfd_h_get_16 (abfd, (bfd_byte *) src->e_ehsize);
- dst->e_phentsize = bfd_h_get_16 (abfd, (bfd_byte *) src->e_phentsize);
- dst->e_phnum = bfd_h_get_16 (abfd, (bfd_byte *) src->e_phnum);
- dst->e_shentsize = bfd_h_get_16 (abfd, (bfd_byte *) src->e_shentsize);
- dst->e_shnum = bfd_h_get_16 (abfd, (bfd_byte *) src->e_shnum);
- dst->e_shstrndx = bfd_h_get_16 (abfd, (bfd_byte *) src->e_shstrndx);
+ dst->e_entry = H_GET_WORD (abfd, src->e_entry);
+ dst->e_phoff = H_GET_WORD (abfd, src->e_phoff);
+ dst->e_shoff = H_GET_WORD (abfd, src->e_shoff);
+ dst->e_flags = H_GET_32 (abfd, src->e_flags);
+ dst->e_ehsize = H_GET_16 (abfd, src->e_ehsize);
+ dst->e_phentsize = H_GET_16 (abfd, src->e_phentsize);
+ dst->e_phnum = H_GET_16 (abfd, src->e_phnum);
+ dst->e_shentsize = H_GET_16 (abfd, src->e_shentsize);
+ dst->e_shnum = H_GET_16 (abfd, src->e_shnum);
+ dst->e_shstrndx = H_GET_16 (abfd, src->e_shstrndx);
}
/* Translate an ELF file header in internal format into an ELF file header in
@@ -274,25 +294,32 @@ elf_swap_ehdr_out (abfd, src, dst)
const Elf_Internal_Ehdr *src;
Elf_External_Ehdr *dst;
{
+ unsigned int tmp;
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
memcpy (dst->e_ident, src->e_ident, EI_NIDENT);
/* note that all elements of dst are *arrays of unsigned char* already... */
- bfd_h_put_16 (abfd, src->e_type, dst->e_type);
- bfd_h_put_16 (abfd, src->e_machine, dst->e_machine);
- bfd_h_put_32 (abfd, src->e_version, dst->e_version);
+ H_PUT_16 (abfd, src->e_type, dst->e_type);
+ H_PUT_16 (abfd, src->e_machine, dst->e_machine);
+ H_PUT_32 (abfd, src->e_version, dst->e_version);
if (signed_vma)
- put_signed_word (abfd, src->e_entry, dst->e_entry);
+ H_PUT_SIGNED_WORD (abfd, src->e_entry, dst->e_entry);
else
- put_word (abfd, src->e_entry, dst->e_entry);
- put_word (abfd, src->e_phoff, dst->e_phoff);
- put_word (abfd, src->e_shoff, dst->e_shoff);
- bfd_h_put_32 (abfd, src->e_flags, dst->e_flags);
- bfd_h_put_16 (abfd, src->e_ehsize, dst->e_ehsize);
- bfd_h_put_16 (abfd, src->e_phentsize, dst->e_phentsize);
- bfd_h_put_16 (abfd, src->e_phnum, dst->e_phnum);
- bfd_h_put_16 (abfd, src->e_shentsize, dst->e_shentsize);
- bfd_h_put_16 (abfd, src->e_shnum, dst->e_shnum);
- bfd_h_put_16 (abfd, src->e_shstrndx, dst->e_shstrndx);
+ H_PUT_WORD (abfd, src->e_entry, dst->e_entry);
+ H_PUT_WORD (abfd, src->e_phoff, dst->e_phoff);
+ H_PUT_WORD (abfd, src->e_shoff, dst->e_shoff);
+ H_PUT_32 (abfd, src->e_flags, dst->e_flags);
+ H_PUT_16 (abfd, src->e_ehsize, dst->e_ehsize);
+ H_PUT_16 (abfd, src->e_phentsize, dst->e_phentsize);
+ H_PUT_16 (abfd, src->e_phnum, dst->e_phnum);
+ H_PUT_16 (abfd, src->e_shentsize, dst->e_shentsize);
+ tmp = src->e_shnum;
+ if (tmp >= SHN_LORESERVE)
+ tmp = SHN_UNDEF;
+ H_PUT_16 (abfd, tmp, dst->e_shnum);
+ tmp = src->e_shstrndx;
+ if (tmp >= SHN_LORESERVE)
+ tmp = SHN_XINDEX;
+ H_PUT_16 (abfd, tmp, dst->e_shstrndx);
}
/* Translate an ELF section header table entry in external format into an
@@ -306,19 +333,19 @@ elf_swap_shdr_in (abfd, src, dst)
{
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
- dst->sh_name = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_name);
- dst->sh_type = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_type);
- dst->sh_flags = get_word (abfd, (bfd_byte *) src->sh_flags);
+ dst->sh_name = H_GET_32 (abfd, src->sh_name);
+ dst->sh_type = H_GET_32 (abfd, src->sh_type);
+ dst->sh_flags = H_GET_WORD (abfd, src->sh_flags);
if (signed_vma)
- dst->sh_addr = get_signed_word (abfd, (bfd_byte *) src->sh_addr);
+ dst->sh_addr = H_GET_SIGNED_WORD (abfd, src->sh_addr);
else
- dst->sh_addr = get_word (abfd, (bfd_byte *) src->sh_addr);
- dst->sh_offset = get_word (abfd, (bfd_byte *) src->sh_offset);
- dst->sh_size = get_word (abfd, (bfd_byte *) src->sh_size);
- dst->sh_link = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_link);
- dst->sh_info = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_info);
- dst->sh_addralign = get_word (abfd, (bfd_byte *) src->sh_addralign);
- dst->sh_entsize = get_word (abfd, (bfd_byte *) src->sh_entsize);
+ dst->sh_addr = H_GET_WORD (abfd, src->sh_addr);
+ dst->sh_offset = H_GET_WORD (abfd, src->sh_offset);
+ dst->sh_size = H_GET_WORD (abfd, src->sh_size);
+ dst->sh_link = H_GET_32 (abfd, src->sh_link);
+ dst->sh_info = H_GET_32 (abfd, src->sh_info);
+ dst->sh_addralign = H_GET_WORD (abfd, src->sh_addralign);
+ dst->sh_entsize = H_GET_WORD (abfd, src->sh_entsize);
dst->bfd_section = NULL;
dst->contents = NULL;
}
@@ -333,16 +360,16 @@ elf_swap_shdr_out (abfd, src, dst)
Elf_External_Shdr *dst;
{
/* note that all elements of dst are *arrays of unsigned char* already... */
- bfd_h_put_32 (abfd, src->sh_name, dst->sh_name);
- bfd_h_put_32 (abfd, src->sh_type, dst->sh_type);
- put_word (abfd, src->sh_flags, dst->sh_flags);
- put_word (abfd, src->sh_addr, dst->sh_addr);
- put_word (abfd, src->sh_offset, dst->sh_offset);
- put_word (abfd, src->sh_size, dst->sh_size);
- bfd_h_put_32 (abfd, src->sh_link, dst->sh_link);
- bfd_h_put_32 (abfd, src->sh_info, dst->sh_info);
- put_word (abfd, src->sh_addralign, dst->sh_addralign);
- put_word (abfd, src->sh_entsize, dst->sh_entsize);
+ H_PUT_32 (abfd, src->sh_name, dst->sh_name);
+ H_PUT_32 (abfd, src->sh_type, dst->sh_type);
+ H_PUT_WORD (abfd, src->sh_flags, dst->sh_flags);
+ H_PUT_WORD (abfd, src->sh_addr, dst->sh_addr);
+ H_PUT_WORD (abfd, src->sh_offset, dst->sh_offset);
+ H_PUT_WORD (abfd, src->sh_size, dst->sh_size);
+ H_PUT_32 (abfd, src->sh_link, dst->sh_link);
+ H_PUT_32 (abfd, src->sh_info, dst->sh_info);
+ H_PUT_WORD (abfd, src->sh_addralign, dst->sh_addralign);
+ H_PUT_WORD (abfd, src->sh_entsize, dst->sh_entsize);
}
/* Translate an ELF program header table entry in external format into an
@@ -356,22 +383,22 @@ elf_swap_phdr_in (abfd, src, dst)
{
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
- dst->p_type = bfd_h_get_32 (abfd, (bfd_byte *) src->p_type);
- dst->p_flags = bfd_h_get_32 (abfd, (bfd_byte *) src->p_flags);
- dst->p_offset = get_word (abfd, (bfd_byte *) src->p_offset);
+ dst->p_type = H_GET_32 (abfd, src->p_type);
+ dst->p_flags = H_GET_32 (abfd, src->p_flags);
+ dst->p_offset = H_GET_WORD (abfd, src->p_offset);
if (signed_vma)
{
- dst->p_vaddr = get_signed_word (abfd, (bfd_byte *) src->p_vaddr);
- dst->p_paddr = get_signed_word (abfd, (bfd_byte *) src->p_paddr);
+ dst->p_vaddr = H_GET_SIGNED_WORD (abfd, src->p_vaddr);
+ dst->p_paddr = H_GET_SIGNED_WORD (abfd, src->p_paddr);
}
else
{
- dst->p_vaddr = get_word (abfd, (bfd_byte *) src->p_vaddr);
- dst->p_paddr = get_word (abfd, (bfd_byte *) src->p_paddr);
+ dst->p_vaddr = H_GET_WORD (abfd, src->p_vaddr);
+ dst->p_paddr = H_GET_WORD (abfd, src->p_paddr);
}
- dst->p_filesz = get_word (abfd, (bfd_byte *) src->p_filesz);
- dst->p_memsz = get_word (abfd, (bfd_byte *) src->p_memsz);
- dst->p_align = get_word (abfd, (bfd_byte *) src->p_align);
+ dst->p_filesz = H_GET_WORD (abfd, src->p_filesz);
+ dst->p_memsz = H_GET_WORD (abfd, src->p_memsz);
+ dst->p_align = H_GET_WORD (abfd, src->p_align);
}
void
@@ -381,14 +408,14 @@ elf_swap_phdr_out (abfd, src, dst)
Elf_External_Phdr *dst;
{
/* note that all elements of dst are *arrays of unsigned char* already... */
- bfd_h_put_32 (abfd, src->p_type, dst->p_type);
- put_word (abfd, src->p_offset, dst->p_offset);
- put_word (abfd, src->p_vaddr, dst->p_vaddr);
- put_word (abfd, src->p_paddr, dst->p_paddr);
- put_word (abfd, src->p_filesz, dst->p_filesz);
- put_word (abfd, src->p_memsz, dst->p_memsz);
- bfd_h_put_32 (abfd, src->p_flags, dst->p_flags);
- put_word (abfd, src->p_align, dst->p_align);
+ H_PUT_32 (abfd, src->p_type, dst->p_type);
+ H_PUT_WORD (abfd, src->p_offset, dst->p_offset);
+ H_PUT_WORD (abfd, src->p_vaddr, dst->p_vaddr);
+ H_PUT_WORD (abfd, src->p_paddr, dst->p_paddr);
+ H_PUT_WORD (abfd, src->p_filesz, dst->p_filesz);
+ H_PUT_WORD (abfd, src->p_memsz, dst->p_memsz);
+ H_PUT_32 (abfd, src->p_flags, dst->p_flags);
+ H_PUT_WORD (abfd, src->p_align, dst->p_align);
}
/* Translate an ELF reloc from external format to internal format. */
@@ -398,8 +425,8 @@ elf_swap_reloc_in (abfd, src, dst)
const Elf_External_Rel *src;
Elf_Internal_Rel *dst;
{
- dst->r_offset = get_word (abfd, (bfd_byte *) src->r_offset);
- dst->r_info = get_word (abfd, (bfd_byte *) src->r_info);
+ dst->r_offset = H_GET_WORD (abfd, src->r_offset);
+ dst->r_info = H_GET_WORD (abfd, src->r_info);
}
INLINE void
@@ -408,9 +435,9 @@ elf_swap_reloca_in (abfd, src, dst)
const Elf_External_Rela *src;
Elf_Internal_Rela *dst;
{
- dst->r_offset = get_word (abfd, (bfd_byte *) src->r_offset);
- dst->r_info = get_word (abfd, (bfd_byte *) src->r_info);
- dst->r_addend = get_signed_word (abfd, (bfd_byte *) src->r_addend);
+ dst->r_offset = H_GET_WORD (abfd, src->r_offset);
+ dst->r_info = H_GET_WORD (abfd, src->r_info);
+ dst->r_addend = H_GET_SIGNED_WORD (abfd, src->r_addend);
}
/* Translate an ELF reloc from internal format to external format. */
@@ -420,8 +447,8 @@ elf_swap_reloc_out (abfd, src, dst)
const Elf_Internal_Rel *src;
Elf_External_Rel *dst;
{
- put_word (abfd, src->r_offset, dst->r_offset);
- put_word (abfd, src->r_info, dst->r_info);
+ H_PUT_WORD (abfd, src->r_offset, dst->r_offset);
+ H_PUT_WORD (abfd, src->r_info, dst->r_info);
}
INLINE void
@@ -430,9 +457,9 @@ elf_swap_reloca_out (abfd, src, dst)
const Elf_Internal_Rela *src;
Elf_External_Rela *dst;
{
- put_word (abfd, src->r_offset, dst->r_offset);
- put_word (abfd, src->r_info, dst->r_info);
- put_signed_word (abfd, src->r_addend, dst->r_addend);
+ H_PUT_WORD (abfd, src->r_offset, dst->r_offset);
+ H_PUT_WORD (abfd, src->r_info, dst->r_info);
+ H_PUT_SIGNED_WORD (abfd, src->r_addend, dst->r_addend);
}
INLINE void
@@ -443,8 +470,8 @@ elf_swap_dyn_in (abfd, p, dst)
{
const Elf_External_Dyn *src = (const Elf_External_Dyn *) p;
- dst->d_tag = get_word (abfd, src->d_tag);
- dst->d_un.d_val = get_word (abfd, src->d_un.d_val);
+ dst->d_tag = H_GET_WORD (abfd, src->d_tag);
+ dst->d_un.d_val = H_GET_WORD (abfd, src->d_un.d_val);
}
INLINE void
@@ -455,8 +482,8 @@ elf_swap_dyn_out (abfd, src, p)
{
Elf_External_Dyn *dst = (Elf_External_Dyn *) p;
- put_word (abfd, src->d_tag, dst->d_tag);
- put_word (abfd, src->d_un.d_val, dst->d_un.d_val);
+ H_PUT_WORD (abfd, src->d_tag, dst->d_tag);
+ H_PUT_WORD (abfd, src->d_un.d_val, dst->d_un.d_val);
}
/* ELF .o/exec file reading */
@@ -476,6 +503,16 @@ elf_file_p (x_ehdrp)
&& (x_ehdrp->e_ident[EI_MAG3] == ELFMAG3));
}
+struct bfd_preserve
+{
+ const struct bfd_arch_info *arch_info;
+ struct elf_obj_tdata *tdata;
+ struct bfd_hash_table section_htab;
+ struct sec *sections;
+ struct sec **section_tail;
+ unsigned int section_count;
+};
+
/* Check to see if the file associated with ABFD matches the target vector
that ABFD points to.
@@ -491,26 +528,22 @@ elf_object_p (abfd)
Elf_External_Ehdr x_ehdr; /* Elf file header, external form */
Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
Elf_External_Shdr x_shdr; /* Section header table entry, external form */
- Elf_Internal_Shdr *i_shdrp = NULL; /* Section header table, internal form */
+ Elf_Internal_Shdr i_shdr;
+ Elf_Internal_Shdr *i_shdrp; /* Section header table, internal form */
unsigned int shindex;
char *shstrtab; /* Internal copy of section header stringtab */
struct elf_backend_data *ebd;
- struct elf_obj_tdata *preserved_tdata = elf_tdata (abfd);
- struct sec *preserved_sections = abfd->sections;
- unsigned int preserved_section_count = abfd->section_count;
- enum bfd_architecture previous_arch = bfd_get_arch (abfd);
- unsigned long previous_mach = bfd_get_mach (abfd);
+ struct bfd_preserve preserve;
struct elf_obj_tdata *new_tdata = NULL;
asection *s;
+ bfd_size_type amt;
- /* Clear section information, since there might be a recognized bfd that
- we now check if we can replace, and we don't want to append to it. */
- abfd->sections = NULL;
- abfd->section_count = 0;
+ preserve.arch_info = abfd->arch_info;
/* Read in the ELF header in external format. */
- if (bfd_read ((PTR) & x_ehdr, sizeof (x_ehdr), 1, abfd) != sizeof (x_ehdr))
+ if (bfd_bread ((PTR) & x_ehdr, (bfd_size_type) sizeof (x_ehdr), abfd)
+ != sizeof (x_ehdr))
{
if (bfd_get_error () != bfd_error_system_call)
goto got_wrong_format_error;
@@ -548,12 +581,25 @@ elf_object_p (abfd)
/* Allocate an instance of the elf_obj_tdata structure and hook it up to
the tdata pointer in the bfd. */
- new_tdata = ((struct elf_obj_tdata *)
- bfd_zalloc (abfd, sizeof (struct elf_obj_tdata)));
+ amt = sizeof (struct elf_obj_tdata);
+ new_tdata = (struct elf_obj_tdata *) bfd_zalloc (abfd, amt);
if (new_tdata == NULL)
goto got_no_match;
+ preserve.tdata = elf_tdata (abfd);
elf_tdata (abfd) = new_tdata;
+ /* Clear section information, since there might be a recognized bfd that
+ we now check if we can replace, and we don't want to append to it. */
+ preserve.sections = abfd->sections;
+ preserve.section_tail = abfd->section_tail;
+ preserve.section_count = abfd->section_count;
+ preserve.section_htab = abfd->section_htab;
+ abfd->sections = NULL;
+ abfd->section_tail = &abfd->sections;
+ abfd->section_count = 0;
+ if (!bfd_hash_table_init (&abfd->section_htab, bfd_section_hash_newfunc))
+ goto got_no_match;
+
/* Now that we know the byte order, swap in the rest of the header */
i_ehdrp = elf_elfheader (abfd);
elf_swap_ehdr_in (abfd, &x_ehdr, i_ehdrp);
@@ -565,14 +611,15 @@ elf_object_p (abfd)
if (i_ehdrp->e_type == ET_CORE)
goto got_wrong_format_error;
- /* If there is no section header table, we're hosed. */
- if (i_ehdrp->e_shoff == 0)
+ /* If this is a relocatable file and there is no section header
+ table, then we're hosed. */
+ if (i_ehdrp->e_shoff == 0 && i_ehdrp->e_type == ET_REL)
goto got_wrong_format_error;
/* As a simple sanity check, verify that the what BFD thinks is the
size of each section header table entry actually matches the size
- recorded in the file. */
- if (i_ehdrp->e_shentsize != sizeof (x_shdr))
+ recorded in the file, but only if there are any sections. */
+ if (i_ehdrp->e_shentsize != sizeof (x_shdr) && i_ehdrp->e_shnum != 0)
goto got_wrong_format_error;
ebd = get_elf_backend_data (abfd);
@@ -628,34 +675,80 @@ elf_object_p (abfd)
/* Remember the entry point specified in the ELF file header. */
bfd_set_start_address (abfd, i_ehdrp->e_entry);
- /* Allocate space for a copy of the section header table in
- internal form, seek to the section header table in the file,
- read it in, and convert it to internal form. */
- i_shdrp = ((Elf_Internal_Shdr *)
- bfd_alloc (abfd, sizeof (*i_shdrp) * i_ehdrp->e_shnum));
- elf_elfsections (abfd) = ((Elf_Internal_Shdr **)
- bfd_alloc (abfd,
- sizeof (i_shdrp) * i_ehdrp->e_shnum));
- if (!i_shdrp || !elf_elfsections (abfd))
+ /* Seek to the section header table in the file. */
+ if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_shoff, SEEK_SET) != 0)
goto got_no_match;
- if (bfd_seek (abfd, i_ehdrp->e_shoff, SEEK_SET) != 0)
+
+ /* Read the first section header at index 0, and convert to internal
+ form. */
+ if (bfd_bread ((PTR) & x_shdr, (bfd_size_type) sizeof x_shdr, abfd)
+ != sizeof (x_shdr))
goto got_no_match;
- for (shindex = 0; shindex < i_ehdrp->e_shnum; shindex++)
+ elf_swap_shdr_in (abfd, &x_shdr, &i_shdr);
+
+ /* If the section count is zero, the actual count is in the first
+ section header. */
+ if (i_ehdrp->e_shnum == SHN_UNDEF)
+ i_ehdrp->e_shnum = i_shdr.sh_size;
+
+ /* And similarly for the string table index. */
+ if (i_ehdrp->e_shstrndx == SHN_XINDEX)
+ i_ehdrp->e_shstrndx = i_shdr.sh_link;
+
+ /* Allocate space for a copy of the section header table in
+ internal form. */
+ if (i_ehdrp->e_shnum != 0)
{
- if (bfd_read ((PTR) & x_shdr, sizeof x_shdr, 1, abfd) != sizeof (x_shdr))
+ Elf_Internal_Shdr *shdrp;
+ unsigned int num_sec;
+
+ amt = sizeof (*i_shdrp) * i_ehdrp->e_shnum;
+ i_shdrp = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt);
+ if (!i_shdrp)
goto got_no_match;
- elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex);
- elf_elfsections (abfd)[shindex] = i_shdrp + shindex;
-
- /* If the section is loaded, but not page aligned, clear
- D_PAGED. */
- if ((i_shdrp[shindex].sh_flags & SHF_ALLOC) != 0
- && i_shdrp[shindex].sh_type != SHT_NOBITS
- && (((i_shdrp[shindex].sh_addr - i_shdrp[shindex].sh_offset)
- % ebd->maxpagesize)
- != 0))
- abfd->flags &= ~D_PAGED;
+ num_sec = i_ehdrp->e_shnum;
+ if (num_sec > SHN_LORESERVE)
+ num_sec += SHN_HIRESERVE + 1 - SHN_LORESERVE;
+ elf_numsections (abfd) = num_sec;
+ amt = sizeof (i_shdrp) * num_sec;
+ elf_elfsections (abfd) = (Elf_Internal_Shdr **) bfd_alloc (abfd, amt);
+ if (!elf_elfsections (abfd))
+ goto got_no_match;
+
+ memcpy (i_shdrp, &i_shdr, sizeof (*i_shdrp));
+ shdrp = i_shdrp;
+ shindex = 0;
+ if (num_sec > SHN_LORESERVE)
+ {
+ for ( ; shindex < SHN_LORESERVE; shindex++)
+ elf_elfsections (abfd)[shindex] = shdrp++;
+ for ( ; shindex < SHN_HIRESERVE + 1; shindex++)
+ elf_elfsections (abfd)[shindex] = i_shdrp;
+ }
+ for ( ; shindex < num_sec; shindex++)
+ elf_elfsections (abfd)[shindex] = shdrp++;
+
+ /* Read in the rest of the section header table and convert it
+ to internal form. */
+ for (shindex = 1; shindex < i_ehdrp->e_shnum; shindex++)
+ {
+ if (bfd_bread ((PTR) & x_shdr, (bfd_size_type) sizeof x_shdr, abfd)
+ != sizeof (x_shdr))
+ goto got_no_match;
+ elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex);
+
+ /* If the section is loaded, but not page aligned, clear
+ D_PAGED. */
+ if (i_shdrp[shindex].sh_size != 0
+ && (i_shdrp[shindex].sh_flags & SHF_ALLOC) != 0
+ && i_shdrp[shindex].sh_type != SHT_NOBITS
+ && (((i_shdrp[shindex].sh_addr - i_shdrp[shindex].sh_offset)
+ % ebd->maxpagesize)
+ != 0))
+ abfd->flags &= ~D_PAGED;
+ }
}
+
if (i_ehdrp->e_shstrndx)
{
if (! bfd_section_from_shdr (abfd, i_ehdrp->e_shstrndx))
@@ -670,20 +763,18 @@ elf_object_p (abfd)
Elf_Internal_Phdr *i_phdr;
unsigned int i;
- elf_tdata (abfd)->phdr = ((Elf_Internal_Phdr *)
- bfd_alloc (abfd,
- (i_ehdrp->e_phnum
- * sizeof (Elf_Internal_Phdr))));
+ amt = i_ehdrp->e_phnum * sizeof (Elf_Internal_Phdr);
+ elf_tdata (abfd)->phdr = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
if (elf_tdata (abfd)->phdr == NULL)
goto got_no_match;
- if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) != 0)
+ if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0)
goto got_no_match;
i_phdr = elf_tdata (abfd)->phdr;
for (i = 0; i < i_ehdrp->e_phnum; i++, i_phdr++)
{
Elf_External_Phdr x_phdr;
- if (bfd_read ((PTR) &x_phdr, sizeof x_phdr, 1, abfd)
+ if (bfd_bread ((PTR) &x_phdr, (bfd_size_type) sizeof x_phdr, abfd)
!= sizeof x_phdr)
goto got_no_match;
elf_swap_phdr_in (abfd, &x_phdr, i_phdr);
@@ -696,18 +787,25 @@ elf_object_p (abfd)
bfd_section_from_shdr with it (since this particular strtab is
used to find all of the ELF section names.) */
- shstrtab = bfd_elf_get_str_section (abfd, i_ehdrp->e_shstrndx);
- if (!shstrtab)
- goto got_no_match;
-
- /* Once all of the section headers have been read and converted, we
- can start processing them. Note that the first section header is
- a dummy placeholder entry, so we ignore it. */
-
- for (shindex = 1; shindex < i_ehdrp->e_shnum; shindex++)
+ if (i_ehdrp->e_shstrndx != 0)
{
- if (! bfd_section_from_shdr (abfd, shindex))
+ unsigned int num_sec;
+
+ shstrtab = bfd_elf_get_str_section (abfd, i_ehdrp->e_shstrndx);
+ if (!shstrtab)
goto got_no_match;
+
+ /* Once all of the section headers have been read and converted, we
+ can start processing them. Note that the first section header is
+ a dummy placeholder entry, so we ignore it. */
+ num_sec = elf_numsections (abfd);
+ for (shindex = 1; shindex < num_sec; shindex++)
+ {
+ if (! bfd_section_from_shdr (abfd, shindex))
+ goto got_no_match;
+ if (shindex == SHN_LORESERVE - 1)
+ shindex += SHN_HIRESERVE + 1 - SHN_LORESERVE;
+ }
}
/* Let the backend double check the format and override global
@@ -737,6 +835,10 @@ elf_object_p (abfd)
}
}
+ /* It would be nice to be able to free more memory here, eg. old
+ elf_elfsections, old tdata, but that's not possible since these
+ blocks are sitting inside obj_alloc'd memory. */
+ bfd_hash_table_free (&preserve.section_htab);
return (abfd->xvec);
got_wrong_format_error:
@@ -749,20 +851,22 @@ elf_object_p (abfd)
target-specific elf_backend_object_p function. Note that saving the
whole bfd here and restoring it would be even worse; the first thing
you notice is that the cached bfd file position gets out of sync. */
- bfd_default_set_arch_mach (abfd, previous_arch, previous_mach);
bfd_set_error (bfd_error_wrong_format);
+
got_no_match:
- if (new_tdata != NULL
- && new_tdata->elf_sect_ptr != NULL)
- bfd_release (abfd, new_tdata->elf_sect_ptr);
- if (i_shdrp != NULL)
- bfd_release (abfd, i_shdrp);
+ abfd->arch_info = preserve.arch_info;
if (new_tdata != NULL)
- bfd_release (abfd, new_tdata);
- elf_tdata (abfd) = preserved_tdata;
- abfd->sections = preserved_sections;
- abfd->section_count = preserved_section_count;
- return (NULL);
+ {
+ /* bfd_release frees all memory more recently bfd_alloc'd than
+ its arg, as well as its arg. */
+ bfd_release (abfd, new_tdata);
+ elf_tdata (abfd) = preserve.tdata;
+ abfd->section_htab = preserve.section_htab;
+ abfd->sections = preserve.sections;
+ abfd->section_tail = preserve.section_tail;
+ abfd->section_count = preserve.section_count;
+ }
+ return NULL;
}
/* ELF .o/exec file writing */
@@ -935,14 +1039,14 @@ int
elf_write_out_phdrs (abfd, phdr, count)
bfd *abfd;
const Elf_Internal_Phdr *phdr;
- int count;
+ unsigned int count;
{
while (count--)
{
Elf_External_Phdr extphdr;
elf_swap_phdr_out (abfd, phdr, &extphdr);
- if (bfd_write (&extphdr, sizeof (Elf_External_Phdr), 1, abfd)
- != sizeof (Elf_External_Phdr))
+ if (bfd_bwrite (&extphdr, (bfd_size_type) sizeof (Elf_External_Phdr),
+ abfd) != sizeof (Elf_External_Phdr))
return -1;
phdr++;
}
@@ -960,6 +1064,7 @@ elf_write_shdrs_and_ehdr (abfd)
Elf_External_Shdr *x_shdrp; /* Section header table, external form */
Elf_Internal_Shdr **i_shdrp; /* Section header table, internal form */
unsigned int count;
+ bfd_size_type amt;
i_ehdrp = elf_elfheader (abfd);
i_shdrp = elf_elfsections (abfd);
@@ -970,27 +1075,37 @@ elf_write_shdrs_and_ehdr (abfd)
elf_debug_file (i_ehdrp);
#endif
elf_swap_ehdr_out (abfd, i_ehdrp, &x_ehdr);
+ amt = sizeof (x_ehdr);
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || (bfd_write ((PTR) & x_ehdr, sizeof (x_ehdr), 1, abfd)
- != sizeof (x_ehdr)))
+ || bfd_bwrite ((PTR) & x_ehdr, amt, abfd) != amt)
return false;
+ /* Some fields in the first section header handle overflow of ehdr
+ fields. */
+ if (i_ehdrp->e_shnum >= SHN_LORESERVE)
+ i_shdrp[0]->sh_size = i_ehdrp->e_shnum;
+ if (i_ehdrp->e_shstrndx >= SHN_LORESERVE)
+ i_shdrp[0]->sh_link = i_ehdrp->e_shstrndx;
+
/* at this point we've concocted all the ELF sections... */
- x_shdrp = (Elf_External_Shdr *)
- bfd_alloc (abfd, sizeof (*x_shdrp) * (i_ehdrp->e_shnum));
+ amt = i_ehdrp->e_shnum;
+ amt *= sizeof (*x_shdrp);
+ x_shdrp = (Elf_External_Shdr *) bfd_alloc (abfd, amt);
if (!x_shdrp)
return false;
- for (count = 0; count < i_ehdrp->e_shnum; count++)
+ for (count = 0; count < i_ehdrp->e_shnum; i_shdrp++, count++)
{
#if DEBUG & 2
- elf_debug_section (count, i_shdrp[count]);
+ elf_debug_section (count, *i_shdrp);
#endif
- elf_swap_shdr_out (abfd, i_shdrp[count], x_shdrp + count);
+ elf_swap_shdr_out (abfd, *i_shdrp, x_shdrp + count);
+
+ if (count == SHN_LORESERVE - 1)
+ i_shdrp += SHN_HIRESERVE + 1 - SHN_LORESERVE;
}
if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_shoff, SEEK_SET) != 0
- || (bfd_write ((PTR) x_shdrp, sizeof (*x_shdrp), i_ehdrp->e_shnum, abfd)
- != sizeof (*x_shdrp) * i_ehdrp->e_shnum))
+ || bfd_bwrite ((PTR) x_shdrp, amt, abfd) != amt)
return false;
/* need to dump the string table too... */
@@ -1011,7 +1126,9 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
elf_symbol_type *symbase; /* Buffer for generated bfd symbols */
Elf_Internal_Sym i_sym;
Elf_External_Sym *x_symp = NULL;
+ Elf_External_Sym_Shndx *x_shndx = NULL;
Elf_External_Versym *x_versymp = NULL;
+ bfd_size_type amt;
/* Read each raw ELF symbol, converting from external ELF form to
internal ELF form, and then using the information to create a
@@ -1025,8 +1142,24 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
if (! dynamic)
{
+ Elf_Internal_Shdr *shndx_hdr;
+
hdr = &elf_tdata (abfd)->symtab_hdr;
+ shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
verhdr = NULL;
+
+ /* If we have a SHT_SYMTAB_SHNDX section for the symbol table,
+ read the raw contents. */
+ if (elf_elfsections (abfd) != NULL
+ && elf_elfsections (abfd)[shndx_hdr->sh_link] == hdr)
+ {
+ amt = shndx_hdr->sh_size;
+ x_shndx = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
+ if (x_shndx == NULL
+ || bfd_seek (abfd, shndx_hdr->sh_offset, SEEK_SET) != 0
+ || bfd_bread ((PTR) x_shndx, amt, abfd) != amt)
+ goto error_return;
+ }
}
else
{
@@ -1045,8 +1178,8 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
}
}
- if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) == -1)
- return -1;
+ if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0)
+ goto error_return;
symcount = hdr->sh_size / sizeof (Elf_External_Sym);
@@ -1056,23 +1189,24 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
{
unsigned long i;
- if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) == -1)
- return -1;
+ if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0)
+ goto error_return;
- symbase = ((elf_symbol_type *)
- bfd_zalloc (abfd, symcount * sizeof (elf_symbol_type)));
+ amt = symcount;
+ amt *= sizeof (elf_symbol_type);
+ symbase = (elf_symbol_type *) bfd_zalloc (abfd, amt);
if (symbase == (elf_symbol_type *) NULL)
- return -1;
+ goto error_return;
sym = symbase;
/* Temporarily allocate room for the raw ELF symbols. */
- x_symp = ((Elf_External_Sym *)
- bfd_malloc (symcount * sizeof (Elf_External_Sym)));
- if (x_symp == NULL && symcount != 0)
+ amt = symcount;
+ amt *= sizeof (Elf_External_Sym);
+ x_symp = (Elf_External_Sym *) bfd_malloc (amt);
+ if (x_symp == NULL)
goto error_return;
- if (bfd_read ((PTR) x_symp, sizeof (Elf_External_Sym), symcount, abfd)
- != symcount * sizeof (Elf_External_Sym))
+ if (bfd_bread ((PTR) x_symp, amt, abfd) != amt)
goto error_return;
/* Read the raw ELF version symbol information. */
@@ -1100,7 +1234,7 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
if (x_versymp == NULL && verhdr->sh_size != 0)
goto error_return;
- if (bfd_read ((PTR) x_versymp, 1, verhdr->sh_size, abfd)
+ if (bfd_bread ((PTR) x_versymp, verhdr->sh_size, abfd)
!= verhdr->sh_size)
goto error_return;
}
@@ -1108,7 +1242,8 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
/* Skip first symbol, which is a null dummy. */
for (i = 1; i < symcount; i++)
{
- elf_swap_symbol_in (abfd, x_symp + i, &i_sym);
+ elf_swap_symbol_in (abfd, x_symp + i,
+ x_shndx + (x_shndx != NULL ? i : 0), &i_sym);
memcpy (&sym->internal_elf_sym, &i_sym, sizeof (Elf_Internal_Sym));
#ifdef ELF_KEEP_EXTSYM
memcpy (&sym->native_elf_sym, x_symp + i, sizeof (Elf_External_Sym));
@@ -1121,7 +1256,12 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
sym->symbol.value = i_sym.st_value;
- if (i_sym.st_shndx > 0 && i_sym.st_shndx < SHN_LORESERVE)
+ if (i_sym.st_shndx == SHN_UNDEF)
+ {
+ sym->symbol.section = bfd_und_section_ptr;
+ }
+ else if (i_sym.st_shndx < SHN_LORESERVE
+ || i_sym.st_shndx > SHN_HIRESERVE)
{
sym->symbol.section = section_from_elf_index (abfd,
i_sym.st_shndx);
@@ -1146,10 +1286,6 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
moment) about the alignment. */
sym->symbol.value = i_sym.st_size;
}
- else if (i_sym.st_shndx == SHN_UNDEF)
- {
- sym->symbol.section = bfd_und_section_ptr;
- }
else
sym->symbol.section = bfd_abs_section_ptr;
@@ -1236,12 +1372,17 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
*symptrs = 0; /* Final null pointer */
}
+ if (x_shndx != NULL)
+ free (x_shndx);
if (x_versymp != NULL)
free (x_versymp);
if (x_symp != NULL)
free (x_symp);
return symcount;
+
error_return:
+ if (x_shndx != NULL)
+ free (x_shndx);
if (x_versymp != NULL)
free (x_versymp);
if (x_symp != NULL)
@@ -1270,12 +1411,12 @@ elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count,
unsigned int i;
int entsize;
- allocated = (PTR) bfd_malloc ((size_t) rel_hdr->sh_size);
+ allocated = (PTR) bfd_malloc (rel_hdr->sh_size);
if (allocated == NULL)
goto error_return;
if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0
- || (bfd_read (allocated, 1, rel_hdr->sh_size, abfd)
+ || (bfd_bread (allocated, rel_hdr->sh_size, abfd)
!= rel_hdr->sh_size))
goto error_return;
@@ -1361,6 +1502,7 @@ elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
bfd_size_type reloc_count;
bfd_size_type reloc_count2;
arelent *relents;
+ bfd_size_type amt;
if (asect->relocation != NULL)
return true;
@@ -1396,9 +1538,8 @@ elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
reloc_count2 = 0;
}
- relents = ((arelent *)
- bfd_alloc (abfd,
- (reloc_count + reloc_count2) * sizeof (arelent)));
+ amt = (reloc_count + reloc_count2) * sizeof (arelent);
+ relents = (arelent *) bfd_alloc (abfd, amt);
if (relents == NULL)
return false;
diff --git a/contrib/binutils/bfd/elfcore.h b/contrib/binutils/bfd/elfcore.h
index ef71762..2a795a9 100644
--- a/contrib/binutils/bfd/elfcore.h
+++ b/contrib/binutils/bfd/elfcore.h
@@ -81,14 +81,18 @@ elf_core_file_p (abfd)
{
Elf_External_Ehdr x_ehdr; /* Elf file header, external form */
Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
- Elf_Internal_Phdr *i_phdrp = NULL; /* Elf program header, internal form */
+ Elf_Internal_Phdr *i_phdrp; /* Elf program header, internal form */
unsigned int phindex;
struct elf_backend_data *ebd;
- struct elf_obj_tdata *preserved_tdata = elf_tdata (abfd);
+ struct bfd_preserve preserve;
struct elf_obj_tdata *new_tdata = NULL;
+ bfd_size_type amt;
+
+ preserve.arch_info = abfd->arch_info;
/* Read in the ELF header in external format. */
- if (bfd_read ((PTR) & x_ehdr, sizeof (x_ehdr), 1, abfd) != sizeof (x_ehdr))
+ if (bfd_bread ((PTR) &x_ehdr, (bfd_size_type) sizeof (x_ehdr), abfd)
+ != sizeof (x_ehdr))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
@@ -121,12 +125,25 @@ elf_core_file_p (abfd)
}
/* Give abfd an elf_obj_tdata. */
- new_tdata =
- (struct elf_obj_tdata *) bfd_zalloc (abfd, sizeof (struct elf_obj_tdata));
+ amt = sizeof (struct elf_obj_tdata);
+ new_tdata = (struct elf_obj_tdata *) bfd_zalloc (abfd, amt);
if (new_tdata == NULL)
return NULL;
+ preserve.tdata = elf_tdata (abfd);
elf_tdata (abfd) = new_tdata;
+ /* Clear section information, since there might be a recognized bfd that
+ we now check if we can replace, and we don't want to append to it. */
+ preserve.sections = abfd->sections;
+ preserve.section_tail = abfd->section_tail;
+ preserve.section_count = abfd->section_count;
+ preserve.section_htab = abfd->section_htab;
+ abfd->sections = NULL;
+ abfd->section_tail = &abfd->sections;
+ abfd->section_count = 0;
+ if (!bfd_hash_table_init (&abfd->section_htab, bfd_section_hash_newfunc))
+ goto fail;
+
/* Swap in the rest of the header, now that we have the byte order. */
i_ehdrp = elf_elfheader (abfd);
elf_swap_ehdr_in (abfd, &x_ehdr, i_ehdrp);
@@ -181,12 +198,12 @@ elf_core_file_p (abfd)
goto wrong;
/* Move to the start of the program headers. */
- if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) != 0)
+ if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0)
goto wrong;
/* Allocate space for the program headers. */
- i_phdrp = (Elf_Internal_Phdr *)
- bfd_alloc (abfd, sizeof (*i_phdrp) * i_ehdrp->e_phnum);
+ amt = sizeof (*i_phdrp) * i_ehdrp->e_phnum;
+ i_phdrp = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
if (!i_phdrp)
goto fail;
@@ -196,7 +213,7 @@ elf_core_file_p (abfd)
for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
{
Elf_External_Phdr x_phdr;
- if (bfd_read ((PTR) &x_phdr, sizeof (x_phdr), 1, abfd)
+ if (bfd_bread ((PTR) &x_phdr, (bfd_size_type) sizeof (x_phdr), abfd)
!= sizeof (x_phdr))
goto fail;
@@ -206,7 +223,7 @@ elf_core_file_p (abfd)
/* Process each program header. */
for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
{
- if (!_bfd_elfcore_section_from_phdr (abfd, i_phdrp + phindex, phindex))
+ if (! bfd_section_from_phdr (abfd, i_phdrp + phindex, (int) phindex))
goto fail;
}
@@ -229,15 +246,33 @@ elf_core_file_p (abfd)
goto wrong;
}
+ bfd_hash_table_free (&preserve.section_htab);
return abfd->xvec;
wrong:
+ /* There is way too much undoing of half-known state here. The caller,
+ bfd_check_format_matches, really shouldn't iterate on live bfd's to
+ check match/no-match like it does. We have to rely on that a call to
+ bfd_default_set_arch_mach with the previously known mach, undoes what
+ was done by the first bfd_default_set_arch_mach (with mach 0) here.
+ For this to work, only elf-data and the mach may be changed by the
+ target-specific elf_backend_object_p function. Note that saving the
+ whole bfd here and restoring it would be even worse; the first thing
+ you notice is that the cached bfd file position gets out of sync. */
bfd_set_error (bfd_error_wrong_format);
+
fail:
- if (i_phdrp != NULL)
- bfd_release (abfd, i_phdrp);
+ abfd->arch_info = preserve.arch_info;
if (new_tdata != NULL)
- bfd_release (abfd, new_tdata);
- elf_tdata (abfd) = preserved_tdata;
+ {
+ /* bfd_release frees all memory more recently bfd_alloc'd than
+ its arg, as well as its arg. */
+ bfd_release (abfd, new_tdata);
+ elf_tdata (abfd) = preserve.tdata;
+ abfd->section_htab = preserve.section_htab;
+ abfd->sections = preserve.sections;
+ abfd->section_tail = preserve.section_tail;
+ abfd->section_count = preserve.section_count;
+ }
return NULL;
}
diff --git a/contrib/binutils/bfd/elflink.c b/contrib/binutils/bfd/elflink.c
index b971311..2032efa 100644
--- a/contrib/binutils/bfd/elflink.c
+++ b/contrib/binutils/bfd/elflink.c
@@ -73,24 +73,27 @@ _bfd_elf_create_got_section (abfd, info)
return false;
}
- /* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the .got
- (or .got.plt) section. We don't do this in the linker script
- because we don't want to define the symbol if we are not creating
- a global offset table. */
- h = NULL;
- if (!(_bfd_generic_link_add_one_symbol
- (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
- bed->got_symbol_offset, (const char *) NULL, false,
- bed->collect, (struct bfd_link_hash_entry **) &h)))
- return false;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- h->type = STT_OBJECT;
+ if (bed->want_got_sym)
+ {
+ /* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the .got
+ (or .got.plt) section. We don't do this in the linker script
+ because we don't want to define the symbol if we are not creating
+ a global offset table. */
+ h = NULL;
+ if (!(_bfd_generic_link_add_one_symbol
+ (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
+ bed->got_symbol_offset, (const char *) NULL, false,
+ bed->collect, (struct bfd_link_hash_entry **) &h)))
+ return false;
+ h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+ h->type = STT_OBJECT;
- if (info->shared
- && ! _bfd_elf_link_record_dynamic_symbol (info, h))
- return false;
+ if (info->shared
+ && ! _bfd_elf_link_record_dynamic_symbol (info, h))
+ return false;
- elf_hash_table (info)->hgot = h;
+ elf_hash_table (info)->hgot = h;
+ }
/* The first bit of the global offset table is the header. */
s->_raw_size += bed->got_header_size + bed->got_symbol_offset;
@@ -134,7 +137,7 @@ _bfd_elf_create_dynamic_sections (abfd, info)
pltflags = flags;
pltflags |= SEC_CODE;
if (bed->plt_not_loaded)
- pltflags &= ~ (SEC_LOAD | SEC_HAS_CONTENTS);
+ pltflags &= ~ (SEC_CODE | SEC_LOAD | SEC_HAS_CONTENTS);
if (bed->plt_readonly)
pltflags |= SEC_READONLY;
@@ -227,7 +230,7 @@ _bfd_elf_link_record_dynamic_symbol (info, h)
{
if (h->dynindx == -1)
{
- struct bfd_strtab_hash *dynstr;
+ struct elf_strtab_hash *dynstr;
char *p, *alc;
const char *name;
boolean copy;
@@ -259,7 +262,7 @@ _bfd_elf_link_record_dynamic_symbol (info, h)
if (dynstr == NULL)
{
/* Create a strtab to hold the dynamic symbol names. */
- elf_hash_table (info)->dynstr = dynstr = _bfd_elf_stringtab_init ();
+ elf_hash_table (info)->dynstr = dynstr = _bfd_elf_strtab_init ();
if (dynstr == NULL)
return false;
}
@@ -275,16 +278,16 @@ _bfd_elf_link_record_dynamic_symbol (info, h)
}
else
{
- alc = bfd_malloc (p - name + 1);
+ alc = bfd_malloc ((bfd_size_type) (p - name + 1));
if (alc == NULL)
return false;
- strncpy (alc, name, p - name);
+ strncpy (alc, name, (size_t) (p - name));
alc[p - name] = '\0';
name = alc;
copy = true;
}
- indx = _bfd_stringtab_add (dynstr, name, true, copy);
+ indx = _bfd_elf_strtab_add (dynstr, name, copy);
if (alc != NULL)
free (alc);
@@ -394,9 +397,9 @@ _bfd_elf_create_linker_section (abfd, info, which, defaults)
if (!lsect)
{
asection *s;
+ bfd_size_type amt = sizeof (elf_linker_section_t);
- lsect = (elf_linker_section_t *)
- bfd_alloc (dynobj, sizeof (elf_linker_section_t));
+ lsect = (elf_linker_section_t *) bfd_alloc (dynobj, amt);
*lsect = *defaults;
elf_linker_section (dynobj, which) = lsect;
@@ -428,10 +431,10 @@ _bfd_elf_create_linker_section (abfd, info, which, defaults)
s->_raw_size += lsect->hole_size;
if (lsect->hole_offset > lsect->max_hole_offset)
{
- (*_bfd_error_handler) (_("%s: Section %s is already to large to put hole of %ld bytes in"),
+ (*_bfd_error_handler) (_("%s: Section %s is too large to add hole of %ld bytes"),
bfd_get_filename (abfd),
lsect->name,
- (long)lsect->hole_size);
+ (long) lsect->hole_size);
bfd_set_error (bfd_error_bad_value);
return (elf_linker_section_t *)0;
@@ -503,7 +506,7 @@ _bfd_elf_create_linker_section (abfd, info, which, defaults)
elf_linker_section_pointers_t *
_bfd_elf_find_pointer_linker_section (linker_pointers, addend, which)
elf_linker_section_pointers_t *linker_pointers;
- bfd_signed_vma addend;
+ bfd_vma addend;
elf_linker_section_enum_t which;
{
for ( ; linker_pointers != NULL; linker_pointers = linker_pointers->next)
diff --git a/contrib/binutils/bfd/elflink.h b/contrib/binutils/bfd/elflink.h
index 26808ab..47927d3 100644
--- a/contrib/binutils/bfd/elflink.h
+++ b/contrib/binutils/bfd/elflink.h
@@ -27,18 +27,30 @@ struct elf_info_failed
{
boolean failed;
struct bfd_link_info *info;
+ struct bfd_elf_version_tree *verdefs;
};
+static boolean is_global_data_symbol_definition
+ PARAMS ((bfd *, Elf_Internal_Sym *));
+static boolean elf_link_is_defined_archive_symbol
+ PARAMS ((bfd *, carsym *));
static boolean elf_link_add_object_symbols
PARAMS ((bfd *, struct bfd_link_info *));
static boolean elf_link_add_archive_symbols
PARAMS ((bfd *, struct bfd_link_info *));
static boolean elf_merge_symbol
- PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
- asection **, bfd_vma *, struct elf_link_hash_entry **,
- boolean *, boolean *, boolean *, boolean));
+ PARAMS ((bfd *, struct bfd_link_info *, const char *,
+ Elf_Internal_Sym *, asection **, bfd_vma *,
+ struct elf_link_hash_entry **, boolean *, boolean *,
+ boolean *, boolean));
+static boolean elf_add_default_symbol
+ PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
+ const char *, Elf_Internal_Sym *, asection **, bfd_vma *,
+ boolean *, boolean, boolean));
static boolean elf_export_symbol
PARAMS ((struct elf_link_hash_entry *, PTR));
+static boolean elf_finalize_dynstr
+ PARAMS ((bfd *, struct bfd_link_info *));
static boolean elf_fix_symbol_flags
PARAMS ((struct elf_link_hash_entry *, struct elf_info_failed *));
static boolean elf_adjust_dynamic_symbol
@@ -53,6 +65,8 @@ static boolean elf_collect_hash_codes
PARAMS ((struct elf_link_hash_entry *, PTR));
static boolean elf_link_read_relocs_from_section
PARAMS ((bfd *, Elf_Internal_Shdr *, PTR, Elf_Internal_Rela *));
+static size_t compute_bucket_count
+ PARAMS ((struct bfd_link_info *));
static void elf_link_output_relocs
PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *));
static boolean elf_link_size_reloc_section
@@ -60,6 +74,14 @@ static boolean elf_link_size_reloc_section
static void elf_link_adjust_relocs
PARAMS ((bfd *, Elf_Internal_Shdr *, unsigned int,
struct elf_link_hash_entry **));
+static int elf_link_sort_cmp1
+ PARAMS ((const void *, const void *));
+static int elf_link_sort_cmp2
+ PARAMS ((const void *, const void *));
+static size_t elf_link_sort_relocs
+ PARAMS ((bfd *, struct bfd_link_info *, asection **));
+static boolean elf_section_ignore_discarded_relocs
+ PARAMS ((asection *));
/* Given an ELF BFD, add symbols to the global hash table as
appropriate. */
@@ -129,13 +151,18 @@ elf_link_is_defined_archive_symbol (abfd, symdef)
carsym * symdef;
{
Elf_Internal_Shdr * hdr;
+ Elf_Internal_Shdr * shndx_hdr;
Elf_External_Sym * esym;
Elf_External_Sym * esymend;
Elf_External_Sym * buf = NULL;
- size_t symcount;
- size_t extsymcount;
- size_t extsymoff;
+ Elf_External_Sym_Shndx * shndx_buf = NULL;
+ Elf_External_Sym_Shndx * shndx;
+ bfd_size_type symcount;
+ bfd_size_type extsymcount;
+ bfd_size_type extsymoff;
boolean result = false;
+ file_ptr pos;
+ bfd_size_type amt;
abfd = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
if (abfd == (bfd *) NULL)
@@ -153,9 +180,15 @@ elf_link_is_defined_archive_symbol (abfd, symdef)
/* Select the appropriate symbol table. */
if ((abfd->flags & DYNAMIC) == 0 || elf_dynsymtab (abfd) == 0)
- hdr = &elf_tdata (abfd)->symtab_hdr;
+ {
+ hdr = &elf_tdata (abfd)->symtab_hdr;
+ shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
+ }
else
- hdr = &elf_tdata (abfd)->dynsymtab_hdr;
+ {
+ hdr = &elf_tdata (abfd)->dynsymtab_hdr;
+ shndx_hdr = NULL;
+ }
symcount = hdr->sh_size / sizeof (Elf_External_Sym);
@@ -172,33 +205,41 @@ elf_link_is_defined_archive_symbol (abfd, symdef)
extsymoff = hdr->sh_info;
}
- buf = ((Elf_External_Sym *)
- bfd_malloc (extsymcount * sizeof (Elf_External_Sym)));
+ amt = extsymcount * sizeof (Elf_External_Sym);
+ buf = (Elf_External_Sym *) bfd_malloc (amt);
if (buf == NULL && extsymcount != 0)
return false;
/* Read in the symbol table.
FIXME: This ought to be cached somewhere. */
- if (bfd_seek (abfd,
- hdr->sh_offset + extsymoff * sizeof (Elf_External_Sym),
- SEEK_SET) != 0
- || (bfd_read ((PTR) buf, sizeof (Elf_External_Sym), extsymcount, abfd)
- != extsymcount * sizeof (Elf_External_Sym)))
+ pos = hdr->sh_offset + extsymoff * sizeof (Elf_External_Sym);
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0
+ || bfd_bread ((PTR) buf, amt, abfd) != amt)
+ goto error_exit;
+
+ if (shndx_hdr != NULL && shndx_hdr->sh_size != 0)
{
- free (buf);
- return false;
+ amt = extsymcount * sizeof (Elf_External_Sym_Shndx);
+ shndx_buf = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
+ if (shndx_buf == NULL && extsymcount != 0)
+ goto error_exit;
+
+ pos = shndx_hdr->sh_offset + extsymoff * sizeof (Elf_External_Sym_Shndx);
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0
+ || bfd_bread ((PTR) shndx_buf, amt, abfd) != amt)
+ goto error_exit;
}
/* Scan the symbol table looking for SYMDEF. */
esymend = buf + extsymcount;
- for (esym = buf;
+ for (esym = buf, shndx = shndx_buf;
esym < esymend;
- esym++)
+ esym++, shndx = (shndx != NULL ? shndx + 1 : NULL))
{
Elf_Internal_Sym sym;
const char * name;
- elf_swap_symbol_in (abfd, esym, & sym);
+ elf_swap_symbol_in (abfd, esym, shndx, &sym);
name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link, sym.st_name);
if (name == (const char *) NULL)
@@ -211,7 +252,11 @@ elf_link_is_defined_archive_symbol (abfd, symdef)
}
}
- free (buf);
+ error_exit:
+ if (shndx_buf != NULL)
+ free (shndx_buf);
+ if (buf != NULL)
+ free (buf);
return result;
}
@@ -251,6 +296,7 @@ elf_link_add_archive_symbols (abfd, info)
boolean *included = NULL;
carsym *symdefs;
boolean loop;
+ bfd_size_type amt;
if (! bfd_has_map (abfd))
{
@@ -267,12 +313,14 @@ elf_link_add_archive_symbols (abfd, info)
c = bfd_ardata (abfd)->symdef_count;
if (c == 0)
return true;
- defined = (boolean *) bfd_malloc (c * sizeof (boolean));
- included = (boolean *) bfd_malloc (c * sizeof (boolean));
+ amt = c;
+ amt *= sizeof (boolean);
+ defined = (boolean *) bfd_malloc (amt);
+ included = (boolean *) bfd_malloc (amt);
if (defined == (boolean *) NULL || included == (boolean *) NULL)
goto error_return;
- memset (defined, 0, c * sizeof (boolean));
- memset (included, 0, c * sizeof (boolean));
+ memset (defined, 0, (size_t) amt);
+ memset (included, 0, (size_t) amt);
symdefs = bfd_ardata (abfd)->symdefs;
@@ -320,10 +368,10 @@ elf_link_add_archive_symbols (abfd, info)
if (p == NULL || p[1] != ELF_VER_CHR)
continue;
- copy = bfd_alloc (abfd, p - symdef->name + 1);
+ copy = bfd_alloc (abfd, (bfd_size_type) (p - symdef->name + 1));
if (copy == NULL)
goto error_return;
- memcpy (copy, symdef->name, p - symdef->name);
+ memcpy (copy, symdef->name, (size_t) (p - symdef->name));
copy[p - symdef->name] = '\0';
h = elf_link_hash_lookup (elf_hash_table (info), copy,
@@ -874,6 +922,243 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash,
return true;
}
+/* This function is called to create an indirect symbol from the
+ default for the symbol with the default version if needed. The
+ symbol is described by H, NAME, SYM, SEC, VALUE, and OVERRIDE. We
+ set DYNSYM if the new indirect symbol is dynamic. DT_NEEDED
+ indicates if it comes from a DT_NEEDED entry of a shared object. */
+
+static boolean
+elf_add_default_symbol (abfd, info, h, name, sym, sec, value,
+ dynsym, override, dt_needed)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ struct elf_link_hash_entry *h;
+ const char *name;
+ Elf_Internal_Sym *sym;
+ asection **sec;
+ bfd_vma *value;
+ boolean *dynsym;
+ boolean override;
+ boolean dt_needed;
+{
+ boolean type_change_ok;
+ boolean size_change_ok;
+ char *shortname;
+ struct elf_link_hash_entry *hi;
+ struct elf_backend_data *bed;
+ boolean collect;
+ boolean dynamic;
+ char *p;
+
+ /* If this symbol has a version, and it is the default version, we
+ create an indirect symbol from the default name to the fully
+ decorated name. This will cause external references which do not
+ specify a version to be bound to this version of the symbol. */
+ p = strchr (name, ELF_VER_CHR);
+ if (p == NULL || p[1] != ELF_VER_CHR)
+ return true;
+
+ if (override)
+ {
+ /* We are overridden by an old defition. We need to check if we
+ need to crreate the indirect symbol from the default name. */
+ hi = elf_link_hash_lookup (elf_hash_table (info), name, true,
+ false, false);
+ BFD_ASSERT (hi != NULL);
+ if (hi == h)
+ return true;
+ while (hi->root.type == bfd_link_hash_indirect
+ || hi->root.type == bfd_link_hash_warning)
+ {
+ hi = (struct elf_link_hash_entry *) hi->root.u.i.link;
+ if (hi == h)
+ return true;
+ }
+ }
+
+ bed = get_elf_backend_data (abfd);
+ collect = bed->collect;
+ dynamic = (abfd->flags & DYNAMIC) != 0;
+
+ shortname = bfd_hash_allocate (&info->hash->table,
+ (size_t) (p - name + 1));
+ if (shortname == NULL)
+ return false;
+ strncpy (shortname, name, (size_t) (p - name));
+ shortname [p - name] = '\0';
+
+ /* We are going to create a new symbol. Merge it with any existing
+ symbol with this name. For the purposes of the merge, act as
+ though we were defining the symbol we just defined, although we
+ actually going to define an indirect symbol. */
+ type_change_ok = false;
+ size_change_ok = false;
+ if (! elf_merge_symbol (abfd, info, shortname, sym, sec, value,
+ &hi, &override, &type_change_ok,
+ &size_change_ok, dt_needed))
+ return false;
+
+ if (! override)
+ {
+ if (! (_bfd_generic_link_add_one_symbol
+ (info, abfd, shortname, BSF_INDIRECT, bfd_ind_section_ptr,
+ (bfd_vma) 0, name, false, collect,
+ (struct bfd_link_hash_entry **) &hi)))
+ return false;
+ }
+ else
+ {
+ /* In this case the symbol named SHORTNAME is overriding the
+ indirect symbol we want to add. We were planning on making
+ SHORTNAME an indirect symbol referring to NAME. SHORTNAME
+ is the name without a version. NAME is the fully versioned
+ name, and it is the default version.
+
+ Overriding means that we already saw a definition for the
+ symbol SHORTNAME in a regular object, and it is overriding
+ the symbol defined in the dynamic object.
+
+ When this happens, we actually want to change NAME, the
+ symbol we just added, to refer to SHORTNAME. This will cause
+ references to NAME in the shared object to become references
+ to SHORTNAME in the regular object. This is what we expect
+ when we override a function in a shared object: that the
+ references in the shared object will be mapped to the
+ definition in the regular object. */
+
+ while (hi->root.type == bfd_link_hash_indirect
+ || hi->root.type == bfd_link_hash_warning)
+ hi = (struct elf_link_hash_entry *) hi->root.u.i.link;
+
+ h->root.type = bfd_link_hash_indirect;
+ h->root.u.i.link = (struct bfd_link_hash_entry *) hi;
+ if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)
+ {
+ h->elf_link_hash_flags &=~ ELF_LINK_HASH_DEF_DYNAMIC;
+ hi->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
+ if (hi->elf_link_hash_flags
+ & (ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_DEF_REGULAR))
+ {
+ if (! _bfd_elf_link_record_dynamic_symbol (info, hi))
+ return false;
+ }
+ }
+
+ /* Now set HI to H, so that the following code will set the
+ other fields correctly. */
+ hi = h;
+ }
+
+ /* If there is a duplicate definition somewhere, then HI may not
+ point to an indirect symbol. We will have reported an error to
+ the user in that case. */
+
+ if (hi->root.type == bfd_link_hash_indirect)
+ {
+ struct elf_link_hash_entry *ht;
+
+ /* If the symbol became indirect, then we assume that we have
+ not seen a definition before. */
+ BFD_ASSERT ((hi->elf_link_hash_flags
+ & (ELF_LINK_HASH_DEF_DYNAMIC
+ | ELF_LINK_HASH_DEF_REGULAR)) == 0);
+
+ ht = (struct elf_link_hash_entry *) hi->root.u.i.link;
+ (*bed->elf_backend_copy_indirect_symbol) (ht, hi);
+
+ /* See if the new flags lead us to realize that the symbol must
+ be dynamic. */
+ if (! *dynsym)
+ {
+ if (! dynamic)
+ {
+ if (info->shared
+ || ((hi->elf_link_hash_flags
+ & ELF_LINK_HASH_REF_DYNAMIC) != 0))
+ *dynsym = true;
+ }
+ else
+ {
+ if ((hi->elf_link_hash_flags
+ & ELF_LINK_HASH_REF_REGULAR) != 0)
+ *dynsym = true;
+ }
+ }
+ }
+
+ /* We also need to define an indirection from the nondefault version
+ of the symbol. */
+
+ shortname = bfd_hash_allocate (&info->hash->table, strlen (name));
+ if (shortname == NULL)
+ return false;
+ strncpy (shortname, name, (size_t) (p - name));
+ strcpy (shortname + (p - name), p + 1);
+
+ /* Once again, merge with any existing symbol. */
+ type_change_ok = false;
+ size_change_ok = false;
+ if (! elf_merge_symbol (abfd, info, shortname, sym, sec, value,
+ &hi, &override, &type_change_ok,
+ &size_change_ok, dt_needed))
+ return false;
+
+ if (override)
+ {
+ /* Here SHORTNAME is a versioned name, so we don't expect to see
+ the type of override we do in the case above. */
+ (*_bfd_error_handler)
+ (_("%s: warning: unexpected redefinition of `%s'"),
+ bfd_archive_filename (abfd), shortname);
+ }
+ else
+ {
+ if (! (_bfd_generic_link_add_one_symbol
+ (info, abfd, shortname, BSF_INDIRECT,
+ bfd_ind_section_ptr, (bfd_vma) 0, name, false,
+ collect, (struct bfd_link_hash_entry **) &hi)))
+ return false;
+
+ /* If there is a duplicate definition somewhere, then HI may not
+ point to an indirect symbol. We will have reported an error
+ to the user in that case. */
+
+ if (hi->root.type == bfd_link_hash_indirect)
+ {
+ /* If the symbol became indirect, then we assume that we have
+ not seen a definition before. */
+ BFD_ASSERT ((hi->elf_link_hash_flags
+ & (ELF_LINK_HASH_DEF_DYNAMIC
+ | ELF_LINK_HASH_DEF_REGULAR)) == 0);
+
+ (*bed->elf_backend_copy_indirect_symbol) (h, hi);
+
+ /* See if the new flags lead us to realize that the symbol
+ must be dynamic. */
+ if (! *dynsym)
+ {
+ if (! dynamic)
+ {
+ if (info->shared
+ || ((hi->elf_link_hash_flags
+ & ELF_LINK_HASH_REF_DYNAMIC) != 0))
+ *dynsym = true;
+ }
+ else
+ {
+ if ((hi->elf_link_hash_flags
+ & ELF_LINK_HASH_REF_REGULAR) != 0)
+ *dynsym = true;
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
/* Add symbols from an ELF object file to the linker hash table. */
static boolean
@@ -889,10 +1174,13 @@ elf_link_add_object_symbols (abfd, info)
asection *, const Elf_Internal_Rela *));
boolean collect;
Elf_Internal_Shdr *hdr;
- size_t symcount;
- size_t extsymcount;
- size_t extsymoff;
+ Elf_Internal_Shdr *shndx_hdr;
+ bfd_size_type symcount;
+ bfd_size_type extsymcount;
+ bfd_size_type extsymoff;
Elf_External_Sym *buf = NULL;
+ Elf_External_Sym_Shndx *shndx_buf = NULL;
+ Elf_External_Sym_Shndx *shndx;
struct elf_link_hash_entry **sym_hash;
boolean dynamic;
Elf_External_Versym *extversym = NULL;
@@ -903,6 +1191,11 @@ elf_link_add_object_symbols (abfd, info)
Elf_External_Sym *esymend;
struct elf_backend_data *bed;
boolean dt_needed;
+ struct elf_link_hash_table * hash_table;
+ file_ptr pos;
+ bfd_size_type amt;
+
+ hash_table = elf_hash_table (info);
bed = get_elf_backend_data (abfd);
add_symbol_hook = bed->elf_add_symbol_hook;
@@ -957,7 +1250,7 @@ elf_link_add_object_symbols (abfd, info)
{
struct elf_link_hash_entry *h;
- h = elf_link_hash_lookup (elf_hash_table (info), name,
+ h = elf_link_hash_lookup (hash_table, name,
false, false, true);
/* FIXME: What about bfd_link_hash_common? */
@@ -1004,9 +1297,15 @@ elf_link_add_object_symbols (abfd, info)
look at .symtab for a dynamic object. */
if (! dynamic || elf_dynsymtab (abfd) == 0)
- hdr = &elf_tdata (abfd)->symtab_hdr;
+ {
+ hdr = &elf_tdata (abfd)->symtab_hdr;
+ shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
+ }
else
- hdr = &elf_tdata (abfd)->dynsymtab_hdr;
+ {
+ hdr = &elf_tdata (abfd)->dynsymtab_hdr;
+ shndx_hdr = NULL;
+ }
if (dynamic)
{
@@ -1025,9 +1324,9 @@ elf_link_add_object_symbols (abfd, info)
extversym = (Elf_External_Versym *) bfd_malloc (versymhdr->sh_size);
if (extversym == NULL)
goto error_return;
+ amt = versymhdr->sh_size;
if (bfd_seek (abfd, versymhdr->sh_offset, SEEK_SET) != 0
- || (bfd_read ((PTR) extversym, 1, versymhdr->sh_size, abfd)
- != versymhdr->sh_size))
+ || bfd_bread ((PTR) extversym, amt, abfd) != amt)
goto error_return;
}
}
@@ -1048,16 +1347,23 @@ elf_link_add_object_symbols (abfd, info)
extsymoff = hdr->sh_info;
}
- buf = ((Elf_External_Sym *)
- bfd_malloc (extsymcount * sizeof (Elf_External_Sym)));
+ amt = extsymcount * sizeof (Elf_External_Sym);
+ buf = (Elf_External_Sym *) bfd_malloc (amt);
if (buf == NULL && extsymcount != 0)
goto error_return;
+ if (shndx_hdr != NULL && shndx_hdr->sh_size != 0)
+ {
+ amt = extsymcount * sizeof (Elf_External_Sym_Shndx);
+ shndx_buf = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
+ if (shndx_buf == NULL && extsymcount != 0)
+ goto error_return;
+ }
+
/* We store a pointer to the hash table entry for each external
symbol. */
- sym_hash = ((struct elf_link_hash_entry **)
- bfd_alloc (abfd,
- extsymcount * sizeof (struct elf_link_hash_entry *)));
+ amt = extsymcount * sizeof (struct elf_link_hash_entry *);
+ sym_hash = (struct elf_link_hash_entry **) bfd_alloc (abfd, amt);
if (sym_hash == NULL)
goto error_return;
elf_sym_hashes (abfd) = sym_hash;
@@ -1072,13 +1378,16 @@ elf_link_add_object_symbols (abfd, info)
format. FIXME: If there are no input BFD's of the same
format as the output, we can't make a shared library. */
if (info->shared
- && ! elf_hash_table (info)->dynamic_sections_created
+ && is_elf_hash_table (info)
+ && ! hash_table->dynamic_sections_created
&& abfd->xvec == info->hash->creator)
{
if (! elf_link_create_dynamic_sections (abfd, info))
goto error_return;
}
}
+ else if (! is_elf_hash_table (info))
+ goto error_return;
else
{
asection *s;
@@ -1113,11 +1422,11 @@ elf_link_add_object_symbols (abfd, info)
Elf_External_Dyn *extdyn;
Elf_External_Dyn *extdynend;
int elfsec;
- unsigned long link;
+ unsigned long shlink;
int rpath;
int runpath;
- dynbuf = (Elf_External_Dyn *) bfd_malloc ((size_t) s->_raw_size);
+ dynbuf = (Elf_External_Dyn *) bfd_malloc (s->_raw_size);
if (dynbuf == NULL)
goto error_return;
@@ -1128,22 +1437,22 @@ elf_link_add_object_symbols (abfd, info)
elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
if (elfsec == -1)
goto error_return;
- link = elf_elfsections (abfd)[elfsec]->sh_link;
+ shlink = elf_elfsections (abfd)[elfsec]->sh_link;
{
/* The shared libraries distributed with hpux11 have a bogus
sh_link field for the ".dynamic" section. This code detects
- when LINK refers to a section that is not a string table and
- tries to find the string table for the ".dynsym" section
+ when SHLINK refers to a section that is not a string table
+ and tries to find the string table for the ".dynsym" section
instead. */
- Elf_Internal_Shdr *hdr = elf_elfsections (abfd)[link];
- if (hdr->sh_type != SHT_STRTAB)
+ Elf_Internal_Shdr *shdr = elf_elfsections (abfd)[shlink];
+ if (shdr->sh_type != SHT_STRTAB)
{
- asection *s = bfd_get_section_by_name (abfd, ".dynsym");
- int elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
- if (elfsec == -1)
+ asection *ds = bfd_get_section_by_name (abfd, ".dynsym");
+ int elfdsec = _bfd_elf_section_from_bfd_section (abfd, ds);
+ if (elfdsec == -1)
goto error_return;
- link = elf_elfsections (abfd)[elfsec]->sh_link;
+ shlink = elf_elfsections (abfd)[elfdsec]->sh_link;
}
}
@@ -1158,8 +1467,8 @@ elf_link_add_object_symbols (abfd, info)
elf_swap_dyn_in (abfd, extdyn, &dyn);
if (dyn.d_tag == DT_SONAME)
{
- name = bfd_elf_string_from_elf_section (abfd, link,
- dyn.d_un.d_val);
+ unsigned int tagv = dyn.d_un.d_val;
+ name = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
if (name == NULL)
goto error_return;
}
@@ -1167,21 +1476,21 @@ elf_link_add_object_symbols (abfd, info)
{
struct bfd_link_needed_list *n, **pn;
char *fnm, *anm;
+ unsigned int tagv = dyn.d_un.d_val;
- n = ((struct bfd_link_needed_list *)
- bfd_alloc (abfd, sizeof (struct bfd_link_needed_list)));
- fnm = bfd_elf_string_from_elf_section (abfd, link,
- dyn.d_un.d_val);
+ amt = sizeof (struct bfd_link_needed_list);
+ n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
+ fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
if (n == NULL || fnm == NULL)
goto error_return;
- anm = bfd_alloc (abfd, strlen (fnm) + 1);
+ anm = bfd_alloc (abfd, (bfd_size_type) strlen (fnm) + 1);
if (anm == NULL)
goto error_return;
strcpy (anm, fnm);
n->name = anm;
n->by = abfd;
n->next = NULL;
- for (pn = &elf_hash_table (info)->needed;
+ for (pn = & hash_table->needed;
*pn != NULL;
pn = &(*pn)->next)
;
@@ -1191,28 +1500,28 @@ elf_link_add_object_symbols (abfd, info)
{
struct bfd_link_needed_list *n, **pn;
char *fnm, *anm;
+ unsigned int tagv = dyn.d_un.d_val;
/* When we see DT_RPATH before DT_RUNPATH, we have
to clear runpath. Do _NOT_ bfd_release, as that
frees all more recently bfd_alloc'd blocks as
well. */
- if (rpath && elf_hash_table (info)->runpath)
- elf_hash_table (info)->runpath = NULL;
+ if (rpath && hash_table->runpath)
+ hash_table->runpath = NULL;
- n = ((struct bfd_link_needed_list *)
- bfd_alloc (abfd, sizeof (struct bfd_link_needed_list)));
- fnm = bfd_elf_string_from_elf_section (abfd, link,
- dyn.d_un.d_val);
+ amt = sizeof (struct bfd_link_needed_list);
+ n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
+ fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
if (n == NULL || fnm == NULL)
goto error_return;
- anm = bfd_alloc (abfd, strlen (fnm) + 1);
+ anm = bfd_alloc (abfd, (bfd_size_type) strlen (fnm) + 1);
if (anm == NULL)
goto error_return;
strcpy (anm, fnm);
n->name = anm;
n->by = abfd;
n->next = NULL;
- for (pn = &elf_hash_table (info)->runpath;
+ for (pn = & hash_table->runpath;
*pn != NULL;
pn = &(*pn)->next)
;
@@ -1225,21 +1534,21 @@ elf_link_add_object_symbols (abfd, info)
{
struct bfd_link_needed_list *n, **pn;
char *fnm, *anm;
+ unsigned int tagv = dyn.d_un.d_val;
- n = ((struct bfd_link_needed_list *)
- bfd_alloc (abfd, sizeof (struct bfd_link_needed_list)));
- fnm = bfd_elf_string_from_elf_section (abfd, link,
- dyn.d_un.d_val);
+ amt = sizeof (struct bfd_link_needed_list);
+ n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
+ fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
if (n == NULL || fnm == NULL)
goto error_return;
- anm = bfd_alloc (abfd, strlen (fnm) + 1);
+ anm = bfd_alloc (abfd, (bfd_size_type) strlen (fnm) + 1);
if (anm == NULL)
goto error_return;
strcpy (anm, fnm);
n->name = anm;
n->by = abfd;
n->next = NULL;
- for (pn = &elf_hash_table (info)->runpath;
+ for (pn = & hash_table->runpath;
*pn != NULL;
pn = &(*pn)->next)
;
@@ -1259,27 +1568,23 @@ elf_link_add_object_symbols (abfd, info)
SEC_NEVER_LOAD flag is not the one we want, because that one
still implies that the section takes up space in the output
file. */
- abfd->sections = NULL;
- abfd->section_count = 0;
+ bfd_section_list_clear (abfd);
/* If this is the first dynamic object found in the link, create
the special sections required for dynamic linking. */
- if (! elf_hash_table (info)->dynamic_sections_created)
- {
- if (! elf_link_create_dynamic_sections (abfd, info))
- goto error_return;
- }
+ if (! hash_table->dynamic_sections_created)
+ if (! elf_link_create_dynamic_sections (abfd, info))
+ goto error_return;
if (add_needed)
{
/* Add a DT_NEEDED entry for this dynamic object. */
- oldsize = _bfd_stringtab_size (elf_hash_table (info)->dynstr);
- strindex = _bfd_stringtab_add (elf_hash_table (info)->dynstr, name,
- true, false);
+ oldsize = _bfd_elf_strtab_size (hash_table->dynstr);
+ strindex = _bfd_elf_strtab_add (hash_table->dynstr, name, false);
if (strindex == (bfd_size_type) -1)
goto error_return;
- if (oldsize == _bfd_stringtab_size (elf_hash_table (info)->dynstr))
+ if (oldsize == _bfd_elf_strtab_size (hash_table->dynstr))
{
asection *sdyn;
Elf_External_Dyn *dyncon, *dynconend;
@@ -1289,8 +1594,7 @@ elf_link_add_object_symbols (abfd, info)
have already included this dynamic object in the
link, just ignore it. There is no reason to include
a particular dynamic object more than once. */
- sdyn = bfd_get_section_by_name (elf_hash_table (info)->dynobj,
- ".dynamic");
+ sdyn = bfd_get_section_by_name (hash_table->dynobj, ".dynamic");
BFD_ASSERT (sdyn != NULL);
dyncon = (Elf_External_Dyn *) sdyn->contents;
@@ -1300,8 +1604,7 @@ elf_link_add_object_symbols (abfd, info)
{
Elf_Internal_Dyn dyn;
- elf_swap_dyn_in (elf_hash_table (info)->dynobj, dyncon,
- &dyn);
+ elf_swap_dyn_in (hash_table->dynobj, dyncon, & dyn);
if (dyn.d_tag == DT_NEEDED
&& dyn.d_un.d_val == strindex)
{
@@ -1309,36 +1612,46 @@ elf_link_add_object_symbols (abfd, info)
free (buf);
if (extversym != NULL)
free (extversym);
+ _bfd_elf_strtab_delref (hash_table->dynstr, strindex);
return true;
}
}
}
- if (! elf_add_dynamic_entry (info, DT_NEEDED, strindex))
+ if (! elf_add_dynamic_entry (info, (bfd_vma) DT_NEEDED, strindex))
goto error_return;
}
/* Save the SONAME, if there is one, because sometimes the
linker emulation code will need to know it. */
if (*name == '\0')
- name = bfd_get_filename (abfd);
+ name = basename (bfd_get_filename (abfd));
elf_dt_name (abfd) = name;
}
- if (bfd_seek (abfd,
- hdr->sh_offset + extsymoff * sizeof (Elf_External_Sym),
- SEEK_SET) != 0
- || (bfd_read ((PTR) buf, sizeof (Elf_External_Sym), extsymcount, abfd)
- != extsymcount * sizeof (Elf_External_Sym)))
+ pos = hdr->sh_offset + extsymoff * sizeof (Elf_External_Sym);
+ amt = extsymcount * sizeof (Elf_External_Sym);
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0
+ || bfd_bread ((PTR) buf, amt, abfd) != amt)
goto error_return;
+ if (shndx_hdr != NULL && shndx_hdr->sh_size != 0)
+ {
+ amt = extsymcount * sizeof (Elf_External_Sym_Shndx);
+ pos = shndx_hdr->sh_offset + extsymoff * sizeof (Elf_External_Sym_Shndx);
+ if (bfd_seek (abfd, pos, SEEK_SET) != 0
+ || bfd_bread ((PTR) shndx_buf, amt, abfd) != amt)
+ goto error_return;
+ }
+
weaks = NULL;
ever = extversym != NULL ? extversym + extsymoff : NULL;
esymend = buf + extsymcount;
- for (esym = buf;
+ for (esym = buf, shndx = shndx_buf;
esym < esymend;
- esym++, sym_hash++, ever = (ever != NULL ? ever + 1 : NULL))
+ esym++, sym_hash++, ever = (ever != NULL ? ever + 1 : NULL),
+ shndx = (shndx != NULL ? shndx + 1 : NULL))
{
Elf_Internal_Sym sym;
int bind;
@@ -1351,8 +1664,11 @@ elf_link_add_object_symbols (abfd, info)
boolean size_change_ok, type_change_ok;
boolean new_weakdef;
unsigned int old_alignment;
+ boolean override;
- elf_swap_symbol_in (abfd, esym, &sym);
+ override = false;
+
+ elf_swap_symbol_in (abfd, esym, shndx, &sym);
flags = BSF_NO_FLAGS;
sec = NULL;
@@ -1383,7 +1699,7 @@ elf_link_add_object_symbols (abfd, info)
if (sym.st_shndx == SHN_UNDEF)
sec = bfd_und_section_ptr;
- else if (sym.st_shndx > 0 && sym.st_shndx < SHN_LORESERVE)
+ else if (sym.st_shndx < SHN_LORESERVE || sym.st_shndx > SHN_HIRESERVE)
{
sec = section_from_elf_index (abfd, sym.st_shndx);
if (sec == NULL)
@@ -1441,7 +1757,6 @@ elf_link_add_object_symbols (abfd, info)
{
Elf_Internal_Versym iver;
unsigned int vernum = 0;
- boolean override;
if (ever != NULL)
{
@@ -1457,7 +1772,8 @@ elf_link_add_object_symbols (abfd, info)
|| (vernum > 1 && ! bfd_is_abs_section (sec)))
{
const char *verstr;
- int namelen, newlen;
+ unsigned int namelen;
+ bfd_size_type newlen;
char *newname, *p;
if (sym.st_shndx != SHN_UNDEF)
@@ -1466,7 +1782,7 @@ elf_link_add_object_symbols (abfd, info)
{
(*_bfd_error_handler)
(_("%s: %s: invalid version %u (max %d)"),
- bfd_get_filename (abfd), name, vernum,
+ bfd_archive_filename (abfd), name, vernum,
elf_tdata (abfd)->dynverdef_hdr.sh_info);
bfd_set_error (bfd_error_bad_value);
goto error_return;
@@ -1507,7 +1823,7 @@ elf_link_add_object_symbols (abfd, info)
{
(*_bfd_error_handler)
(_("%s: %s: invalid needed version %d"),
- bfd_get_filename (abfd), name, vernum);
+ bfd_archive_filename (abfd), name, vernum);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -1628,7 +1944,7 @@ elf_link_add_object_symbols (abfd, info)
(*_bfd_error_handler)
(_("Warning: size of symbol `%s' changed from %lu to %lu in %s"),
name, (unsigned long) h->size, (unsigned long) sym.st_size,
- bfd_get_filename (abfd));
+ bfd_archive_filename (abfd));
h->size = sym.st_size;
}
@@ -1650,7 +1966,7 @@ elf_link_add_object_symbols (abfd, info)
(*_bfd_error_handler)
(_("Warning: type of symbol `%s' changed from %d to %d in %s"),
name, h->type, ELF_ST_TYPE (sym.st_info),
- bfd_get_filename (abfd));
+ bfd_archive_filename (abfd));
h->type = ELF_ST_TYPE (sym.st_info);
}
@@ -1712,217 +2028,13 @@ elf_link_add_object_symbols (abfd, info)
h->elf_link_hash_flags |= new_flag;
- /* If this symbol has a version, and it is the default
- version, we create an indirect symbol from the default
- name to the fully decorated name. This will cause
- external references which do not specify a version to be
- bound to this version of the symbol. */
+ /* Check to see if we need to add an indirect symbol for
+ the default name. */
if (definition || h->root.type == bfd_link_hash_common)
- {
- char *p;
-
- p = strchr (name, ELF_VER_CHR);
- if (p != NULL && p[1] == ELF_VER_CHR)
- {
- char *shortname;
- struct elf_link_hash_entry *hi;
- boolean override;
-
- shortname = bfd_hash_allocate (&info->hash->table,
- p - name + 1);
- if (shortname == NULL)
- goto error_return;
- strncpy (shortname, name, p - name);
- shortname[p - name] = '\0';
-
- /* We are going to create a new symbol. Merge it
- with any existing symbol with this name. For the
- purposes of the merge, act as though we were
- defining the symbol we just defined, although we
- actually going to define an indirect symbol. */
- type_change_ok = false;
- size_change_ok = false;
- if (! elf_merge_symbol (abfd, info, shortname, &sym, &sec,
- &value, &hi, &override,
- &type_change_ok,
- &size_change_ok, dt_needed))
- goto error_return;
-
- if (! override)
- {
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, shortname, BSF_INDIRECT,
- bfd_ind_section_ptr, (bfd_vma) 0, name, false,
- collect, (struct bfd_link_hash_entry **) &hi)))
- goto error_return;
- }
- else
- {
- /* In this case the symbol named SHORTNAME is
- overriding the indirect symbol we want to
- add. We were planning on making SHORTNAME an
- indirect symbol referring to NAME. SHORTNAME
- is the name without a version. NAME is the
- fully versioned name, and it is the default
- version.
-
- Overriding means that we already saw a
- definition for the symbol SHORTNAME in a
- regular object, and it is overriding the
- symbol defined in the dynamic object.
-
- When this happens, we actually want to change
- NAME, the symbol we just added, to refer to
- SHORTNAME. This will cause references to
- NAME in the shared object to become
- references to SHORTNAME in the regular
- object. This is what we expect when we
- override a function in a shared object: that
- the references in the shared object will be
- mapped to the definition in the regular
- object. */
-
- while (hi->root.type == bfd_link_hash_indirect
- || hi->root.type == bfd_link_hash_warning)
- hi = (struct elf_link_hash_entry *) hi->root.u.i.link;
-
- h->root.type = bfd_link_hash_indirect;
- h->root.u.i.link = (struct bfd_link_hash_entry *) hi;
- if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)
- {
- h->elf_link_hash_flags &=~ ELF_LINK_HASH_DEF_DYNAMIC;
- hi->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
- if (hi->elf_link_hash_flags
- & (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_DEF_REGULAR))
- {
- if (! _bfd_elf_link_record_dynamic_symbol (info,
- hi))
- goto error_return;
- }
- }
-
- /* Now set HI to H, so that the following code
- will set the other fields correctly. */
- hi = h;
- }
-
- /* If there is a duplicate definition somewhere,
- then HI may not point to an indirect symbol. We
- will have reported an error to the user in that
- case. */
-
- if (hi->root.type == bfd_link_hash_indirect)
- {
- struct elf_link_hash_entry *ht;
-
- /* If the symbol became indirect, then we assume
- that we have not seen a definition before. */
- BFD_ASSERT ((hi->elf_link_hash_flags
- & (ELF_LINK_HASH_DEF_DYNAMIC
- | ELF_LINK_HASH_DEF_REGULAR))
- == 0);
-
- ht = (struct elf_link_hash_entry *) hi->root.u.i.link;
- (*bed->elf_backend_copy_indirect_symbol) (ht, hi);
-
- /* See if the new flags lead us to realize that
- the symbol must be dynamic. */
- if (! dynsym)
- {
- if (! dynamic)
- {
- if (info->shared
- || ((hi->elf_link_hash_flags
- & ELF_LINK_HASH_REF_DYNAMIC)
- != 0))
- dynsym = true;
- }
- else
- {
- if ((hi->elf_link_hash_flags
- & ELF_LINK_HASH_REF_REGULAR) != 0)
- dynsym = true;
- }
- }
- }
-
- /* We also need to define an indirection from the
- nondefault version of the symbol. */
-
- shortname = bfd_hash_allocate (&info->hash->table,
- strlen (name));
- if (shortname == NULL)
- goto error_return;
- strncpy (shortname, name, p - name);
- strcpy (shortname + (p - name), p + 1);
-
- /* Once again, merge with any existing symbol. */
- type_change_ok = false;
- size_change_ok = false;
- if (! elf_merge_symbol (abfd, info, shortname, &sym, &sec,
- &value, &hi, &override,
- &type_change_ok,
- &size_change_ok, dt_needed))
- goto error_return;
-
- if (override)
- {
- /* Here SHORTNAME is a versioned name, so we
- don't expect to see the type of override we
- do in the case above. */
- (*_bfd_error_handler)
- (_("%s: warning: unexpected redefinition of `%s'"),
- bfd_get_filename (abfd), shortname);
- }
- else
- {
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, shortname, BSF_INDIRECT,
- bfd_ind_section_ptr, (bfd_vma) 0, name, false,
- collect, (struct bfd_link_hash_entry **) &hi)))
- goto error_return;
-
- /* If there is a duplicate definition somewhere,
- then HI may not point to an indirect symbol.
- We will have reported an error to the user in
- that case. */
-
- if (hi->root.type == bfd_link_hash_indirect)
- {
- /* If the symbol became indirect, then we
- assume that we have not seen a definition
- before. */
- BFD_ASSERT ((hi->elf_link_hash_flags
- & (ELF_LINK_HASH_DEF_DYNAMIC
- | ELF_LINK_HASH_DEF_REGULAR))
- == 0);
-
- (*bed->elf_backend_copy_indirect_symbol) (h, hi);
-
- /* See if the new flags lead us to realize
- that the symbol must be dynamic. */
- if (! dynsym)
- {
- if (! dynamic)
- {
- if (info->shared
- || ((hi->elf_link_hash_flags
- & ELF_LINK_HASH_REF_DYNAMIC)
- != 0))
- dynsym = true;
- }
- else
- {
- if ((hi->elf_link_hash_flags
- & ELF_LINK_HASH_REF_REGULAR) != 0)
- dynsym = true;
- }
- }
- }
- }
- }
- }
+ if (! elf_add_default_symbol (abfd, info, h, name, &sym,
+ &sec, &value, &dynsym,
+ override, dt_needed))
+ goto error_return;
if (dynsym && h->dynindx == -1)
{
@@ -1932,8 +2044,7 @@ elf_link_add_object_symbols (abfd, info)
&& ! new_weakdef
&& h->weakdef->dynindx == -1)
{
- if (! _bfd_elf_link_record_dynamic_symbol (info,
- h->weakdef))
+ if (! _bfd_elf_link_record_dynamic_symbol (info, h->weakdef))
goto error_return;
}
}
@@ -1945,8 +2056,7 @@ elf_link_add_object_symbols (abfd, info)
{
case STV_INTERNAL:
case STV_HIDDEN:
- h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
- (*bed->elf_backend_hide_symbol) (info, h);
+ (*bed->elf_backend_hide_symbol) (info, h, true);
break;
}
@@ -1957,25 +2067,26 @@ elf_link_add_object_symbols (abfd, info)
bfd_size_type oldsize;
bfd_size_type strindex;
+ if (! is_elf_hash_table (info))
+ goto error_return;
+
/* The symbol from a DT_NEEDED object is referenced from
the regular object to create a dynamic executable. We
have to make sure there is a DT_NEEDED entry for it. */
dt_needed = false;
- oldsize = _bfd_stringtab_size (elf_hash_table (info)->dynstr);
- strindex = _bfd_stringtab_add (elf_hash_table (info)->dynstr,
- elf_dt_soname (abfd),
- true, false);
+ oldsize = _bfd_elf_strtab_size (hash_table->dynstr);
+ strindex = _bfd_elf_strtab_add (hash_table->dynstr,
+ elf_dt_soname (abfd), false);
if (strindex == (bfd_size_type) -1)
goto error_return;
- if (oldsize
- == _bfd_stringtab_size (elf_hash_table (info)->dynstr))
+ if (oldsize == _bfd_elf_strtab_size (hash_table->dynstr))
{
asection *sdyn;
Elf_External_Dyn *dyncon, *dynconend;
- sdyn = bfd_get_section_by_name (elf_hash_table (info)->dynobj,
+ sdyn = bfd_get_section_by_name (hash_table->dynobj,
".dynamic");
BFD_ASSERT (sdyn != NULL);
@@ -1986,14 +2097,14 @@ elf_link_add_object_symbols (abfd, info)
{
Elf_Internal_Dyn dyn;
- elf_swap_dyn_in (elf_hash_table (info)->dynobj,
+ elf_swap_dyn_in (hash_table->dynobj,
dyncon, &dyn);
BFD_ASSERT (dyn.d_tag != DT_NEEDED ||
dyn.d_un.d_val != strindex);
}
}
- if (! elf_add_dynamic_entry (info, DT_NEEDED, strindex))
+ if (! elf_add_dynamic_entry (info, (bfd_vma) DT_NEEDED, strindex))
goto error_return;
}
}
@@ -2143,12 +2254,13 @@ elf_link_add_object_symbols (abfd, info)
&& ! info->relocateable
&& ! info->traditional_format
&& info->hash->creator->flavour == bfd_target_elf_flavour
+ && is_elf_hash_table (info)
&& (info->strip != strip_all && info->strip != strip_debugger))
{
asection *stab, *stabstr;
stab = bfd_get_section_by_name (abfd, ".stab");
- if (stab != NULL)
+ if (stab != NULL && !(stab->flags & SEC_MERGE))
{
stabstr = bfd_get_section_by_name (abfd, ".stabstr");
@@ -2158,14 +2270,36 @@ elf_link_add_object_symbols (abfd, info)
secdata = elf_section_data (stab);
if (! _bfd_link_section_stabs (abfd,
- &elf_hash_table (info)->stab_info,
+ & hash_table->stab_info,
stab, stabstr,
- &secdata->stab_info))
+ &secdata->sec_info))
goto error_return;
+ if (secdata->sec_info)
+ secdata->sec_info_type = ELF_INFO_TYPE_STABS;
}
}
}
+ if (! info->relocateable && ! dynamic
+ && is_elf_hash_table (info))
+ {
+ asection *s;
+
+ for (s = abfd->sections; s != NULL; s = s->next)
+ if (s->flags & SEC_MERGE)
+ {
+ struct bfd_elf_section_data *secdata;
+
+ secdata = elf_section_data (s);
+ if (! _bfd_merge_section (abfd,
+ & hash_table->merge_info,
+ s, &secdata->sec_info))
+ goto error_return;
+ else if (secdata->sec_info)
+ secdata->sec_info_type = ELF_INFO_TYPE_MERGE;
+ }
+ }
+
return true;
error_return:
@@ -2195,6 +2329,9 @@ elf_link_create_dynamic_sections (abfd, info)
struct elf_link_hash_entry *h;
struct elf_backend_data *bed;
+ if (! is_elf_hash_table (info))
+ return false;
+
if (elf_hash_table (info)->dynamic_sections_created)
return true;
@@ -2219,6 +2356,16 @@ elf_link_create_dynamic_sections (abfd, info)
return false;
}
+ if (! info->traditional_format
+ && info->hash->creator->flavour == bfd_target_elf_flavour)
+ {
+ s = bfd_make_section (abfd, ".eh_frame_hdr");
+ if (s == NULL
+ || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+ || ! bfd_set_section_alignment (abfd, s, 2))
+ return false;
+ }
+
/* Create sections to hold version informations. These are removed
if they are not needed. */
s = bfd_make_section (abfd, ".gnu.version_d");
@@ -2253,7 +2400,7 @@ elf_link_create_dynamic_sections (abfd, info)
/* Create a strtab to hold the dynamic symbol names. */
if (elf_hash_table (info)->dynstr == NULL)
{
- elf_hash_table (info)->dynstr = elf_stringtab_init ();
+ elf_hash_table (info)->dynstr = _bfd_elf_strtab_init ();
if (elf_hash_table (info)->dynstr == NULL)
return false;
}
@@ -2316,9 +2463,12 @@ elf_add_dynamic_entry (info, tag, val)
Elf_Internal_Dyn dyn;
bfd *dynobj;
asection *s;
- size_t newsize;
+ bfd_size_type newsize;
bfd_byte *newcontents;
+ if (! is_elf_hash_table (info))
+ return false;
+
dynobj = elf_hash_table (info)->dynobj;
s = bfd_get_section_by_name (dynobj, ".dynamic");
@@ -2350,10 +2500,17 @@ elf_link_record_local_dynamic_symbol (info, input_bfd, input_indx)
{
struct elf_link_local_dynamic_entry *entry;
struct elf_link_hash_table *eht;
- struct bfd_strtab_hash *dynstr;
+ struct elf_strtab_hash *dynstr;
Elf_External_Sym esym;
+ Elf_External_Sym_Shndx eshndx;
+ Elf_External_Sym_Shndx *shndx;
unsigned long dynstr_index;
char *name;
+ file_ptr pos;
+ bfd_size_type amt;
+
+ if (! is_elf_hash_table (info))
+ return false;
/* See if the entry exists already. */
for (entry = elf_hash_table (info)->dynlocal; entry ; entry = entry->next)
@@ -2361,19 +2518,28 @@ elf_link_record_local_dynamic_symbol (info, input_bfd, input_indx)
return true;
entry = (struct elf_link_local_dynamic_entry *)
- bfd_alloc (input_bfd, sizeof (*entry));
+ bfd_alloc (input_bfd, (bfd_size_type) sizeof (*entry));
if (entry == NULL)
return false;
/* Go find the symbol, so that we can find it's name. */
- if (bfd_seek (input_bfd,
- (elf_tdata (input_bfd)->symtab_hdr.sh_offset
- + input_indx * sizeof (Elf_External_Sym)),
- SEEK_SET) != 0
- || (bfd_read (&esym, sizeof (Elf_External_Sym), 1, input_bfd)
- != sizeof (Elf_External_Sym)))
+ amt = sizeof (Elf_External_Sym);
+ pos = elf_tdata (input_bfd)->symtab_hdr.sh_offset + input_indx * amt;
+ if (bfd_seek (input_bfd, pos, SEEK_SET) != 0
+ || bfd_bread ((PTR) &esym, amt, input_bfd) != amt)
return false;
- elf_swap_symbol_in (input_bfd, &esym, &entry->isym);
+ shndx = NULL;
+ if (elf_tdata (input_bfd)->symtab_shndx_hdr.sh_size != 0)
+ {
+ amt = sizeof (Elf_External_Sym_Shndx);
+ pos = elf_tdata (input_bfd)->symtab_shndx_hdr.sh_offset;
+ pos += input_indx * amt;
+ shndx = &eshndx;
+ if (bfd_seek (input_bfd, pos, SEEK_SET) != 0
+ || bfd_bread ((PTR) shndx, amt, input_bfd) != amt)
+ return false;
+ }
+ elf_swap_symbol_in (input_bfd, &esym, shndx, &entry->isym);
name = (bfd_elf_string_from_elf_section
(input_bfd, elf_tdata (input_bfd)->symtab_hdr.sh_link,
@@ -2383,12 +2549,12 @@ elf_link_record_local_dynamic_symbol (info, input_bfd, input_indx)
if (dynstr == NULL)
{
/* Create a strtab to hold the dynamic symbol names. */
- elf_hash_table (info)->dynstr = dynstr = _bfd_elf_stringtab_init ();
+ elf_hash_table (info)->dynstr = dynstr = _bfd_elf_strtab_init ();
if (dynstr == NULL)
return false;
}
- dynstr_index = _bfd_stringtab_add (dynstr, name, true, false);
+ dynstr_index = _bfd_elf_strtab_add (dynstr, name, false);
if (dynstr_index == (unsigned long) -1)
return false;
entry->isym.st_name = dynstr_index;
@@ -2428,6 +2594,7 @@ elf_link_read_relocs_from_section (abfd, shdr, external_relocs,
Elf_Internal_Rela *internal_relocs;
{
struct elf_backend_data *bed;
+ bfd_size_type amt;
/* If there aren't any relocations, that's OK. */
if (!shdr)
@@ -2438,8 +2605,7 @@ elf_link_read_relocs_from_section (abfd, shdr, external_relocs,
return false;
/* Read the relocations. */
- if (bfd_read (external_relocs, 1, shdr->sh_size, abfd)
- != shdr->sh_size)
+ if (bfd_bread (external_relocs, shdr->sh_size, abfd) != shdr->sh_size)
return false;
bed = get_elf_backend_data (abfd);
@@ -2455,8 +2621,8 @@ elf_link_read_relocs_from_section (abfd, shdr, external_relocs,
erel = (Elf_External_Rel *) external_relocs;
erelend = erel + NUM_SHDR_ENTRIES (shdr);
irela = internal_relocs;
- irel = bfd_alloc (abfd, (bed->s->int_rels_per_ext_rel
- * sizeof (Elf_Internal_Rel)));
+ amt = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel);
+ irel = bfd_alloc (abfd, amt);
for (; erel < erelend; erel++, irela += bed->s->int_rels_per_ext_rel)
{
unsigned int i;
@@ -2531,10 +2697,10 @@ NAME(_bfd_elf,link_read_relocs) (abfd, o, external_relocs, internal_relocs,
if (internal_relocs == NULL)
{
- size_t size;
+ bfd_size_type size;
- size = (o->reloc_count * bed->s->int_rels_per_ext_rel
- * sizeof (Elf_Internal_Rela));
+ size = o->reloc_count;
+ size *= bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rela);
if (keep_memory)
internal_relocs = (Elf_Internal_Rela *) bfd_alloc (abfd, size);
else
@@ -2545,10 +2711,10 @@ NAME(_bfd_elf,link_read_relocs) (abfd, o, external_relocs, internal_relocs,
if (external_relocs == NULL)
{
- size_t size = (size_t) rel_hdr->sh_size;
+ bfd_size_type size = rel_hdr->sh_size;
if (elf_section_data (o)->rel_hdr2)
- size += (size_t) elf_section_data (o)->rel_hdr2->sh_size;
+ size += elf_section_data (o)->rel_hdr2->sh_size;
alloc1 = (PTR) bfd_malloc (size);
if (alloc1 == NULL)
goto error_return;
@@ -2590,7 +2756,6 @@ NAME(_bfd_elf,link_read_relocs) (abfd, o, external_relocs, internal_relocs,
/* Record an assignment to a symbol made by a linker script. We need
this in case some dynamic object refers to this symbol. */
-/*ARGSUSED*/
boolean
NAME(bfd_elf,record_link_assignment) (output_bfd, info, name, provide)
bfd *output_bfd ATTRIBUTE_UNUSED;
@@ -2608,7 +2773,7 @@ NAME(bfd_elf,record_link_assignment) (output_bfd, info, name, provide)
return false;
if (h->root.type == bfd_link_hash_new)
- h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
/* If this symbol is being provided by the linker script, and it is
currently defined by a dynamic object, but not by a regular
@@ -2630,7 +2795,7 @@ NAME(bfd_elf,record_link_assignment) (output_bfd, info, name, provide)
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- /* When possible, keep the original type of the symbol */
+ /* When possible, keep the original type of the symbol. */
if (h->type == STT_NOTYPE)
h->type = STT_OBJECT;
@@ -2667,8 +2832,6 @@ struct elf_assign_sym_version_info
struct bfd_link_info *info;
/* Version tree. */
struct bfd_elf_version_tree *verdefs;
- /* Whether we are exporting all dynamic symbols. */
- boolean export_dynamic;
/* Whether we had a failure. */
boolean failed;
};
@@ -2717,12 +2880,14 @@ compute_bucket_count (info)
unsigned long int *hashcodes;
unsigned long int *hashcodesp;
unsigned long int i;
+ bfd_size_type amt;
/* Compute the hash values for all exported symbols. At the same
time store the values in an array so that we could use them for
optimizations. */
- hashcodes = (unsigned long int *) bfd_malloc (dynsymcount
- * sizeof (unsigned long int));
+ amt = dynsymcount;
+ amt *= sizeof (unsigned long int);
+ hashcodes = (unsigned long int *) bfd_malloc (amt);
if (hashcodes == NULL)
return 0;
hashcodesp = hashcodes;
@@ -2753,8 +2918,9 @@ compute_bucket_count (info)
/* Create array where we count the collisions in. We must use bfd_malloc
since the size could be large. */
- counts = (unsigned long int *) bfd_malloc (maxsize
- * sizeof (unsigned long int));
+ amt = maxsize;
+ amt *= sizeof (unsigned long int);
+ counts = (unsigned long int *) bfd_malloc (amt);
if (counts == NULL)
{
free (hashcodes);
@@ -2850,13 +3016,12 @@ compute_bucket_count (info)
boolean
NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
- export_dynamic, filter_shlib,
+ filter_shlib,
auxiliary_filters, info, sinterpptr,
verdefs)
bfd *output_bfd;
const char *soname;
const char *rpath;
- boolean export_dynamic;
const char *filter_shlib;
const char * const *auxiliary_filters;
struct bfd_link_info *info;
@@ -2875,6 +3040,13 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
if (info->hash->creator->flavour != bfd_target_elf_flavour)
return true;
+ if (! is_elf_hash_table (info))
+ return false;
+
+ /* Any syms created from now on start with -1 in
+ got.refcount/offset and plt.refcount/offset. */
+ elf_hash_table (info)->init_refcount = -1;
+
/* The backend may have to create some sections regardless of whether
we're dynamic or not. */
bed = get_elf_backend_data (output_bfd);
@@ -2889,6 +3061,9 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
if (dynobj == NULL)
return true;
+ if (! _bfd_elf_maybe_strip_eh_frame_hdr (info))
+ return false;
+
if (elf_hash_table (info)->dynamic_sections_created)
{
struct elf_info_failed eif;
@@ -2900,16 +3075,18 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
if (soname != NULL)
{
- soname_indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr,
- soname, true, true);
+ soname_indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
+ soname, true);
if (soname_indx == (bfd_size_type) -1
- || ! elf_add_dynamic_entry (info, DT_SONAME, soname_indx))
+ || ! elf_add_dynamic_entry (info, (bfd_vma) DT_SONAME,
+ soname_indx))
return false;
}
if (info->symbolic)
{
- if (! elf_add_dynamic_entry (info, DT_SYMBOLIC, 0))
+ if (! elf_add_dynamic_entry (info, (bfd_vma) DT_SYMBOLIC,
+ (bfd_vma) 0))
return false;
info->flags |= DF_SYMBOLIC;
}
@@ -2918,12 +3095,15 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
{
bfd_size_type indx;
- indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, rpath,
- true, true);
+ indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, rpath,
+ true);
+ if (info->new_dtags)
+ _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, indx);
if (indx == (bfd_size_type) -1
- || ! elf_add_dynamic_entry (info, DT_RPATH, indx)
+ || ! elf_add_dynamic_entry (info, (bfd_vma) DT_RPATH, indx)
|| (info->new_dtags
- && ! elf_add_dynamic_entry (info, DT_RUNPATH, indx)))
+ && ! elf_add_dynamic_entry (info, (bfd_vma) DT_RUNPATH,
+ indx)))
return false;
}
@@ -2931,10 +3111,10 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
{
bfd_size_type indx;
- indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr,
- filter_shlib, true, true);
+ indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
+ filter_shlib, true);
if (indx == (bfd_size_type) -1
- || ! elf_add_dynamic_entry (info, DT_FILTER, indx))
+ || ! elf_add_dynamic_entry (info, (bfd_vma) DT_FILTER, indx))
return false;
}
@@ -2946,20 +3126,22 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
{
bfd_size_type indx;
- indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr,
- *p, true, true);
+ indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
+ *p, true);
if (indx == (bfd_size_type) -1
- || ! elf_add_dynamic_entry (info, DT_AUXILIARY, indx))
+ || ! elf_add_dynamic_entry (info, (bfd_vma) DT_AUXILIARY,
+ indx))
return false;
}
}
eif.info = info;
+ eif.verdefs = verdefs;
eif.failed = false;
/* If we are supposed to export all symbols into the dynamic symbol
table (this is not the normal case), then do so. */
- if (export_dynamic)
+ if (info->export_dynamic)
{
elf_link_hash_traverse (elf_hash_table (info), elf_export_symbol,
(PTR) &eif);
@@ -2971,7 +3153,6 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
asvinfo.output_bfd = output_bfd;
asvinfo.info = info;
asvinfo.verdefs = verdefs;
- asvinfo.export_dynamic = export_dynamic;
asvinfo.failed = false;
elf_link_hash_traverse (elf_hash_table (info),
@@ -3003,7 +3184,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
&& (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
| ELF_LINK_HASH_DEF_REGULAR)) != 0)
{
- if (! elf_add_dynamic_entry (info, DT_INIT, 0))
+ if (! elf_add_dynamic_entry (info, (bfd_vma) DT_INIT, (bfd_vma) 0))
return false;
}
h = (info->fini_function
@@ -3015,7 +3196,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
&& (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR
| ELF_LINK_HASH_DEF_REGULAR)) != 0)
{
- if (! elf_add_dynamic_entry (info, DT_FINI, 0))
+ if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FINI, (bfd_vma) 0))
return false;
}
@@ -3028,13 +3209,13 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
{
bfd_size_type strsize;
- strsize = _bfd_stringtab_size (elf_hash_table (info)->dynstr);
- if (! elf_add_dynamic_entry (info, DT_HASH, 0)
- || ! elf_add_dynamic_entry (info, DT_STRTAB, 0)
- || ! elf_add_dynamic_entry (info, DT_SYMTAB, 0)
- || ! elf_add_dynamic_entry (info, DT_STRSZ, strsize)
- || ! elf_add_dynamic_entry (info, DT_SYMENT,
- sizeof (Elf_External_Sym)))
+ strsize = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
+ if (! elf_add_dynamic_entry (info, (bfd_vma) DT_HASH, (bfd_vma) 0)
+ || ! elf_add_dynamic_entry (info, (bfd_vma) DT_STRTAB, (bfd_vma) 0)
+ || ! elf_add_dynamic_entry (info, (bfd_vma) DT_SYMTAB, (bfd_vma) 0)
+ || ! elf_add_dynamic_entry (info, (bfd_vma) DT_STRSZ, strsize)
+ || ! elf_add_dynamic_entry (info, (bfd_vma) DT_SYMENT,
+ (bfd_vma) sizeof (Elf_External_Sym)))
return false;
}
}
@@ -3047,10 +3228,11 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
if (elf_hash_table (info)->dynamic_sections_created)
{
- size_t dynsymcount;
+ bfd_size_type dynsymcount;
asection *s;
size_t bucketcount = 0;
size_t hash_entry_size;
+ unsigned int dtagcount;
/* Set up the version definition section. */
s = bfd_get_section_by_name (dynobj, ".gnu.version_d");
@@ -3060,6 +3242,10 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
just linking a regular application. */
verdefs = asvinfo.verdefs;
+ /* Skip anonymous version tag. */
+ if (verdefs != NULL && verdefs->vernum == 0)
+ verdefs = verdefs->next;
+
if (verdefs == NULL)
_bfd_strip_section_from_output (info, s);
else
@@ -3110,6 +3296,8 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
if (soname_indx != (bfd_size_type) -1)
{
+ _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr,
+ soname_indx);
def.vd_hash = bfd_elf_hash (soname);
defaux.vda_name = soname_indx;
}
@@ -3118,10 +3306,10 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
const char *name;
bfd_size_type indx;
- name = output_bfd->filename;
+ name = basename (output_bfd->filename);
def.vd_hash = bfd_elf_hash (name);
- indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr,
- name, true, false);
+ indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
+ name, false);
if (indx == (bfd_size_type) -1)
return false;
defaux.vda_name = indx;
@@ -3129,7 +3317,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
defaux.vda_next = 0;
_bfd_elf_swap_verdef_out (output_bfd, &def,
- (Elf_External_Verdef *)p);
+ (Elf_External_Verdef *) p);
p += sizeof (Elf_External_Verdef);
_bfd_elf_swap_verdaux_out (output_bfd, &defaux,
(Elf_External_Verdaux *) p);
@@ -3180,6 +3368,8 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
p += sizeof (Elf_External_Verdef);
defaux.vda_name = h->dynstr_index;
+ _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr,
+ h->dynstr_index);
if (t->deps == NULL)
defaux.vda_next = 0;
else
@@ -3199,7 +3389,11 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
defaux.vda_name = 0;
}
else
- defaux.vda_name = n->version_needed->name_indx;
+ {
+ defaux.vda_name = n->version_needed->name_indx;
+ _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr,
+ defaux.vda_name);
+ }
if (n->next == NULL)
defaux.vda_next = 0;
else
@@ -3211,8 +3405,9 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
}
}
- if (! elf_add_dynamic_entry (info, DT_VERDEF, 0)
- || ! elf_add_dynamic_entry (info, DT_VERDEFNUM, cdefs))
+ if (! elf_add_dynamic_entry (info, (bfd_vma) DT_VERDEF, (bfd_vma) 0)
+ || ! elf_add_dynamic_entry (info, (bfd_vma) DT_VERDEFNUM,
+ (bfd_vma) cdefs))
return false;
elf_tdata (output_bfd)->cverdefs = cdefs;
@@ -3220,7 +3415,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
if (info->new_dtags && info->flags)
{
- if (! elf_add_dynamic_entry (info, DT_FLAGS, info->flags))
+ if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FLAGS, info->flags))
return false;
}
@@ -3230,7 +3425,8 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
info->flags_1 &= ~ (DF_1_INITFIRST
| DF_1_NODELETE
| DF_1_NOOPEN);
- if (! elf_add_dynamic_entry (info, DT_FLAGS_1, info->flags_1))
+ if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FLAGS_1,
+ info->flags_1))
return false;
}
@@ -3277,7 +3473,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
}
s->_raw_size = size;
- s->contents = (bfd_byte *) bfd_alloc (output_bfd, size);
+ s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
if (s->contents == NULL)
return false;
@@ -3296,13 +3492,11 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
t->vn_version = VER_NEED_CURRENT;
t->vn_cnt = caux;
- if (elf_dt_name (t->vn_bfd) != NULL)
- indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr,
- elf_dt_name (t->vn_bfd),
- true, false);
- else
- indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr,
- t->vn_bfd->filename, true, false);
+ indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
+ elf_dt_name (t->vn_bfd) != NULL
+ ? elf_dt_name (t->vn_bfd)
+ : basename (t->vn_bfd->filename),
+ false);
if (indx == (bfd_size_type) -1)
return false;
t->vn_file = indx;
@@ -3320,8 +3514,8 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
{
a->vna_hash = bfd_elf_hash (a->vna_nodename);
- indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr,
- a->vna_nodename, true, false);
+ indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr,
+ a->vna_nodename, false);
if (indx == (bfd_size_type) -1)
return false;
a->vna_name = indx;
@@ -3336,8 +3530,10 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
}
}
- if (! elf_add_dynamic_entry (info, DT_VERNEED, 0)
- || ! elf_add_dynamic_entry (info, DT_VERNEEDNUM, crefs))
+ if (! elf_add_dynamic_entry (info, (bfd_vma) DT_VERNEED,
+ (bfd_vma) 0)
+ || ! elf_add_dynamic_entry (info, (bfd_vma) DT_VERNEEDNUM,
+ (bfd_vma) crefs))
return false;
elf_tdata (output_bfd)->cverrefs = crefs;
@@ -3369,7 +3565,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
if (s->contents == NULL)
return false;
- if (! elf_add_dynamic_entry (info, DT_VERSYM, 0))
+ if (! elf_add_dynamic_entry (info, (bfd_vma) DT_VERSYM, (bfd_vma) 0))
return false;
}
@@ -3397,8 +3593,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
isym.st_info = 0;
isym.st_other = 0;
isym.st_shndx = 0;
- elf_swap_symbol_out (output_bfd, &isym,
- (PTR) (Elf_External_Sym *) s->contents);
+ elf_swap_symbol_out (output_bfd, &isym, (PTR) s->contents, (PTR) 0);
}
/* Compute the size of the hashing table. As a side effect this
@@ -3414,23 +3609,172 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
return false;
memset (s->contents, 0, (size_t) s->_raw_size);
- bfd_put (8 * hash_entry_size, output_bfd, bucketcount, s->contents);
- bfd_put (8 * hash_entry_size, output_bfd, dynsymcount,
+ bfd_put (8 * hash_entry_size, output_bfd, (bfd_vma) bucketcount,
+ s->contents);
+ bfd_put (8 * hash_entry_size, output_bfd, (bfd_vma) dynsymcount,
s->contents + hash_entry_size);
elf_hash_table (info)->bucketcount = bucketcount;
s = bfd_get_section_by_name (dynobj, ".dynstr");
BFD_ASSERT (s != NULL);
- s->_raw_size = _bfd_stringtab_size (elf_hash_table (info)->dynstr);
- if (! elf_add_dynamic_entry (info, DT_NULL, 0))
- return false;
+ elf_finalize_dynstr (output_bfd, info);
+
+ s->_raw_size = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr);
+
+ for (dtagcount = 0; dtagcount <= info->spare_dynamic_tags; ++dtagcount)
+ if (! elf_add_dynamic_entry (info, (bfd_vma) DT_NULL, (bfd_vma) 0))
+ return false;
}
return true;
}
+/* This function is used to adjust offsets into .dynstr for
+ dynamic symbols. This is called via elf_link_hash_traverse. */
+
+static boolean elf_adjust_dynstr_offsets
+PARAMS ((struct elf_link_hash_entry *, PTR));
+
+static boolean
+elf_adjust_dynstr_offsets (h, data)
+ struct elf_link_hash_entry *h;
+ PTR data;
+{
+ struct elf_strtab_hash *dynstr = (struct elf_strtab_hash *) data;
+
+ if (h->dynindx != -1)
+ h->dynstr_index = _bfd_elf_strtab_offset (dynstr, h->dynstr_index);
+ return true;
+}
+
+/* Assign string offsets in .dynstr, update all structures referencing
+ them. */
+
+static boolean
+elf_finalize_dynstr (output_bfd, info)
+ bfd *output_bfd;
+ struct bfd_link_info *info;
+{
+ struct elf_link_local_dynamic_entry *entry;
+ struct elf_strtab_hash *dynstr = elf_hash_table (info)->dynstr;
+ bfd *dynobj = elf_hash_table (info)->dynobj;
+ asection *sdyn;
+ bfd_size_type size;
+ Elf_External_Dyn *dyncon, *dynconend;
+
+ _bfd_elf_strtab_finalize (dynstr);
+ size = _bfd_elf_strtab_size (dynstr);
+
+ /* Update all .dynamic entries referencing .dynstr strings. */
+ sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
+ BFD_ASSERT (sdyn != NULL);
+
+ dyncon = (Elf_External_Dyn *) sdyn->contents;
+ dynconend = (Elf_External_Dyn *) (sdyn->contents +
+ sdyn->_raw_size);
+ for (; dyncon < dynconend; dyncon++)
+ {
+ Elf_Internal_Dyn dyn;
+
+ elf_swap_dyn_in (dynobj, dyncon, & dyn);
+ switch (dyn.d_tag)
+ {
+ case DT_STRSZ:
+ dyn.d_un.d_val = size;
+ elf_swap_dyn_out (dynobj, & dyn, dyncon);
+ break;
+ case DT_NEEDED:
+ case DT_SONAME:
+ case DT_RPATH:
+ case DT_RUNPATH:
+ case DT_FILTER:
+ case DT_AUXILIARY:
+ dyn.d_un.d_val = _bfd_elf_strtab_offset (dynstr, dyn.d_un.d_val);
+ elf_swap_dyn_out (dynobj, & dyn, dyncon);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /* Now update local dynamic symbols. */
+ for (entry = elf_hash_table (info)->dynlocal; entry ; entry = entry->next)
+ entry->isym.st_name = _bfd_elf_strtab_offset (dynstr,
+ entry->isym.st_name);
+
+ /* And the rest of dynamic symbols. */
+ elf_link_hash_traverse (elf_hash_table (info),
+ elf_adjust_dynstr_offsets, dynstr);
+
+ /* Adjust version definitions. */
+ if (elf_tdata (output_bfd)->cverdefs)
+ {
+ asection *s;
+ bfd_byte *p;
+ bfd_size_type i;
+ Elf_Internal_Verdef def;
+ Elf_Internal_Verdaux defaux;
+
+ s = bfd_get_section_by_name (dynobj, ".gnu.version_d");
+ p = (bfd_byte *) s->contents;
+ do
+ {
+ _bfd_elf_swap_verdef_in (output_bfd, (Elf_External_Verdef *) p,
+ &def);
+ p += sizeof (Elf_External_Verdef);
+ for (i = 0; i < def.vd_cnt; ++i)
+ {
+ _bfd_elf_swap_verdaux_in (output_bfd,
+ (Elf_External_Verdaux *) p, &defaux);
+ defaux.vda_name = _bfd_elf_strtab_offset (dynstr,
+ defaux.vda_name);
+ _bfd_elf_swap_verdaux_out (output_bfd,
+ &defaux, (Elf_External_Verdaux *) p);
+ p += sizeof (Elf_External_Verdaux);
+ }
+ }
+ while (def.vd_next);
+ }
+
+ /* Adjust version references. */
+ if (elf_tdata (output_bfd)->verref)
+ {
+ asection *s;
+ bfd_byte *p;
+ bfd_size_type i;
+ Elf_Internal_Verneed need;
+ Elf_Internal_Vernaux needaux;
+
+ s = bfd_get_section_by_name (dynobj, ".gnu.version_r");
+ p = (bfd_byte *) s->contents;
+ do
+ {
+ _bfd_elf_swap_verneed_in (output_bfd, (Elf_External_Verneed *) p,
+ &need);
+ need.vn_file = _bfd_elf_strtab_offset (dynstr, need.vn_file);
+ _bfd_elf_swap_verneed_out (output_bfd, &need,
+ (Elf_External_Verneed *) p);
+ p += sizeof (Elf_External_Verneed);
+ for (i = 0; i < need.vn_cnt; ++i)
+ {
+ _bfd_elf_swap_vernaux_in (output_bfd,
+ (Elf_External_Vernaux *) p, &needaux);
+ needaux.vna_name = _bfd_elf_strtab_offset (dynstr,
+ needaux.vna_name);
+ _bfd_elf_swap_vernaux_out (output_bfd,
+ &needaux,
+ (Elf_External_Vernaux *) p);
+ p += sizeof (Elf_External_Vernaux);
+ }
+ }
+ while (need.vn_next);
+ }
+
+ return true;
+}
+
/* Fix up the flags for a symbol. This handles various cases which
can only be fixed after all the input files are seen. This is
currently called by both adjust_dynamic_symbol and
@@ -3519,17 +3863,20 @@ elf_fix_symbol_flags (h, eif)
backend specifically; we can't just clear PLT-related data here. */
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0
&& eif->info->shared
+ && is_elf_hash_table (eif->info)
&& (eif->info->symbolic
|| ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
|| ELF_ST_VISIBILITY (h->other) == STV_HIDDEN)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
{
struct elf_backend_data *bed;
+ boolean force_local;
+
bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
- if (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
- || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN)
- h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
- (*bed->elf_backend_hide_symbol) (eif->info, h);
+
+ force_local = (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
+ || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN);
+ (*bed->elf_backend_hide_symbol) (eif->info, h, force_local);
}
/* If this is a weak defined symbol in a dynamic object, and we know
@@ -3552,11 +3899,12 @@ elf_fix_symbol_flags (h, eif)
if ((weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
h->weakdef = NULL;
else
- weakdef->elf_link_hash_flags |=
- (h->elf_link_hash_flags
- & (ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK
- | ELF_LINK_NON_GOT_REF));
+ {
+ struct elf_backend_data *bed;
+
+ bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
+ (*bed->elf_backend_copy_indirect_symbol) (weakdef, h);
+ }
}
return true;
@@ -3579,6 +3927,9 @@ elf_adjust_dynamic_symbol (h, data)
if (h->root.type == bfd_link_hash_indirect)
return true;
+ if (! is_elf_hash_table (eif->info))
+ return false;
+
/* Fix the symbol flags. */
if (! elf_fix_symbol_flags (h, eif))
return false;
@@ -3692,11 +4043,39 @@ elf_export_symbol (h, data)
&& (h->elf_link_hash_flags
& (ELF_LINK_HASH_DEF_REGULAR | ELF_LINK_HASH_REF_REGULAR)) != 0)
{
- if (! _bfd_elf_link_record_dynamic_symbol (eif->info, h))
+ struct bfd_elf_version_tree *t;
+ struct bfd_elf_version_expr *d;
+
+ for (t = eif->verdefs; t != NULL; t = t->next)
{
- eif->failed = true;
- return false;
+ if (t->globals != NULL)
+ {
+ for (d = t->globals; d != NULL; d = d->next)
+ {
+ if ((*d->match) (d, h->root.root.string))
+ goto doit;
+ }
+ }
+
+ if (t->locals != NULL)
+ {
+ for (d = t->locals ; d != NULL; d = d->next)
+ {
+ if ((*d->match) (d, h->root.root.string))
+ return true;
+ }
+ }
}
+
+ if (!eif->verdefs)
+ {
+doit:
+ if (! _bfd_elf_link_record_dynamic_symbol (eif->info, h))
+ {
+ eif->failed = true;
+ return false;
+ }
+ }
}
return true;
@@ -3715,6 +4094,7 @@ elf_link_find_version_dependencies (h, data)
struct elf_find_verdep_info *rinfo = (struct elf_find_verdep_info *) data;
Elf_Internal_Verneed *t;
Elf_Internal_Vernaux *a;
+ bfd_size_type amt;
/* We only care about symbols defined in shared objects with version
information. */
@@ -3741,7 +4121,8 @@ elf_link_find_version_dependencies (h, data)
if (t == NULL)
{
- t = (Elf_Internal_Verneed *) bfd_zalloc (rinfo->output_bfd, sizeof *t);
+ amt = sizeof *t;
+ t = (Elf_Internal_Verneed *) bfd_zalloc (rinfo->output_bfd, amt);
if (t == NULL)
{
rinfo->failed = true;
@@ -3753,7 +4134,8 @@ elf_link_find_version_dependencies (h, data)
elf_tdata (rinfo->output_bfd)->verref = t;
}
- a = (Elf_Internal_Vernaux *) bfd_zalloc (rinfo->output_bfd, sizeof *a);
+ amt = sizeof *a;
+ a = (Elf_Internal_Vernaux *) bfd_zalloc (rinfo->output_bfd, amt);
/* Note that we are copying a string pointer here, and testing it
above. If bfd_elf_string_from_elf_section is ever changed to
@@ -3784,12 +4166,15 @@ elf_link_assign_sym_version (h, data)
struct elf_link_hash_entry *h;
PTR data;
{
- struct elf_assign_sym_version_info *sinfo =
- (struct elf_assign_sym_version_info *) data;
- struct bfd_link_info *info = sinfo->info;
+ struct elf_assign_sym_version_info *sinfo;
+ struct bfd_link_info *info;
struct elf_backend_data *bed;
struct elf_info_failed eif;
char *p;
+ bfd_size_type amt;
+
+ sinfo = (struct elf_assign_sym_version_info *) data;
+ info = sinfo->info;
/* Fix the symbol flags. */
eif.failed = false;
@@ -3837,12 +4222,12 @@ elf_link_assign_sym_version (h, data)
{
if (strcmp (t->name, p) == 0)
{
- int len;
+ size_t len;
char *alc;
struct bfd_elf_version_expr *d;
len = p - h->root.root.string;
- alc = bfd_alloc (sinfo->output_bfd, len);
+ alc = bfd_malloc ((bfd_size_type) len);
if (alc == NULL)
return false;
strncpy (alc, h->root.root.string, len - 1);
@@ -3871,13 +4256,9 @@ elf_link_assign_sym_version (h, data)
{
if (h->dynindx != -1
&& info->shared
- && ! sinfo->export_dynamic)
+ && ! info->export_dynamic)
{
- h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
- (*bed->elf_backend_hide_symbol) (info, h);
- /* FIXME: The name of the symbol has
- already been recorded in the dynamic
- string table section. */
+ (*bed->elf_backend_hide_symbol) (info, h, true);
}
break;
@@ -3885,7 +4266,7 @@ elf_link_assign_sym_version (h, data)
}
}
- bfd_release (sinfo->output_bfd, alc);
+ free (alc);
break;
}
}
@@ -3902,8 +4283,9 @@ elf_link_assign_sym_version (h, data)
if (h->dynindx == -1)
return true;
+ amt = sizeof *t;
t = ((struct bfd_elf_version_tree *)
- bfd_alloc (sinfo->output_bfd, sizeof *t));
+ bfd_alloc (sinfo->output_bfd, amt));
if (t == NULL)
{
sinfo->failed = true;
@@ -3919,6 +4301,9 @@ elf_link_assign_sym_version (h, data)
t->used = true;
version_index = 1;
+ /* Don't count anonymous version tag. */
+ if (sinfo->verdefs != NULL && sinfo->verdefs->vernum == 0)
+ version_index = 0;
for (pp = &sinfo->verdefs; *pp != NULL; pp = &(*pp)->next)
++version_index;
t->vernum = version_index;
@@ -3983,13 +4368,9 @@ elf_link_assign_sym_version (h, data)
h->verinfo.vertree = t;
if (h->dynindx != -1
&& info->shared
- && ! sinfo->export_dynamic)
+ && ! info->export_dynamic)
{
- h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
- (*bed->elf_backend_hide_symbol) (info, h);
- /* FIXME: The name of the symbol has already
- been recorded in the dynamic string table
- section. */
+ (*bed->elf_backend_hide_symbol) (info, h, true);
}
break;
}
@@ -4005,12 +4386,9 @@ elf_link_assign_sym_version (h, data)
h->verinfo.vertree = deflt;
if (h->dynindx != -1
&& info->shared
- && ! sinfo->export_dynamic)
+ && ! info->export_dynamic)
{
- h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
- (*bed->elf_backend_hide_symbol) (info, h);
- /* FIXME: The name of the symbol has already been
- recorded in the dynamic string table section. */
+ (*bed->elf_backend_hide_symbol) (info, h, true);
}
}
}
@@ -4045,6 +4423,8 @@ struct elf_final_link_info
/* Buffer large enough to hold external local symbols of any input
BFD. */
Elf_External_Sym *external_syms;
+ /* And a buffer for symbol section indices. */
+ Elf_External_Sym_Shndx *locsym_shndx;
/* Buffer large enough to hold internal local symbols of any input
BFD. */
Elf_Internal_Sym *internal_syms;
@@ -4056,6 +4436,8 @@ struct elf_final_link_info
asection **sections;
/* Buffer to hold swapped out symbols. */
Elf_External_Sym *symbuf;
+ /* And one for symbol section indices. */
+ Elf_External_Sym_Shndx *symshndxbuf;
/* Number of swapped out symbols in buffer. */
size_t symbuf_count;
/* Number of symbols which fit in symbuf. */
@@ -4069,6 +4451,8 @@ static boolean elf_link_flush_output_syms
PARAMS ((struct elf_final_link_info *));
static boolean elf_link_output_extsym
PARAMS ((struct elf_link_hash_entry *, PTR));
+static boolean elf_link_sec_merge_syms
+ PARAMS ((struct elf_link_hash_entry *, PTR));
static boolean elf_link_input_bfd
PARAMS ((struct elf_final_link_info *, bfd *));
static boolean elf_reloc_link_order
@@ -4093,7 +4477,8 @@ elf_link_size_reloc_section (abfd, rel_hdr, o)
Elf_Internal_Shdr *rel_hdr;
asection *o;
{
- unsigned reloc_count;
+ bfd_size_type reloc_count;
+ bfd_size_type num_rel_hashes;
/* Figure out how many relocations there will be. */
if (rel_hdr == &elf_section_data (o)->rel_hdr)
@@ -4101,6 +4486,10 @@ elf_link_size_reloc_section (abfd, rel_hdr, o)
else
reloc_count = elf_section_data (o)->rel_count2;
+ num_rel_hashes = o->reloc_count;
+ if (num_rel_hashes < reloc_count)
+ num_rel_hashes = reloc_count;
+
/* That allows us to calculate the size of the section. */
rel_hdr->sh_size = rel_hdr->sh_entsize * reloc_count;
@@ -4114,14 +4503,15 @@ elf_link_size_reloc_section (abfd, rel_hdr, o)
/* We only allocate one set of hash entries, so we only do it the
first time we are called. */
- if (elf_section_data (o)->rel_hashes == NULL)
+ if (elf_section_data (o)->rel_hashes == NULL
+ && num_rel_hashes)
{
struct elf_link_hash_entry **p;
p = ((struct elf_link_hash_entry **)
- bfd_zmalloc (o->reloc_count
+ bfd_zmalloc (num_rel_hashes
* sizeof (struct elf_link_hash_entry *)));
- if (p == NULL && o->reloc_count != 0)
+ if (p == NULL)
return false;
elf_section_data (o)->rel_hashes = p;
@@ -4146,17 +4536,17 @@ elf_link_adjust_relocs (abfd, rel_hdr, count, rel_hash)
struct elf_backend_data *bed = get_elf_backend_data (abfd);
Elf_Internal_Rel *irel;
Elf_Internal_Rela *irela;
+ bfd_size_type amt = sizeof (Elf_Internal_Rel) * bed->s->int_rels_per_ext_rel;
- irel = (Elf_Internal_Rel *) bfd_zmalloc (sizeof (Elf_Internal_Rel)
- * bed->s->int_rels_per_ext_rel);
+ irel = (Elf_Internal_Rel *) bfd_zmalloc (amt);
if (irel == NULL)
{
(*_bfd_error_handler) (_("Error: out of memory"));
abort ();
}
- irela = (Elf_Internal_Rela *) bfd_zmalloc (sizeof (Elf_Internal_Rela)
- * bed->s->int_rels_per_ext_rel);
+ amt = sizeof (Elf_Internal_Rela) * bed->s->int_rels_per_ext_rel;
+ irela = (Elf_Internal_Rela *) bfd_zmalloc (amt);
if (irela == NULL)
{
(*_bfd_error_handler) (_("Error: out of memory"));
@@ -4219,6 +4609,214 @@ elf_link_adjust_relocs (abfd, rel_hdr, count, rel_hash)
free (irela);
}
+struct elf_link_sort_rela {
+ bfd_vma offset;
+ enum elf_reloc_type_class type;
+ union {
+ Elf_Internal_Rel rel;
+ Elf_Internal_Rela rela;
+ } u;
+};
+
+static int
+elf_link_sort_cmp1 (A, B)
+ const PTR A;
+ const PTR B;
+{
+ struct elf_link_sort_rela *a = (struct elf_link_sort_rela *) A;
+ struct elf_link_sort_rela *b = (struct elf_link_sort_rela *) B;
+ int relativea, relativeb;
+
+ relativea = a->type == reloc_class_relative;
+ relativeb = b->type == reloc_class_relative;
+
+ if (relativea < relativeb)
+ return 1;
+ if (relativea > relativeb)
+ return -1;
+ if (ELF_R_SYM (a->u.rel.r_info) < ELF_R_SYM (b->u.rel.r_info))
+ return -1;
+ if (ELF_R_SYM (a->u.rel.r_info) > ELF_R_SYM (b->u.rel.r_info))
+ return 1;
+ if (a->u.rel.r_offset < b->u.rel.r_offset)
+ return -1;
+ if (a->u.rel.r_offset > b->u.rel.r_offset)
+ return 1;
+ return 0;
+}
+
+static int
+elf_link_sort_cmp2 (A, B)
+ const PTR A;
+ const PTR B;
+{
+ struct elf_link_sort_rela *a = (struct elf_link_sort_rela *) A;
+ struct elf_link_sort_rela *b = (struct elf_link_sort_rela *) B;
+ int copya, copyb;
+
+ if (a->offset < b->offset)
+ return -1;
+ if (a->offset > b->offset)
+ return 1;
+ copya = (a->type == reloc_class_copy) * 2 + (a->type == reloc_class_plt);
+ copyb = (b->type == reloc_class_copy) * 2 + (b->type == reloc_class_plt);
+ if (copya < copyb)
+ return -1;
+ if (copya > copyb)
+ return 1;
+ if (a->u.rel.r_offset < b->u.rel.r_offset)
+ return -1;
+ if (a->u.rel.r_offset > b->u.rel.r_offset)
+ return 1;
+ return 0;
+}
+
+static size_t
+elf_link_sort_relocs (abfd, info, psec)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ asection **psec;
+{
+ bfd *dynobj = elf_hash_table (info)->dynobj;
+ asection *reldyn, *o;
+ boolean rel = false;
+ bfd_size_type count, size;
+ size_t i, j, ret;
+ struct elf_link_sort_rela *rela;
+ struct elf_backend_data *bed = get_elf_backend_data (abfd);
+
+ reldyn = bfd_get_section_by_name (abfd, ".rela.dyn");
+ if (reldyn == NULL || reldyn->_raw_size == 0)
+ {
+ reldyn = bfd_get_section_by_name (abfd, ".rel.dyn");
+ if (reldyn == NULL || reldyn->_raw_size == 0)
+ return 0;
+ rel = true;
+ count = reldyn->_raw_size / sizeof (Elf_External_Rel);
+ }
+ else
+ count = reldyn->_raw_size / sizeof (Elf_External_Rela);
+
+ size = 0;
+ for (o = dynobj->sections; o != NULL; o = o->next)
+ if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED))
+ == (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)
+ && o->output_section == reldyn)
+ size += o->_raw_size;
+
+ if (size != reldyn->_raw_size)
+ return 0;
+
+ rela = (struct elf_link_sort_rela *) bfd_zmalloc (sizeof (*rela) * count);
+ if (rela == NULL)
+ {
+ (*info->callbacks->warning)
+ (info, _("Not enough memory to sort relocations"), 0, abfd, 0,
+ (bfd_vma) 0);
+ return 0;
+ }
+
+ for (o = dynobj->sections; o != NULL; o = o->next)
+ if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED))
+ == (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)
+ && o->output_section == reldyn)
+ {
+ if (rel)
+ {
+ Elf_External_Rel *erel, *erelend;
+ struct elf_link_sort_rela *s;
+
+ erel = (Elf_External_Rel *) o->contents;
+ erelend = (Elf_External_Rel *) (o->contents + o->_raw_size);
+ s = rela + o->output_offset / sizeof (Elf_External_Rel);
+ for (; erel < erelend; erel++, s++)
+ {
+ if (bed->s->swap_reloc_in)
+ (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel, &s->u.rel);
+ else
+ elf_swap_reloc_in (abfd, erel, &s->u.rel);
+
+ s->type = (*bed->elf_backend_reloc_type_class) (&s->u.rela);
+ }
+ }
+ else
+ {
+ Elf_External_Rela *erela, *erelaend;
+ struct elf_link_sort_rela *s;
+
+ erela = (Elf_External_Rela *) o->contents;
+ erelaend = (Elf_External_Rela *) (o->contents + o->_raw_size);
+ s = rela + o->output_offset / sizeof (Elf_External_Rela);
+ for (; erela < erelaend; erela++, s++)
+ {
+ if (bed->s->swap_reloca_in)
+ (*bed->s->swap_reloca_in) (dynobj, (bfd_byte *) erela,
+ &s->u.rela);
+ else
+ elf_swap_reloca_in (dynobj, erela, &s->u.rela);
+
+ s->type = (*bed->elf_backend_reloc_type_class) (&s->u.rela);
+ }
+ }
+ }
+
+ qsort (rela, (size_t) count, sizeof (*rela), elf_link_sort_cmp1);
+ for (ret = 0; ret < count && rela[ret].type == reloc_class_relative; ret++)
+ ;
+ for (i = ret, j = ret; i < count; i++)
+ {
+ if (ELF_R_SYM (rela[i].u.rel.r_info) != ELF_R_SYM (rela[j].u.rel.r_info))
+ j = i;
+ rela[i].offset = rela[j].u.rel.r_offset;
+ }
+ qsort (rela + ret, (size_t) count - ret, sizeof (*rela), elf_link_sort_cmp2);
+
+ for (o = dynobj->sections; o != NULL; o = o->next)
+ if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED))
+ == (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)
+ && o->output_section == reldyn)
+ {
+ if (rel)
+ {
+ Elf_External_Rel *erel, *erelend;
+ struct elf_link_sort_rela *s;
+
+ erel = (Elf_External_Rel *) o->contents;
+ erelend = (Elf_External_Rel *) (o->contents + o->_raw_size);
+ s = rela + o->output_offset / sizeof (Elf_External_Rel);
+ for (; erel < erelend; erel++, s++)
+ {
+ if (bed->s->swap_reloc_out)
+ (*bed->s->swap_reloc_out) (abfd, &s->u.rel,
+ (bfd_byte *) erel);
+ else
+ elf_swap_reloc_out (abfd, &s->u.rel, erel);
+ }
+ }
+ else
+ {
+ Elf_External_Rela *erela, *erelaend;
+ struct elf_link_sort_rela *s;
+
+ erela = (Elf_External_Rela *) o->contents;
+ erelaend = (Elf_External_Rela *) (o->contents + o->_raw_size);
+ s = rela + o->output_offset / sizeof (Elf_External_Rela);
+ for (; erela < erelaend; erela++, s++)
+ {
+ if (bed->s->swap_reloca_out)
+ (*bed->s->swap_reloca_out) (dynobj, &s->u.rela,
+ (bfd_byte *) erela);
+ else
+ elf_swap_reloca_out (dynobj, &s->u.rela, erela);
+ }
+ }
+ }
+
+ free (rela);
+ *psec = reldyn;
+ return ret;
+}
+
/* Do the final step of an ELF link. */
boolean
@@ -4227,15 +4825,17 @@ elf_bfd_final_link (abfd, info)
struct bfd_link_info *info;
{
boolean dynamic;
+ boolean emit_relocs;
bfd *dynobj;
struct elf_final_link_info finfo;
register asection *o;
register struct bfd_link_order *p;
register bfd *sub;
- size_t max_contents_size;
- size_t max_external_reloc_size;
- size_t max_internal_reloc_count;
- size_t max_sym_count;
+ bfd_size_type max_contents_size;
+ bfd_size_type max_external_reloc_size;
+ bfd_size_type max_internal_reloc_count;
+ bfd_size_type max_sym_count;
+ bfd_size_type max_sym_shndx_count;
file_ptr off;
Elf_Internal_Sym elfsym;
unsigned int i;
@@ -4243,6 +4843,13 @@ elf_bfd_final_link (abfd, info)
Elf_Internal_Shdr *symstrtab_hdr;
struct elf_backend_data *bed = get_elf_backend_data (abfd);
struct elf_outext_info eoinfo;
+ boolean merged;
+ size_t relativecount = 0;
+ asection *reldyn = 0;
+ bfd_size_type amt;
+
+ if (! is_elf_hash_table (info))
+ return false;
if (info->shared)
abfd->flags |= DYNAMIC;
@@ -4250,6 +4857,10 @@ elf_bfd_final_link (abfd, info)
dynamic = elf_hash_table (info)->dynamic_sections_created;
dynobj = elf_hash_table (info)->dynobj;
+ emit_relocs = (info->relocateable
+ || info->emitrelocations
+ || bed->elf_backend_emit_relocs);
+
finfo.info = info;
finfo.output_bfd = abfd;
finfo.symstrtab = elf_stringtab_init ();
@@ -4275,10 +4886,12 @@ elf_bfd_final_link (abfd, info)
finfo.external_relocs = NULL;
finfo.internal_relocs = NULL;
finfo.external_syms = NULL;
+ finfo.locsym_shndx = NULL;
finfo.internal_syms = NULL;
finfo.indices = NULL;
finfo.sections = NULL;
finfo.symbuf = NULL;
+ finfo.symshndxbuf = NULL;
finfo.symbuf_count = 0;
/* Count up the number of relocations we will output for each output
@@ -4288,6 +4901,8 @@ elf_bfd_final_link (abfd, info)
max_external_reloc_size = 0;
max_internal_reloc_count = 0;
max_sym_count = 0;
+ max_sym_shndx_count = 0;
+ merged = false;
for (o = abfd->sections; o != (asection *) NULL; o = o->next)
{
o->reloc_count = 0;
@@ -4309,8 +4924,25 @@ elf_bfd_final_link (abfd, info)
the linker has decided to not include. */
sec->linker_mark = true;
+ if (sec->flags & SEC_MERGE)
+ merged = true;
+
if (info->relocateable || info->emitrelocations)
o->reloc_count += sec->reloc_count;
+ else if (bed->elf_backend_count_relocs)
+ {
+ Elf_Internal_Rela * relocs;
+
+ relocs = (NAME(_bfd_elf,link_read_relocs)
+ (abfd, sec, (PTR) NULL,
+ (Elf_Internal_Rela *) NULL, info->keep_memory));
+
+ o->reloc_count += (*bed->elf_backend_count_relocs)
+ (sec, relocs);
+
+ if (!info->keep_memory)
+ free (relocs);
+ }
if (sec->_raw_size > max_contents_size)
max_contents_size = sec->_raw_size;
@@ -4333,6 +4965,10 @@ elf_bfd_final_link (abfd, info)
if (sym_count > max_sym_count)
max_sym_count = sym_count;
+ if (sym_count > max_sym_shndx_count
+ && elf_symtab_shndx (sec->owner) != 0)
+ max_sym_shndx_count = sym_count;
+
if ((sec->flags & SEC_RELOC) != 0)
{
size_t ext_size;
@@ -4366,6 +5002,10 @@ elf_bfd_final_link (abfd, info)
o->vma = 0;
}
+ if (! info->relocateable && merged)
+ elf_link_hash_traverse (elf_hash_table (info),
+ elf_link_sec_merge_syms, (PTR) abfd);
+
/* Figure out the file positions for everything but the symbol table
and the relocs. We set symcount to force assign_section_numbers
to create a symbol table. */
@@ -4377,7 +5017,7 @@ elf_bfd_final_link (abfd, info)
/* Figure out how many relocations we will have in each section.
Just using RELOC_COUNT isn't good enough since that doesn't
maintain a separate value for REL vs. RELA relocations. */
- if (info->relocateable || info->emitrelocations)
+ if (emit_relocs)
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
for (o = sub->sections; o != NULL; o = o->next)
{
@@ -4417,6 +5057,7 @@ elf_bfd_final_link (abfd, info)
*rel_count += NUM_SHDR_ENTRIES (& esdi->rel_hdr);
if (esdi->rel_hdr2)
*rel_count2 += NUM_SHDR_ENTRIES (esdi->rel_hdr2);
+ output_section->flags |= SEC_RELOC;
}
}
@@ -4476,14 +5117,24 @@ elf_bfd_final_link (abfd, info)
finfo.symbuf_size = 20;
else
finfo.symbuf_size = max_sym_count;
- finfo.symbuf = ((Elf_External_Sym *)
- bfd_malloc (finfo.symbuf_size * sizeof (Elf_External_Sym)));
+ amt = finfo.symbuf_size;
+ amt *= sizeof (Elf_External_Sym);
+ finfo.symbuf = (Elf_External_Sym *) bfd_malloc (amt);
if (finfo.symbuf == NULL)
goto error_return;
+ if (elf_numsections (abfd) > SHN_LORESERVE)
+ {
+ amt = finfo.symbuf_size;
+ amt *= sizeof (Elf_External_Sym_Shndx);
+ finfo.symshndxbuf = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
+ if (finfo.symshndxbuf == NULL)
+ goto error_return;
+ }
/* Start writing out the symbol table. The first symbol is always a
dummy symbol. */
- if (info->strip != strip_all || info->relocateable || info->emitrelocations)
+ if (info->strip != strip_all
+ || emit_relocs)
{
elfsym.st_value = 0;
elfsym.st_size = 0;
@@ -4516,12 +5167,13 @@ elf_bfd_final_link (abfd, info)
symbols have no names. We store the index of each one in the
index field of the section, so that we can find it again when
outputting relocs. */
- if (info->strip != strip_all || info->relocateable || info->emitrelocations)
+ if (info->strip != strip_all
+ || emit_relocs)
{
elfsym.st_size = 0;
elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
elfsym.st_other = 0;
- for (i = 1; i < elf_elfheader (abfd)->e_shnum; i++)
+ for (i = 1; i < elf_numsections (abfd); i++)
{
o = section_from_elf_index (abfd, i);
if (o != NULL)
@@ -4534,34 +5186,66 @@ elf_bfd_final_link (abfd, info)
if (! elf_link_output_sym (&finfo, (const char *) NULL,
&elfsym, o))
goto error_return;
+ if (i == SHN_LORESERVE)
+ i += SHN_HIRESERVE + 1 - SHN_LORESERVE;
}
}
/* Allocate some memory to hold information read in from the input
files. */
- finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
- finfo.external_relocs = (PTR) bfd_malloc (max_external_reloc_size);
- finfo.internal_relocs = ((Elf_Internal_Rela *)
- bfd_malloc (max_internal_reloc_count
- * sizeof (Elf_Internal_Rela)
- * bed->s->int_rels_per_ext_rel));
- finfo.external_syms = ((Elf_External_Sym *)
- bfd_malloc (max_sym_count
- * sizeof (Elf_External_Sym)));
- finfo.internal_syms = ((Elf_Internal_Sym *)
- bfd_malloc (max_sym_count
- * sizeof (Elf_Internal_Sym)));
- finfo.indices = (long *) bfd_malloc (max_sym_count * sizeof (long));
- finfo.sections = ((asection **)
- bfd_malloc (max_sym_count * sizeof (asection *)));
- if ((finfo.contents == NULL && max_contents_size != 0)
- || (finfo.external_relocs == NULL && max_external_reloc_size != 0)
- || (finfo.internal_relocs == NULL && max_internal_reloc_count != 0)
- || (finfo.external_syms == NULL && max_sym_count != 0)
- || (finfo.internal_syms == NULL && max_sym_count != 0)
- || (finfo.indices == NULL && max_sym_count != 0)
- || (finfo.sections == NULL && max_sym_count != 0))
- goto error_return;
+ if (max_contents_size != 0)
+ {
+ finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
+ if (finfo.contents == NULL)
+ goto error_return;
+ }
+
+ if (max_external_reloc_size != 0)
+ {
+ finfo.external_relocs = (PTR) bfd_malloc (max_external_reloc_size);
+ if (finfo.external_relocs == NULL)
+ goto error_return;
+ }
+
+ if (max_internal_reloc_count != 0)
+ {
+ amt = max_internal_reloc_count * bed->s->int_rels_per_ext_rel;
+ amt *= sizeof (Elf_Internal_Rela);
+ finfo.internal_relocs = (Elf_Internal_Rela *) bfd_malloc (amt);
+ if (finfo.internal_relocs == NULL)
+ goto error_return;
+ }
+
+ if (max_sym_count != 0)
+ {
+ amt = max_sym_count * sizeof (Elf_External_Sym);
+ finfo.external_syms = (Elf_External_Sym *) bfd_malloc (amt);
+ if (finfo.external_syms == NULL)
+ goto error_return;
+
+ amt = max_sym_count * sizeof (Elf_Internal_Sym);
+ finfo.internal_syms = (Elf_Internal_Sym *) bfd_malloc (amt);
+ if (finfo.internal_syms == NULL)
+ goto error_return;
+
+ amt = max_sym_count * sizeof (long);
+ finfo.indices = (long *) bfd_malloc (amt);
+ if (finfo.indices == NULL)
+ goto error_return;
+
+ amt = max_sym_count * sizeof (asection *);
+ finfo.sections = (asection **) bfd_malloc (amt);
+ if (finfo.sections == NULL)
+ goto error_return;
+ }
+
+ if (max_sym_shndx_count != 0)
+ {
+ amt = max_sym_shndx_count * sizeof (Elf_External_Sym_Shndx);
+ finfo.locsym_shndx = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
+ if (finfo.locsym_shndx == NULL)
+ goto error_return;
+ }
/* Since ELF permits relocations to be against local symbols, we
must have the local symbols available when we do the relocations.
@@ -4645,7 +5329,7 @@ elf_bfd_final_link (abfd, info)
{
Elf_Internal_Sym sym;
Elf_External_Sym *dynsym =
- (Elf_External_Sym *)finfo.dynsym_sec->contents;
+ (Elf_External_Sym *) finfo.dynsym_sec->contents;
long last_local = 0;
/* Write out the section symbols for the output sections. */
@@ -4661,13 +5345,14 @@ elf_bfd_final_link (abfd, info)
for (s = abfd->sections; s != NULL; s = s->next)
{
int indx;
+ Elf_External_Sym *dest;
+
indx = elf_section_data (s)->this_idx;
BFD_ASSERT (indx > 0);
sym.st_shndx = indx;
sym.st_value = s->vma;
-
- elf_swap_symbol_out (abfd, &sym,
- dynsym + elf_section_data (s)->dynindx);
+ dest = dynsym + elf_section_data (s)->dynindx;
+ elf_swap_symbol_out (abfd, &sym, (PTR) dest, (PTR) 0);
}
last_local = bfd_count_sections (abfd);
@@ -4680,6 +5365,7 @@ elf_bfd_final_link (abfd, info)
for (e = elf_hash_table (info)->dynlocal; e ; e = e->next)
{
asection *s;
+ Elf_External_Sym *dest;
sym.st_size = e->isym.st_size;
sym.st_other = e->isym.st_other;
@@ -4689,7 +5375,8 @@ elf_bfd_final_link (abfd, info)
the original st_name with the dynstr_index. */
sym = e->isym;
- if (e->isym.st_shndx > 0 && e->isym.st_shndx < SHN_LORESERVE)
+ if (e->isym.st_shndx < SHN_LORESERVE
+ || e->isym.st_shndx > SHN_HIRESERVE)
{
s = bfd_section_from_elf_index (e->input_bfd,
e->isym.st_shndx);
@@ -4704,7 +5391,8 @@ elf_bfd_final_link (abfd, info)
if (last_local < e->dynindx)
last_local = e->dynindx;
- elf_swap_symbol_out (abfd, &sym, dynsym + e->dynindx);
+ dest = dynsym + e->dynindx;
+ elf_swap_symbol_out (abfd, &sym, (PTR) dest, (PTR) 0);
}
}
@@ -4725,11 +5413,12 @@ elf_bfd_final_link (abfd, info)
table, do it now. */
if (bed->elf_backend_output_arch_syms)
{
- if (! (*bed->elf_backend_output_arch_syms)
- (abfd, info, (PTR) &finfo,
- (boolean (*) PARAMS ((PTR, const char *,
- Elf_Internal_Sym *, asection *)))
- elf_link_output_sym))
+ typedef boolean (*out_sym_func) PARAMS ((PTR, const char *,
+ Elf_Internal_Sym *,
+ asection *));
+
+ if (! ((*bed->elf_backend_output_arch_syms)
+ (abfd, info, (PTR) &finfo, (out_sym_func) elf_link_output_sym)))
return false;
}
@@ -4784,6 +5473,9 @@ elf_bfd_final_link (abfd, info)
o->reloc_count = 0;
}
+ if (dynamic && info->combreloc && dynobj != NULL)
+ relativecount = elf_link_sort_relocs (abfd, info, &reldyn);
+
/* If we are linking against a dynamic object, or generating a
shared library, finish up the dynamic linking information. */
if (dynamic)
@@ -4808,6 +5500,23 @@ elf_bfd_final_link (abfd, info)
{
default:
break;
+ case DT_NULL:
+ if (relativecount > 0 && dyncon + 1 < dynconend)
+ {
+ switch (elf_section_data (reldyn)->this_hdr.sh_type)
+ {
+ case SHT_REL: dyn.d_tag = DT_RELCOUNT; break;
+ case SHT_RELA: dyn.d_tag = DT_RELACOUNT; break;
+ default: break;
+ }
+ if (dyn.d_tag != DT_NULL)
+ {
+ dyn.d_un.d_val = relativecount;
+ elf_swap_dyn_out (dynobj, &dyn, dyncon);
+ relativecount = 0;
+ }
+ }
+ break;
case DT_INIT:
name = info->init_function;
goto get_sym;
@@ -4873,7 +5582,7 @@ elf_bfd_final_link (abfd, info)
else
type = SHT_RELA;
dyn.d_un.d_val = 0;
- for (i = 1; i < elf_elfheader (abfd)->e_shnum; i++)
+ for (i = 1; i < elf_numsections (abfd); i++)
{
Elf_Internal_Shdr *hdr;
@@ -4920,20 +5629,19 @@ elf_bfd_final_link (abfd, info)
|| strcmp (bfd_get_section_name (abfd, o), ".dynstr") != 0)
{
if (! bfd_set_section_contents (abfd, o->output_section,
- o->contents, o->output_offset,
+ o->contents,
+ (file_ptr) o->output_offset,
o->_raw_size))
goto error_return;
}
else
{
- file_ptr off;
-
/* The contents of the .dynstr section are actually in a
stringtab. */
off = elf_section_data (o->output_section)->this_hdr.sh_offset;
if (bfd_seek (abfd, off, SEEK_SET) != 0
- || ! _bfd_stringtab_emit (abfd,
- elf_hash_table (info)->dynstr))
+ || ! _bfd_elf_strtab_emit (abfd,
+ elf_hash_table (info)->dynstr))
goto error_return;
}
}
@@ -4946,6 +5654,19 @@ elf_bfd_final_link (abfd, info)
goto error_return;
}
+ if (info->eh_frame_hdr && elf_hash_table (info)->dynobj)
+ {
+ o = bfd_get_section_by_name (elf_hash_table (info)->dynobj,
+ ".eh_frame_hdr");
+ if (o
+ && (elf_section_data (o)->sec_info_type
+ == ELF_INFO_TYPE_EH_FRAME_HDR))
+ {
+ if (! _bfd_elf_write_section_eh_frame_hdr (abfd, o))
+ goto error_return;
+ }
+ }
+
if (finfo.symstrtab != NULL)
_bfd_stringtab_free (finfo.symstrtab);
if (finfo.contents != NULL)
@@ -4956,6 +5677,8 @@ elf_bfd_final_link (abfd, info)
free (finfo.internal_relocs);
if (finfo.external_syms != NULL)
free (finfo.external_syms);
+ if (finfo.locsym_shndx != NULL)
+ free (finfo.locsym_shndx);
if (finfo.internal_syms != NULL)
free (finfo.internal_syms);
if (finfo.indices != NULL)
@@ -4964,11 +5687,13 @@ elf_bfd_final_link (abfd, info)
free (finfo.sections);
if (finfo.symbuf != NULL)
free (finfo.symbuf);
+ if (finfo.symshndxbuf != NULL)
+ free (finfo.symbuf);
for (o = abfd->sections; o != NULL; o = o->next)
{
if ((o->flags & SEC_RELOC) != 0
&& elf_section_data (o)->rel_hashes != NULL)
- free (elf_section_data (o)->rel_hashes);
+ free (elf_section_data (o)->rel_hashes);
}
elf_tdata (abfd)->linker = true;
@@ -4986,6 +5711,8 @@ elf_bfd_final_link (abfd, info)
free (finfo.internal_relocs);
if (finfo.external_syms != NULL)
free (finfo.external_syms);
+ if (finfo.locsym_shndx != NULL)
+ free (finfo.locsym_shndx);
if (finfo.internal_syms != NULL)
free (finfo.internal_syms);
if (finfo.indices != NULL)
@@ -4994,6 +5721,8 @@ elf_bfd_final_link (abfd, info)
free (finfo.sections);
if (finfo.symbuf != NULL)
free (finfo.symbuf);
+ if (finfo.symshndxbuf != NULL)
+ free (finfo.symbuf);
for (o = abfd->sections; o != NULL; o = o->next)
{
if ((o->flags & SEC_RELOC) != 0
@@ -5013,6 +5742,9 @@ elf_link_output_sym (finfo, name, elfsym, input_sec)
Elf_Internal_Sym *elfsym;
asection *input_sec;
{
+ Elf_External_Sym *dest;
+ Elf_External_Sym_Shndx *destshndx;
+
boolean (*output_symbol_hook) PARAMS ((bfd *,
struct bfd_link_info *info,
const char *,
@@ -5035,8 +5767,7 @@ elf_link_output_sym (finfo, name, elfsym, input_sec)
else
{
elfsym->st_name = (unsigned long) _bfd_stringtab_add (finfo->symstrtab,
- name, true,
- false);
+ name, true, false);
if (elfsym->st_name == (unsigned long) -1)
return false;
}
@@ -5047,8 +5778,11 @@ elf_link_output_sym (finfo, name, elfsym, input_sec)
return false;
}
- elf_swap_symbol_out (finfo->output_bfd, elfsym,
- (PTR) (finfo->symbuf + finfo->symbuf_count));
+ dest = finfo->symbuf + finfo->symbuf_count;
+ destshndx = finfo->symshndxbuf;
+ if (destshndx != NULL)
+ destshndx += finfo->symbuf_count;
+ elf_swap_symbol_out (finfo->output_bfd, elfsym, (PTR) dest, (PTR) destshndx);
++finfo->symbuf_count;
++ bfd_get_symcount (finfo->output_bfd);
@@ -5064,18 +5798,31 @@ elf_link_flush_output_syms (finfo)
{
if (finfo->symbuf_count > 0)
{
- Elf_Internal_Shdr *symtab;
+ Elf_Internal_Shdr *hdr;
+ file_ptr pos;
+ bfd_size_type amt;
+
+ hdr = &elf_tdata (finfo->output_bfd)->symtab_hdr;
+ pos = hdr->sh_offset + hdr->sh_size;
+ amt = finfo->symbuf_count * sizeof (Elf_External_Sym);
+ if (bfd_seek (finfo->output_bfd, pos, SEEK_SET) != 0
+ || bfd_bwrite ((PTR) finfo->symbuf, amt, finfo->output_bfd) != amt)
+ return false;
- symtab = &elf_tdata (finfo->output_bfd)->symtab_hdr;
+ hdr->sh_size += amt;
- if (bfd_seek (finfo->output_bfd, symtab->sh_offset + symtab->sh_size,
- SEEK_SET) != 0
- || (bfd_write ((PTR) finfo->symbuf, finfo->symbuf_count,
- sizeof (Elf_External_Sym), finfo->output_bfd)
- != finfo->symbuf_count * sizeof (Elf_External_Sym)))
- return false;
+ if (finfo->symshndxbuf != NULL)
+ {
+ hdr = &elf_tdata (finfo->output_bfd)->symtab_shndx_hdr;
+ pos = hdr->sh_offset + hdr->sh_size;
+ amt = finfo->symbuf_count * sizeof (Elf_External_Sym_Shndx);
+ if (bfd_seek (finfo->output_bfd, pos, SEEK_SET) != 0
+ || (bfd_bwrite ((PTR) finfo->symshndxbuf, amt, finfo->output_bfd)
+ != amt))
+ return false;
- symtab->sh_size += finfo->symbuf_count * sizeof (Elf_External_Sym);
+ hdr->sh_size += amt;
+ }
finfo->symbuf_count = 0;
}
@@ -5083,6 +5830,33 @@ elf_link_flush_output_syms (finfo)
return true;
}
+/* Adjust all external symbols pointing into SEC_MERGE sections
+ to reflect the object merging within the sections. */
+
+static boolean
+elf_link_sec_merge_syms (h, data)
+ struct elf_link_hash_entry *h;
+ PTR data;
+{
+ asection *sec;
+
+ if ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && ((sec = h->root.u.def.section)->flags & SEC_MERGE)
+ && elf_section_data (sec)->sec_info_type == ELF_INFO_TYPE_MERGE)
+ {
+ bfd *output_bfd = (bfd *) data;
+
+ h->root.u.def.value =
+ _bfd_merged_section_offset (output_bfd,
+ &h->root.u.def.section,
+ elf_section_data (sec)->sec_info,
+ h->root.u.def.value, (bfd_vma) 0);
+ }
+
+ return true;
+}
+
/* Add an external symbol to the symbol table. This is called from
the hash table traversal routine. When generating a shared object,
we go through the symbol table twice. The first time we output
@@ -5122,15 +5896,14 @@ elf_link_output_extsym (h, data)
warnings for them. */
if (! finfo->info->relocateable
&& ! finfo->info->allow_shlib_undefined
- && ! (finfo->info->shared
- && !finfo->info->no_undefined)
+ && ! finfo->info->shared
&& h->root.type == bfd_link_hash_undefined
&& (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
&& (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
{
if (! ((*finfo->info->callbacks->undefined_symbol)
(finfo->info, h->root.root.string, h->root.u.undef.abfd,
- (asection *) NULL, 0, true)))
+ (asection *) NULL, (bfd_vma) 0, true)))
{
eoinfo->failed = true;
return false;
@@ -5201,7 +5974,7 @@ elf_link_output_extsym (h, data)
sym.st_shndx =
_bfd_elf_section_from_bfd_section (finfo->output_bfd,
input_sec->output_section);
- if (sym.st_shndx == (unsigned short) -1)
+ if (sym.st_shndx == SHN_BAD)
{
(*_bfd_error_handler)
(_("%s: could not find output section %s for input section %s"),
@@ -5281,8 +6054,8 @@ elf_link_output_extsym (h, data)
finish_dynamic_symbol routine gets through with it. */
if (sym.st_shndx == SHN_UNDEF
&& (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0
- && (ELF_ST_BIND(sym.st_info) == STB_GLOBAL
- || ELF_ST_BIND(sym.st_info) == STB_WEAK))
+ && (ELF_ST_BIND (sym.st_info) == STB_GLOBAL
+ || ELF_ST_BIND (sym.st_info) == STB_WEAK))
{
int bindtype;
@@ -5295,8 +6068,9 @@ elf_link_output_extsym (h, data)
/* If a symbol is not defined locally, we clear the visibility
field. */
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- sym.st_other ^= ELF_ST_VISIBILITY(sym.st_other);
+ if (! finfo->info->relocateable
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ sym.st_other ^= ELF_ST_VISIBILITY (sym.st_other);
/* If this symbol should be put in the .dynsym section, then put it
there now. We have already know the symbol index. We also fill
@@ -5309,13 +6083,11 @@ elf_link_output_extsym (h, data)
size_t hash_entry_size;
bfd_byte *bucketpos;
bfd_vma chain;
+ Elf_External_Sym *esym;
sym.st_name = h->dynstr_index;
-
- elf_swap_symbol_out (finfo->output_bfd, &sym,
- (PTR) (((Elf_External_Sym *)
- finfo->dynsym_sec->contents)
- + h->dynindx));
+ esym = (Elf_External_Sym *) finfo->dynsym_sec->contents + h->dynindx;
+ elf_swap_symbol_out (finfo->output_bfd, &sym, (PTR) esym, (PTR) 0);
bucketcount = elf_hash_table (finfo->info)->bucketcount;
bucket = h->elf_hash_value % bucketcount;
@@ -5324,7 +6096,8 @@ elf_link_output_extsym (h, data)
bucketpos = ((bfd_byte *) finfo->hash_sec->contents
+ (bucket + 2) * hash_entry_size);
chain = bfd_get (8 * hash_entry_size, finfo->output_bfd, bucketpos);
- bfd_put (8 * hash_entry_size, finfo->output_bfd, h->dynindx, bucketpos);
+ bfd_put (8 * hash_entry_size, finfo->output_bfd, (bfd_vma) h->dynindx,
+ bucketpos);
bfd_put (8 * hash_entry_size, finfo->output_bfd, chain,
((bfd_byte *) finfo->hash_sec->contents
+ (bucketcount + 2 + h->dynindx) * hash_entry_size));
@@ -5332,6 +6105,7 @@ elf_link_output_extsym (h, data)
if (finfo->symver_sec != NULL && finfo->symver_sec->contents != NULL)
{
Elf_Internal_Versym iversym;
+ Elf_External_Versym *eversym;
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
@@ -5351,10 +6125,9 @@ elf_link_output_extsym (h, data)
if ((h->elf_link_hash_flags & ELF_LINK_HIDDEN) != 0)
iversym.vs_vers |= VERSYM_HIDDEN;
- _bfd_elf_swap_versym_out (finfo->output_bfd, &iversym,
- (((Elf_External_Versym *)
- finfo->symver_sec->contents)
- + h->dynindx));
+ eversym = (Elf_External_Versym *) finfo->symver_sec->contents;
+ eversym += h->dynindx;
+ _bfd_elf_swap_versym_out (finfo->output_bfd, &iversym, eversym);
}
}
@@ -5392,6 +6165,7 @@ elf_link_output_relocs (output_bfd, input_section, input_rel_hdr,
asection *output_section;
unsigned int *rel_countp = NULL;
struct elf_backend_data *bed;
+ bfd_size_type amt;
output_section = input_section->output_section;
output_rel_hdr = NULL;
@@ -5421,9 +6195,9 @@ elf_link_output_relocs (output_bfd, input_section, input_rel_hdr,
{
Elf_External_Rel *erel;
Elf_Internal_Rel *irel;
-
- irel = (Elf_Internal_Rel *) bfd_zmalloc (bed->s->int_rels_per_ext_rel
- * sizeof (Elf_Internal_Rel));
+
+ amt = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel);
+ irel = (Elf_Internal_Rel *) bfd_zmalloc (amt);
if (irel == NULL)
{
(*_bfd_error_handler) (_("Error: out of memory"));
@@ -5434,7 +6208,7 @@ elf_link_output_relocs (output_bfd, input_section, input_rel_hdr,
for (; irela < irelaend; irela += bed->s->int_rels_per_ext_rel, erel++)
{
unsigned int i;
-
+
for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
{
irel[i].r_offset = irela[i].r_offset;
@@ -5485,16 +6259,21 @@ elf_link_input_bfd (finfo, input_bfd)
Elf_Internal_Sym *, asection **));
bfd *output_bfd;
Elf_Internal_Shdr *symtab_hdr;
+ Elf_Internal_Shdr *shndx_hdr;
size_t locsymcount;
size_t extsymoff;
Elf_External_Sym *external_syms;
Elf_External_Sym *esym;
Elf_External_Sym *esymend;
+ Elf_External_Sym_Shndx *shndx_buf;
+ Elf_External_Sym_Shndx *shndx;
Elf_Internal_Sym *isym;
long *pindex;
asection **ppsection;
asection *o;
struct elf_backend_data *bed;
+ boolean emit_relocs;
+ struct elf_link_hash_entry **sym_hashes;
output_bfd = finfo->output_bfd;
bed = get_elf_backend_data (output_bfd);
@@ -5506,6 +6285,10 @@ elf_link_input_bfd (finfo, input_bfd)
if ((input_bfd->flags & DYNAMIC) != 0)
return true;
+ emit_relocs = (finfo->info->relocateable
+ || finfo->info->emitrelocations
+ || bed->elf_backend_emit_relocs);
+
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
if (elf_bad_symtab (input_bfd))
{
@@ -5525,28 +6308,38 @@ elf_link_input_bfd (finfo, input_bfd)
external_syms = NULL;
else
{
+ bfd_size_type amt = locsymcount * sizeof (Elf_External_Sym);
external_syms = finfo->external_syms;
if (bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0
- || (bfd_read (external_syms, sizeof (Elf_External_Sym),
- locsymcount, input_bfd)
- != locsymcount * sizeof (Elf_External_Sym)))
+ || bfd_bread (external_syms, amt, input_bfd) != amt)
+ return false;
+ }
+
+ shndx_hdr = &elf_tdata (input_bfd)->symtab_shndx_hdr;
+ shndx_buf = NULL;
+ if (shndx_hdr->sh_size != 0 && locsymcount != 0)
+ {
+ bfd_size_type amt = locsymcount * sizeof (Elf_External_Sym_Shndx);
+ shndx_buf = finfo->locsym_shndx;
+ if (bfd_seek (input_bfd, shndx_hdr->sh_offset, SEEK_SET) != 0
+ || bfd_bread (shndx_buf, amt, input_bfd) != amt)
return false;
}
/* Swap in the local symbols and write out the ones which we know
are going into the output file. */
- esym = external_syms;
- esymend = esym + locsymcount;
- isym = finfo->internal_syms;
- pindex = finfo->indices;
- ppsection = finfo->sections;
- for (; esym < esymend; esym++, isym++, pindex++, ppsection++)
+ for (esym = external_syms, esymend = esym + locsymcount,
+ isym = finfo->internal_syms, pindex = finfo->indices,
+ ppsection = finfo->sections, shndx = shndx_buf;
+ esym < esymend;
+ esym++, isym++, pindex++, ppsection++,
+ shndx = (shndx != NULL ? shndx + 1 : NULL))
{
asection *isec;
const char *name;
Elf_Internal_Sym osym;
- elf_swap_symbol_in (input_bfd, esym, isym);
+ elf_swap_symbol_in (input_bfd, esym, shndx, isym);
*pindex = -1;
if (elf_bad_symtab (input_bfd))
@@ -5558,24 +6351,24 @@ elf_link_input_bfd (finfo, input_bfd)
}
}
- name = NULL;
if (isym->st_shndx == SHN_UNDEF)
- {
- isec = bfd_und_section_ptr;
- name = isec->name;
- }
- else if (isym->st_shndx > 0 && isym->st_shndx < SHN_LORESERVE)
- isec = section_from_elf_index (input_bfd, isym->st_shndx);
- else if (isym->st_shndx == SHN_ABS)
+ isec = bfd_und_section_ptr;
+ else if (isym->st_shndx < SHN_LORESERVE
+ || isym->st_shndx > SHN_HIRESERVE)
{
- isec = bfd_abs_section_ptr;
- name = isec->name;
+ isec = section_from_elf_index (input_bfd, isym->st_shndx);
+ if (isec
+ && elf_section_data (isec)->sec_info_type == ELF_INFO_TYPE_MERGE
+ && ELF_ST_TYPE (isym->st_info) != STT_SECTION)
+ isym->st_value =
+ _bfd_merged_section_offset (output_bfd, &isec,
+ elf_section_data (isec)->sec_info,
+ isym->st_value, (bfd_vma) 0);
}
+ else if (isym->st_shndx == SHN_ABS)
+ isec = bfd_abs_section_ptr;
else if (isym->st_shndx == SHN_COMMON)
- {
- isec = bfd_com_section_ptr;
- name = isec->name;
- }
+ isec = bfd_com_section_ptr;
else
{
/* Who knows? */
@@ -5590,41 +6383,6 @@ elf_link_input_bfd (finfo, input_bfd)
if (ELF_ST_TYPE (isym->st_info) == STT_SECTION)
{
- asection *ksec;
-
- /* Save away all section symbol values. */
- if (isec != NULL)
- {
- if (name)
- {
- if (isec->symbol->value != isym->st_value)
- (*_bfd_error_handler)
- (_("%s: invalid section symbol index 0x%x (%s) ingored"),
- bfd_get_filename (input_bfd), isym->st_shndx,
- name);
- continue;
- }
- isec->symbol->value = isym->st_value;
- }
-
- /* If this is a discarded link-once section symbol, update
- it's value to that of the kept section symbol. The
- linker will keep the first of any matching link-once
- sections, so we should have already seen it's section
- symbol. I trust no-one will have the bright idea of
- re-ordering the bfd list... */
- if (isec != NULL
- && (bfd_get_section_flags (input_bfd, isec) & SEC_LINK_ONCE) != 0
- && (ksec = isec->kept_section) != NULL)
- {
- isym->st_value = ksec->symbol->value;
-
- /* That put the value right, but the section info is all
- wrong. I hope this works. */
- isec->output_offset = ksec->output_offset;
- isec->output_section = ksec->output_section;
- }
-
/* We never output section symbols. Instead, we use the
section symbol of the corresponding section in the output
file. */
@@ -5649,8 +6407,7 @@ elf_link_input_bfd (finfo, input_bfd)
linker_mark is only reliable for sections that have contents.
For the benefit of the MIPS ELF linker, we check SEC_EXCLUDE
as well as linker_mark. */
- if (isym->st_shndx > 0
- && isym->st_shndx < SHN_LORESERVE
+ if ((isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE)
&& isec != NULL
&& ((! isec->linker_mark && (isec->flags & SEC_HAS_CONTENTS) != 0)
|| (! finfo->info->relocateable
@@ -5667,7 +6424,9 @@ elf_link_input_bfd (finfo, input_bfd)
if ((finfo->info->strip == strip_some
&& (bfd_hash_lookup (finfo->info->keep_hash, name, false, false)
== NULL))
- || (finfo->info->discard == discard_l
+ || (((finfo->info->discard == discard_sec_merge
+ && (isec->flags & SEC_MERGE) && ! finfo->info->relocateable)
+ || finfo->info->discard == discard_l)
&& bfd_is_local_label_name (input_bfd, name)))
continue;
@@ -5678,7 +6437,7 @@ elf_link_input_bfd (finfo, input_bfd)
/* Adjust the section index for the output file. */
osym.st_shndx = _bfd_elf_section_from_bfd_section (output_bfd,
isec->output_section);
- if (osym.st_shndx == (unsigned short) -1)
+ if (osym.st_shndx == SHN_BAD)
return false;
*pindex = bfd_get_symcount (output_bfd);
@@ -5699,6 +6458,7 @@ elf_link_input_bfd (finfo, input_bfd)
}
/* Relocate the contents of each section. */
+ sym_hashes = elf_sym_hashes (input_bfd);
for (o = input_bfd->sections; o != NULL; o = o->next)
{
bfd_byte *contents;
@@ -5746,6 +6506,117 @@ elf_link_input_bfd (finfo, input_bfd)
&& o->reloc_count > 0)
return false;
+ /* Run through the relocs looking for any against symbols
+ from discarded sections and section symbols from
+ removed link-once sections. Complain about relocs
+ against discarded sections. Zero relocs against removed
+ link-once sections. We should really complain if
+ anything in the final link tries to use it, but
+ DWARF-based exception handling might have an entry in
+ .eh_frame to describe a routine in the linkonce section,
+ and it turns out to be hard to remove the .eh_frame
+ entry too. FIXME. */
+ if (!finfo->info->relocateable
+ && !elf_section_ignore_discarded_relocs (o))
+ {
+ Elf_Internal_Rela *rel, *relend;
+
+ rel = internal_relocs;
+ relend = rel + o->reloc_count * bed->s->int_rels_per_ext_rel;
+ for ( ; rel < relend; rel++)
+ {
+ unsigned long r_symndx = ELF_R_SYM (rel->r_info);
+
+ if (r_symndx >= locsymcount
+ || (elf_bad_symtab (input_bfd)
+ && finfo->sections[r_symndx] == NULL))
+ {
+ struct elf_link_hash_entry *h;
+
+ h = sym_hashes[r_symndx - extsymoff];
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ /* Complain if the definition comes from a
+ discarded section. */
+ if ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && elf_discarded_section (h->root.u.def.section))
+ {
+#if BFD_VERSION_DATE < 20031005
+ if ((o->flags & SEC_DEBUGGING) != 0)
+ {
+#if BFD_VERSION_DATE > 20021005
+ (*finfo->info->callbacks->warning)
+ (finfo->info,
+ _("warning: relocation against removed section; zeroing"),
+ NULL, input_bfd, o, rel->r_offset);
+#endif
+ BFD_ASSERT (r_symndx != 0);
+ memset (rel, 0, sizeof (*rel));
+ }
+ else
+#endif
+ {
+ if (! ((*finfo->info->callbacks->undefined_symbol)
+ (finfo->info, h->root.root.string,
+ input_bfd, o, rel->r_offset,
+ true)))
+ return false;
+ }
+ }
+ }
+ else
+ {
+ asection *sec = finfo->sections[r_symndx];
+
+ if (sec != NULL && elf_discarded_section (sec))
+ {
+#if BFD_VERSION_DATE < 20031005
+ if ((o->flags & SEC_DEBUGGING) != 0
+ || (sec->flags & SEC_LINK_ONCE) != 0)
+ {
+#if BFD_VERSION_DATE > 20021005
+ (*finfo->info->callbacks->warning)
+ (finfo->info,
+ _("warning: relocation against removed section"),
+ NULL, input_bfd, o, rel->r_offset);
+#endif
+ BFD_ASSERT (r_symndx != 0);
+ rel->r_info
+ = ELF_R_INFO (0, ELF_R_TYPE (rel->r_info));
+ rel->r_addend = 0;
+ }
+ else
+#endif
+ {
+ boolean ok;
+ const char *msg
+ = _("local symbols in discarded section %s");
+ bfd_size_type amt
+ = strlen (sec->name) + strlen (msg) - 1;
+ char *buf = (char *) bfd_malloc (amt);
+
+ if (buf != NULL)
+ sprintf (buf, msg, sec->name);
+ else
+ buf = (char *) sec->name;
+ ok = (*finfo->info->callbacks
+ ->undefined_symbol) (finfo->info, buf,
+ input_bfd, o,
+ rel->r_offset,
+ true);
+ if (buf != sec->name)
+ free (buf);
+ if (!ok)
+ return false;
+ }
+ }
+ }
+ }
+ }
+
/* Relocate the section by invoking a back end routine.
The back end routine is responsible for adjusting the
@@ -5773,26 +6644,27 @@ elf_link_input_bfd (finfo, input_bfd)
finfo->sections))
return false;
- if (finfo->info->relocateable || finfo->info->emitrelocations)
+ if (emit_relocs)
{
Elf_Internal_Rela *irela;
Elf_Internal_Rela *irelaend;
struct elf_link_hash_entry **rel_hash;
Elf_Internal_Shdr *input_rel_hdr;
unsigned int next_erel;
+ void (*reloc_emitter) PARAMS ((bfd *, asection *,
+ Elf_Internal_Shdr *,
+ Elf_Internal_Rela *));
/* Adjust the reloc addresses and symbol indices. */
irela = internal_relocs;
- irelaend = irela
- + o->reloc_count * bed->s->int_rels_per_ext_rel;
+ irelaend = irela + o->reloc_count * bed->s->int_rels_per_ext_rel;
rel_hash = (elf_section_data (o->output_section)->rel_hashes
+ elf_section_data (o->output_section)->rel_count
+ elf_section_data (o->output_section)->rel_count2);
for (next_erel = 0; irela < irelaend; irela++, next_erel++)
{
unsigned long r_symndx;
- Elf_Internal_Sym *isym;
asection *sec;
if (next_erel == bed->s->int_rels_per_ext_rel)
@@ -5875,7 +6747,7 @@ elf_link_input_bfd (finfo, input_bfd)
{
if (finfo->indices[r_symndx] == -1)
{
- unsigned long link;
+ unsigned long shlink;
const char *name;
asection *osec;
@@ -5889,10 +6761,9 @@ elf_link_input_bfd (finfo, input_bfd)
/* This symbol was skipped earlier, but
since it is needed by a reloc, we
must output it now. */
- link = symtab_hdr->sh_link;
- name = bfd_elf_string_from_elf_section (input_bfd,
- link,
- isym->st_name);
+ shlink = symtab_hdr->sh_link;
+ name = (bfd_elf_string_from_elf_section
+ (input_bfd, shlink, isym->st_name));
if (name == NULL)
return false;
@@ -5900,14 +6771,15 @@ elf_link_input_bfd (finfo, input_bfd)
isym->st_shndx =
_bfd_elf_section_from_bfd_section (output_bfd,
osec);
- if (isym->st_shndx == (unsigned short) -1)
+ if (isym->st_shndx == SHN_BAD)
return false;
isym->st_value += sec->output_offset;
if (! finfo->info->relocateable)
isym->st_value += osec->vma;
- finfo->indices[r_symndx] = bfd_get_symcount (output_bfd);
+ finfo->indices[r_symndx]
+ = bfd_get_symcount (output_bfd);
if (! elf_link_output_sym (finfo, name, isym, sec))
return false;
@@ -5921,37 +6793,72 @@ elf_link_input_bfd (finfo, input_bfd)
}
/* Swap out the relocs. */
+ if (bed->elf_backend_emit_relocs
+ && !(finfo->info->relocateable
+ || finfo->info->emitrelocations))
+ reloc_emitter = bed->elf_backend_emit_relocs;
+ else
+ reloc_emitter = elf_link_output_relocs;
+
input_rel_hdr = &elf_section_data (o)->rel_hdr;
- elf_link_output_relocs (output_bfd, o,
- input_rel_hdr,
- internal_relocs);
- internal_relocs += NUM_SHDR_ENTRIES (input_rel_hdr)
- * bed->s->int_rels_per_ext_rel;
+ (*reloc_emitter) (output_bfd, o, input_rel_hdr, internal_relocs);
+
input_rel_hdr = elf_section_data (o)->rel_hdr2;
- if (input_rel_hdr)
- elf_link_output_relocs (output_bfd, o,
- input_rel_hdr,
- internal_relocs);
+ if (input_rel_hdr)
+ {
+ internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr)
+ * bed->s->int_rels_per_ext_rel);
+ reloc_emitter (output_bfd, o, input_rel_hdr, internal_relocs);
+ }
+
}
}
/* Write out the modified section contents. */
- if (elf_section_data (o)->stab_info == NULL)
+ if (bed->elf_backend_write_section
+ && (*bed->elf_backend_write_section) (output_bfd, o, contents))
{
- if (! (o->flags & SEC_EXCLUDE) &&
- ! bfd_set_section_contents (output_bfd, o->output_section,
- contents, o->output_offset,
- (o->_cooked_size != 0
- ? o->_cooked_size
- : o->_raw_size)))
- return false;
+ /* Section written out. */
}
- else
+ else switch (elf_section_data (o)->sec_info_type)
{
+ case ELF_INFO_TYPE_STABS:
if (! (_bfd_write_section_stabs
- (output_bfd, &elf_hash_table (finfo->info)->stab_info,
- o, &elf_section_data (o)->stab_info, contents)))
+ (output_bfd,
+ &elf_hash_table (finfo->info)->stab_info,
+ o, &elf_section_data (o)->sec_info, contents)))
return false;
+ break;
+ case ELF_INFO_TYPE_MERGE:
+ if (! (_bfd_write_merged_section
+ (output_bfd, o, elf_section_data (o)->sec_info)))
+ return false;
+ break;
+ case ELF_INFO_TYPE_EH_FRAME:
+ {
+ asection *ehdrsec;
+
+ ehdrsec
+ = bfd_get_section_by_name (elf_hash_table (finfo->info)->dynobj,
+ ".eh_frame_hdr");
+ if (! (_bfd_elf_write_section_eh_frame (output_bfd, o, ehdrsec,
+ contents)))
+ return false;
+ }
+ break;
+ default:
+ {
+ bfd_size_type sec_size;
+
+ sec_size = (o->_cooked_size != 0 ? o->_cooked_size : o->_raw_size);
+ if (! (o->flags & SEC_EXCLUDE)
+ && ! bfd_set_section_contents (output_bfd, o->output_section,
+ contents,
+ (file_ptr) o->output_offset,
+ sec_size))
+ return false;
+ }
+ break;
}
}
@@ -6047,28 +6954,31 @@ elf_reloc_link_order (output_bfd, info, output_section, link_order)
bfd_reloc_status_type rstat;
bfd_byte *buf;
boolean ok;
+ const char *sym_name;
size = bfd_get_reloc_size (howto);
buf = (bfd_byte *) bfd_zmalloc (size);
if (buf == (bfd_byte *) NULL)
return false;
- rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf);
+ rstat = _bfd_relocate_contents (howto, output_bfd, (bfd_vma) addend, buf);
switch (rstat)
{
case bfd_reloc_ok:
break;
+
default:
case bfd_reloc_outofrange:
abort ();
+
case bfd_reloc_overflow:
+ if (link_order->type == bfd_section_reloc_link_order)
+ sym_name = bfd_section_name (output_bfd,
+ link_order->u.reloc.p->u.section);
+ else
+ sym_name = link_order->u.reloc.p->u.name;
if (! ((*info->callbacks->reloc_overflow)
- (info,
- (link_order->type == bfd_section_reloc_link_order
- ? bfd_section_name (output_bfd,
- link_order->u.reloc.p->u.section)
- : link_order->u.reloc.p->u.name),
- howto->name, addend, (bfd *) NULL, (asection *) NULL,
- (bfd_vma) 0)))
+ (info, sym_name, howto->name, addend,
+ (bfd *) NULL, (asection *) NULL, (bfd_vma) 0)))
{
free (buf);
return false;
@@ -6093,15 +7003,16 @@ elf_reloc_link_order (output_bfd, info, output_section, link_order)
if (rel_hdr->sh_type == SHT_REL)
{
+ bfd_size_type size;
Elf_Internal_Rel *irel;
Elf_External_Rel *erel;
unsigned int i;
-
- irel = (Elf_Internal_Rel *) bfd_zmalloc (bed->s->int_rels_per_ext_rel
- * sizeof (Elf_Internal_Rel));
+
+ size = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel);
+ irel = (Elf_Internal_Rel *) bfd_zmalloc (size);
if (irel == NULL)
return false;
-
+
for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
irel[i].r_offset = offset;
irel[0].r_info = ELF_R_INFO (indx, howto->type);
@@ -6118,12 +7029,13 @@ elf_reloc_link_order (output_bfd, info, output_section, link_order)
}
else
{
+ bfd_size_type size;
Elf_Internal_Rela *irela;
Elf_External_Rela *erela;
unsigned int i;
-
- irela = (Elf_Internal_Rela *) bfd_zmalloc (bed->s->int_rels_per_ext_rel
- * sizeof (Elf_Internal_Rela));
+
+ size = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rela);
+ irela = (Elf_Internal_Rela *) bfd_zmalloc (size);
if (irela == NULL)
return false;
@@ -6158,14 +7070,15 @@ elf_create_pointer_linker_section (abfd, info, lsect, h, rel)
{
elf_linker_section_pointers_t **ptr_linker_section_ptr = NULL;
elf_linker_section_pointers_t *linker_section_ptr;
- unsigned long r_symndx = ELF_R_SYM (rel->r_info);;
+ unsigned long r_symndx = ELF_R_SYM (rel->r_info);
+ bfd_size_type amt;
BFD_ASSERT (lsect != NULL);
- /* Is this a global symbol? */
+ /* Is this a global symbol? */
if (h != NULL)
{
- /* Has this symbol already been allocated, if so, our work is done */
+ /* Has this symbol already been allocated? If so, our work is done. */
if (_bfd_elf_find_pointer_linker_section (h->linker_section_pointer,
rel->r_addend,
lsect->which))
@@ -6182,29 +7095,30 @@ elf_create_pointer_linker_section (abfd, info, lsect, h, rel)
if (lsect->rel_section)
lsect->rel_section->_raw_size += sizeof (Elf_External_Rela);
}
-
- else /* Allocation of a pointer to a local symbol */
+ else
{
+ /* Allocation of a pointer to a local symbol. */
elf_linker_section_pointers_t **ptr = elf_local_ptr_offsets (abfd);
- /* Allocate a table to hold the local symbols if first time */
+ /* Allocate a table to hold the local symbols if first time. */
if (!ptr)
{
unsigned int num_symbols = elf_tdata (abfd)->symtab_hdr.sh_info;
register unsigned int i;
- ptr = (elf_linker_section_pointers_t **)
- bfd_alloc (abfd, num_symbols * sizeof (elf_linker_section_pointers_t *));
+ amt = num_symbols;
+ amt *= sizeof (elf_linker_section_pointers_t *);
+ ptr = (elf_linker_section_pointers_t **) bfd_alloc (abfd, amt);
if (!ptr)
return false;
elf_local_ptr_offsets (abfd) = ptr;
for (i = 0; i < num_symbols; i++)
- ptr[i] = (elf_linker_section_pointers_t *)0;
+ ptr[i] = (elf_linker_section_pointers_t *) 0;
}
- /* Has this symbol already been allocated, if so, our work is done */
+ /* Has this symbol already been allocated? If so, our work is done. */
if (_bfd_elf_find_pointer_linker_section (ptr[r_symndx],
rel->r_addend,
lsect->which))
@@ -6222,11 +7136,11 @@ elf_create_pointer_linker_section (abfd, info, lsect, h, rel)
}
}
- /* Allocate space for a pointer in the linker section, and allocate a new pointer record
- from internal memory. */
+ /* Allocate space for a pointer in the linker section, and allocate
+ a new pointer record from internal memory. */
BFD_ASSERT (ptr_linker_section_ptr != NULL);
- linker_section_ptr = (elf_linker_section_pointers_t *)
- bfd_alloc (abfd, sizeof (elf_linker_section_pointers_t));
+ amt = sizeof (elf_linker_section_pointers_t);
+ linker_section_ptr = (elf_linker_section_pointers_t *) bfd_alloc (abfd, amt);
if (!linker_section_ptr)
return false;
@@ -6240,17 +7154,19 @@ elf_create_pointer_linker_section (abfd, info, lsect, h, rel)
#if 0
if (lsect->hole_size && lsect->hole_offset < lsect->max_hole_offset)
{
- linker_section_ptr->offset = lsect->section->_raw_size - lsect->hole_size + (ARCH_SIZE / 8);
+ linker_section_ptr->offset = (lsect->section->_raw_size
+ - lsect->hole_size + (ARCH_SIZE / 8));
lsect->hole_offset += ARCH_SIZE / 8;
lsect->sym_offset += ARCH_SIZE / 8;
- if (lsect->sym_hash) /* Bump up symbol value if needed */
+ if (lsect->sym_hash)
{
+ /* Bump up symbol value if needed. */
lsect->sym_hash->root.u.def.value += ARCH_SIZE / 8;
#ifdef DEBUG
fprintf (stderr, "Bump up %s by %ld, current value = %ld\n",
lsect->sym_hash->root.root.string,
- (long)ARCH_SIZE / 8,
- (long)lsect->sym_hash->root.u.def.value);
+ (long) ARCH_SIZE / 8,
+ (long) lsect->sym_hash->root.u.def.value);
#endif
}
}
@@ -6261,8 +7177,10 @@ elf_create_pointer_linker_section (abfd, info, lsect, h, rel)
lsect->section->_raw_size += ARCH_SIZE / 8;
#ifdef DEBUG
- fprintf (stderr, "Create pointer in linker section %s, offset = %ld, section size = %ld\n",
- lsect->name, (long)linker_section_ptr->offset, (long)lsect->section->_raw_size);
+ fprintf (stderr,
+ "Create pointer in linker section %s, offset = %ld, section size = %ld\n",
+ lsect->name, (long) linker_section_ptr->offset,
+ (long) lsect->section->_raw_size);
#endif
return true;
@@ -6278,7 +7196,8 @@ elf_create_pointer_linker_section (abfd, info, lsect, h, rel)
/* Fill in the address for a pointer generated in a linker section. */
bfd_vma
-elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h, relocation, rel, relative_reloc)
+elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h,
+ relocation, rel, relative_reloc)
bfd *output_bfd;
bfd *input_bfd;
struct bfd_link_info *info;
@@ -6292,11 +7211,13 @@ elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h, reloca
BFD_ASSERT (lsect != NULL);
- if (h != NULL) /* global symbol */
+ if (h != NULL)
{
- linker_section_ptr = _bfd_elf_find_pointer_linker_section (h->linker_section_pointer,
- rel->r_addend,
- lsect->which);
+ /* Handle global symbol. */
+ linker_section_ptr = (_bfd_elf_find_pointer_linker_section
+ (h->linker_section_pointer,
+ rel->r_addend,
+ lsect->which));
BFD_ASSERT (linker_section_ptr != NULL);
@@ -6316,23 +7237,27 @@ elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h, reloca
if (!linker_section_ptr->written_address_p)
{
linker_section_ptr->written_address_p = true;
- bfd_put_ptr (output_bfd, relocation + linker_section_ptr->addend,
- lsect->section->contents + linker_section_ptr->offset);
+ bfd_put_ptr (output_bfd,
+ relocation + linker_section_ptr->addend,
+ (lsect->section->contents
+ + linker_section_ptr->offset));
}
}
}
- else /* local symbol */
+ else
{
+ /* Handle local symbol. */
unsigned long r_symndx = ELF_R_SYM (rel->r_info);
BFD_ASSERT (elf_local_ptr_offsets (input_bfd) != NULL);
BFD_ASSERT (elf_local_ptr_offsets (input_bfd)[r_symndx] != NULL);
- linker_section_ptr = _bfd_elf_find_pointer_linker_section (elf_local_ptr_offsets (input_bfd)[r_symndx],
- rel->r_addend,
- lsect->which);
+ linker_section_ptr = (_bfd_elf_find_pointer_linker_section
+ (elf_local_ptr_offsets (input_bfd)[r_symndx],
+ rel->r_addend,
+ lsect->which));
BFD_ASSERT (linker_section_ptr != NULL);
- /* Write out pointer if it hasn't been rewritten out before */
+ /* Write out pointer if it hasn't been rewritten out before. */
if (!linker_section_ptr->written_address_p)
{
linker_section_ptr->written_address_p = true;
@@ -6343,21 +7268,27 @@ elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h, reloca
{
asection *srel = lsect->rel_section;
Elf_Internal_Rela *outrel;
+ Elf_External_Rela *erel;
struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
unsigned int i;
+ bfd_size_type amt;
- outrel = (Elf_Internal_Rela *) bfd_zmalloc (sizeof (Elf_Internal_Rela)
- * bed->s->int_rels_per_ext_rel);
+ amt = sizeof (Elf_Internal_Rela) * bed->s->int_rels_per_ext_rel;
+ outrel = (Elf_Internal_Rela *) bfd_zmalloc (amt);
if (outrel == NULL)
{
(*_bfd_error_handler) (_("Error: out of memory"));
return 0;
}
- /* We need to generate a relative reloc for the dynamic linker. */
+ /* We need to generate a relative reloc for the dynamic
+ linker. */
if (!srel)
- lsect->rel_section = srel = bfd_get_section_by_name (elf_hash_table (info)->dynobj,
- lsect->rel_name);
+ {
+ srel = bfd_get_section_by_name (elf_hash_table (info)->dynobj,
+ lsect->rel_name);
+ lsect->rel_section = srel;
+ }
BFD_ASSERT (srel != NULL);
@@ -6367,12 +7298,11 @@ elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h, reloca
+ linker_section_ptr->offset);
outrel[0].r_info = ELF_R_INFO (0, relative_reloc);
outrel[0].r_addend = 0;
- elf_swap_reloca_out (output_bfd, outrel,
- (((Elf_External_Rela *)
- lsect->section->contents)
- + elf_section_data (lsect->section)->rel_count));
+ erel = (Elf_External_Rela *) lsect->section->contents;
+ erel += elf_section_data (lsect->section)->rel_count;
+ elf_swap_reloca_out (output_bfd, outrel, erel);
++elf_section_data (lsect->section)->rel_count;
-
+
free (outrel);
}
}
@@ -6384,8 +7314,9 @@ elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h, reloca
- lsect->sym_offset);
#ifdef DEBUG
- fprintf (stderr, "Finish pointer in linker section %s, offset = %ld (0x%lx)\n",
- lsect->name, (long)relocation, (long)relocation);
+ fprintf (stderr,
+ "Finish pointer in linker section %s, offset = %ld (0x%lx)\n",
+ lsect->name, (long) relocation, (long) relocation);
#endif
/* Subtract out the addend, because it will get added back in by the normal
@@ -6420,7 +7351,8 @@ static boolean elf_gc_smash_unused_vtentry_relocs
PARAMS ((struct elf_link_hash_entry *h, PTR dummy));
/* The mark phase of garbage collection. For a given section, mark
- it, and all the sections which define symbols to which it refers. */
+ it and any sections in this section's group, and all the sections
+ which define symbols to which it refers. */
static boolean
elf_gc_mark (info, sec, gc_mark_hook)
@@ -6430,20 +7362,29 @@ elf_gc_mark (info, sec, gc_mark_hook)
PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *));
{
- boolean ret = true;
+ boolean ret;
+ asection *group_sec;
sec->gc_mark = 1;
- /* Look through the section relocs. */
+ /* Mark all the sections in the group. */
+ group_sec = elf_section_data (sec)->next_in_group;
+ if (group_sec && !group_sec->gc_mark)
+ if (!elf_gc_mark (info, group_sec, gc_mark_hook))
+ return false;
+ /* Look through the section relocs. */
+ ret = true;
if ((sec->flags & SEC_RELOC) != 0 && sec->reloc_count > 0)
{
Elf_Internal_Rela *relstart, *rel, *relend;
Elf_Internal_Shdr *symtab_hdr;
+ Elf_Internal_Shdr *shndx_hdr;
struct elf_link_hash_entry **sym_hashes;
size_t nlocsyms;
size_t extsymoff;
Elf_External_Sym *locsyms, *freesyms = NULL;
+ Elf_External_Sym_Shndx *locsym_shndx;
bfd *input_bfd = sec->owner;
struct elf_backend_data *bed = get_elf_backend_data (input_bfd);
@@ -6461,25 +7402,35 @@ elf_gc_mark (info, sec, gc_mark_hook)
}
else
extsymoff = nlocsyms = symtab_hdr->sh_info;
+
if (symtab_hdr->contents)
locsyms = (Elf_External_Sym *) symtab_hdr->contents;
else if (nlocsyms == 0)
locsyms = NULL;
else
{
- locsyms = freesyms =
- bfd_malloc (nlocsyms * sizeof (Elf_External_Sym));
+ bfd_size_type amt = nlocsyms * sizeof (Elf_External_Sym);
+ locsyms = freesyms = bfd_malloc (amt);
if (freesyms == NULL
|| bfd_seek (input_bfd, symtab_hdr->sh_offset, SEEK_SET) != 0
- || (bfd_read (locsyms, sizeof (Elf_External_Sym),
- nlocsyms, input_bfd)
- != nlocsyms * sizeof (Elf_External_Sym)))
+ || bfd_bread (locsyms, amt, input_bfd) != amt)
{
ret = false;
goto out1;
}
}
+ shndx_hdr = &elf_tdata (input_bfd)->symtab_shndx_hdr;
+ locsym_shndx = NULL;
+ if (shndx_hdr->sh_size != 0 && nlocsyms != 0)
+ {
+ bfd_size_type amt = nlocsyms * sizeof (Elf_External_Sym_Shndx);
+ locsym_shndx = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
+ if (bfd_seek (input_bfd, shndx_hdr->sh_offset, SEEK_SET) != 0
+ || bfd_bread (locsym_shndx, amt, input_bfd) != amt)
+ return false;
+ }
+
/* Read the relocations. */
relstart = (NAME(_bfd_elf,link_read_relocs)
(sec->owner, sec, NULL, (Elf_Internal_Rela *) NULL,
@@ -6504,7 +7455,10 @@ elf_gc_mark (info, sec, gc_mark_hook)
if (elf_bad_symtab (sec->owner))
{
- elf_swap_symbol_in (input_bfd, &locsyms[r_symndx], &s);
+ elf_swap_symbol_in (input_bfd,
+ locsyms + r_symndx,
+ locsym_shndx + (locsym_shndx ? r_symndx : 0),
+ &s);
if (ELF_ST_BIND (s.st_info) == STB_LOCAL)
rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s);
else
@@ -6520,7 +7474,10 @@ elf_gc_mark (info, sec, gc_mark_hook)
}
else
{
- elf_swap_symbol_in (input_bfd, &locsyms[r_symndx], &s);
+ elf_swap_symbol_in (input_bfd,
+ locsyms + r_symndx,
+ locsym_shndx + (locsym_shndx ? r_symndx : 0),
+ &s);
rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s);
}
@@ -6678,11 +7635,17 @@ elf_gc_propagate_vtable_entries_used (h, okp)
pu = h->vtable_parent->vtable_entries_used;
if (pu != NULL)
{
- n = h->vtable_parent->vtable_entries_size / FILE_ALIGN;
- while (--n != 0)
+ asection *sec = h->root.u.def.section;
+ struct elf_backend_data *bed = get_elf_backend_data (sec->owner);
+ int file_align = bed->s->file_align;
+
+ n = h->vtable_parent->vtable_entries_size / file_align;
+ while (n--)
{
- if (*pu) *cu = true;
- pu++, cu++;
+ if (*pu)
+ *cu = true;
+ pu++;
+ cu++;
}
}
}
@@ -6699,6 +7662,7 @@ elf_gc_smash_unused_vtentry_relocs (h, okp)
bfd_vma hstart, hend;
Elf_Internal_Rela *relstart, *relend, *rel;
struct elf_backend_data *bed;
+ int file_align;
/* Take care of both those symbols that do not describe vtables as
well as those that are not loaded. */
@@ -6715,8 +7679,10 @@ elf_gc_smash_unused_vtentry_relocs (h, okp)
relstart = (NAME(_bfd_elf,link_read_relocs)
(sec->owner, sec, NULL, (Elf_Internal_Rela *) NULL, true));
if (!relstart)
- return *(boolean *)okp = false;
+ return *(boolean *) okp = false;
bed = get_elf_backend_data (sec->owner);
+ file_align = bed->s->file_align;
+
relend = relstart + sec->reloc_count * bed->s->int_rels_per_ext_rel;
for (rel = relstart; rel < relend; ++rel)
@@ -6726,7 +7692,7 @@ elf_gc_smash_unused_vtentry_relocs (h, okp)
if (h->vtable_entries_used
&& (rel->r_offset - hstart) < h->vtable_entries_size)
{
- bfd_vma entry = (rel->r_offset - hstart) / FILE_ALIGN;
+ bfd_vma entry = (rel->r_offset - hstart) / file_align;
if (h->vtable_entries_used[entry])
continue;
}
@@ -6747,7 +7713,7 @@ elf_gc_sections (abfd, info)
boolean ok = true;
bfd *sub;
asection * (*gc_mark_hook)
- PARAMS ((bfd *abfd, struct bfd_link_info *, Elf_Internal_Rela *,
+ PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *h, Elf_Internal_Sym *));
if (!get_elf_backend_data (abfd)->can_gc_sections
@@ -6788,7 +7754,7 @@ elf_gc_sections (abfd, info)
}
/* ... and mark SEC_EXCLUDE for those that go. */
- if (!elf_gc_sweep(info, get_elf_backend_data (abfd)->gc_sweep_hook))
+ if (!elf_gc_sweep (info, get_elf_backend_data (abfd)->gc_sweep_hook))
return false;
return true;
@@ -6830,12 +7796,12 @@ elf_gc_record_vtinherit (abfd, sec, h, offset)
}
(*_bfd_error_handler) ("%s: %s+%lu: No symbol found for INHERIT",
- bfd_get_filename (abfd), sec->name,
- (unsigned long)offset);
+ bfd_archive_filename (abfd), sec->name,
+ (unsigned long) offset);
bfd_set_error (bfd_error_invalid_operation);
return false;
-win:
+ win:
if (!h)
{
/* This *should* only be the absolute section. It could potentially
@@ -6860,6 +7826,9 @@ elf_gc_record_vtentry (abfd, sec, h, addend)
struct elf_link_hash_entry *h;
bfd_vma addend;
{
+ struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ int file_align = bed->s->file_align;
+
if (addend >= h->vtable_entries_size)
{
size_t size, bytes;
@@ -6882,22 +7851,23 @@ elf_gc_record_vtentry (abfd, sec, h, addend)
/* Allocate one extra entry for use as a "done" flag for the
consolidation pass. */
- bytes = (size / FILE_ALIGN + 1) * sizeof (boolean);
+ bytes = (size / file_align + 1) * sizeof (boolean);
if (ptr)
{
- ptr = bfd_realloc (ptr - 1, bytes);
+ ptr = bfd_realloc (ptr - 1, (bfd_size_type) bytes);
if (ptr != NULL)
{
size_t oldbytes;
- oldbytes = (h->vtable_entries_size/FILE_ALIGN + 1) * sizeof (boolean);
- memset (((char *)ptr) + oldbytes, 0, bytes - oldbytes);
+ oldbytes = ((h->vtable_entries_size / file_align + 1)
+ * sizeof (boolean));
+ memset (((char *) ptr) + oldbytes, 0, bytes - oldbytes);
}
}
else
- ptr = bfd_zmalloc (bytes);
+ ptr = bfd_zmalloc ((bfd_size_type) bytes);
if (ptr == NULL)
return false;
@@ -6907,7 +7877,7 @@ elf_gc_record_vtentry (abfd, sec, h, addend)
h->vtable_entries_size = size;
}
- h->vtable_entries_used[addend / FILE_ALIGN] = true;
+ h->vtable_entries_used[addend / file_align] = true;
return true;
}
@@ -7029,8 +7999,8 @@ elf_collect_hash_codes (h, data)
p = strchr (name, ELF_VER_CHR);
if (p != NULL)
{
- alc = bfd_malloc (p - name + 1);
- memcpy (alc, name, p - name);
+ alc = bfd_malloc ((bfd_size_type) (p - name + 1));
+ memcpy (alc, name, (size_t) (p - name));
alc[p - name] = '\0';
name = alc;
}
@@ -7050,3 +8020,271 @@ elf_collect_hash_codes (h, data)
return true;
}
+
+boolean
+elf_reloc_symbol_deleted_p (offset, cookie)
+ bfd_vma offset;
+ PTR cookie;
+{
+ struct elf_reloc_cookie *rcookie = (struct elf_reloc_cookie *) cookie;
+
+ if (rcookie->bad_symtab)
+ rcookie->rel = rcookie->rels;
+
+ for (; rcookie->rel < rcookie->relend; rcookie->rel++)
+ {
+ unsigned long r_symndx = ELF_R_SYM (rcookie->rel->r_info);
+ Elf_Internal_Sym isym;
+
+ if (! rcookie->bad_symtab)
+ if (rcookie->rel->r_offset > offset)
+ return false;
+ if (rcookie->rel->r_offset != offset)
+ continue;
+
+ if (rcookie->locsyms && r_symndx < rcookie->locsymcount)
+ {
+ Elf_External_Sym *lsym;
+ Elf_External_Sym_Shndx *lshndx;
+
+ lsym = (Elf_External_Sym *) rcookie->locsyms + r_symndx;
+ lshndx = (Elf_External_Sym_Shndx *) rcookie->locsym_shndx;
+ if (lshndx != NULL)
+ lshndx += r_symndx;
+ elf_swap_symbol_in (rcookie->abfd, lsym, lshndx, &isym);
+ }
+
+ if (r_symndx >= rcookie->locsymcount
+ || (rcookie->locsyms
+ && ELF_ST_BIND (isym.st_info) != STB_LOCAL))
+ {
+ struct elf_link_hash_entry *h;
+
+ h = rcookie->sym_hashes[r_symndx - rcookie->extsymoff];
+
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ if ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && elf_discarded_section (h->root.u.def.section))
+ return true;
+ else
+ return false;
+ }
+ else if (rcookie->locsyms)
+ {
+ /* It's not a relocation against a global symbol,
+ but it could be a relocation against a local
+ symbol for a discarded section. */
+ asection *isec;
+
+ /* Need to: get the symbol; get the section. */
+ if (isym.st_shndx < SHN_LORESERVE || isym.st_shndx > SHN_HIRESERVE)
+ {
+ isec = section_from_elf_index (rcookie->abfd, isym.st_shndx);
+ if (isec != NULL && elf_discarded_section (isec))
+ return true;
+ }
+ }
+ return false;
+ }
+ return false;
+}
+
+/* Discard unneeded references to discarded sections.
+ Returns true if any section's size was changed. */
+/* This function assumes that the relocations are in sorted order,
+ which is true for all known assemblers. */
+
+boolean
+elf_bfd_discard_info (output_bfd, info)
+ bfd *output_bfd;
+ struct bfd_link_info *info;
+{
+ struct elf_reloc_cookie cookie;
+ asection *stab, *eh, *ehdr;
+ Elf_Internal_Shdr *symtab_hdr;
+ Elf_Internal_Shdr *shndx_hdr;
+ Elf_External_Sym *freesyms;
+ struct elf_backend_data *bed;
+ bfd *abfd;
+ boolean ret = false;
+ boolean strip = info->strip == strip_all || info->strip == strip_debugger;
+
+ if (info->relocateable
+ || info->traditional_format
+ || info->hash->creator->flavour != bfd_target_elf_flavour
+ || ! is_elf_hash_table (info))
+ return false;
+
+ ehdr = NULL;
+ if (elf_hash_table (info)->dynobj != NULL)
+ ehdr = bfd_get_section_by_name (elf_hash_table (info)->dynobj,
+ ".eh_frame_hdr");
+
+ for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next)
+ {
+ if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
+ continue;
+
+ bed = get_elf_backend_data (abfd);
+
+ if ((abfd->flags & DYNAMIC) != 0)
+ continue;
+
+ eh = NULL;
+ if (ehdr)
+ {
+ eh = bfd_get_section_by_name (abfd, ".eh_frame");
+ if (eh && eh->_raw_size == 0)
+ eh = NULL;
+ }
+
+ stab = strip ? NULL : bfd_get_section_by_name (abfd, ".stab");
+ if ((! stab || elf_section_data(stab)->sec_info_type != ELF_INFO_TYPE_STABS)
+ && ! eh
+ && (strip || ! bed->elf_backend_discard_info))
+ continue;
+
+ symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+ shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
+
+ cookie.abfd = abfd;
+ cookie.sym_hashes = elf_sym_hashes (abfd);
+ cookie.bad_symtab = elf_bad_symtab (abfd);
+ if (cookie.bad_symtab)
+ {
+ cookie.locsymcount =
+ symtab_hdr->sh_size / sizeof (Elf_External_Sym);
+ cookie.extsymoff = 0;
+ }
+ else
+ {
+ cookie.locsymcount = symtab_hdr->sh_info;
+ cookie.extsymoff = symtab_hdr->sh_info;
+ }
+
+ freesyms = NULL;
+ if (symtab_hdr->contents)
+ cookie.locsyms = (void *) symtab_hdr->contents;
+ else if (cookie.locsymcount == 0)
+ cookie.locsyms = NULL;
+ else
+ {
+ bfd_size_type amt = cookie.locsymcount * sizeof (Elf_External_Sym);
+ cookie.locsyms = bfd_malloc (amt);
+ if (cookie.locsyms == NULL)
+ return false;
+ freesyms = cookie.locsyms;
+ if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0
+ || bfd_bread (cookie.locsyms, amt, abfd) != amt)
+ {
+ error_ret_free_loc:
+ free (cookie.locsyms);
+ return false;
+ }
+ }
+
+ cookie.locsym_shndx = NULL;
+ if (shndx_hdr->sh_size != 0 && cookie.locsymcount != 0)
+ {
+ bfd_size_type amt;
+ amt = cookie.locsymcount * sizeof (Elf_External_Sym_Shndx);
+ cookie.locsym_shndx = bfd_malloc (amt);
+ if (cookie.locsym_shndx == NULL)
+ goto error_ret_free_loc;
+ if (bfd_seek (abfd, shndx_hdr->sh_offset, SEEK_SET) != 0
+ || bfd_bread (cookie.locsym_shndx, amt, abfd) != amt)
+ {
+ free (cookie.locsym_shndx);
+ goto error_ret_free_loc;
+ }
+ }
+
+ if (stab)
+ {
+ cookie.rels = (NAME(_bfd_elf,link_read_relocs)
+ (abfd, stab, (PTR) NULL,
+ (Elf_Internal_Rela *) NULL,
+ info->keep_memory));
+ if (cookie.rels)
+ {
+ cookie.rel = cookie.rels;
+ cookie.relend =
+ cookie.rels + stab->reloc_count * bed->s->int_rels_per_ext_rel;
+ if (_bfd_discard_section_stabs (abfd, stab,
+ elf_section_data (stab)->sec_info,
+ elf_reloc_symbol_deleted_p,
+ &cookie))
+ ret = true;
+ if (! info->keep_memory)
+ free (cookie.rels);
+ }
+ }
+
+ if (eh)
+ {
+ cookie.rels = NULL;
+ cookie.rel = NULL;
+ cookie.relend = NULL;
+ if (eh->reloc_count)
+ cookie.rels = (NAME(_bfd_elf,link_read_relocs)
+ (abfd, eh, (PTR) NULL,
+ (Elf_Internal_Rela *) NULL,
+ info->keep_memory));
+ if (cookie.rels)
+ {
+ cookie.rel = cookie.rels;
+ cookie.relend =
+ cookie.rels + eh->reloc_count * bed->s->int_rels_per_ext_rel;
+ }
+ if (_bfd_elf_discard_section_eh_frame (abfd, info, eh, ehdr,
+ elf_reloc_symbol_deleted_p,
+ &cookie))
+ ret = true;
+ if (! info->keep_memory)
+ free (cookie.rels);
+ }
+
+ if (bed->elf_backend_discard_info)
+ {
+ if (bed->elf_backend_discard_info (abfd, &cookie, info))
+ ret = true;
+ }
+
+ if (cookie.locsym_shndx != NULL)
+ free (cookie.locsym_shndx);
+
+ if (freesyms != NULL)
+ free (freesyms);
+ }
+
+ if (ehdr
+ && _bfd_elf_discard_section_eh_frame_hdr (output_bfd,
+ info, ehdr))
+ ret = true;
+ return ret;
+}
+
+static boolean
+elf_section_ignore_discarded_relocs (sec)
+ asection *sec;
+{
+ switch (elf_section_data (sec)->sec_info_type)
+ {
+ case ELF_INFO_TYPE_STABS:
+ case ELF_INFO_TYPE_EH_FRAME:
+ return true;
+ default:
+ break;
+ }
+ if ((get_elf_backend_data (sec->owner)->elf_backend_ignore_discarded_relocs
+ != NULL)
+ && (*get_elf_backend_data (sec->owner)
+ ->elf_backend_ignore_discarded_relocs) (sec))
+ return true;
+
+ return false;
+}
diff --git a/contrib/binutils/bfd/elfxx-ia64.c b/contrib/binutils/bfd/elfxx-ia64.c
index ee69168..7c4e139 100644
--- a/contrib/binutils/bfd/elfxx-ia64.c
+++ b/contrib/binutils/bfd/elfxx-ia64.c
@@ -1,5 +1,5 @@
/* IA-64 support for 64-bit ELF
- Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -111,6 +111,10 @@ struct elfNN_ia64_local_hash_entry
{
struct bfd_hash_entry root;
struct elfNN_ia64_dyn_sym_info *info;
+
+ /* True if this hash entry's addends was translated for
+ SHF_MERGE optimization. */
+ unsigned sec_merge_done : 1;
};
struct elfNN_ia64_local_hash_table
@@ -138,6 +142,7 @@ struct elfNN_ia64_link_hash_table
asection *rel_pltoff_sec; /* dynamic relocation section for same */
bfd_size_type minplt_entries; /* number of minplt entries */
+ unsigned reltext : 1; /* are there relocs against readonly sections? */
struct elfNN_ia64_local_hash_table loc_hash_table;
};
@@ -158,9 +163,11 @@ static boolean elfNN_ia64_relax_section
PARAMS((bfd *abfd, asection *sec, struct bfd_link_info *link_info,
boolean *again));
static boolean is_unwind_section_name
- PARAMS ((const char *));
+ PARAMS ((bfd *abfd, const char *));
static boolean elfNN_ia64_section_from_shdr
PARAMS ((bfd *, ElfNN_Internal_Shdr *, char *));
+static boolean elfNN_ia64_section_flags
+ PARAMS ((flagword *, ElfNN_Internal_Shdr *));
static boolean elfNN_ia64_fake_sections
PARAMS ((bfd *abfd, ElfNN_Internal_Shdr *hdr, asection *sec));
static void elfNN_ia64_final_write_processing
@@ -169,8 +176,18 @@ static boolean elfNN_ia64_add_symbol_hook
PARAMS ((bfd *abfd, struct bfd_link_info *info, const Elf_Internal_Sym *sym,
const char **namep, flagword *flagsp, asection **secp,
bfd_vma *valp));
+static boolean elfNN_ia64_aix_vec
+ PARAMS ((const bfd_target *vec));
+static boolean elfNN_ia64_aix_add_symbol_hook
+ PARAMS ((bfd *abfd, struct bfd_link_info *info, const Elf_Internal_Sym *sym,
+ const char **namep, flagword *flagsp, asection **secp,
+ bfd_vma *valp));
+static boolean elfNN_ia64_aix_link_add_symbols
+ PARAMS ((bfd *abfd, struct bfd_link_info *info));
static int elfNN_ia64_additional_program_headers
PARAMS ((bfd *abfd));
+static boolean elfNN_ia64_modify_segment_map
+ PARAMS ((bfd *));
static boolean elfNN_ia64_is_local_label_name
PARAMS ((bfd *abfd, const char *name));
static boolean elfNN_ia64_dynamic_symbol_p
@@ -184,17 +201,28 @@ static struct bfd_hash_entry *elfNN_ia64_new_loc_hash_entry
static struct bfd_hash_entry *elfNN_ia64_new_elf_hash_entry
PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table,
const char *string));
+static void elfNN_ia64_hash_copy_indirect
+ PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
+static void elfNN_ia64_hash_hide_symbol
+ PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
static struct bfd_link_hash_table *elfNN_ia64_hash_table_create
PARAMS ((bfd *abfd));
static struct elfNN_ia64_local_hash_entry *elfNN_ia64_local_hash_lookup
PARAMS ((struct elfNN_ia64_local_hash_table *table, const char *string,
boolean create, boolean copy));
+static boolean elfNN_ia64_global_dyn_sym_thunk
+ PARAMS ((struct bfd_hash_entry *, PTR));
+static boolean elfNN_ia64_local_dyn_sym_thunk
+ PARAMS ((struct bfd_hash_entry *, PTR));
static void elfNN_ia64_dyn_sym_traverse
PARAMS ((struct elfNN_ia64_link_hash_table *ia64_info,
boolean (*func) (struct elfNN_ia64_dyn_sym_info *, PTR),
PTR info));
static boolean elfNN_ia64_create_dynamic_sections
PARAMS ((bfd *abfd, struct bfd_link_info *info));
+static struct elfNN_ia64_local_hash_entry * get_local_sym_hash
+ PARAMS ((struct elfNN_ia64_link_hash_table *ia64_info,
+ bfd *abfd, const Elf_Internal_Rela *rel, boolean create));
static struct elfNN_ia64_dyn_sym_info * get_dyn_sym_info
PARAMS ((struct elfNN_ia64_link_hash_table *ia64_info,
struct elf_link_hash_entry *h,
@@ -219,7 +247,7 @@ static boolean elfNN_ia64_check_relocs
const Elf_Internal_Rela *relocs));
static boolean elfNN_ia64_adjust_dynamic_symbol
PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h));
-static unsigned long global_sym_index
+static long global_sym_index
PARAMS ((struct elf_link_hash_entry *h));
static boolean allocate_fptr
PARAMS ((struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data));
@@ -257,6 +285,8 @@ static bfd_vma set_pltoff_entry
PARAMS ((bfd *abfd, struct bfd_link_info *info,
struct elfNN_ia64_dyn_sym_info *dyn_i,
bfd_vma value, boolean));
+static int elfNN_ia64_unwind_entry_compare
+ PARAMS ((const PTR, const PTR));
static boolean elfNN_ia64_final_link
PARAMS ((bfd *abfd, struct bfd_link_info *info));
static boolean elfNN_ia64_relocate_section
@@ -271,12 +301,18 @@ static boolean elfNN_ia64_finish_dynamic_sections
PARAMS ((bfd *abfd, struct bfd_link_info *info));
static boolean elfNN_ia64_set_private_flags
PARAMS ((bfd *abfd, flagword flags));
-static boolean elfNN_ia64_copy_private_bfd_data
- PARAMS ((bfd *ibfd, bfd *obfd));
static boolean elfNN_ia64_merge_private_bfd_data
PARAMS ((bfd *ibfd, bfd *obfd));
static boolean elfNN_ia64_print_private_bfd_data
PARAMS ((bfd *abfd, PTR ptr));
+static enum elf_reloc_type_class elfNN_ia64_reloc_type_class
+ PARAMS ((const Elf_Internal_Rela *));
+static boolean elfNN_ia64_hpux_vec
+ PARAMS ((const bfd_target *vec));
+static void elfNN_hpux_post_process_headers
+ PARAMS ((bfd *abfd, struct bfd_link_info *info));
+boolean elfNN_hpux_backend_section_from_bfd_section
+ PARAMS ((bfd *abfd, asection *sec, int *retval));
/* ia64-specific relocation */
@@ -352,6 +388,8 @@ static reloc_howto_type ia64_howto_table[] =
IA64_HOWTO (R_IA64_LTOFF_FPTR22, "LTOFF_FPTR22", 0, false, true),
IA64_HOWTO (R_IA64_LTOFF_FPTR64I, "LTOFF_FPTR64I", 0, false, true),
+ IA64_HOWTO (R_IA64_LTOFF_FPTR32MSB, "LTOFF_FPTR32MSB", 2, false, true),
+ IA64_HOWTO (R_IA64_LTOFF_FPTR32LSB, "LTOFF_FPTR32LSB", 2, false, true),
IA64_HOWTO (R_IA64_LTOFF_FPTR64MSB, "LTOFF_FPTR64MSB", 4, false, true),
IA64_HOWTO (R_IA64_LTOFF_FPTR64LSB, "LTOFF_FPTR64LSB", 4, false, true),
@@ -472,6 +510,8 @@ elfNN_ia64_reloc_type_lookup (abfd, bfd_code)
case BFD_RELOC_IA64_LTOFF_FPTR22: rtype = R_IA64_LTOFF_FPTR22; break;
case BFD_RELOC_IA64_LTOFF_FPTR64I: rtype = R_IA64_LTOFF_FPTR64I; break;
+ case BFD_RELOC_IA64_LTOFF_FPTR32MSB: rtype = R_IA64_LTOFF_FPTR32MSB; break;
+ case BFD_RELOC_IA64_LTOFF_FPTR32LSB: rtype = R_IA64_LTOFF_FPTR32LSB; break;
case BFD_RELOC_IA64_LTOFF_FPTR64MSB: rtype = R_IA64_LTOFF_FPTR64MSB; break;
case BFD_RELOC_IA64_LTOFF_FPTR64LSB: rtype = R_IA64_LTOFF_FPTR64LSB; break;
@@ -519,7 +559,8 @@ elfNN_ia64_info_to_howto (abfd, bfd_reloc, elf_reloc)
arelent *bfd_reloc;
ElfNN_Internal_Rela *elf_reloc;
{
- bfd_reloc->howto = lookup_howto (ELFNN_R_TYPE (elf_reloc->r_info));
+ bfd_reloc->howto
+ = lookup_howto ((unsigned int) ELFNN_R_TYPE (elf_reloc->r_info));
}
#define PLT_HEADER_SIZE (3 * 16)
@@ -558,6 +599,9 @@ static const bfd_byte plt_full_entry[PLT_FULL_ENTRY_SIZE] =
};
#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
+#define AIX_DYNAMIC_INTERPRETER "/usr/lib/ia64l64/libc.so.1"
+#define DYNAMIC_INTERPRETER(abfd) \
+ (elfNN_ia64_aix_vec (abfd->xvec) ? AIX_DYNAMIC_INTERPRETER : ELF_DYNAMIC_INTERPRETER)
/* Select out of range branch fixup type. Note that Itanium does
not support brl, and so it gets emulated by the kernel. */
@@ -604,6 +648,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
};
Elf_Internal_Shdr *symtab_hdr;
+ Elf_Internal_Shdr *shndx_hdr;
Elf_Internal_Rela *internal_relocs;
Elf_Internal_Rela *free_relocs = NULL;
Elf_Internal_Rela *irel, *irelend;
@@ -611,6 +656,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
bfd_byte *free_contents = NULL;
ElfNN_External_Sym *extsyms;
ElfNN_External_Sym *free_extsyms = NULL;
+ Elf_External_Sym_Shndx *shndx_buf = NULL;
struct elfNN_ia64_link_hash_table *ia64_info;
struct one_fixup *fixups = NULL;
boolean changed_contents = false;
@@ -672,18 +718,34 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
goto error_return;
}
- /* Read this BFD's symbols. */
+ /* Read this BFD's local symbols. */
if (symtab_hdr->contents != NULL)
extsyms = (ElfNN_External_Sym *) symtab_hdr->contents;
else
{
- extsyms = (ElfNN_External_Sym *) bfd_malloc (symtab_hdr->sh_size);
+ bfd_size_type amt;
+
+ amt = symtab_hdr->sh_info * sizeof (ElfNN_External_Sym);
+ extsyms = (ElfNN_External_Sym *) bfd_malloc (amt);
if (extsyms == NULL)
goto error_return;
free_extsyms = extsyms;
if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0
- || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd)
- != symtab_hdr->sh_size))
+ || bfd_bread (extsyms, amt, abfd) != amt)
+ goto error_return;
+ }
+
+ shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
+ if (shndx_hdr->sh_size != 0)
+ {
+ bfd_size_type amt;
+
+ amt = symtab_hdr->sh_info * sizeof (Elf_External_Sym_Shndx);
+ shndx_buf = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
+ if (shndx_buf == NULL)
+ goto error_return;
+ if (bfd_seek (abfd, shndx_hdr->sh_offset, SEEK_SET) != 0
+ || bfd_bread (shndx_buf, amt, abfd) != amt)
goto error_return;
}
@@ -693,6 +755,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
Elf_Internal_Sym isym;
asection *tsec;
struct one_fixup *f;
+ bfd_size_type amt;
if (ELFNN_R_TYPE (irel->r_info) != (int) R_IA64_PCREL21B)
continue;
@@ -700,20 +763,23 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
/* Get the value of the symbol referred to by the reloc. */
if (ELFNN_R_SYM (irel->r_info) < symtab_hdr->sh_info)
{
+ ElfNN_External_Sym *esym;
+ Elf_External_Sym_Shndx *shndx;
+
/* A local symbol. */
- bfd_elfNN_swap_symbol_in (abfd,
- extsyms + ELFNN_R_SYM (irel->r_info),
- &isym);
+ esym = extsyms + ELFNN_R_SYM (irel->r_info);
+ shndx = shndx_buf + (shndx_buf ? ELFNN_R_SYM (irel->r_info) : 0);
+ bfd_elfNN_swap_symbol_in (abfd, esym, shndx, &isym);
if (isym.st_shndx == SHN_UNDEF)
continue; /* We can't do anthing with undefined symbols. */
else if (isym.st_shndx == SHN_ABS)
tsec = bfd_abs_section_ptr;
else if (isym.st_shndx == SHN_COMMON)
tsec = bfd_com_section_ptr;
- else if (isym.st_shndx > 0 && isym.st_shndx < SHN_LORESERVE)
- tsec = bfd_section_from_elf_index (abfd, isym.st_shndx);
+ else if (isym.st_shndx == SHN_IA_64_ANSI_COMMON)
+ tsec = bfd_com_section_ptr;
else
- continue; /* who knows. */
+ tsec = bfd_section_from_elf_index (abfd, isym.st_shndx);
toff = isym.st_value;
}
@@ -760,7 +826,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
roff = irel->r_offset;
reladdr = (sec->output_section->vma
+ sec->output_offset
- + roff) & -4;
+ + roff) & (bfd_vma) -4;
/* If the branch is in range, no need to do anything. */
if ((bfd_signed_vma) (symaddr - reladdr) >= -0x1000000
@@ -784,7 +850,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
make a copy of the FULL_PLT entry. Otherwise, we'll have
to use a `brl' insn to get where we're going. */
- int size;
+ size_t size;
if (tsec == ia64_info->plt_sec)
size = sizeof (plt_full_entry);
@@ -798,11 +864,12 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
}
/* Resize the current section to make room for the new branch. */
- trampoff = (sec->_cooked_size + 15) & -16;
- contents = (bfd_byte *) bfd_realloc (contents, trampoff + size);
+ trampoff = (sec->_cooked_size + 15) & (bfd_vma) -16;
+ amt = trampoff + size;
+ contents = (bfd_byte *) bfd_realloc (contents, amt);
if (contents == NULL)
goto error_return;
- sec->_cooked_size = trampoff + size;
+ sec->_cooked_size = amt;
if (tsec == ia64_info->plt_sec)
{
@@ -830,7 +897,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
}
/* Record the fixup so we don't do it again this section. */
- f = (struct one_fixup *) bfd_malloc (sizeof (*f));
+ f = (struct one_fixup *) bfd_malloc ((bfd_size_type) sizeof (*f));
f->next = fixups;
f->tsec = tsec;
f->toff = toff;
@@ -846,7 +913,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
/* Fix up the existing branch to hit the trampoline. Hope like
hell this doesn't overflow too. */
if (elfNN_ia64_install_value (abfd, contents + roff,
- f->trampoff - (roff & -4),
+ f->trampoff - (roff & (bfd_vma) -4),
R_IA64_PCREL21B) != bfd_reloc_ok)
goto error_return;
@@ -880,6 +947,9 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
}
}
+ if (shndx_buf != NULL)
+ free (shndx_buf);
+
if (free_extsyms != NULL)
{
if (! link_info->keep_memory)
@@ -887,7 +957,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
else
{
/* Cache the symbols for elf_link_input_bfd. */
- symtab_hdr->contents = extsyms;
+ symtab_hdr->contents = (unsigned char *) extsyms;
}
}
@@ -899,6 +969,8 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
free (free_relocs);
if (free_contents != NULL)
free (free_contents);
+ if (shndx_buf != NULL)
+ free (shndx_buf);
if (free_extsyms != NULL)
free (free_extsyms);
return false;
@@ -907,11 +979,16 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
/* Return true if NAME is an unwind table section name. */
static inline boolean
-is_unwind_section_name (name)
+is_unwind_section_name (abfd, name)
+ bfd *abfd;
const char *name;
{
size_t len1, len2, len3;
+ if (elfNN_ia64_hpux_vec (abfd->xvec)
+ && !strcmp (name, ELF_STRING_ia64_unwind_hdr))
+ return false;
+
len1 = sizeof (ELF_STRING_ia64_unwind) - 1;
len2 = sizeof (ELF_STRING_ia64_unwind_info) - 1;
len3 = sizeof (ELF_STRING_ia64_unwind_once) - 1;
@@ -939,6 +1016,10 @@ elfNN_ia64_section_from_shdr (abfd, hdr, name)
switch (hdr->sh_type)
{
case SHT_IA_64_UNWIND:
+ case SHT_INIT_ARRAY:
+ case SHT_FINI_ARRAY:
+ case SHT_PREINIT_ARRAY:
+ case SHT_IA_64_HP_OPT_ANOT:
break;
case SHT_IA_64_EXT:
@@ -986,7 +1067,7 @@ elfNN_ia64_fake_sections (abfd, hdr, sec)
name = bfd_get_section_name (abfd, sec);
- if (is_unwind_section_name (name))
+ if (is_unwind_section_name (abfd, name))
{
/* We don't have the sections numbered at this point, so sh_info
is set later, in elfNN_ia64_final_write_processing. */
@@ -995,6 +1076,14 @@ elfNN_ia64_fake_sections (abfd, hdr, sec)
}
else if (strcmp (name, ELF_STRING_ia64_archext) == 0)
hdr->sh_type = SHT_IA_64_EXT;
+ else if (strcmp (name, ".init_array") == 0)
+ hdr->sh_type = SHT_INIT_ARRAY;
+ else if (strcmp (name, ".fini_array") == 0)
+ hdr->sh_type = SHT_FINI_ARRAY;
+ else if (strcmp (name, ".preinit_array") == 0)
+ hdr->sh_type = SHT_PREINIT_ARRAY;
+ else if (strcmp (name, ".HP.opt_annot") == 0)
+ hdr->sh_type = SHT_IA_64_HP_OPT_ANOT;
else if (strcmp (name, ".reloc") == 0)
/*
* This is an ugly, but unfortunately necessary hack that is
@@ -1062,11 +1151,29 @@ elfNN_ia64_final_write_processing (abfd, linker)
{
/* .gnu.linkonce.ia64unw.FOO -> .gnu.linkonce.t.FOO */
size_t len2 = sizeof (".gnu.linkonce.t.") - 1;
- char *once_name = alloca (len2 + strlen (sname) - len + 1);
+ char *once_name = bfd_malloc (len2 + strlen (sname + len) + 1);
- memcpy (once_name, ".gnu.linkonce.t.", len2);
- strcpy (once_name + len2, sname + len);
- text_sect = bfd_get_section_by_name (abfd, once_name);
+ if (once_name != NULL)
+ {
+ memcpy (once_name, ".gnu.linkonce.t.", len2);
+ strcpy (once_name + len2, sname + len);
+ text_sect = bfd_get_section_by_name (abfd, once_name);
+ free (once_name);
+ }
+ else
+ /* Should only happen if we run out of memory, in
+ which case we're probably toast anyway. Try to
+ cope by finding the section the slow way. */
+ for (text_sect = abfd->sections;
+ text_sect != NULL;
+ text_sect = text_sect->next)
+ {
+ if (strncmp (bfd_section_name (abfd, text_sect),
+ ".gnu.linkonce.t.", len2) == 0
+ && strcmp (bfd_section_name (abfd, text_sect) + len2,
+ sname + len) == 0)
+ break;
+ }
}
else
/* last resort: fall back on .text */
@@ -1101,7 +1208,7 @@ elfNN_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
{
if (sym->st_shndx == SHN_COMMON
&& !info->relocateable
- && sym->st_size <= (unsigned) bfd_get_gp_size (abfd))
+ && sym->st_size <= elf_gp_size (abfd))
{
/* Common symbols less than or equal to -G nn bytes are
automatically put into .sbss. */
@@ -1125,6 +1232,112 @@ elfNN_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
return true;
}
+static boolean
+elfNN_ia64_aix_vec (const bfd_target *vec)
+{
+ extern const bfd_target bfd_elfNN_ia64_aix_little_vec;
+ extern const bfd_target bfd_elfNN_ia64_aix_big_vec;
+
+ return (/**/vec == & bfd_elfNN_ia64_aix_little_vec
+ || vec == & bfd_elfNN_ia64_aix_big_vec);
+}
+
+/* Hook called by the linker routine which adds symbols from an object
+ file. We use it to handle OS-specific symbols. */
+
+static boolean
+elfNN_ia64_aix_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ const Elf_Internal_Sym *sym;
+ const char **namep;
+ flagword *flagsp;
+ asection **secp;
+ bfd_vma *valp;
+{
+ if (strcmp (*namep, "__GLOB_DATA_PTR") == 0)
+ {
+ /* Define __GLOB_DATA_PTR when it is encountered. This is expected to
+ be a linker-defined symbol by the Aix C runtime startup code. IBM sez
+ no one else should use it b/c it is undocumented. */
+ struct elf_link_hash_entry *h;
+
+ h = elf_link_hash_lookup (elf_hash_table (info), *namep,
+ false, false, false);
+ if (h == NULL)
+ {
+ struct elf_backend_data *bed;
+ struct elfNN_ia64_link_hash_table *ia64_info;
+
+ bed = get_elf_backend_data (abfd);
+ ia64_info = elfNN_ia64_hash_table (info);
+
+ if (!(_bfd_generic_link_add_one_symbol
+ (info, abfd, *namep, BSF_GLOBAL,
+ bfd_get_section_by_name (abfd, ".bss"),
+ bed->got_symbol_offset, (const char *) NULL, false,
+ bed->collect, (struct bfd_link_hash_entry **) &h)))
+ return false;
+
+ h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+ h->type = STT_OBJECT;
+
+ if (! _bfd_elf_link_record_dynamic_symbol (info, h))
+ return false;
+ }
+
+ return true;
+ }
+ else if (sym->st_shndx == SHN_LOOS)
+ {
+ unsigned int i;
+
+ /* SHN_AIX_SYSCALL: Treat this as any other symbol. The special symbol
+ is only relevant when compiling code for extended system calls.
+ Replace the "special" section with .text, if possible.
+ Note that these symbols are always assumed to be in .text. */
+ for (i = 1; i < elf_numsections (abfd); i++)
+ {
+ asection * sec = bfd_section_from_elf_index (abfd, i);
+
+ if (sec && strcmp (sec->name, ".text") == 0)
+ {
+ *secp = sec;
+ break;
+ }
+ }
+
+ if (*secp == NULL)
+ *secp = bfd_abs_section_ptr;
+
+ *valp = sym->st_size;
+
+ return true;
+ }
+ else
+ {
+ return elfNN_ia64_add_symbol_hook (abfd, info, sym,
+ namep, flagsp, secp, valp);
+ }
+}
+
+boolean
+elfNN_ia64_aix_link_add_symbols (abfd, info)
+ bfd *abfd;
+ struct bfd_link_info *info;
+{
+ /* Make sure dynamic sections are always created. */
+ if (! elf_hash_table (info)->dynamic_sections_created
+ && abfd->xvec == info->hash->creator)
+ {
+ if (! bfd_elfNN_link_create_dynamic_sections (abfd, info))
+ return false;
+ }
+
+ /* Now do the standard call. */
+ return bfd_elfNN_bfd_link_add_symbols (abfd, info);
+}
+
/* Return the number of additional phdrs we will need. */
static int
@@ -1141,7 +1354,7 @@ elfNN_ia64_additional_program_headers (abfd)
/* Count how many PT_IA_64_UNWIND segments we need. */
for (s = abfd->sections; s; s = s->next)
- if (is_unwind_section_name(s->name) && (s->flags & SEC_LOAD))
+ if (is_unwind_section_name (abfd, s->name) && (s->flags & SEC_LOAD))
++ret;
return ret;
@@ -1154,6 +1367,8 @@ elfNN_ia64_modify_segment_map (abfd)
struct elf_segment_map *m, **pm;
Elf_Internal_Shdr *hdr;
asection *s;
+ boolean unwind_found;
+ asection *unwind_sec;
/* If we need a PT_IA_64_ARCHEXT segment, it must come before
all PT_LOAD segments. */
@@ -1165,7 +1380,8 @@ elfNN_ia64_modify_segment_map (abfd)
break;
if (m == NULL)
{
- m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m);
+ m = ((struct elf_segment_map *)
+ bfd_zalloc (abfd, (bfd_size_type) sizeof *m));
if (m == NULL)
return false;
@@ -1195,12 +1411,29 @@ elfNN_ia64_modify_segment_map (abfd)
if (s && (s->flags & SEC_LOAD))
{
for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
- if (m->p_type == PT_IA_64_UNWIND && m->sections[0] == s)
- break;
+ if (m->p_type == PT_IA_64_UNWIND)
+ {
+ /* Look through all sections in the unwind segment
+ for a match since there may be multiple sections
+ to a segment. */
+
+ unwind_sec = m->sections[0];
+ unwind_found = false;
+ while (unwind_sec != NULL && !unwind_found)
+ {
+ if (unwind_sec == s)
+ unwind_found = true;
+ else
+ unwind_sec = unwind_sec -> next;
+ }
+ if (unwind_found)
+ break;
+ }
if (m == NULL)
{
- m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m);
+ m = ((struct elf_segment_map *)
+ bfd_zalloc (abfd, (bfd_size_type) sizeof *m));
if (m == NULL)
return false;
@@ -1287,7 +1520,7 @@ elfNN_ia64_dynamic_symbol_p (h, info)
|| h->root.type == bfd_link_hash_defweak)
return true;
- if ((info->shared && !info->symbolic)
+ if ((info->shared && (!info->symbolic || info->allow_shlib_undefined))
|| ((h->elf_link_hash_flags
& (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR))
== (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR)))
@@ -1369,8 +1602,8 @@ elfNN_ia64_hash_copy_indirect (xdir, xind)
{
struct elfNN_ia64_link_hash_entry *dir, *ind;
- dir = (struct elfNN_ia64_link_hash_entry *)xdir;
- ind = (struct elfNN_ia64_link_hash_entry *)xind;
+ dir = (struct elfNN_ia64_link_hash_entry *) xdir;
+ ind = (struct elfNN_ia64_link_hash_entry *) xind;
/* Copy down any references that we may have already seen to the
symbol which just became indirect. */
@@ -1381,6 +1614,9 @@ elfNN_ia64_hash_copy_indirect (xdir, xind)
| ELF_LINK_HASH_REF_REGULAR
| ELF_LINK_HASH_REF_REGULAR_NONWEAK));
+ if (ind->root.root.type != bfd_link_hash_indirect)
+ return;
+
/* Copy over the got and plt data. This would have been done
by check_relocs. */
@@ -1410,18 +1646,17 @@ elfNN_ia64_hash_copy_indirect (xdir, xind)
}
static void
-elfNN_ia64_hash_hide_symbol (info, xh)
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
+elfNN_ia64_hash_hide_symbol (info, xh, force_local)
+ struct bfd_link_info *info;
struct elf_link_hash_entry *xh;
+ boolean force_local;
{
struct elfNN_ia64_link_hash_entry *h;
struct elfNN_ia64_dyn_sym_info *dyn_i;
h = (struct elfNN_ia64_link_hash_entry *)xh;
- h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
- if ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
- h->root.dynindx = -1;
+ _bfd_elf_link_hash_hide_symbol (info, &h->root, force_local);
for (dyn_i = h->info; dyn_i; dyn_i = dyn_i->next)
dyn_i->want_plt2 = 0;
@@ -1437,7 +1672,7 @@ elfNN_ia64_hash_table_create (abfd)
{
struct elfNN_ia64_link_hash_table *ret;
- ret = bfd_zalloc (abfd, sizeof (*ret));
+ ret = bfd_zalloc (abfd, (bfd_size_type) sizeof (*ret));
if (!ret)
return 0;
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
@@ -1573,6 +1808,37 @@ elfNN_ia64_create_dynamic_sections (abfd, info)
return true;
}
+/* Find and/or create a hash entry for local symbol. */
+static struct elfNN_ia64_local_hash_entry *
+get_local_sym_hash (ia64_info, abfd, rel, create)
+ struct elfNN_ia64_link_hash_table *ia64_info;
+ bfd *abfd;
+ const Elf_Internal_Rela *rel;
+ boolean create;
+{
+ char *addr_name;
+ size_t len;
+ struct elfNN_ia64_local_hash_entry *ret;
+
+ /* Construct a string for use in the elfNN_ia64_local_hash_table.
+ name describes what was once anonymous memory. */
+
+ len = sizeof (void*)*2 + 1 + sizeof (bfd_vma)*4 + 1 + 1;
+ len += 10; /* %p slop */
+
+ addr_name = bfd_malloc (len);
+ if (addr_name == NULL)
+ return 0;
+ sprintf (addr_name, "%p:%lx",
+ (void *) abfd, (unsigned long) ELFNN_R_SYM (rel->r_info));
+
+ /* Collect the canonical entry data for this address. */
+ ret = elfNN_ia64_local_hash_lookup (&ia64_info->loc_hash_table,
+ addr_name, create, create);
+ free (addr_name);
+ return ret;
+}
+
/* Find and/or create a descriptor for dynamic symbol info. This will
vary based on global or local symbol, and the addend to the reloc. */
@@ -1593,21 +1859,8 @@ get_dyn_sym_info (ia64_info, h, abfd, rel, create)
else
{
struct elfNN_ia64_local_hash_entry *loc_h;
- char *addr_name;
- size_t len;
-
- /* Construct a string for use in the elfNN_ia64_local_hash_table.
- The name describes what was once anonymous memory. */
- len = sizeof (void*)*2 + 1 + sizeof (bfd_vma)*4 + 1 + 1;
- len += 10; /* %p slop */
-
- addr_name = alloca (len);
- sprintf (addr_name, "%p:%lx", (void *) abfd, ELFNN_R_SYM (rel->r_info));
-
- /* Collect the canonical entry data for this address. */
- loc_h = elfNN_ia64_local_hash_lookup (&ia64_info->loc_hash_table,
- addr_name, create, create);
+ loc_h = get_local_sym_hash (ia64_info, abfd, rel, create);
BFD_ASSERT (loc_h);
pp = &loc_h->info;
@@ -1618,8 +1871,8 @@ get_dyn_sym_info (ia64_info, h, abfd, rel, create)
if (dyn_i == NULL && create)
{
- dyn_i = (struct elfNN_ia64_dyn_sym_info *)
- bfd_zalloc (abfd, sizeof *dyn_i);
+ dyn_i = ((struct elfNN_ia64_dyn_sym_info *)
+ bfd_zalloc (abfd, (bfd_size_type) sizeof *dyn_i));
*pp = dyn_i;
dyn_i->addend = addend;
}
@@ -1781,6 +2034,9 @@ get_reloc_section (abfd, ia64_info, sec, create)
return NULL;
}
+ if (sec->flags & SEC_READONLY)
+ ia64_info->reltext = 1;
+
return srel;
}
@@ -1799,8 +2055,8 @@ count_dyn_reloc (abfd, dyn_i, srel, type)
if (!rent)
{
- rent = (struct elfNN_ia64_dyn_reloc_entry *)
- bfd_alloc (abfd, sizeof (*rent));
+ rent = ((struct elfNN_ia64_dyn_reloc_entry *)
+ bfd_alloc (abfd, (bfd_size_type) sizeof (*rent)));
if (!rent)
return false;
@@ -1874,9 +2130,11 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
have yet been processed. Do something with what we know, as
this may help reduce memory usage and processing time later. */
maybe_dynamic = false;
- if (h && ((info->shared && ! info->symbolic)
+ if (h && ((info->shared
+ && (!info->symbolic || info->allow_shlib_undefined))
|| ! (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)
- || h->root.type == bfd_link_hash_defweak))
+ || h->root.type == bfd_link_hash_defweak
+ || elfNN_ia64_aix_vec (abfd->xvec)))
maybe_dynamic = true;
need_entry = 0;
@@ -1890,6 +2148,8 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
case R_IA64_LTOFF_FPTR22:
case R_IA64_LTOFF_FPTR64I:
+ case R_IA64_LTOFF_FPTR32MSB:
+ case R_IA64_LTOFF_FPTR32LSB:
case R_IA64_LTOFF_FPTR64MSB:
case R_IA64_LTOFF_FPTR64LSB:
need_entry = NEED_FPTR | NEED_GOT | NEED_LTOFF_FPTR;
@@ -1900,7 +2160,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
case R_IA64_FPTR32LSB:
case R_IA64_FPTR64MSB:
case R_IA64_FPTR64LSB:
- if (info->shared || h)
+ if (info->shared || h || elfNN_ia64_aix_vec (abfd->xvec))
need_entry = NEED_FPTR | NEED_DYNREL;
else
need_entry = NEED_FPTR;
@@ -1927,7 +2187,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
{
(*info->callbacks->warning)
(info, _("@pltoff reloc against local symbol"), 0,
- abfd, 0, 0);
+ abfd, 0, (bfd_vma) 0);
}
break;
@@ -1949,7 +2209,10 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
case R_IA64_DIR64MSB:
case R_IA64_DIR64LSB:
/* Shared objects will always need at least a REL relocation. */
- if (info->shared || maybe_dynamic)
+ if (info->shared || maybe_dynamic
+ || (elfNN_ia64_aix_vec (abfd->xvec)
+ && (!h || strcmp (h->root.root.string,
+ "__GLOB_DATA_PTR") != 0)))
need_entry = NEED_DYNREL;
dynrel_type = R_IA64_DIR64LSB;
break;
@@ -1982,7 +2245,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
{
(*info->callbacks->warning)
(info, _("non-zero addend in @fptr reloc"), 0,
- abfd, 0, 0);
+ abfd, 0, (bfd_vma) 0);
}
dyn_i = get_dyn_sym_info (ia64_info, h, abfd, rel, true);
@@ -2013,10 +2276,12 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
/* FPTRs for shared libraries are allocated by the dynamic
linker. Make sure this local symbol will appear in the
dynamic symbol table. */
- if (!h && info->shared)
+ if (!h && (info->shared
+ /* AIX also needs one */
+ || elfNN_ia64_aix_vec (abfd->xvec)))
{
if (! (_bfd_elfNN_link_record_local_dynamic_symbol
- (info, abfd, r_symndx)))
+ (info, abfd, (long) r_symndx)))
return false;
}
@@ -2069,7 +2334,10 @@ allocate_global_data_got (dyn_i, data)
if (dyn_i->want_got
&& ! dyn_i->want_fptr
- && elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info))
+ && (elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info)
+ || (elfNN_ia64_aix_vec (x->info->hash->creator)
+ && (!dyn_i->h || strcmp (dyn_i->h->root.root.string,
+ "__GLOB_DATA_PTR") != 0))))
{
dyn_i->got_offset = x->ofs;
x->ofs += 8;
@@ -2088,7 +2356,8 @@ allocate_global_fptr_got (dyn_i, data)
if (dyn_i->want_got
&& dyn_i->want_fptr
- && elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info))
+ && (elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info)
+ || elfNN_ia64_aix_vec (x->info->hash->creator)))
{
dyn_i->got_offset = x->ofs;
x->ofs += 8;
@@ -2106,7 +2375,8 @@ allocate_local_got (dyn_i, data)
struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
if (dyn_i->want_got
- && ! elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info))
+ && ! (elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info)
+ || elfNN_ia64_aix_vec (x->info->hash->creator)))
{
dyn_i->got_offset = x->ofs;
x->ofs += 8;
@@ -2116,7 +2386,7 @@ allocate_local_got (dyn_i, data)
/* Search for the index of a global symbol in it's defining object file. */
-static unsigned long
+static long
global_sym_index (h)
struct elf_link_hash_entry *h;
{
@@ -2152,7 +2422,12 @@ allocate_fptr (dyn_i, data)
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
- if (x->info->shared)
+ if (x->info->shared
+ /* AIX needs an FPTR in this case. */
+ || (elfNN_ia64_aix_vec (x->info->hash->creator)
+ && (!h
+ || h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)))
{
if (h && h->dynindx == -1)
{
@@ -2275,7 +2550,11 @@ allocate_dynrel_entries (dyn_i, data)
boolean dynamic_symbol, shared;
ia64_info = elfNN_ia64_hash_table (x->info);
- dynamic_symbol = elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info);
+ dynamic_symbol = elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info)
+ || (elfNN_ia64_aix_vec (x->info->hash->creator)
+ /* Don't allocate an entry for __GLOB_DATA_PTR */
+ && (!dyn_i->h || strcmp (dyn_i->h->root.root.string,
+ "__GLOB_DATA_PTR") != 0));
shared = x->info->shared;
/* Take care of the normal data relocations. */
@@ -2378,7 +2657,6 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
struct elfNN_ia64_link_hash_table *ia64_info;
asection *sec;
bfd *dynobj;
- boolean reltext = false;
boolean relplt = false;
dynobj = elf_hash_table(info)->dynobj;
@@ -2392,8 +2670,8 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
{
sec = bfd_get_section_by_name (dynobj, ".interp");
BFD_ASSERT (sec != NULL);
- sec->contents = (bfd_byte *) ELF_DYNAMIC_INTERPRETER;
- sec->_raw_size = strlen (ELF_DYNAMIC_INTERPRETER) + 1;
+ sec->contents = (bfd_byte *) DYNAMIC_INTERPRETER (output_bfd);
+ sec->_raw_size = strlen (DYNAMIC_INTERPRETER (output_bfd)) + 1;
}
/* Allocate the GOT entries. */
@@ -2432,7 +2710,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
}
/* Align the pointer for the plt2 entries. */
- data.ofs = (data.ofs + 31) & -32;
+ data.ofs = (data.ofs + 31) & (bfd_vma) -32;
elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_plt2_entries, &data);
if (data.ofs != 0)
@@ -2535,24 +2813,6 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
{
if (!strip)
{
- const char *outname;
- asection *target;
-
- /* If this relocation section applies to a read only
- section, then we probably need a DT_TEXTREL entry. */
- outname = bfd_get_section_name (output_bfd,
- sec->output_section);
- if (outname[4] == 'a')
- outname += 5;
- else
- outname += 4;
-
- target = bfd_get_section_by_name (output_bfd, outname);
- if (target != NULL
- && (target->flags & SEC_READONLY) != 0
- && (target->flags & SEC_ALLOC) != 0)
- reltext = true;
-
/* We use the reloc_count field as a counter if we need to
copy relocs into the output file. */
sec->reloc_count = 0;
@@ -2567,7 +2827,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
else
{
/* Allocate memory for the section contents. */
- sec->contents = (bfd_byte *) bfd_zalloc(dynobj, sec->_raw_size);
+ sec->contents = (bfd_byte *) bfd_zalloc (dynobj, sec->_raw_size);
if (sec->contents == NULL && sec->_raw_size != 0)
return false;
}
@@ -2583,32 +2843,34 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
{
/* The DT_DEBUG entry is filled in by the dynamic linker and used
by the debugger. */
- if (!bfd_elfNN_add_dynamic_entry (info, DT_DEBUG, 0))
+#define add_dynamic_entry(TAG, VAL) \
+ bfd_elfNN_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
+
+ if (!add_dynamic_entry (DT_DEBUG, 0))
return false;
}
- if (! bfd_elfNN_add_dynamic_entry (info, DT_IA_64_PLT_RESERVE, 0))
+ if (!add_dynamic_entry (DT_IA_64_PLT_RESERVE, 0))
return false;
- if (! bfd_elfNN_add_dynamic_entry (info, DT_PLTGOT, 0))
+ if (!add_dynamic_entry (DT_PLTGOT, 0))
return false;
if (relplt)
{
- if (! bfd_elfNN_add_dynamic_entry (info, DT_PLTRELSZ, 0)
- || ! bfd_elfNN_add_dynamic_entry (info, DT_PLTREL, DT_RELA)
- || ! bfd_elfNN_add_dynamic_entry (info, DT_JMPREL, 0))
+ if (!add_dynamic_entry (DT_PLTRELSZ, 0)
+ || !add_dynamic_entry (DT_PLTREL, DT_RELA)
+ || !add_dynamic_entry (DT_JMPREL, 0))
return false;
}
- if (! bfd_elfNN_add_dynamic_entry (info, DT_RELA, 0)
- || ! bfd_elfNN_add_dynamic_entry (info, DT_RELASZ, 0)
- || ! bfd_elfNN_add_dynamic_entry (info, DT_RELAENT,
- sizeof (ElfNN_External_Rela)))
+ if (!add_dynamic_entry (DT_RELA, 0)
+ || !add_dynamic_entry (DT_RELASZ, 0)
+ || !add_dynamic_entry (DT_RELAENT, sizeof (ElfNN_External_Rela)))
return false;
- if (reltext)
+ if (ia64_info->reltext)
{
- if (! bfd_elfNN_add_dynamic_entry (info, DT_TEXTREL, 0))
+ if (!add_dynamic_entry (DT_TEXTREL, 0))
return false;
info->flags |= DF_TEXTREL;
}
@@ -2620,10 +2882,10 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
}
static bfd_reloc_status_type
-elfNN_ia64_install_value (abfd, hit_addr, val, r_type)
+elfNN_ia64_install_value (abfd, hit_addr, v, r_type)
bfd *abfd;
bfd_byte *hit_addr;
- bfd_vma val;
+ bfd_vma v;
unsigned int r_type;
{
const struct ia64_operand *op;
@@ -2632,6 +2894,11 @@ elfNN_ia64_install_value (abfd, hit_addr, val, r_type)
enum ia64_opnd opnd;
const char *err;
size_t size = 8;
+#ifdef BFD_HOST_U_64_BIT
+ BFD_HOST_U_64_BIT val = (BFD_HOST_U_64_BIT) v;
+#else
+ bfd_vma val = v;
+#endif
opnd = IA64_OPND_NIL;
switch (r_type)
@@ -2678,6 +2945,7 @@ elfNN_ia64_install_value (abfd, hit_addr, val, r_type)
case R_IA64_GPREL32MSB:
case R_IA64_FPTR32MSB:
case R_IA64_PCREL32MSB:
+ case R_IA64_LTOFF_FPTR32MSB:
case R_IA64_SEGREL32MSB:
case R_IA64_SECREL32MSB:
case R_IA64_LTV32MSB:
@@ -2688,6 +2956,7 @@ elfNN_ia64_install_value (abfd, hit_addr, val, r_type)
case R_IA64_GPREL32LSB:
case R_IA64_FPTR32LSB:
case R_IA64_PCREL32LSB:
+ case R_IA64_LTOFF_FPTR32LSB:
case R_IA64_SEGREL32LSB:
case R_IA64_SECREL32LSB:
case R_IA64_LTV32LSB:
@@ -2791,7 +3060,7 @@ elfNN_ia64_install_value (abfd, hit_addr, val, r_type)
insn = (dword >> shift) & 0x1ffffffffffLL;
op = elf64_ia64_operands + opnd;
- err = (*op->insert) (op, val, &insn);
+ err = (*op->insert) (op, val, (ia64_insn *)& insn);
if (err)
return bfd_reloc_overflow;
@@ -2832,33 +3101,19 @@ elfNN_ia64_install_dyn_reloc (abfd, info, sec, srel, offset, type,
{
Elf_Internal_Rela outrel;
- outrel.r_offset = (sec->output_section->vma
- + sec->output_offset
- + offset);
+ offset += sec->output_section->vma + sec->output_offset;
BFD_ASSERT (dynindx != -1);
outrel.r_info = ELFNN_R_INFO (dynindx, type);
outrel.r_addend = addend;
-
- if (elf_section_data (sec)->stab_info != NULL)
+ outrel.r_offset = _bfd_elf_section_offset (abfd, info, sec, offset);
+ if (outrel.r_offset == (bfd_vma) -1)
{
- /* This may be NULL for linker-generated relocations, as it is
- inconvenient to pass all the bits around. And this shouldn't
- happen. */
- BFD_ASSERT (info != NULL);
-
- offset = (_bfd_stab_section_offset
- (abfd, &elf_hash_table (info)->stab_info, sec,
- &elf_section_data (sec)->stab_info, offset));
- if (offset == (bfd_vma) -1)
- {
- /* Run for the hills. We shouldn't be outputting a relocation
- for this. So do what everyone else does and output a no-op. */
- outrel.r_info = ELFNN_R_INFO (0, R_IA64_NONE);
- outrel.r_addend = 0;
- offset = 0;
- }
- outrel.r_offset = offset;
+ /* Run for the hills. We shouldn't be outputting a relocation
+ for this. So do what everyone else does and output a no-op. */
+ outrel.r_info = ELFNN_R_INFO (0, R_IA64_NONE);
+ outrel.r_addend = 0;
+ outrel.r_offset = 0;
}
bfd_elfNN_swap_reloca_out (abfd, &outrel,
@@ -2899,6 +3154,7 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type)
/* Install a dynamic relocation if needed. */
if (info->shared
|| elfNN_ia64_dynamic_symbol_p (dyn_i->h, info)
+ || elfNN_ia64_aix_vec (abfd->xvec)
|| (dynindx != -1 && dyn_r_type == R_IA64_FPTR64LSB))
{
if (dynindx == -1)
@@ -3043,8 +3299,8 @@ static bfd *elfNN_ia64_unwind_entry_compare_bfd;
static int
elfNN_ia64_unwind_entry_compare (a, b)
- PTR a;
- PTR b;
+ const PTR a;
+ const PTR b;
{
bfd_vma av, bv;
@@ -3205,11 +3461,13 @@ elfNN_ia64_final_link (abfd, info)
if (unwind_output_sec)
{
elfNN_ia64_unwind_entry_compare_bfd = abfd;
- qsort (unwind_output_sec->contents, unwind_output_sec->_raw_size / 24,
- 24, elfNN_ia64_unwind_entry_compare);
+ qsort (unwind_output_sec->contents,
+ (size_t) (unwind_output_sec->_raw_size / 24),
+ 24,
+ elfNN_ia64_unwind_entry_compare);
if (! bfd_set_section_contents (abfd, unwind_output_sec,
- unwind_output_sec->contents, 0,
+ unwind_output_sec->contents, (bfd_vma) 0,
unwind_output_sec->_raw_size))
return false;
}
@@ -3277,7 +3535,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
{
(*_bfd_error_handler)
(_("%s: unknown relocation type %d"),
- bfd_get_filename (input_bfd), (int)r_type);
+ bfd_archive_filename (input_bfd), (int)r_type);
bfd_set_error (bfd_error_bad_value);
ret_val = false;
continue;
@@ -3315,9 +3573,39 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
/* Reloc against local symbol. */
sym = local_syms + r_symndx;
sym_sec = local_sections[r_symndx];
- value = (sym_sec->output_section->vma
- + sym_sec->output_offset
- + sym->st_value);
+ value = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel);
+ if ((sym_sec->flags & SEC_MERGE)
+ && ELF_ST_TYPE (sym->st_info) == STT_SECTION
+ && (elf_section_data (sym_sec)->sec_info_type
+ == ELF_INFO_TYPE_MERGE))
+ {
+ struct elfNN_ia64_local_hash_entry *loc_h;
+
+ loc_h = get_local_sym_hash (ia64_info, input_bfd, rel, false);
+ if (loc_h && ! loc_h->sec_merge_done)
+ {
+ struct elfNN_ia64_dyn_sym_info *dynent;
+ asection *msec;
+
+ for (dynent = loc_h->info; dynent; dynent = dynent->next)
+ {
+ msec = sym_sec;
+ dynent->addend =
+ _bfd_merged_section_offset (output_bfd, &msec,
+ elf_section_data (msec)->
+ sec_info,
+ sym->st_value
+ + dynent->addend,
+ (bfd_vma) 0);
+ dynent->addend -= sym->st_value;
+ dynent->addend += msec->output_section->vma
+ + msec->output_offset
+ - sym_sec->output_section->vma
+ - sym_sec->output_offset;
+ }
+ loc_h->sec_merge_done = 1;
+ }
+ }
}
else
{
@@ -3353,7 +3641,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
}
else if (h->root.type == bfd_link_hash_undefweak)
undef_weak_ref = true;
- else if (info->shared && !info->symbolic
+ else if (info->shared
+ && (!info->symbolic || info->allow_shlib_undefined)
&& !info->no_undefined
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
;
@@ -3388,7 +3677,12 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
case R_IA64_DIR64MSB:
case R_IA64_DIR64LSB:
/* Install a dynamic relocation for this reloc. */
- if ((dynamic_symbol_p || info->shared)
+ if ((dynamic_symbol_p || info->shared
+ || (elfNN_ia64_aix_vec (info->hash->creator)
+ /* Don't emit relocs for __GLOB_DATA_PTR on AIX. */
+ && (!h || strcmp (h->root.root.string,
+ "__GLOB_DATA_PTR") != 0)))
+ && r_symndx != 0
&& (input_section->flags & SEC_ALLOC) != 0)
{
unsigned int dyn_r_type;
@@ -3432,7 +3726,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
shared libraries. Hork. */
(*_bfd_error_handler)
(_("%s: linking non-pic code in a shared library"),
- bfd_get_filename (input_bfd));
+ bfd_archive_filename (input_bfd));
ret_val = false;
continue;
}
@@ -3440,6 +3734,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
addend = value;
}
+ if (elfNN_ia64_aix_vec (info->hash->creator))
+ rel->r_addend = value;
elfNN_ia64_install_dyn_reloc (output_bfd, info, input_section,
srel, rel->r_offset, dyn_r_type,
dynindx, addend);
@@ -3463,7 +3759,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
{
(*_bfd_error_handler)
(_("%s: @gprel relocation against dynamic symbol %s"),
- bfd_get_filename (input_bfd), h->root.root.string);
+ bfd_archive_filename (input_bfd), h->root.root.string);
ret_val = false;
continue;
}
@@ -3521,7 +3817,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
dynindx = (_bfd_elf_link_lookup_local_dynindx
- (info, input_bfd, r_symndx));
+ (info, input_bfd, (long) r_symndx));
}
elfNN_ia64_install_dyn_reloc (output_bfd, info, input_section,
@@ -3535,6 +3831,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
case R_IA64_LTOFF_FPTR22:
case R_IA64_LTOFF_FPTR64I:
+ case R_IA64_LTOFF_FPTR32MSB:
+ case R_IA64_LTOFF_FPTR32LSB:
case R_IA64_LTOFF_FPTR64MSB:
case R_IA64_LTOFF_FPTR64LSB:
{
@@ -3563,7 +3861,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
}
else
dynindx = (_bfd_elf_link_lookup_local_dynindx
- (info, input_bfd, r_symndx));
+ (info, input_bfd, (long) r_symndx));
value = 0;
}
@@ -3579,7 +3877,9 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
case R_IA64_PCREL64MSB:
case R_IA64_PCREL64LSB:
/* Install a dynamic relocation for this reloc. */
- if (dynamic_symbol_p)
+ if ((dynamic_symbol_p
+ || elfNN_ia64_aix_vec (info->hash->creator))
+ && r_symndx != 0)
{
BFD_ASSERT (srel != NULL);
@@ -3598,7 +3898,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
{
(*_bfd_error_handler)
(_("%s: dynamic relocation against speculation fixup"),
- bfd_get_filename (input_bfd));
+ bfd_archive_filename (input_bfd));
ret_val = false;
continue;
}
@@ -3606,7 +3906,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
{
(*_bfd_error_handler)
(_("%s: speculation fixup against undefined weak symbol"),
- bfd_get_filename (input_bfd));
+ bfd_archive_filename (input_bfd));
ret_val = false;
continue;
}
@@ -3657,47 +3957,48 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
case R_IA64_SEGREL32LSB:
case R_IA64_SEGREL64MSB:
case R_IA64_SEGREL64LSB:
- {
- struct elf_segment_map *m;
- Elf_Internal_Phdr *p;
-
- /* Find the segment that contains the output_section. */
- for (m = elf_tdata (output_bfd)->segment_map,
- p = elf_tdata (output_bfd)->phdr;
- m != NULL;
- m = m->next, p++)
- {
- int i;
- for (i = m->count - 1; i >= 0; i--)
- if (m->sections[i] == sym_sec->output_section)
+ if (r_symndx == 0)
+ {
+ /* If the input section was discarded from the output, then
+ do nothing. */
+ r = bfd_reloc_ok;
+ }
+ else
+ {
+ struct elf_segment_map *m;
+ Elf_Internal_Phdr *p;
+
+ /* Find the segment that contains the output_section. */
+ for (m = elf_tdata (output_bfd)->segment_map,
+ p = elf_tdata (output_bfd)->phdr;
+ m != NULL;
+ m = m->next, p++)
+ {
+ int i;
+ for (i = m->count - 1; i >= 0; i--)
+ if (m->sections[i] == sym_sec->output_section)
+ break;
+ if (i >= 0)
break;
- if (i >= 0)
- break;
- }
-
- if (m == NULL)
- {
- /* If the input section was discarded from the output, then
- do nothing. */
+ }
- if (bfd_is_abs_section (sym_sec->output_section))
- r = bfd_reloc_ok;
- else
+ if (m == NULL)
+ {
r = bfd_reloc_notsupported;
- }
- else
- {
- /* The VMA of the segment is the vaddr of the associated
- program header. */
- if (value > p->p_vaddr)
- value -= p->p_vaddr;
- else
- value = 0;
- r = elfNN_ia64_install_value (output_bfd, hit_addr, value,
- r_type);
- }
- break;
- }
+ }
+ else
+ {
+ /* The VMA of the segment is the vaddr of the associated
+ program header. */
+ if (value > p->p_vaddr)
+ value -= p->p_vaddr;
+ else
+ value = 0;
+ r = elfNN_ia64_install_value (output_bfd, hit_addr, value,
+ r_type);
+ }
+ break;
+ }
case R_IA64_SECREL32MSB:
case R_IA64_SECREL32LSB:
@@ -3816,7 +4117,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
name = bfd_section_name (input_bfd, input_section);
}
if (!(*info->callbacks->reloc_overflow) (info, name,
- howto->name, 0,
+ howto->name,
+ (bfd_vma) 0,
input_bfd,
input_section,
rel->r_offset))
@@ -4023,24 +4325,6 @@ elfNN_ia64_set_private_flags (abfd, flags)
return true;
}
-/* Copy backend specific data from one object module to another */
-static boolean
-elfNN_ia64_copy_private_bfd_data (ibfd, obfd)
- bfd *ibfd, *obfd;
-{
- if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour
- || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return true;
-
- BFD_ASSERT (!elf_flags_init (obfd)
- || (elf_elfheader (obfd)->e_flags
- == elf_elfheader (ibfd)->e_flags));
-
- elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
- elf_flags_init (obfd) = true;
- return true;
-}
-
/* Merge backend specific data from an object file to the output
object file when linking. */
static boolean
@@ -4086,7 +4370,7 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
{
(*_bfd_error_handler)
(_("%s: linking trap-on-NULL-dereference with non-trapping files"),
- bfd_get_filename (ibfd));
+ bfd_archive_filename (ibfd));
bfd_set_error (bfd_error_bad_value);
ok = false;
@@ -4095,7 +4379,7 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
{
(*_bfd_error_handler)
(_("%s: linking big-endian files with little-endian files"),
- bfd_get_filename (ibfd));
+ bfd_archive_filename (ibfd));
bfd_set_error (bfd_error_bad_value);
ok = false;
@@ -4104,7 +4388,7 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
{
(*_bfd_error_handler)
(_("%s: linking 64-bit files with 32-bit files"),
- bfd_get_filename (ibfd));
+ bfd_archive_filename (ibfd));
bfd_set_error (bfd_error_bad_value);
ok = false;
@@ -4113,7 +4397,7 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
{
(*_bfd_error_handler)
(_("%s: linking constant-gp files with non-constant-gp files"),
- bfd_get_filename (ibfd));
+ bfd_archive_filename (ibfd));
bfd_set_error (bfd_error_bad_value);
ok = false;
@@ -4123,7 +4407,7 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd)
{
(*_bfd_error_handler)
(_("%s: linking auto-pic files with non-auto-pic files"),
- bfd_get_filename (ibfd));
+ bfd_archive_filename (ibfd));
bfd_set_error (bfd_error_bad_value);
ok = false;
@@ -4155,6 +4439,59 @@ elfNN_ia64_print_private_bfd_data (abfd, ptr)
_bfd_elf_print_private_bfd_data (abfd, ptr);
return true;
}
+
+static enum elf_reloc_type_class
+elfNN_ia64_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
+{
+ switch ((int) ELFNN_R_TYPE (rela->r_info))
+ {
+ case R_IA64_REL32MSB:
+ case R_IA64_REL32LSB:
+ case R_IA64_REL64MSB:
+ case R_IA64_REL64LSB:
+ return reloc_class_relative;
+ case R_IA64_IPLTMSB:
+ case R_IA64_IPLTLSB:
+ return reloc_class_plt;
+ case R_IA64_COPY:
+ return reloc_class_copy;
+ default:
+ return reloc_class_normal;
+ }
+}
+
+static boolean
+elfNN_ia64_hpux_vec (const bfd_target *vec)
+{
+ extern const bfd_target bfd_elfNN_ia64_hpux_big_vec;
+ return (vec == & bfd_elfNN_ia64_hpux_big_vec);
+}
+
+static void
+elfNN_hpux_post_process_headers (abfd, info)
+ bfd *abfd;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
+{
+ Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd);
+
+ i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_HPUX;
+ i_ehdrp->e_ident[EI_ABIVERSION] = 1;
+}
+
+boolean
+elfNN_hpux_backend_section_from_bfd_section (abfd, sec, retval)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ asection *sec;
+ int *retval;
+{
+ if (bfd_is_com_section (sec))
+ {
+ *retval = SHN_IA_64_ANSI_COMMON;
+ return true;
+ }
+ return false;
+}
#define TARGET_LITTLE_SYM bfd_elfNN_ia64_little_vec
#define TARGET_LITTLE_NAME "elfNN-ia64-little"
@@ -4210,8 +4547,6 @@ elfNN_ia64_print_private_bfd_data (abfd, ptr)
#define bfd_elfNN_bfd_final_link \
elfNN_ia64_final_link
-#define bfd_elfNN_bfd_copy_private_bfd_data \
- elfNN_ia64_copy_private_bfd_data
#define bfd_elfNN_bfd_merge_private_bfd_data \
elfNN_ia64_merge_private_bfd_data
#define bfd_elfNN_bfd_set_private_flags \
@@ -4231,5 +4566,60 @@ elfNN_ia64_print_private_bfd_data (abfd, ptr)
#define elf_backend_want_dynbss 0
#define elf_backend_copy_indirect_symbol elfNN_ia64_hash_copy_indirect
#define elf_backend_hide_symbol elfNN_ia64_hash_hide_symbol
+#define elf_backend_reloc_type_class elfNN_ia64_reloc_type_class
+
+#include "elfNN-target.h"
+
+/* AIX-specific vectors. */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elfNN_ia64_aix_little_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elfNN-ia64-aix-little"
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elfNN_ia64_aix_big_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elfNN-ia64-aix-big"
+
+#undef elf_backend_add_symbol_hook
+#define elf_backend_add_symbol_hook elfNN_ia64_aix_add_symbol_hook
+
+#undef bfd_elfNN_bfd_link_add_symbols
+#define bfd_elfNN_bfd_link_add_symbols elfNN_ia64_aix_link_add_symbols
+
+#define elfNN_bed elfNN_ia64_aix_bed
+
+#include "elfNN-target.h"
+
+/* HPUX-specific vectors. */
+
+#undef TARGET_LITTLE_SYM
+#undef TARGET_LITTLE_NAME
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elfNN_ia64_hpux_big_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elfNN-ia64-hpux-big"
+
+/* We need to undo the AIX specific functions. */
+
+#undef elf_backend_add_symbol_hook
+#define elf_backend_add_symbol_hook elfNN_ia64_add_symbol_hook
+
+#undef bfd_elfNN_bfd_link_add_symbols
+#define bfd_elfNN_bfd_link_add_symbols _bfd_generic_link_add_symbols
+
+/* These are HP-UX specific functions. */
+
+#undef elf_backend_post_process_headers
+#define elf_backend_post_process_headers elfNN_hpux_post_process_headers
+
+#undef elf_backend_section_from_bfd_section
+#define elf_backend_section_from_bfd_section elfNN_hpux_backend_section_from_bfd_section
+
+#undef ELF_MAXPAGESIZE
+#define ELF_MAXPAGESIZE 0x1000 /* 1K */
+
+#undef elfNN_bed
+#define elfNN_bed elfNN_ia64_hpux_bed
#include "elfNN-target.h"
diff --git a/contrib/binutils/bfd/elfxx-target.h b/contrib/binutils/bfd/elfxx-target.h
index 3ec9820..fda0f0d 100644
--- a/contrib/binutils/bfd/elfxx-target.h
+++ b/contrib/binutils/bfd/elfxx-target.h
@@ -66,6 +66,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef elf_backend_got_symbol_offset
#define elf_backend_got_symbol_offset (bfd_vma) 0
#endif
+#ifndef elf_backend_can_refcount
+#define elf_backend_can_refcount 0
+#endif
#ifndef elf_backend_want_got_plt
#define elf_backend_want_got_plt 0
#endif
@@ -87,7 +90,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define bfd_elfNN_bfd_debug_info_start bfd_void
#define bfd_elfNN_bfd_debug_info_end bfd_void
-#define bfd_elfNN_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
+#define bfd_elfNN_bfd_debug_info_accumulate \
+ (void (*) PARAMS ((bfd*, struct sec *))) bfd_void
#ifndef bfd_elfNN_bfd_get_relocated_section_contents
#define bfd_elfNN_bfd_get_relocated_section_contents \
@@ -101,6 +105,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef elf_backend_can_gc_sections
#define elf_backend_can_gc_sections 0
#endif
+#ifndef elf_backend_can_refcount
+#define elf_backend_can_refcount 0
+#endif
+#ifndef elf_backend_want_got_sym
+#define elf_backend_want_got_sym 1
+#endif
#ifndef elf_backend_gc_mark_hook
#define elf_backend_gc_mark_hook NULL
#endif
@@ -111,6 +121,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define bfd_elfNN_bfd_gc_sections _bfd_elfNN_gc_sections
#endif
+#ifndef bfd_elfNN_bfd_merge_sections
+#define bfd_elfNN_bfd_merge_sections \
+ _bfd_elf_merge_sections
+#endif
+
#ifndef bfd_elfNN_bfd_make_debug_symbol
#define bfd_elfNN_bfd_make_debug_symbol \
((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
@@ -127,7 +142,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#endif
#ifndef bfd_elfNN_bfd_copy_private_bfd_data
#define bfd_elfNN_bfd_copy_private_bfd_data \
- ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
+ _bfd_elf_copy_private_bfd_data
#endif
#ifndef bfd_elfNN_bfd_print_private_bfd_data
#define bfd_elfNN_bfd_print_private_bfd_data \
@@ -159,7 +174,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define bfd_elfNN_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
#endif
#else /* ! defined (elf_backend_relocate_section) */
-/* If no backend relocate_section routine, use the generic linker. */
+/* If no backend relocate_section routine, use the generic linker.
+ Note - this will prevent the port from being able to use some of
+ the other features of the ELF linker, because the generic hash structure
+ does not have the fields needed by the ELF linker. In particular it
+ means that linking directly to S-records will not work. */
#ifndef bfd_elfNN_bfd_link_hash_table_create
#define bfd_elfNN_bfd_link_hash_table_create \
_bfd_generic_link_hash_table_create
@@ -318,6 +337,36 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef elf_backend_hide_symbol
#define elf_backend_hide_symbol _bfd_elf_link_hash_hide_symbol
#endif
+#ifndef elf_backend_emit_relocs
+#define elf_backend_emit_relocs NULL
+#endif
+#ifndef elf_backend_count_relocs
+#define elf_backend_count_relocs NULL
+#endif
+#ifndef elf_backend_grok_prstatus
+#define elf_backend_grok_prstatus NULL
+#endif
+#ifndef elf_backend_grok_psinfo
+#define elf_backend_grok_psinfo NULL
+#endif
+#ifndef elf_backend_sprintf_vma
+#define elf_backend_sprintf_vma _bfd_elf_sprintf_vma
+#endif
+#ifndef elf_backend_fprintf_vma
+#define elf_backend_fprintf_vma _bfd_elf_fprintf_vma
+#endif
+#ifndef elf_backend_reloc_type_class
+#define elf_backend_reloc_type_class _bfd_elf_reloc_type_class
+#endif
+#ifndef elf_backend_discard_info
+#define elf_backend_discard_info NULL
+#endif
+#ifndef elf_backend_ignore_discarded_relocs
+#define elf_backend_ignore_discarded_relocs NULL
+#endif
+#ifndef elf_backend_write_section
+#define elf_backend_write_section NULL
+#endif
/* Previously, backends could only use SHT_REL or SHT_RELA relocation
sections, but not both. They defined USE_REL to indicate SHT_REL
@@ -360,7 +409,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
extern const struct elf_size_info _bfd_elfNN_size_info;
#ifndef INCLUDED_TARGET_FILE
-static CONST struct elf_backend_data elfNN_bed =
+static const struct elf_backend_data elfNN_bed =
{
ELF_ARCH, /* arch */
ELF_MACHINE_CODE, /* elf_machine_code */
@@ -399,6 +448,16 @@ static CONST struct elf_backend_data elfNN_bed =
elf_backend_output_arch_syms,
elf_backend_copy_indirect_symbol,
elf_backend_hide_symbol,
+ elf_backend_emit_relocs,
+ elf_backend_count_relocs,
+ elf_backend_grok_prstatus,
+ elf_backend_grok_psinfo,
+ elf_backend_sprintf_vma,
+ elf_backend_fprintf_vma,
+ elf_backend_reloc_type_class,
+ elf_backend_discard_info,
+ elf_backend_ignore_discarded_relocs,
+ elf_backend_write_section,
elf_backend_ecoff_debug_swap,
ELF_MACHINE_ALT1,
ELF_MACHINE_ALT2,
@@ -418,6 +477,8 @@ static CONST struct elf_backend_data elfNN_bed =
elf_backend_plt_not_loaded,
elf_backend_plt_alignment,
elf_backend_can_gc_sections,
+ elf_backend_can_refcount,
+ elf_backend_want_got_sym,
elf_backend_want_dynbss
};
#endif
@@ -443,12 +504,13 @@ const bfd_target TARGET_BIG_SYM =
BFD_ENDIAN_BIG,
/* object_flags: mask of all file flags */
- (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
- DYNAMIC | WP_TEXT | D_PAGED),
+ (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS
+ | DYNAMIC | WP_TEXT | D_PAGED),
/* section_flags: mask of all section flags */
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
- SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES),
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY
+ | SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES
+ | SEC_ARCH_BIT_0 | SEC_SMALL_DATA | SEC_MERGE | SEC_STRINGS | SEC_GROUP),
/* leading_symbol_char: is the first char of a user symbol
predictable, and if so what is it */
@@ -538,12 +600,13 @@ const bfd_target TARGET_LITTLE_SYM =
BFD_ENDIAN_LITTLE,
/* object_flags: mask of all file flags */
- (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
- DYNAMIC | WP_TEXT | D_PAGED),
+ (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS
+ | DYNAMIC | WP_TEXT | D_PAGED),
/* section_flags: mask of all section flags */
- (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
- SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES),
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY
+ | SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES
+ | SEC_ARCH_BIT_0 | SEC_SMALL_DATA | SEC_MERGE | SEC_STRINGS | SEC_GROUP),
/* leading_symbol_char: is the first char of a user symbol
predictable, and if so what is it */
diff --git a/contrib/binutils/bfd/format.c b/contrib/binutils/bfd/format.c
index 6afcb60..f60f0ca 100644
--- a/contrib/binutils/bfd/format.c
+++ b/contrib/binutils/bfd/format.c
@@ -119,38 +119,40 @@ bfd_check_format_matches (abfd, format, matching)
char ***matching;
{
extern const bfd_target binary_vec;
- const bfd_target * const *target, *save_targ, *right_targ;
+ const bfd_target * const *target, *save_targ, *right_targ, *ar_right_targ;
char **matching_vector = NULL;
int match_count;
+ int ar_match_index;
- if (!bfd_read_p (abfd) ||
- ((int)(abfd->format) < (int)bfd_unknown) ||
- ((int)(abfd->format) >= (int)bfd_type_end))
+ if (!bfd_read_p (abfd)
+ || (unsigned int) abfd->format >= (unsigned int) bfd_type_end)
{
bfd_set_error (bfd_error_invalid_operation);
return false;
}
if (abfd->format != bfd_unknown)
- return (abfd->format == format)? true: false;
+ return abfd->format == format;
/* Since the target type was defaulted, check them
all in the hope that one will be uniquely recognized. */
save_targ = abfd->xvec;
match_count = 0;
+ ar_match_index = _bfd_target_vector_entries;
if (matching)
{
- matching_vector =
- (char **) bfd_malloc (sizeof (char *) *
- (_bfd_target_vector_entries + 1));
+ bfd_size_type amt;
+
+ *matching = NULL;
+ amt = sizeof (char *) * 2 * _bfd_target_vector_entries;
+ matching_vector = (char **) bfd_malloc (amt);
if (!matching_vector)
return false;
- matching_vector[0] = NULL;
- *matching = matching_vector;
}
right_targ = 0;
+ ar_right_targ = 0;
/* Presume the answer is yes. */
abfd->format = format;
@@ -158,7 +160,7 @@ bfd_check_format_matches (abfd, format, matching)
/* If the target type was explicitly specified, just check that target. */
if (!abfd->target_defaulted)
{
- if (bfd_seek (abfd, (file_ptr)0, SEEK_SET) != 0) /* rewind! */
+ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) /* rewind! */
return false;
right_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
@@ -202,13 +204,14 @@ bfd_check_format_matches (abfd, format, matching)
for (target = bfd_target_vector; *target != NULL; target++)
{
const bfd_target *temp;
+ bfd_error_type err;
if (*target == &binary_vec)
continue;
abfd->xvec = *target; /* Change BFD's target temporarily */
- if (bfd_seek (abfd, (file_ptr)0, SEEK_SET) != 0)
+ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
return false;
/* If _bfd_check_format neglects to set bfd_error, assume
@@ -223,27 +226,20 @@ bfd_check_format_matches (abfd, format, matching)
{ /* This format checks out as ok! */
right_targ = temp;
- if (matching)
- {
- matching_vector[match_count] = temp->name;
- matching_vector[match_count + 1] = NULL;
- }
-
- match_count++;
-
/* If this is the default target, accept it, even if other
targets might match. People who want those other targets
have to set the GNUTARGET variable. */
if (temp == bfd_default_vector[0])
{
- if (matching)
- {
- matching_vector[0] = temp->name;
- matching_vector[1] = NULL;
- }
match_count = 1;
break;
}
+
+ if (matching)
+ matching_vector[match_count] = temp->name;
+
+ match_count++;
+
#ifdef GNU960
/* Big- and little-endian b.out archives look the same, but it
doesn't matter: there is no difference in their headers, and
@@ -254,19 +250,50 @@ bfd_check_format_matches (abfd, format, matching)
break;
#endif
}
- else if (bfd_get_error () != bfd_error_wrong_format)
+ else if ((err = bfd_get_error ()) == bfd_error_wrong_object_format
+ || err == bfd_error_file_ambiguously_recognized)
+ {
+ /* An archive with objects of the wrong type, or an
+ ambiguous match. We want this target to match if we get
+ no better matches. */
+ if (ar_right_targ != bfd_default_vector[0])
+ ar_right_targ = *target;
+ if (matching)
+ matching_vector[ar_match_index] = (*target)->name;
+ ar_match_index++;
+ }
+ else if (err != bfd_error_wrong_format)
{
abfd->xvec = save_targ;
abfd->format = bfd_unknown;
- if (matching && bfd_get_error ()
- != bfd_error_file_ambiguously_recognized)
+ if (matching)
free (matching_vector);
return false;
}
}
+ if (match_count == 0)
+ {
+ /* Try partial matches. */
+ right_targ = ar_right_targ;
+ if (right_targ == bfd_default_vector[0])
+ {
+ match_count = 1;
+ }
+ else
+ {
+ match_count = ar_match_index - _bfd_target_vector_entries;
+ if (matching && match_count > 1)
+ {
+ memcpy (matching_vector,
+ matching_vector + _bfd_target_vector_entries,
+ sizeof (char *) * match_count);
+ }
+ }
+ }
+
if (match_count == 1)
{
abfd->xvec = right_targ; /* Change BFD's target permanently. */
@@ -288,7 +315,15 @@ bfd_check_format_matches (abfd, format, matching)
free (matching_vector);
}
else
- bfd_set_error (bfd_error_file_ambiguously_recognized);
+ {
+ bfd_set_error (bfd_error_file_ambiguously_recognized);
+
+ if (matching)
+ {
+ *matching = matching_vector;
+ matching_vector[match_count] = NULL;
+ }
+ }
return false;
}
@@ -312,9 +347,8 @@ bfd_set_format (abfd, format)
bfd *abfd;
bfd_format format;
{
- if (bfd_read_p (abfd) ||
- ((int)abfd->format < (int)bfd_unknown) ||
- ((int)abfd->format >= (int)bfd_type_end))
+ if (bfd_read_p (abfd)
+ || (unsigned int) abfd->format >= (unsigned int) bfd_type_end)
{
bfd_set_error (bfd_error_invalid_operation);
return false;
@@ -340,7 +374,7 @@ FUNCTION
bfd_format_string
SYNOPSIS
- CONST char *bfd_format_string(bfd_format format);
+ const char *bfd_format_string(bfd_format format);
DESCRIPTION
Return a pointer to a const string
@@ -348,7 +382,7 @@ DESCRIPTION
depending upon the value of @var{format}.
*/
-CONST char *
+const char *
bfd_format_string (format)
bfd_format format;
{
diff --git a/contrib/binutils/bfd/gen-aout.c b/contrib/binutils/bfd/gen-aout.c
index 088fc09..1bba14a 100644
--- a/contrib/binutils/bfd/gen-aout.c
+++ b/contrib/binutils/bfd/gen-aout.c
@@ -1,5 +1,5 @@
/* Generate parameters for an a.out system.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -87,9 +87,12 @@ main (argc, argv)
fprintf (stderr, _(" fix DEFAULT_ARCH in the output file yourself\n"));
arch = "unknown";
}
- printf("#define DEFAULT_ARCH bfd_arch_%s\n", arch);
+ printf("#define DEFAULT_ARCH bfd_arch_%s\n\n", arch);
- printf("\n#define MY(OP) CAT(%s_,OP)\n", target);
+ printf("/* Do not \"beautify\" the CONCAT* macro args. Traditional C will not");
+ printf(" remove whitespace added here, and thus will fail to concatenate");
+ printf(" the tokens. */");
+ printf("\n#define MY(OP) CONCAT2 (%s_,OP)\n\n", target);
printf("#define TARGETNAME \"a.out-%s\"\n\n", target);
printf("#include \"bfd.h\"\n");
diff --git a/contrib/binutils/bfd/hash.c b/contrib/binutils/bfd/hash.c
index 11d54fd..9766eaf 100644
--- a/contrib/binutils/bfd/hash.c
+++ b/contrib/binutils/bfd/hash.c
@@ -582,9 +582,9 @@ struct bfd_strtab_hash *
_bfd_stringtab_init ()
{
struct bfd_strtab_hash *table;
+ bfd_size_type amt = sizeof (struct bfd_strtab_hash);
- table = ((struct bfd_strtab_hash *)
- bfd_malloc (sizeof (struct bfd_strtab_hash)));
+ table = (struct bfd_strtab_hash *) bfd_malloc (amt);
if (table == NULL)
return NULL;
@@ -711,8 +711,8 @@ _bfd_stringtab_emit (abfd, tab)
for (entry = tab->first; entry != NULL; entry = entry->next)
{
- register const char *str;
- register size_t len;
+ const char *str;
+ size_t len;
str = entry->root.string;
len = strlen (str) + 1;
@@ -722,12 +722,12 @@ _bfd_stringtab_emit (abfd, tab)
bfd_byte buf[2];
/* The output length includes the null byte. */
- bfd_put_16 (abfd, len, buf);
- if (bfd_write ((PTR) buf, 1, 2, abfd) != 2)
+ bfd_put_16 (abfd, (bfd_vma) len, buf);
+ if (bfd_bwrite ((PTR) buf, (bfd_size_type) 2, abfd) != 2)
return false;
}
- if (bfd_write ((PTR) str, 1, len, abfd) != len)
+ if (bfd_bwrite ((PTR) str, (bfd_size_type) len, abfd) != len)
return false;
}
diff --git a/contrib/binutils/bfd/host-aout.c b/contrib/binutils/bfd/host-aout.c
index a53cf09..5cbb5df 100644
--- a/contrib/binutils/bfd/host-aout.c
+++ b/contrib/binutils/bfd/host-aout.c
@@ -1,5 +1,6 @@
/* BFD backend for local host's a.out binaries
- Copyright 1990, 1991, 1992, 1994, 1995 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1994, 1995, 2001
+ Free Software Foundation, Inc.
Written by Cygnus Support. Probably John Gilmore's fault.
This file is part of BFD, the Binary File Descriptor library.
@@ -77,7 +78,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#endif
#endif /* HOST_MACHINE_ARCH */
-#define MY(OP) CAT(host_aout_,OP)
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define MY(OP) CONCAT2 (host_aout_,OP)
#define TARGETNAME "a.out"
#include "aout-target.h"
diff --git a/contrib/binutils/bfd/i386aout.c b/contrib/binutils/bfd/i386aout.c
index 1192dd4..c68dbec 100644
--- a/contrib/binutils/bfd/i386aout.c
+++ b/contrib/binutils/bfd/i386aout.c
@@ -1,5 +1,5 @@
/* BFD back-end for i386 a.out binaries.
- Copyright 1990, 1991, 1992, 1994, 1996, 1997
+ Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,7 +19,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-/* The only 386 aout system we have here is GO32 from DJ.
+/* The only 386 aout system we have here is GO32 from DJ.
These numbers make BFD work with that. If your aout 386 system
doesn't work with these, we'll have to split them into different
files. Send me (sac@cygnus.com) the runes to make it work on your
@@ -41,7 +41,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define SEGMENT_SIZE 0x400000
#define DEFAULT_ARCH bfd_arch_i386
-#define MY(OP) CAT(i386aout_,OP)
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define MY(OP) CONCAT2 (i386aout_,OP)
#define TARGETNAME "a.out-i386"
#define NO_WRITE_HEADER_KLUDGE 1
@@ -51,6 +54,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "aout/aout64.h"
#include "libaout.h"
+static boolean i386aout_write_object_contents PARAMS ((bfd *));
+static boolean MY (set_sizes) PARAMS ((bfd *));
+
/* Set the machine type correctly. */
static boolean
@@ -71,9 +77,8 @@ i386aout_write_object_contents (abfd)
#define MY_write_object_contents i386aout_write_object_contents
-static boolean MY(set_sizes)();
#define MY_backend_data &MY(backend_data)
-static CONST struct aout_backend_data MY(backend_data) = {
+static const struct aout_backend_data MY(backend_data) = {
0, /* zmagic contiguous */
1, /* text incl header */
0, /* entry is text address */
diff --git a/contrib/binutils/bfd/i386bsd.c b/contrib/binutils/bfd/i386bsd.c
index 98c48cd..e21a9ca 100644
--- a/contrib/binutils/bfd/i386bsd.c
+++ b/contrib/binutils/bfd/i386bsd.c
@@ -1,5 +1,6 @@
/* BFD back-end for i386 a.out binaries under BSD.
- Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1993, 1994, 2001
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -35,7 +36,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define DEFAULT_ARCH bfd_arch_i386
#define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN)
-#define MY(OP) CAT(i386bsd_,OP)
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define MY(OP) CONCAT2 (i386bsd_,OP)
#define TARGETNAME "a.out-i386-bsd"
#include "bfd.h"
diff --git a/contrib/binutils/bfd/i386freebsd.c b/contrib/binutils/bfd/i386freebsd.c
index f9684e4..73fa0ca 100644
--- a/contrib/binutils/bfd/i386freebsd.c
+++ b/contrib/binutils/bfd/i386freebsd.c
@@ -1,5 +1,5 @@
/* BFD back-end for FreeBSD/386 a.out-ish binaries.
- Copyright 1990, 1991, 1992, 1996 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1996, 2001 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -26,7 +26,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define DEFAULT_ARCH bfd_arch_i386
#define MACHTYPE_OK(mtype) ((mtype) == M_386_NETBSD || (mtype) == M_UNKNOWN)
-#define MY(OP) CAT(i386freebsd_,OP)
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define MY(OP) CONCAT2 (i386freebsd_,OP)
+
/* This needs to start with a.out so GDB knows it is an a.out variant. */
#define TARGETNAME "a.out-i386-freebsd"
diff --git a/contrib/binutils/bfd/i386linux.c b/contrib/binutils/bfd/i386linux.c
index 5fee098..bb93650 100644
--- a/contrib/binutils/bfd/i386linux.c
+++ b/contrib/binutils/bfd/i386linux.c
@@ -1,5 +1,5 @@
/* BFD back-end for linux flavored i386 a.out binaries.
- Copyright 1992, 1993, 1994, 1995, 1996, 1997
+ Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -36,7 +36,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libaout.h" /* BFD a.out internal data structures */
#define DEFAULT_ARCH bfd_arch_i386
-#define MY(OP) CAT(i386linux_,OP)
+
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define MY(OP) CONCAT2 (i386linux_,OP)
#define TARGETNAME "a.out-i386-linux"
extern const bfd_target MY(vec);
@@ -223,9 +227,9 @@ linux_link_hash_table_create (abfd)
bfd *abfd;
{
struct linux_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct linux_link_hash_table);
- ret = ((struct linux_link_hash_table *)
- bfd_alloc (abfd, sizeof (struct linux_link_hash_table)));
+ ret = (struct linux_link_hash_table *) bfd_alloc (abfd, amt);
if (ret == (struct linux_link_hash_table *) NULL)
return (struct bfd_link_hash_table *) NULL;
if (! NAME(aout,link_hash_table_init) (&ret->root, abfd,
@@ -405,7 +409,8 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
if (! (_bfd_generic_link_add_one_symbol
(info, linux_hash_table (info)->dynobj, SHARABLE_CONFLICTS,
- BSF_GLOBAL | BSF_CONSTRUCTOR, s, 0, NULL, false, false, NULL)))
+ BSF_GLOBAL | BSF_CONSTRUCTOR, s, (bfd_vma) 0, NULL,
+ false, false, NULL)))
return false;
}
@@ -444,7 +449,7 @@ linux_tally_symbols (h, data)
name = h->root.root.root.string + sizeof NEEDS_SHRLIB - 1;
p = strrchr (name, '_');
if (p != NULL)
- alloc = (char *) bfd_malloc (strlen (name) + 1);
+ alloc = (char *) bfd_malloc ((bfd_size_type) strlen (name) + 1);
if (p == NULL || alloc == NULL)
(*_bfd_error_handler) (_("Output file requires shared library `%s'\n"),
@@ -476,7 +481,7 @@ linux_tally_symbols (h, data)
+ sizeof PLT_REF_PREFIX - 1),
false, false, true);
/* h2 does not follow indirect symbols. */
- h2 = linux_link_hash_lookup (linux_hash_table (info),
+ h2 = linux_link_hash_lookup (linux_hash_table (info),
(h->root.root.root.string
+ sizeof PLT_REF_PREFIX - 1),
false, false, false);
@@ -587,7 +592,8 @@ bfd_i386linux_size_dynamic_sections (output_bfd, info)
".linux-dynamic");
if (s != NULL)
{
- s->_raw_size = 8 + linux_hash_table (info)->fixup_count * 8;
+ s->_raw_size = linux_hash_table (info)->fixup_count + 1;
+ s->_raw_size *= 8;
s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
if (s->contents == NULL)
return false;
@@ -624,13 +630,14 @@ linux_finish_dynamic_link (output_bfd, info)
fixups_written = 0;
#ifdef LINUX_LINK_DEBUG
- printf ("Fixup table file offset: %x VMA: %x\n",
+ printf ("Fixup table file offset: %x VMA: %x\n",
os->filepos + s->output_offset,
os->vma + s->output_offset);
#endif
fixup_table = s->contents;
- bfd_put_32 (output_bfd, linux_hash_table (info)->fixup_count, fixup_table);
+ bfd_put_32 (output_bfd,
+ (bfd_vma) linux_hash_table (info)->fixup_count, fixup_table);
fixup_table += 4;
/* Fill in fixup table. */
@@ -660,15 +667,15 @@ linux_finish_dynamic_link (output_bfd, info)
if (f->jump)
{
/* Relative address */
- new_addr = new_addr - (f->value + 5);
- bfd_put_32 (output_bfd, new_addr, fixup_table);
+ new_addr = new_addr - (f->value + 5);
+ bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
fixup_table += 4;
bfd_put_32 (output_bfd, f->value + 1, fixup_table);
fixup_table += 4;
}
else
{
- bfd_put_32 (output_bfd, new_addr, fixup_table);
+ bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
fixup_table += 4;
bfd_put_32 (output_bfd, f->value, fixup_table);
fixup_table += 4;
@@ -679,9 +686,9 @@ linux_finish_dynamic_link (output_bfd, info)
if (linux_hash_table (info)->local_builtins != 0)
{
/* Special marker so we know to switch to the other type of fixup */
- bfd_put_32 (output_bfd, 0, fixup_table);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
fixup_table += 4;
- bfd_put_32 (output_bfd, 0, fixup_table);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
fixup_table += 4;
++fixups_written;
for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next)
@@ -707,7 +714,7 @@ linux_finish_dynamic_link (output_bfd, info)
new_addr, f->value);
#endif
- bfd_put_32 (output_bfd, new_addr, fixup_table);
+ bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
fixup_table += 4;
bfd_put_32 (output_bfd, f->value, fixup_table);
fixup_table += 4;
@@ -720,15 +727,15 @@ linux_finish_dynamic_link (output_bfd, info)
(*_bfd_error_handler) (_("Warning: fixup count mismatch\n"));
while (linux_hash_table (info)->fixup_count > fixups_written)
{
- bfd_put_32 (output_bfd, 0, fixup_table);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
fixup_table += 4;
- bfd_put_32 (output_bfd, 0, fixup_table);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
fixup_table += 4;
++fixups_written;
}
}
- h = linux_link_hash_lookup (linux_hash_table (info),
+ h = linux_link_hash_lookup (linux_hash_table (info),
"__BUILTIN_FIXUPS__",
false, false, false);
@@ -744,16 +751,16 @@ linux_finish_dynamic_link (output_bfd, info)
printf ("Builtin fixup table at %x\n", new_addr);
#endif
- bfd_put_32 (output_bfd, new_addr, fixup_table);
+ bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
}
else
- bfd_put_32 (output_bfd, 0, fixup_table);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
- if (bfd_seek (output_bfd, os->filepos + s->output_offset, SEEK_SET) != 0)
+ if (bfd_seek (output_bfd, (file_ptr) (os->filepos + s->output_offset),
+ SEEK_SET) != 0)
return false;
- if (bfd_write ((PTR) s->contents, 1, s->_raw_size, output_bfd)
- != s->_raw_size)
+ if (bfd_bwrite ((PTR) s->contents, s->_raw_size, output_bfd) != s->_raw_size)
return false;
return true;
diff --git a/contrib/binutils/bfd/i386netbsd.c b/contrib/binutils/bfd/i386netbsd.c
index 0e01763..26fa30e 100644
--- a/contrib/binutils/bfd/i386netbsd.c
+++ b/contrib/binutils/bfd/i386netbsd.c
@@ -1,5 +1,5 @@
/* BFD back-end for NetBSD/386 a.out-ish binaries.
- Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1998
+ Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1998, 2001
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -27,7 +27,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define DEFAULT_ARCH bfd_arch_i386
#define DEFAULT_MID M_386_NETBSD
-#define MY(OP) CAT(i386netbsd_,OP)
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define MY(OP) CONCAT2 (i386netbsd_,OP)
+
/* This needs to start with a.out so GDB knows it is an a.out variant. */
#define TARGETNAME "a.out-i386-netbsd"
diff --git a/contrib/binutils/bfd/ieee.c b/contrib/binutils/bfd/ieee.c
index 8414424..546f12c 100644
--- a/contrib/binutils/bfd/ieee.c
+++ b/contrib/binutils/bfd/ieee.c
@@ -32,29 +32,96 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libbfd.h"
#include "ieee.h"
#include "libieee.h"
+#include "safe-ctype.h"
-#include <ctype.h>
+struct output_buffer_struct
+{
+ unsigned char *ptrp;
+ int buffer;
+};
static boolean ieee_write_byte PARAMS ((bfd *, int));
static boolean ieee_write_2bytes PARAMS ((bfd *, int));
static boolean ieee_write_int PARAMS ((bfd *, bfd_vma));
static boolean ieee_write_id PARAMS ((bfd *, const char *));
+static unsigned short read_2bytes PARAMS ((common_header_type *));
+static void bfd_get_string PARAMS ((common_header_type *, char *, size_t));
+static char *read_id PARAMS ((common_header_type *));
static boolean ieee_write_expression
PARAMS ((bfd *, bfd_vma, asymbol *, boolean, unsigned int));
static void ieee_write_int5 PARAMS ((bfd_byte *, bfd_vma));
static boolean ieee_write_int5_out PARAMS ((bfd *, bfd_vma));
+static boolean parse_int PARAMS ((common_header_type *, bfd_vma *));
+static int parse_i PARAMS ((common_header_type *, boolean *));
+static bfd_vma must_parse_int PARAMS ((common_header_type *));
+static void parse_expression
+ PARAMS ((ieee_data_type *, bfd_vma *, ieee_symbol_index_type *,
+ boolean *, unsigned int *, asection **));
+static file_ptr ieee_part_after PARAMS ((ieee_data_type *, file_ptr));
+static ieee_symbol_type *get_symbol
+ PARAMS ((bfd *, ieee_data_type *, ieee_symbol_type *, unsigned int *,
+ ieee_symbol_type ***, unsigned int *, int));
+static boolean ieee_slurp_external_symbols PARAMS ((bfd *));
+static boolean ieee_slurp_symbol_table PARAMS ((bfd *));
+static long ieee_get_symtab_upper_bound PARAMS ((bfd *));
+static long ieee_get_symtab PARAMS ((bfd *, asymbol **));
+static asection *get_section_entry
+ PARAMS ((bfd *, ieee_data_type *i, unsigned int));
+static void ieee_slurp_sections PARAMS ((bfd *));
+static boolean ieee_slurp_debug PARAMS ((bfd *));
+const bfd_target *ieee_archive_p PARAMS ((bfd *));
+const bfd_target *ieee_object_p PARAMS ((bfd *));
+static void ieee_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
+static void ieee_print_symbol
+ PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
+static boolean do_one
+ PARAMS ((ieee_data_type *, ieee_per_section_type *, unsigned char *,
+ asection *, int));
+static boolean ieee_slurp_section_data PARAMS ((bfd *));
+static boolean ieee_new_section_hook PARAMS ((bfd *, asection *));
+static long ieee_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
+static boolean ieee_get_section_contents
+ PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
+static long ieee_canonicalize_reloc
+ PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
+static int comp PARAMS ((const PTR, const PTR));
static boolean ieee_write_section_part PARAMS ((bfd *));
static boolean do_with_relocs PARAMS ((bfd *, asection *));
static boolean do_as_repeat PARAMS ((bfd *, asection *));
static boolean do_without_relocs PARAMS ((bfd *, asection *));
-static boolean ieee_write_external_part PARAMS ((bfd *));
-static boolean ieee_write_data_part PARAMS ((bfd *));
+static boolean ieee_mkobject PARAMS ((bfd *));
+static void fill PARAMS ((void));
+static void flush PARAMS ((void));
+static void write_int PARAMS ((int));
+static void copy_id PARAMS ((void));
+static void copy_expression PARAMS ((void));
+static void fill_int PARAMS ((struct output_buffer_struct *));
+static void drop_int PARAMS ((struct output_buffer_struct *));
+static void copy_int PARAMS ((void));
+static void f1_record PARAMS ((void));
+static void f0_record PARAMS ((void));
+static void copy_till_end PARAMS ((void));
+static void f2_record PARAMS ((void));
+static void f8_record PARAMS ((void));
+static void e2_record PARAMS ((void));
+static void block PARAMS ((void));
+static void relocate_debug PARAMS ((bfd *, bfd *));
static boolean ieee_write_debug_part PARAMS ((bfd *));
+static boolean ieee_write_data_part PARAMS ((bfd *));
+static boolean init_for_output PARAMS ((bfd *));
+static boolean ieee_set_section_contents
+ PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
+static boolean ieee_write_external_part PARAMS ((bfd *));
static boolean ieee_write_me_part PARAMS ((bfd *));
static boolean ieee_write_processor PARAMS ((bfd *));
-
-static boolean ieee_slurp_debug PARAMS ((bfd *));
-static boolean ieee_slurp_section_data PARAMS ((bfd *));
+static boolean ieee_write_object_contents PARAMS ((bfd *));
+static asymbol *ieee_make_empty_symbol PARAMS ((bfd *));
+static bfd *ieee_openr_next_archived_file PARAMS ((bfd *, bfd *));
+static boolean ieee_find_nearest_line
+ PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
+ const char **, unsigned int *));
+static int ieee_generic_stat_arch_elt PARAMS ((bfd *, struct stat *));
+static int ieee_sizeof_headers PARAMS ((bfd *, boolean));
/* Functions for writing to ieee files in the strange way that the
standard requires. */
@@ -67,7 +134,7 @@ ieee_write_byte (abfd, barg)
bfd_byte byte;
byte = barg;
- if (bfd_write ((PTR) &byte, 1, 1, abfd) != 1)
+ if (bfd_bwrite ((PTR) &byte, (bfd_size_type) 1, abfd) != 1)
return false;
return true;
}
@@ -81,7 +148,7 @@ ieee_write_2bytes (abfd, bytes)
buffer[0] = bytes >> 8;
buffer[1] = bytes & 0xff;
- if (bfd_write ((PTR) buffer, 1, 2, abfd) != 2)
+ if (bfd_bwrite ((PTR) buffer, (bfd_size_type) 2, abfd) != 2)
return false;
return true;
}
@@ -171,7 +238,7 @@ ieee_write_id (abfd, id)
return false;
}
- if (bfd_write ((PTR) id, 1, length, abfd) != length)
+ if (bfd_bwrite ((PTR) id, (bfd_size_type) length, abfd) != length)
return false;
return true;
}
@@ -230,7 +297,7 @@ read_id (ieee)
length = (length * 256) + this_byte_and_next (ieee);
}
/* Buy memory and read string */
- string = bfd_alloc (ieee->abfd, length + 1);
+ string = bfd_alloc (ieee->abfd, (bfd_size_type) length + 1);
if (!string)
return NULL;
bfd_get_string (ieee, string, length);
@@ -316,7 +383,7 @@ ieee_write_expression (abfd, value, symbol, pcrel, index)
/* Handle the degenerate case of a 0 address. */
if (term_count == 0)
{
- if (! ieee_write_int (abfd, 0))
+ if (! ieee_write_int (abfd, (bfd_vma) 0))
return false;
}
@@ -355,7 +422,7 @@ ieee_write_int5_out (abfd, value)
bfd_byte b[5];
ieee_write_int5 (b, value);
- if (bfd_write ((PTR) b, 1, 5, abfd) != 5)
+ if (bfd_bwrite ((PTR) b, (bfd_size_type) 5, abfd) != 5)
return false;
return true;
}
@@ -543,8 +610,9 @@ parse_expression (ieee, value, symbol, pcrel, extra, section)
#define PUSH(x,y,z) TOS.symbol=x;TOS.section=y;TOS.value=z;INC;
#define POP(x,y,z) DEC;x=TOS.symbol;y=TOS.section;z=TOS.value;
ieee_value_type *sp = stack;
+ asection *dummy;
- while (loop)
+ while (loop && ieee->h.input_p < ieee->h.last_byte)
{
switch (this_byte (&(ieee->h)))
{
@@ -637,70 +705,85 @@ parse_expression (ieee, value, symbol, pcrel, extra, section)
}
else
{
- /*
- Thats all that we can understand. As far as I can see
- there is a bug in the Microtec IEEE output which I'm
- using to scan, whereby the comma operator is omitted
- sometimes in an expression, giving expressions with too
- many terms. We can tell if that's the case by ensuring
- that sp == stack here. If not, then we've pushed
- something too far, so we keep adding. */
-
- while (sp != stack + 1)
- {
- asection *section1;
- ieee_symbol_index_type sy1;
- POP (sy1, section1, *extra);
- }
- {
- asection *dummy;
-
- POP (*symbol, dummy, *value);
- if (section)
- *section = dummy;
- }
-
+ /* Thats all that we can understand. */
loop = false;
}
}
}
}
+
+ /* As far as I can see there is a bug in the Microtec IEEE output
+ which I'm using to scan, whereby the comma operator is omitted
+ sometimes in an expression, giving expressions with too many
+ terms. We can tell if that's the case by ensuring that
+ sp == stack here. If not, then we've pushed something too far,
+ so we keep adding. */
+
+ while (sp != stack + 1)
+ {
+ asection *section1;
+ ieee_symbol_index_type sy1;
+ POP (sy1, section1, *extra);
+ }
+
+ POP (*symbol, dummy, *value);
+ if (section)
+ *section = dummy;
}
-#define ieee_seek(abfd, offset) \
- IEEE_DATA(abfd)->h.input_p = IEEE_DATA(abfd)->h.first_byte + offset
+#define ieee_seek(ieee, offset) \
+ do \
+ { \
+ ieee->h.input_p = ieee->h.first_byte + offset; \
+ ieee->h.last_byte = (ieee->h.first_byte \
+ + ieee_part_after (ieee, offset)); \
+ } \
+ while (0)
+
+#define ieee_pos(ieee) \
+ (ieee->h.input_p - ieee->h.first_byte)
+
+/* Find the first part of the ieee file after HERE. */
-#define ieee_pos(abfd) \
- (IEEE_DATA(abfd)->h.input_p - IEEE_DATA(abfd)->h.first_byte)
+static file_ptr
+ieee_part_after (ieee, here)
+ ieee_data_type *ieee;
+ file_ptr here;
+{
+ int part;
+ file_ptr after = ieee->w.r.me_record;
+
+ /* File parts can come in any order, except that module end is
+ guaranteed to be last (and the header first). */
+ for (part = 0; part < N_W_VARIABLES; part++)
+ if (ieee->w.offset[part] > here && after > ieee->w.offset[part])
+ after = ieee->w.offset[part];
+
+ return after;
+}
static unsigned int last_index;
static char last_type; /* is the index for an X or a D */
static ieee_symbol_type *
-get_symbol (abfd,
- ieee,
- last_symbol,
- symbol_count,
- pptr,
- max_index,
- this_type
-)
+get_symbol (abfd, ieee, last_symbol, symbol_count, pptr, max_index, this_type)
bfd *abfd ATTRIBUTE_UNUSED;
ieee_data_type *ieee;
ieee_symbol_type *last_symbol;
unsigned int *symbol_count;
ieee_symbol_type ***pptr;
unsigned int *max_index;
- char this_type
- ;
+ int this_type;
{
/* Need a new symbol */
unsigned int new_index = must_parse_int (&(ieee->h));
if (new_index != last_index || this_type != last_type)
{
- ieee_symbol_type *new_symbol = (ieee_symbol_type *) bfd_alloc (ieee->h.abfd,
- sizeof (ieee_symbol_type));
+ ieee_symbol_type *new_symbol;
+ bfd_size_type amt = sizeof (ieee_symbol_type);
+
+ new_symbol = (ieee_symbol_type *) bfd_alloc (ieee->h.abfd, amt);
if (!new_symbol)
return NULL;
@@ -735,7 +818,7 @@ ieee_slurp_external_symbols (abfd)
last_index = 0xffffff;
ieee->symbol_table_full = true;
- ieee_seek (abfd, offset);
+ ieee_seek (ieee, offset);
while (loop)
{
@@ -777,7 +860,7 @@ ieee_slurp_external_symbols (abfd)
unsigned int symbol_type_index;
unsigned int symbol_attribute_def;
bfd_vma value;
- switch (read_2bytes (ieee))
+ switch (read_2bytes (&ieee->h))
{
case ieee_attribute_record_enum:
symbol_name_index = must_parse_int (&(ieee->h));
@@ -792,7 +875,7 @@ ieee_slurp_external_symbols (abfd)
default:
(*_bfd_error_handler)
(_("%s: unimplemented ATI record %u for symbol %u"),
- bfd_get_filename (abfd), symbol_attribute_def,
+ bfd_archive_filename (abfd), symbol_attribute_def,
symbol_name_index);
bfd_set_error (bfd_error_bad_value);
return false;
@@ -817,7 +900,7 @@ ieee_slurp_external_symbols (abfd)
{
(*_bfd_error_handler)
(_("%s: unexpected ATN type %d in external part"),
- bfd_get_filename (abfd), (int) value);
+ bfd_archive_filename (abfd), (int) value);
bfd_set_error (bfd_error_bad_value);
return false;
}
@@ -829,7 +912,7 @@ ieee_slurp_external_symbols (abfd)
--value;
- switch (read_2bytes (ieee))
+ switch (read_2bytes (&ieee->h))
{
case ieee_asn_record_enum:
parse_int (&ieee->h, &val1);
@@ -839,7 +922,7 @@ ieee_slurp_external_symbols (abfd)
default:
(*_bfd_error_handler)
(_("%s: unexpected type after ATN"),
- bfd_get_filename (abfd));
+ bfd_archive_filename (abfd));
bfd_set_error (bfd_error_bad_value);
return false;
}
@@ -984,7 +1067,7 @@ ieee_slurp_symbol_table (abfd)
return true;
}
-long
+static long
ieee_get_symtab_upper_bound (abfd)
bfd *abfd;
{
@@ -1002,7 +1085,7 @@ symbol index order
extern const bfd_target ieee_vec;
-long
+static long
ieee_get_symtab (abfd, location)
bfd *abfd;
asymbol **location;
@@ -1079,6 +1162,7 @@ get_section_entry (abfd, ieee, index)
{
unsigned int c, i;
asection **n;
+ bfd_size_type amt;
c = ieee->section_table_size;
if (c == 0)
@@ -1086,8 +1170,9 @@ get_section_entry (abfd, ieee, index)
while (c <= index)
c *= 2;
- n = ((asection **)
- bfd_realloc (ieee->section_table, c * sizeof (asection *)));
+ amt = c;
+ amt *= sizeof (asection *);
+ n = (asection **) bfd_realloc (ieee->section_table, amt);
if (n == NULL)
return NULL;
@@ -1100,7 +1185,7 @@ get_section_entry (abfd, ieee, index)
if (ieee->section_table[index] == (asection *) NULL)
{
- char *tmp = bfd_alloc (abfd, 11);
+ char *tmp = bfd_alloc (abfd, (bfd_size_type) 11);
asection *section;
if (!tmp)
@@ -1121,19 +1206,19 @@ ieee_slurp_sections (abfd)
{
ieee_data_type *ieee = IEEE_DATA (abfd);
file_ptr offset = ieee->w.r.section_part;
- asection *section = (asection *) NULL;
char *name;
if (offset != 0)
{
bfd_byte section_type[3];
- ieee_seek (abfd, offset);
+ ieee_seek (ieee, offset);
while (true)
{
switch (this_byte (&(ieee->h)))
{
case ieee_section_type_enum:
{
+ asection *section;
unsigned int section_index;
next_byte (&(ieee->h));
section_index = must_parse_int (&(ieee->h));
@@ -1233,8 +1318,10 @@ ieee_slurp_sections (abfd)
break;
case ieee_e2_first_byte_enum:
{
- ieee_record_enum_type t = (ieee_record_enum_type) (read_2bytes (&(ieee->h)));
+ asection *section;
+ ieee_record_enum_type t;
+ t = (ieee_record_enum_type) (read_2bytes (&(ieee->h)));
switch (t)
{
case ieee_section_size_enum:
@@ -1301,11 +1388,7 @@ ieee_slurp_debug (abfd)
sec->flags |= SEC_DEBUGGING | SEC_HAS_CONTENTS;
sec->filepos = ieee->w.r.debug_information_part;
- debug_end = ieee->w.r.data_part;
- if (debug_end == 0)
- debug_end = ieee->w.r.trailer_part;
- if (debug_end == 0)
- debug_end = ieee->w.r.me_record;
+ debug_end = ieee_part_after (ieee, ieee->w.r.debug_information_part);
sec->_raw_size = debug_end - ieee->w.r.debug_information_part;
return true;
@@ -1325,18 +1408,18 @@ ieee_archive_p (abfd)
file_ptr buffer_offset = 0;
ieee_ar_data_type *save = abfd->tdata.ieee_ar_data;
ieee_ar_data_type *ieee;
- unsigned int alc_elts;
+ bfd_size_type alc_elts;
ieee_ar_obstack_type *elts = NULL;
+ bfd_size_type amt = sizeof (ieee_ar_data_type);
- abfd->tdata.ieee_ar_data =
- (ieee_ar_data_type *) bfd_alloc (abfd, sizeof (ieee_ar_data_type));
+ abfd->tdata.ieee_ar_data = (ieee_ar_data_type *) bfd_alloc (abfd, amt);
if (!abfd->tdata.ieee_ar_data)
goto error_return;
ieee = IEEE_AR_DATA (abfd);
- /* FIXME: Check return value. I'm not sure whether it needs to read
- the entire buffer or not. */
- bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd);
+ /* Ignore the return value here. It doesn't matter if we don't read
+ the entire buffer. We might have a very small ieee file. */
+ bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd);
ieee->h.first_byte = buffer;
ieee->h.input_p = buffer;
@@ -1396,29 +1479,27 @@ ieee_archive_p (abfd)
t->abfd = (bfd *) NULL;
/* Make sure that we don't go over the end of the buffer. */
- if ((size_t) ieee_pos (abfd) > sizeof (buffer) / 2)
+ if ((size_t) ieee_pos (IEEE_DATA (abfd)) > sizeof (buffer) / 2)
{
/* Past half way, reseek and reprime. */
- buffer_offset += ieee_pos (abfd);
+ buffer_offset += ieee_pos (IEEE_DATA (abfd));
if (bfd_seek (abfd, buffer_offset, SEEK_SET) != 0)
goto error_return;
- /* FIXME: Check return value. I'm not sure whether it needs
- to read the entire buffer or not. */
- bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd);
+ /* Again ignore return value of bfd_bread. */
+ bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd);
ieee->h.first_byte = buffer;
ieee->h.input_p = buffer;
}
}
- ieee->elements = ((ieee_ar_obstack_type *)
- bfd_alloc (abfd,
- ieee->element_count * sizeof *ieee->elements));
+ amt = ieee->element_count;
+ amt *= sizeof *ieee->elements;
+ ieee->elements = (ieee_ar_obstack_type *) bfd_alloc (abfd, amt);
if (ieee->elements == NULL)
goto error_return;
- memcpy (ieee->elements, elts,
- ieee->element_count * sizeof *ieee->elements);
+ memcpy (ieee->elements, elts, (size_t) amt);
free (elts);
elts = NULL;
@@ -1428,16 +1509,15 @@ ieee_archive_p (abfd)
if (bfd_seek (abfd, ieee->elements[i].file_offset, SEEK_SET) != 0)
goto error_return;
- /* FIXME: Check return value. I'm not sure whether it needs to
- read the entire buffer or not. */
- bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd);
+ /* Again ignore return value of bfd_bread. */
+ bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd);
ieee->h.first_byte = buffer;
ieee->h.input_p = buffer;
next_byte (&(ieee->h)); /* Drop F8. */
next_byte (&(ieee->h)); /* Drop 14. */
must_parse_int (&(ieee->h)); /* Drop size of block. */
-
+
if (must_parse_int (&(ieee->h)) != 0)
/* This object has been deleted. */
ieee->elements[i].file_offset = 0;
@@ -1461,14 +1541,6 @@ ieee_archive_p (abfd)
return NULL;
}
-static boolean
-ieee_mkobject (abfd)
- bfd *abfd;
-{
- abfd->tdata.ieee_data = (ieee_data_type *) bfd_zalloc (abfd, sizeof (ieee_data_type));
- return abfd->tdata.ieee_data ? true : false;
-}
-
const bfd_target *
ieee_object_p (abfd)
bfd *abfd;
@@ -1478,6 +1550,7 @@ ieee_object_p (abfd)
ieee_data_type *ieee;
unsigned char buffer[300];
ieee_data_type *save = IEEE_DATA (abfd);
+ bfd_size_type amt;
abfd->tdata.ieee_data = 0;
ieee_mkobject (abfd);
@@ -1485,10 +1558,9 @@ ieee_object_p (abfd)
ieee = IEEE_DATA (abfd);
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
goto fail;
- /* Read the first few bytes in to see if it makes sense */
- /* FIXME: Check return value. I'm not sure whether it needs to read
- the entire buffer or not. */
- bfd_read ((PTR) buffer, 1, sizeof (buffer), abfd);
+ /* Read the first few bytes in to see if it makes sense. Ignore
+ bfd_bread return value; The file might be very small. */
+ bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd);
ieee->h.input_p = buffer;
if (this_byte_and_next (&(ieee->h)) != Module_Beginning)
@@ -1509,7 +1581,7 @@ ieee_object_p (abfd)
if (strcmp (processor, "LIBRARY") == 0)
goto got_wrong_format;
ieee->mb.module_name = read_id (&(ieee->h));
- if (abfd->filename == (CONST char *) NULL)
+ if (abfd->filename == (const char *) NULL)
{
abfd->filename = ieee->mb.module_name;
}
@@ -1553,12 +1625,12 @@ ieee_object_p (abfd)
strcpy (family, "68332"); /* Guess it will be CPU32 */
}
}
- else if (toupper (processor[3]) == 'F') /* 68F333 */
- strcpy (family, "68332"); /* CPU32 */
- else if ((toupper (processor[3]) == 'C') /* Embedded controllers */
- && ((toupper (processor[2]) == 'E')
- || (toupper (processor[2]) == 'H')
- || (toupper (processor[2]) == 'L')))
+ else if (TOUPPER (processor[3]) == 'F') /* 68F333 */
+ strcpy (family, "68332"); /* CPU32 */
+ else if ((TOUPPER (processor[3]) == 'C') /* Embedded controllers */
+ && ((TOUPPER (processor[2]) == 'E')
+ || (TOUPPER (processor[2]) == 'H')
+ || (TOUPPER (processor[2]) == 'L')))
{
strcpy (family, "68");
strncat (family, processor + 4, 7);
@@ -1633,16 +1705,17 @@ ieee_object_p (abfd)
quickly. We can work out how big the file is from the trailer
record */
+ amt = ieee->w.r.me_record + 1;
IEEE_DATA (abfd)->h.first_byte =
- (unsigned char *) bfd_alloc (ieee->h.abfd, ieee->w.r.me_record + 1);
+ (unsigned char *) bfd_alloc (ieee->h.abfd, amt);
if (!IEEE_DATA (abfd)->h.first_byte)
goto fail;
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
goto fail;
/* FIXME: Check return value. I'm not sure whether it needs to read
the entire buffer or not. */
- bfd_read ((PTR) (IEEE_DATA (abfd)->h.first_byte), 1,
- ieee->w.r.me_record + 1, abfd);
+ bfd_bread ((PTR) (IEEE_DATA (abfd)->h.first_byte),
+ (bfd_size_type) ieee->w.r.me_record + 1, abfd);
ieee_slurp_sections (abfd);
@@ -1654,7 +1727,7 @@ ieee_object_p (abfd)
if (! ieee_slurp_section_data (abfd))
goto fail;
-
+
return abfd->xvec;
got_wrong_format:
bfd_set_error (bfd_error_wrong_format);
@@ -1664,7 +1737,7 @@ fail:
return (const bfd_target *) NULL;
}
-void
+static void
ieee_get_symbol_info (ignore_abfd, symbol, ret)
bfd *ignore_abfd ATTRIBUTE_UNUSED;
asymbol *symbol;
@@ -1677,9 +1750,9 @@ ieee_get_symbol_info (ignore_abfd, symbol, ret)
ret->type = (symbol->flags & BSF_LOCAL) ? 'a' : 'A';
}
-void
-ieee_print_symbol (ignore_abfd, afile, symbol, how)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
+static void
+ieee_print_symbol (abfd, afile, symbol, how)
+ bfd *abfd;
PTR afile;
asymbol *symbol;
bfd_print_symbol_type how;
@@ -1710,7 +1783,7 @@ ieee_print_symbol (ignore_abfd, afile, symbol, how)
}
else
{
- bfd_print_symbol_vandf ((PTR) file, symbol);
+ bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
fprintf (file, " %-5s %04x %02x %s",
section_name,
@@ -1765,9 +1838,10 @@ do_one (ieee, current_map, location_ptr, s, iterations)
unsigned int extra = 4;
boolean pcrel = false;
asection *section;
- ieee_reloc_type *r =
- (ieee_reloc_type *) bfd_alloc (ieee->h.abfd,
- sizeof (ieee_reloc_type));
+ ieee_reloc_type *r;
+ bfd_size_type amt = sizeof (ieee_reloc_type);
+
+ r = (ieee_reloc_type *) bfd_alloc (ieee->h.abfd, amt);
if (!r)
return false;
@@ -1824,21 +1898,20 @@ do_one (ieee, current_map, location_ptr, s, iterations)
if (pcrel == true)
{
#if KEEPMINUSPCININST
- bfd_put_32 (ieee->h.abfd, -current_map->pc, location_ptr +
- current_map->pc);
+ bfd_put_32 (ieee->h.abfd, -current_map->pc,
+ location_ptr + current_map->pc);
r->relent.howto = &rel32_howto;
- r->relent.addend -=
- current_map->pc;
+ r->relent.addend -= current_map->pc;
#else
- bfd_put_32 (ieee->h.abfd, 0, location_ptr +
+ bfd_put_32 (ieee->h.abfd, (bfd_vma) 0, location_ptr +
current_map->pc);
r->relent.howto = &rel32_howto;
#endif
}
else
{
- bfd_put_32 (ieee->h.abfd, 0, location_ptr +
- current_map->pc);
+ bfd_put_32 (ieee->h.abfd, (bfd_vma) 0,
+ location_ptr + current_map->pc);
r->relent.howto = &abs32_howto;
}
current_map->pc += 4;
@@ -1847,19 +1920,22 @@ do_one (ieee, current_map, location_ptr, s, iterations)
if (pcrel == true)
{
#if KEEPMINUSPCININST
- bfd_put_16 (ieee->h.abfd, (int) (-current_map->pc), location_ptr + current_map->pc);
+ bfd_put_16 (ieee->h.abfd, (bfd_vma) -current_map->pc,
+ location_ptr + current_map->pc);
r->relent.addend -= current_map->pc;
r->relent.howto = &rel16_howto;
#else
- bfd_put_16 (ieee->h.abfd, 0, location_ptr + current_map->pc);
+ bfd_put_16 (ieee->h.abfd, (bfd_vma) 0,
+ location_ptr + current_map->pc);
r->relent.howto = &rel16_howto;
#endif
}
else
{
- bfd_put_16 (ieee->h.abfd, 0, location_ptr + current_map->pc);
+ bfd_put_16 (ieee->h.abfd, (bfd_vma) 0,
+ location_ptr + current_map->pc);
r->relent.howto = &abs16_howto;
}
current_map->pc += 2;
@@ -1934,7 +2010,7 @@ ieee_slurp_section_data (abfd)
if (ieee->read_data == true)
return true;
ieee->read_data = true;
- ieee_seek (abfd, ieee->w.r.data_part);
+ ieee_seek (ieee, ieee->w.r.data_part);
/* Allocate enough space for all the section contents */
@@ -1983,7 +2059,7 @@ ieee_slurp_section_data (abfd)
unsigned int extra;
boolean pcrel;
next_byte (&(ieee->h));
- must_parse_int (&(ieee->h)); /* Thow away section #*/
+ must_parse_int (&(ieee->h)); /* Throw away section #*/
parse_expression (ieee, &value,
&symbol,
&pcrel, &extra,
@@ -2036,7 +2112,7 @@ ieee_slurp_section_data (abfd)
{
ieee->h.input_p = start;
if (!do_one (ieee, current_map, location_ptr, s,
- iterations))
+ (int) iterations))
return false;
iterations--;
}
@@ -2053,13 +2129,13 @@ ieee_slurp_section_data (abfd)
}
}
-boolean
+static boolean
ieee_new_section_hook (abfd, newsect)
bfd *abfd;
asection *newsect;
{
newsect->used_by_bfd = (PTR)
- bfd_alloc (abfd, sizeof (ieee_per_section_type));
+ bfd_alloc (abfd, (bfd_size_type) sizeof (ieee_per_section_type));
if (!newsect->used_by_bfd)
return false;
ieee_per_section (newsect)->data = (bfd_byte *) NULL;
@@ -2067,7 +2143,7 @@ ieee_new_section_hook (abfd, newsect)
return true;
}
-long
+static long
ieee_get_reloc_upper_bound (abfd, asect)
bfd *abfd;
sec_ptr asect;
@@ -2096,7 +2172,7 @@ ieee_get_section_contents (abfd, section, location, offset, count)
return true;
}
-long
+static long
ieee_canonicalize_reloc (abfd, section, relptr, symbols)
bfd *abfd;
sec_ptr section;
@@ -2141,8 +2217,8 @@ ieee_canonicalize_reloc (abfd, section, relptr, symbols)
static int
comp (ap, bp)
- CONST PTR ap;
- CONST PTR bp;
+ const PTR ap;
+ const PTR bp;
{
arelent *a = *((arelent **) ap);
arelent *b = *((arelent **) bp);
@@ -2215,7 +2291,7 @@ ieee_write_section_part (abfd)
|| ! ieee_write_byte (abfd,
(bfd_byte) (s->index
+ IEEE_SECTION_NUMBER_BASE))
- || ! ieee_write_int (abfd, 1 << s->alignment_power))
+ || ! ieee_write_int (abfd, (bfd_vma) 1 << s->alignment_power))
return false;
/* Size */
@@ -2269,6 +2345,7 @@ do_with_relocs (abfd, s)
|| ! ieee_write_byte (abfd,
(bfd_byte) (s->index + IEEE_SECTION_NUMBER_BASE)))
return false;
+
if ((abfd->flags & EXEC_P) != 0 && relocs_to_go == 0)
{
if (! ieee_write_int (abfd, s->lma))
@@ -2276,7 +2353,7 @@ do_with_relocs (abfd, s)
}
else
{
- if (! ieee_write_expression (abfd, 0, s->symbol, 0, 0))
+ if (! ieee_write_expression (abfd, (bfd_vma) 0, s->symbol, 0, 0))
return false;
}
@@ -2302,10 +2379,7 @@ do_with_relocs (abfd, s)
/* Output a stream of bytes */
if (! ieee_write_int (abfd, run))
return false;
- if (bfd_write ((PTR) (stream + current_byte_index),
- 1,
- run,
- abfd)
+ if (bfd_bwrite ((PTR) (stream + current_byte_index), run, abfd)
!= run)
return false;
current_byte_index += run;
@@ -2353,10 +2427,7 @@ do_with_relocs (abfd, s)
/* Output a stream of bytes */
if (! ieee_write_int (abfd, run))
return false;
- if (bfd_write ((PTR) (stream + current_byte_index),
- 1,
- run,
- abfd)
+ if (bfd_bwrite ((PTR) (stream + current_byte_index), run, abfd)
!= run)
return false;
current_byte_index += run;
@@ -2418,7 +2489,7 @@ do_with_relocs (abfd, s)
if (! ieee_write_expression (abfd, r->addend + ov,
*(r->sym_ptr_ptr),
r->howto->pc_relative,
- s->index))
+ (unsigned) s->index))
return false;
}
else
@@ -2426,15 +2497,15 @@ do_with_relocs (abfd, s)
if (! ieee_write_expression (abfd, r->addend + ov,
(asymbol *) NULL,
r->howto->pc_relative,
- s->index))
+ (unsigned) s->index))
return false;
}
if (number_of_maus_in_address
!= bfd_get_reloc_size (r->howto))
{
- if (! ieee_write_int (abfd,
- bfd_get_reloc_size (r->howto)))
+ bfd_vma rsize = bfd_get_reloc_size (r->howto);
+ if (! ieee_write_int (abfd, rsize))
return false;
}
if (! ieee_write_byte (abfd,
@@ -2471,9 +2542,21 @@ do_as_repeat (abfd, s)
|| ! ieee_write_byte (abfd, ieee_set_current_pc_enum & 0xff)
|| ! ieee_write_byte (abfd,
(bfd_byte) (s->index
- + IEEE_SECTION_NUMBER_BASE))
- || ! ieee_write_int (abfd, s->lma)
- || ! ieee_write_byte (abfd, ieee_repeat_data_enum)
+ + IEEE_SECTION_NUMBER_BASE)))
+ return false;
+
+ if ((abfd->flags & EXEC_P) != 0)
+ {
+ if (! ieee_write_int (abfd, s->lma))
+ return false;
+ }
+ else
+ {
+ if (! ieee_write_expression (abfd, (bfd_vma) 0, s->symbol, 0, 0))
+ return false;
+ }
+
+ if (! ieee_write_byte (abfd, ieee_repeat_data_enum)
|| ! ieee_write_int (abfd, s->_raw_size)
|| ! ieee_write_byte (abfd, ieee_load_constant_bytes_enum)
|| ! ieee_write_byte (abfd, 1)
@@ -2526,20 +2609,41 @@ static bfd *input_bfd;
static bfd *output_bfd;
static int output_buffer;
+static boolean
+ieee_mkobject (abfd)
+ bfd *abfd;
+{
+ bfd_size_type amt;
+
+ output_ptr_start = NULL;
+ output_ptr = NULL;
+ output_ptr_end = NULL;
+ input_ptr_start = NULL;
+ input_ptr = NULL;
+ input_ptr_end = NULL;
+ input_bfd = NULL;
+ output_bfd = NULL;
+ output_buffer = 0;
+ amt = sizeof (ieee_data_type);
+ abfd->tdata.ieee_data = (ieee_data_type *) bfd_zalloc (abfd, amt);
+ return abfd->tdata.ieee_data ? true : false;
+}
+
static void
fill ()
{
+ bfd_size_type amt = input_ptr_end - input_ptr_start;
/* FIXME: Check return value. I'm not sure whether it needs to read
the entire buffer or not. */
- bfd_read ((PTR) input_ptr_start, 1, input_ptr_end - input_ptr_start, input_bfd);
+ bfd_bread ((PTR) input_ptr_start, amt, input_bfd);
input_ptr = input_ptr_start;
}
+
static void
flush ()
{
- if (bfd_write ((PTR) (output_ptr_start), 1, output_ptr - output_ptr_start,
- output_bfd)
- != (bfd_size_type) (output_ptr - output_ptr_start))
+ bfd_size_type amt = output_ptr - output_ptr_start;
+ if (bfd_bwrite ((PTR) (output_ptr_start), amt, output_bfd) != amt)
abort ();
output_ptr = output_ptr_start;
output_buffer++;
@@ -2614,7 +2718,7 @@ copy_expression ()
{
int stack[10];
int *tos = stack;
- int value = 0;
+ int value;
while (1)
{
switch (THIS ())
@@ -2668,16 +2772,13 @@ copy_expression ()
}
*tos++ = THIS ();
NEXT ();
- value = 0;
break;
case 0xa5:
/* PLUS anything */
- {
- int value = *(--tos);
- value += *(--tos);
- *tos++ = value;
- NEXT ();
- }
+ value = *(--tos);
+ value += *(--tos);
+ *tos++ = value;
+ NEXT ();
break;
case VAR ('R'):
{
@@ -2690,17 +2791,11 @@ copy_expression ()
NEXT ();
ieee = IEEE_DATA (input_bfd);
s = ieee->section_table[section_number];
+ value = 0;
if (s->output_section)
- {
- value = s->output_section->lma;
- }
- else
- {
- value = 0;
- }
+ value = s->output_section->lma;
value += s->output_offset;
*tos++ = value;
- value = 0;
}
break;
case 0x90:
@@ -2709,22 +2804,14 @@ copy_expression ()
write_int (*(--tos));
OUT (0x90);
return;
-
}
}
}
-
}
/* Drop the int in the buffer, and copy a null into the gap, which we
will overwrite later */
-struct output_buffer_struct
-{
- unsigned char *ptrp;
- int buffer;
-};
-
static void
fill_int (buf)
struct output_buffer_struct *buf;
@@ -2812,7 +2899,6 @@ copy_int ()
#define ID copy_id()
#define INT copy_int()
#define EXP copy_expression()
-static void copy_till_end ();
#define INTn(q) copy_int()
#define EXPn(q) copy_expression()
@@ -2978,7 +3064,6 @@ f2_record ()
}
-static void block ();
static void
f8_record ()
{
@@ -3189,7 +3274,7 @@ relocate_debug (output, input)
input_bfd = input;
/* FIXME: Check return value. I'm not sure whether it needs to read
the entire buffer or not. */
- bfd_read ((PTR) input_ptr_start, 1, IBS, input);
+ bfd_bread ((PTR) input_ptr_start, (bfd_size_type) IBS, input);
block ();
}
@@ -3202,13 +3287,13 @@ ieee_write_debug_part (abfd)
{
ieee_data_type *ieee = IEEE_DATA (abfd);
bfd_chain_type *chain = ieee->chain_root;
- unsigned char output_buffer[OBS];
+ unsigned char obuff[OBS];
boolean some_debug = false;
file_ptr here = bfd_tell (abfd);
- output_ptr_start = output_ptr = output_buffer;
- output_ptr_end = output_buffer + OBS;
- output_ptr = output_buffer;
+ output_ptr_start = output_ptr = obuff;
+ output_ptr_end = obuff + OBS;
+ output_ptr = obuff;
output_bfd = abfd;
if (chain == (bfd_chain_type *) NULL)
@@ -3225,7 +3310,7 @@ ieee_write_debug_part (abfd)
}
ieee->w.r.debug_information_part = here;
- if (bfd_write (s->contents, 1, s->_raw_size, abfd) != s->_raw_size)
+ if (bfd_bwrite (s->contents, s->_raw_size, abfd) != s->_raw_size)
return false;
}
else
@@ -3237,8 +3322,7 @@ ieee_write_debug_part (abfd)
if (entry_ieee->w.r.debug_information_part)
{
if (bfd_seek (entry, entry_ieee->w.r.debug_information_part,
- SEEK_SET)
- != 0)
+ SEEK_SET) != 0)
return false;
relocate_debug (abfd, entry);
}
@@ -3305,7 +3389,8 @@ init_for_output (abfd)
continue;
if (s->_raw_size != 0)
{
- ieee_per_section (s)->data = (bfd_byte *) (bfd_alloc (abfd, s->_raw_size));
+ bfd_size_type size = s->_raw_size;
+ ieee_per_section (s)->data = (bfd_byte *) (bfd_alloc (abfd, size));
if (!ieee_per_section (s)->data)
return false;
}
@@ -3318,7 +3403,7 @@ init_for_output (abfd)
/* set section contents is complicated with IEEE since the format is
* not a byte image, but a record stream.
*/
-boolean
+static boolean
ieee_set_section_contents (abfd, section, location, offset, count)
bfd *abfd;
sec_ptr section;
@@ -3330,14 +3415,14 @@ ieee_set_section_contents (abfd, section, location, offset, count)
{
if (section->contents == NULL)
{
- section->contents = ((unsigned char *)
- bfd_alloc (abfd, section->_raw_size));
+ bfd_size_type size = section->_raw_size;
+ section->contents = (unsigned char *) bfd_alloc (abfd, size);
if (section->contents == NULL)
return false;
}
/* bfd_set_section_contents has already checked that everything
is within range. */
- memcpy (section->contents + offset, location, count);
+ memcpy (section->contents + offset, location, (size_t) count);
return true;
}
@@ -3378,7 +3463,7 @@ ieee_write_external_part (abfd)
{
/* This must be a symbol reference .. */
if (! ieee_write_byte (abfd, ieee_external_reference_enum)
- || ! ieee_write_int (abfd, reference_index)
+ || ! ieee_write_int (abfd, (bfd_vma) reference_index)
|| ! ieee_write_id (abfd, p->name))
return false;
p->value = reference_index;
@@ -3389,11 +3474,11 @@ ieee_write_external_part (abfd)
{
/* This is a weak reference */
if (! ieee_write_byte (abfd, ieee_external_reference_enum)
- || ! ieee_write_int (abfd, reference_index)
+ || ! ieee_write_int (abfd, (bfd_vma) reference_index)
|| ! ieee_write_id (abfd, p->name)
|| ! ieee_write_byte (abfd,
ieee_weak_external_reference_enum)
- || ! ieee_write_int (abfd, reference_index)
+ || ! ieee_write_int (abfd, (bfd_vma) reference_index)
|| ! ieee_write_int (abfd, p->value))
return false;
p->value = reference_index;
@@ -3405,10 +3490,10 @@ ieee_write_external_part (abfd)
/* This must be a symbol definition */
if (! ieee_write_byte (abfd, ieee_external_symbol_enum)
- || ! ieee_write_int (abfd, public_index)
+ || ! ieee_write_int (abfd, (bfd_vma) public_index)
|| ! ieee_write_id (abfd, p->name)
|| ! ieee_write_2bytes (abfd, ieee_attribute_record_enum)
- || ! ieee_write_int (abfd, public_index)
+ || ! ieee_write_int (abfd, (bfd_vma) public_index)
|| ! ieee_write_byte (abfd, 15) /* instruction address */
|| ! ieee_write_byte (abfd, 19) /* static symbol */
|| ! ieee_write_byte (abfd, 1)) /* one of them */
@@ -3416,7 +3501,7 @@ ieee_write_external_part (abfd)
/* Write out the value */
if (! ieee_write_2bytes (abfd, ieee_value_record_enum)
- || ! ieee_write_int (abfd, public_index))
+ || ! ieee_write_int (abfd, (bfd_vma) public_index))
return false;
if (! bfd_is_abs_section (p->section))
{
@@ -3467,7 +3552,7 @@ ieee_write_external_part (abfd)
}
-static CONST unsigned char exten[] =
+static const unsigned char exten[] =
{
0xf0, 0x20, 0x00,
0xf1, 0xce, 0x20, 0x00, 37, 3, 3, /* Set version 3 rev 3 */
@@ -3475,7 +3560,7 @@ static CONST unsigned char exten[] =
0xf1, 0xce, 0x20, 0x00, 38 /* set object type relocateable to x */
};
-static CONST unsigned char envi[] =
+static const unsigned char envi[] =
{
0xf0, 0x21, 0x00,
@@ -3597,7 +3682,7 @@ ieee_write_processor (abfd)
return true;
}
-boolean
+static boolean
ieee_write_object_contents (abfd)
bfd *abfd;
{
@@ -3632,7 +3717,8 @@ ieee_write_object_contents (abfd)
return false;
ieee->w.r.extension_record = bfd_tell (abfd);
- if (bfd_write ((char *) exten, 1, sizeof (exten), abfd) != sizeof (exten))
+ if (bfd_bwrite ((char *) exten, (bfd_size_type) sizeof (exten), abfd)
+ != sizeof (exten))
return false;
if (abfd->flags & EXEC_P)
{
@@ -3646,7 +3732,8 @@ ieee_write_object_contents (abfd)
}
ieee->w.r.environmental_record = bfd_tell (abfd);
- if (bfd_write ((char *) envi, 1, sizeof (envi), abfd) != sizeof (envi))
+ if (bfd_bwrite ((char *) envi, (bfd_size_type) sizeof (envi), abfd)
+ != sizeof (envi))
return false;
/* The HP emulator database requires a timestamp in the file. */
@@ -3660,12 +3747,12 @@ ieee_write_object_contents (abfd)
|| ! ieee_write_byte (abfd, 0x21)
|| ! ieee_write_byte (abfd, 0)
|| ! ieee_write_byte (abfd, 50)
- || ! ieee_write_int (abfd, t->tm_year + 1900)
- || ! ieee_write_int (abfd, t->tm_mon + 1)
- || ! ieee_write_int (abfd, t->tm_mday)
- || ! ieee_write_int (abfd, t->tm_hour)
- || ! ieee_write_int (abfd, t->tm_min)
- || ! ieee_write_int (abfd, t->tm_sec))
+ || ! ieee_write_int (abfd, (bfd_vma) (t->tm_year + 1900))
+ || ! ieee_write_int (abfd, (bfd_vma) (t->tm_mon + 1))
+ || ! ieee_write_int (abfd, (bfd_vma) t->tm_mday)
+ || ! ieee_write_int (abfd, (bfd_vma) t->tm_hour)
+ || ! ieee_write_int (abfd, (bfd_vma) t->tm_min)
+ || ! ieee_write_int (abfd, (bfd_vma) t->tm_sec))
return false;
}
@@ -3707,7 +3794,7 @@ ieee_write_object_contents (abfd)
{
if (! ieee_write_2bytes (abfd, ieee_assign_value_to_variable_enum)
|| ! ieee_write_byte (abfd, (bfd_byte) i)
- || ! ieee_write_int5_out (abfd, ieee->w.offset[i]))
+ || ! ieee_write_int5_out (abfd, (bfd_vma) ieee->w.offset[i]))
return false;
}
@@ -3720,12 +3807,12 @@ ieee_write_object_contents (abfd)
function exits. We read the strings into a buffer large enough to
hold them all plus all the cached symbol entries. */
-asymbol *
+static asymbol *
ieee_make_empty_symbol (abfd)
bfd *abfd;
{
- ieee_symbol_type *new =
- (ieee_symbol_type *) bfd_zalloc (abfd, sizeof (ieee_symbol_type));
+ bfd_size_type amt = sizeof (ieee_symbol_type);
+ ieee_symbol_type *new = (ieee_symbol_type *) bfd_zalloc (abfd, amt);
if (!new)
return NULL;
new->symbol.the_bfd = abfd;
@@ -3770,13 +3857,8 @@ ieee_openr_next_archived_file (arch, prev)
}
static boolean
-ieee_find_nearest_line (abfd,
- section,
- symbols,
- offset,
- filename_ptr,
- functionname_ptr,
- line_ptr)
+ieee_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
+ functionname_ptr, line_ptr)
bfd *abfd ATTRIBUTE_UNUSED;
asection *section ATTRIBUTE_UNUSED;
asymbol **symbols ATTRIBUTE_UNUSED;
@@ -3872,7 +3954,8 @@ ieee_bfd_debug_info_accumulate (abfd, section)
/* Add to chain */
{
- bfd_chain_type *n = (bfd_chain_type *) bfd_alloc (abfd, sizeof (bfd_chain_type));
+ bfd_size_type amt = sizeof (bfd_chain_type);
+ bfd_chain_type *n = (bfd_chain_type *) bfd_alloc (abfd, amt);
if (!n)
abort (); /* FIXME */
n->this = section->owner;
@@ -3926,6 +4009,7 @@ ieee_bfd_debug_info_accumulate (abfd, section)
bfd_generic_get_relocated_section_contents
#define ieee_bfd_relax_section bfd_generic_relax_section
#define ieee_bfd_gc_sections bfd_generic_gc_sections
+#define ieee_bfd_merge_sections bfd_generic_merge_sections
#define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define ieee_bfd_final_link _bfd_generic_final_link
@@ -3971,17 +4055,43 @@ const bfd_target ieee_vec =
bfd_false,
},
+ /* ieee_close_and_cleanup, ieee_bfd_free_cached_info, ieee_new_section_hook,
+ ieee_get_section_contents, ieee_get_section_contents_in_window */
BFD_JUMP_TABLE_GENERIC (ieee),
+
BFD_JUMP_TABLE_COPY (_bfd_generic),
BFD_JUMP_TABLE_CORE (_bfd_nocore),
+
+ /* ieee_slurp_armap, ieee_slurp_extended_name_table,
+ ieee_construct_extended_name_table, ieee_truncate_arname,
+ ieee_write_armap, ieee_read_ar_hdr, ieee_openr_next_archived_file,
+ ieee_get_elt_at_index, ieee_generic_stat_arch_elt,
+ ieee_update_armap_timestamp */
BFD_JUMP_TABLE_ARCHIVE (ieee),
+
+ /* ieee_get_symtab_upper_bound, ieee_get_symtab, ieee_make_empty_symbol,
+ ieee_print_symbol, ieee_get_symbol_info, ieee_bfd_is_local_label_name,
+ ieee_get_lineno, ieee_find_nearest_line, ieee_bfd_make_debug_symbol,
+ ieee_read_minisymbols, ieee_minisymbol_to_symbol */
BFD_JUMP_TABLE_SYMBOLS (ieee),
+
+ /* ieee_get_reloc_upper_bound, ieee_canonicalize_reloc,
+ ieee_bfd_reloc_type_lookup */
BFD_JUMP_TABLE_RELOCS (ieee),
+
+ /* ieee_set_arch_mach, ieee_set_section_contents */
BFD_JUMP_TABLE_WRITE (ieee),
+
+ /* ieee_sizeof_headers, ieee_bfd_get_relocated_section_contents,
+ ieee_bfd_relax_section, ieee_bfd_link_hash_table_create,
+ ieee_bfd_link_add_symbols, ieee_bfd_final_link,
+ ieee_bfd_link_split_section, ieee_bfd_gc_sections,
+ ieee_bfd_merge_sections */
BFD_JUMP_TABLE_LINK (ieee),
+
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
-
+
(PTR) 0
};
diff --git a/contrib/binutils/bfd/ihex.c b/contrib/binutils/bfd/ihex.c
index 738da81..8bb5134 100644
--- a/contrib/binutils/bfd/ihex.c
+++ b/contrib/binutils/bfd/ihex.c
@@ -1,5 +1,6 @@
/* BFD back-end for Intel Hex objects.
- Copyright 1995, 1996, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002
+ Free Software Foundation, Inc.
Written by Ian Lance Taylor of Cygnus Support <ian@cygnus.com>.
This file is part of BFD, the Binary File Descriptor library.
@@ -122,8 +123,7 @@ The MRI compiler uses this, which is a repeat of type 5:
#include "sysdep.h"
#include "libbfd.h"
#include "libiberty.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
static void ihex_init PARAMS ((void));
static boolean ihex_mkobject PARAMS ((bfd *));
@@ -137,9 +137,8 @@ static boolean ihex_get_section_contents
static boolean ihex_set_section_contents
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
static boolean ihex_write_record
- PARAMS ((bfd *, bfd_size_type, bfd_vma, unsigned int, bfd_byte *));
+ PARAMS ((bfd *, size_t, unsigned int, unsigned int, bfd_byte *));
static boolean ihex_write_object_contents PARAMS ((bfd *));
-static asymbol *ihex_make_empty_symbol PARAMS ((bfd *));
static boolean ihex_set_arch_mach
PARAMS ((bfd *, enum bfd_architecture, unsigned long));
static int ihex_sizeof_headers PARAMS ((bfd *, boolean));
@@ -197,9 +196,9 @@ ihex_mkobject (abfd)
if (abfd->tdata.ihex_data == NULL)
{
struct ihex_data_struct *tdata;
+ bfd_size_type amt = sizeof (struct ihex_data_struct);
- tdata = ((struct ihex_data_struct *)
- bfd_alloc (abfd, sizeof (struct ihex_data_struct)));
+ tdata = (struct ihex_data_struct *) bfd_alloc (abfd, amt);
if (tdata == NULL)
return false;
abfd->tdata.ihex_data = tdata;
@@ -220,7 +219,7 @@ ihex_get_byte (abfd, errorptr)
{
bfd_byte c;
- if (bfd_read (&c, 1, 1, abfd) != 1)
+ if (bfd_bread (&c, (bfd_size_type) 1, abfd) != 1)
{
if (bfd_get_error () != bfd_error_file_truncated)
*errorptr = true;
@@ -248,7 +247,7 @@ ihex_bad_byte (abfd, lineno, c, error)
{
char buf[10];
- if (! isprint (c))
+ if (! ISPRINT (c))
sprintf (buf, "\\%03o", (unsigned int) c);
else
{
@@ -257,7 +256,7 @@ ihex_bad_byte (abfd, lineno, c, error)
}
(*_bfd_error_handler)
(_("%s:%d: unexpected character `%s' in Intel Hex file\n"),
- bfd_get_filename (abfd), lineno, buf);
+ bfd_archive_filename (abfd), lineno, buf);
bfd_set_error (bfd_error_bad_value);
}
}
@@ -272,7 +271,7 @@ ihex_scan (abfd)
bfd_vma segbase;
bfd_vma extbase;
asection *sec;
- int lineno;
+ unsigned int lineno;
boolean error;
bfd_byte *buf = NULL;
size_t bufsize;
@@ -320,7 +319,7 @@ ihex_scan (abfd)
/* Read the header bytes. */
- if (bfd_read (hdr, 1, 8, abfd) != 8)
+ if (bfd_bread (hdr, (bfd_size_type) 8, abfd) != 8)
goto error_return;
for (i = 0; i < 8; i++)
@@ -341,13 +340,13 @@ ihex_scan (abfd)
chars = len * 2 + 2;
if (chars >= bufsize)
{
- buf = (bfd_byte *) bfd_realloc (buf, chars);
+ buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) chars);
if (buf == NULL)
goto error_return;
bufsize = chars;
}
- if (bfd_read (buf, 1, chars, abfd) != chars)
+ if (bfd_bread (buf, (bfd_size_type) chars, abfd) != chars)
goto error_return;
for (i = 0; i < chars; i++)
@@ -366,8 +365,8 @@ ihex_scan (abfd)
if (((- chksum) & 0xff) != (unsigned int) HEX2 (buf + 2 * i))
{
(*_bfd_error_handler)
- (_("%s:%d: bad checksum in Intel Hex file (expected %u, found %u)"),
- bfd_get_filename (abfd), lineno,
+ (_("%s:%u: bad checksum in Intel Hex file (expected %u, found %u)"),
+ bfd_archive_filename (abfd), lineno,
(- chksum) & 0xff, (unsigned int) HEX2 (buf + 2 * i));
bfd_set_error (bfd_error_bad_value);
goto error_return;
@@ -388,9 +387,11 @@ ihex_scan (abfd)
{
char secbuf[20];
char *secname;
+ bfd_size_type amt;
sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
- secname = (char *) bfd_alloc (abfd, strlen (secbuf) + 1);
+ amt = strlen (secbuf) + 1;
+ secname = (char *) bfd_alloc (abfd, amt);
if (secname == NULL)
goto error_return;
strcpy (secname, secbuf);
@@ -418,8 +419,8 @@ ihex_scan (abfd)
if (len != 2)
{
(*_bfd_error_handler)
- (_("%s:%d: bad extended address record length in Intel Hex file"),
- bfd_get_filename (abfd), lineno);
+ (_("%s:%u: bad extended address record length in Intel Hex file"),
+ bfd_archive_filename (abfd), lineno);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -435,8 +436,8 @@ ihex_scan (abfd)
if (len != 4)
{
(*_bfd_error_handler)
- (_("%s:%d: bad extended start address length in Intel Hex file"),
- bfd_get_filename (abfd), lineno);
+ (_("%s:%u: bad extended start address length in Intel Hex file"),
+ bfd_archive_filename (abfd), lineno);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -452,8 +453,8 @@ ihex_scan (abfd)
if (len != 2)
{
(*_bfd_error_handler)
- (_("%s:%d: bad extended linear address record length in Intel Hex file"),
- bfd_get_filename (abfd), lineno);
+ (_("%s:%u: bad extended linear address record length in Intel Hex file"),
+ bfd_archive_filename (abfd), lineno);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -469,8 +470,8 @@ ihex_scan (abfd)
if (len != 2 && len != 4)
{
(*_bfd_error_handler)
- (_("%s:%d: bad extended linear start address length in Intel Hex file"),
- bfd_get_filename (abfd), lineno);
+ (_("%s:%u: bad extended linear start address length in Intel Hex file"),
+ bfd_archive_filename (abfd), lineno);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -486,8 +487,8 @@ ihex_scan (abfd)
default:
(*_bfd_error_handler)
- (_("%s:%d: unrecognized ihex type %u in Intel Hex file\n"),
- bfd_get_filename (abfd), lineno, type);
+ (_("%s:%u: unrecognized ihex type %u in Intel Hex file\n"),
+ bfd_archive_filename (abfd), lineno, type);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -522,7 +523,7 @@ ihex_object_p (abfd)
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
return NULL;
- if (bfd_read (b, 1, 9, abfd) != 9)
+ if (bfd_bread (b, (bfd_size_type) 9, abfd) != 9)
{
if (bfd_get_error () == bfd_error_file_truncated)
bfd_set_error (bfd_error_wrong_format);
@@ -595,7 +596,7 @@ ihex_read_section (abfd, section, contents)
know the exact format. */
BFD_ASSERT (c == ':');
- if (bfd_read (hdr, 1, 8, abfd) != 8)
+ if (bfd_bread (hdr, (bfd_size_type) 8, abfd) != 8)
goto error_return;
len = HEX2 (hdr);
@@ -607,20 +608,20 @@ ihex_read_section (abfd, section, contents)
{
(*_bfd_error_handler)
(_("%s: internal error in ihex_read_section"),
- bfd_get_filename (abfd));
+ bfd_archive_filename (abfd));
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
if (len * 2 > bufsize)
{
- buf = (bfd_byte *) bfd_realloc (buf, len * 2);
+ buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) len * 2);
if (buf == NULL)
goto error_return;
bufsize = len * 2;
}
- if (bfd_read (buf, 1, len * 2, abfd) != len * 2)
+ if (bfd_bread (buf, (bfd_size_type) len * 2, abfd) != len * 2)
goto error_return;
for (i = 0; i < len; i++)
@@ -634,7 +635,7 @@ ihex_read_section (abfd, section, contents)
}
/* Skip the checksum. */
- if (bfd_read (buf, 1, 2, abfd) != 2)
+ if (bfd_bread (buf, (bfd_size_type) 2, abfd) != 2)
goto error_return;
}
@@ -642,7 +643,7 @@ ihex_read_section (abfd, section, contents)
{
(*_bfd_error_handler)
(_("%s: bad section length in ihex_read_section"),
- bfd_get_filename (abfd));
+ bfd_archive_filename (abfd));
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -696,14 +697,15 @@ ihex_set_section_contents (abfd, section, location, offset, count)
struct ihex_data_list *n;
bfd_byte *data;
struct ihex_data_struct *tdata;
+ bfd_size_type amt;
if (count == 0
|| (section->flags & SEC_ALLOC) == 0
|| (section->flags & SEC_LOAD) == 0)
return true;
- n = ((struct ihex_data_list *)
- bfd_alloc (abfd, sizeof (struct ihex_data_list)));
+ amt = sizeof (struct ihex_data_list);
+ n = (struct ihex_data_list *) bfd_alloc (abfd, amt);
if (n == NULL)
return false;
@@ -748,8 +750,8 @@ ihex_set_section_contents (abfd, section, location, offset, count)
static boolean
ihex_write_record (abfd, count, addr, type, data)
bfd *abfd;
- bfd_size_type count;
- bfd_vma addr;
+ size_t count;
+ unsigned int addr;
unsigned int type;
bfd_byte *data;
{
@@ -758,6 +760,7 @@ ihex_write_record (abfd, count, addr, type, data)
char *p;
unsigned int chksum;
unsigned int i;
+ size_t total;
#define TOHEX(buf, v) \
((buf)[0] = digs[((v) >> 4) & 0xf], (buf)[1] = digs[(v) & 0xf])
@@ -780,7 +783,8 @@ ihex_write_record (abfd, count, addr, type, data)
p[2] = '\r';
p[3] = '\n';
- if (bfd_write (buf, 1, 9 + count * 2 + 4, abfd) != 9 + count * 2 + 4)
+ total = 9 + count * 2 + 4;
+ if (bfd_bwrite (buf, (bfd_size_type) total, abfd) != total)
return false;
return true;
@@ -809,10 +813,11 @@ ihex_write_object_contents (abfd)
count = l->size;
while (count > 0)
{
- bfd_size_type now;
+ size_t now;
+ unsigned int rec_addr;
now = count;
- if (now > CHUNK)
+ if (count > CHUNK)
now = CHUNK;
if (where > segbase + extbase + 0xffff)
@@ -867,8 +872,8 @@ ihex_write_object_contents (abfd)
}
}
- if (! ihex_write_record (abfd, now, where - (extbase + segbase),
- 0, p))
+ rec_addr = where - (extbase + segbase);
+ if (! ihex_write_record (abfd, now, rec_addr, 0, p))
return false;
where += now;
@@ -910,21 +915,6 @@ ihex_write_object_contents (abfd)
return true;
}
-/* Make an empty symbol. This is required only because
- bfd_make_section_anyway wants to create a symbol for the section. */
-
-static asymbol *
-ihex_make_empty_symbol (abfd)
- bfd *abfd;
-{
- asymbol *new;
-
- new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol));
- if (new != NULL)
- new->the_bfd = abfd;
- return new;
-}
-
/* Set the architecture for the output file. The architecture is
irrelevant, so we ignore errors about unknown architectures. */
@@ -964,6 +954,7 @@ ihex_sizeof_headers (abfd, exec)
#define ihex_get_symtab_upper_bound bfd_0l
#define ihex_get_symtab \
((long (*) PARAMS ((bfd *, asymbol **))) bfd_0l)
+#define ihex_make_empty_symbol _bfd_generic_make_empty_symbol
#define ihex_print_symbol _bfd_nosymbols_print_symbol
#define ihex_get_symbol_info _bfd_nosymbols_get_symbol_info
#define ihex_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name
@@ -983,6 +974,7 @@ ihex_sizeof_headers (abfd, exec)
bfd_generic_get_relocated_section_contents
#define ihex_bfd_relax_section bfd_generic_relax_section
#define ihex_bfd_gc_sections bfd_generic_gc_sections
+#define ihex_bfd_merge_sections bfd_generic_merge_sections
#define ihex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ihex_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define ihex_bfd_final_link _bfd_generic_final_link
@@ -1038,6 +1030,6 @@ const bfd_target ihex_vec =
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
-
+
(PTR) 0
};
diff --git a/contrib/binutils/bfd/libaout.h b/contrib/binutils/bfd/libaout.h
index b3efdce..d7e5c71 100644
--- a/contrib/binutils/bfd/libaout.h
+++ b/contrib/binutils/bfd/libaout.h
@@ -29,27 +29,94 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfdlink.h"
+/* Macros for accessing components in an aout header. Saves cluttering
+ the source with (bfd_vma) and (bfd_byte *) casts. */
+
+#define H_PUT_64(abfd, val, where) \
+ bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_32(abfd, val, where) \
+ bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_16(abfd, val, where) \
+ bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_8 bfd_h_put_8
+
+#define H_PUT_S64(abfd, val, where) \
+ bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_S32(abfd, val, where) \
+ bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_S16(abfd, val, where) \
+ bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+
+#define H_PUT_S8 bfd_h_put_signed_8
+
+#define H_GET_64(abfd, where) \
+ bfd_h_get_64 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_32(abfd, where) \
+ bfd_h_get_32 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_16(abfd, where) \
+ bfd_h_get_16 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_8 bfd_h_get_8
+
+#define H_GET_S64(abfd, where) \
+ bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_S32(abfd, where) \
+ bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_S16(abfd, where) \
+ bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where))
+
+#define H_GET_S8 bfd_h_get_signed_8
+
/* Parameterize the a.out code based on whether it is being built
for a 32-bit architecture or a 64-bit architecture. */
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
#if ARCH_SIZE==64
-#define GET_WORD bfd_h_get_64
-#define GET_SWORD bfd_h_get_signed_64
-#define PUT_WORD bfd_h_put_64
+#define GET_WORD H_GET_64
+#define GET_SWORD H_GET_S64
+#define GET_MAGIC H_GET_32
+#define PUT_WORD H_PUT_64
+#define PUT_MAGIC H_PUT_32
#ifndef NAME
-#define NAME(x,y) CAT3(x,_64_,y)
+#define NAME(x,y) CONCAT3 (x,_64_,y)
#endif
-#define JNAME(x) CAT(x,_64)
+#define JNAME(x) CONCAT2 (x,_64)
#define BYTES_IN_WORD 8
+#else
+#if ARCH_SIZE==16
+#define GET_WORD H_GET_16
+#define GET_SWORD H_GET_S16
+#define GET_MAGIC H_GET_16
+#define PUT_WORD H_PUT_16
+#define PUT_MAGIC H_PUT_16
+#ifndef NAME
+#define NAME(x,y) CONCAT3 (x,_16_,y)
+#endif
+#define JNAME(x) CONCAT2 (x,_16)
+#define BYTES_IN_WORD 2
#else /* ARCH_SIZE == 32 */
-#define GET_WORD bfd_h_get_32
-#define GET_SWORD bfd_h_get_signed_32
-#define PUT_WORD bfd_h_put_32
+#define GET_WORD H_GET_32
+#define GET_SWORD H_GET_S32
+#define GET_MAGIC H_GET_32
+#define PUT_WORD H_PUT_32
+#define PUT_MAGIC H_PUT_32
#ifndef NAME
-#define NAME(x,y) CAT3(x,_32_,y)
+#define NAME(x,y) CONCAT3 (x,_32_,y)
#endif
-#define JNAME(x) CAT(x,_32)
+#define JNAME(x) CONCAT2 (x,_32)
#define BYTES_IN_WORD 4
#endif /* ARCH_SIZE==32 */
+#endif /* ARCH_SIZE==64 */
/* Declare at file level, since used in parameter lists, which have
weird scope. */
@@ -126,7 +193,8 @@ struct aout_backend_data
/* Callback for setting the page and segment sizes, if they can't be
trivially determined from the architecture. */
- boolean (*set_sizes) PARAMS ((bfd *));
+ boolean (*set_sizes)
+ PARAMS ((bfd *));
/* zmagic files only. For go32, the length of the exec header contributes
to the size of the text section in the file for alignment purposes but
@@ -135,44 +203,43 @@ struct aout_backend_data
/* Callback from the add symbols phase of the linker code to handle
a dynamic object. */
- boolean (*add_dynamic_symbols) PARAMS ((bfd *, struct bfd_link_info *,
- struct external_nlist **,
- bfd_size_type *, char **));
+ boolean (*add_dynamic_symbols)
+ PARAMS ((bfd *, struct bfd_link_info *, struct external_nlist **,
+ bfd_size_type *, char **));
/* Callback from the add symbols phase of the linker code to handle
adding a single symbol to the global linker hash table. */
- boolean (*add_one_symbol) PARAMS ((struct bfd_link_info *, bfd *,
- const char *, flagword, asection *,
- bfd_vma, const char *, boolean,
- boolean,
- struct bfd_link_hash_entry **));
+ boolean (*add_one_symbol)
+ PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
+ asection *, bfd_vma, const char *, boolean, boolean,
+ struct bfd_link_hash_entry **));
/* Called to handle linking a dynamic object. */
- boolean (*link_dynamic_object) PARAMS ((struct bfd_link_info *, bfd *));
+ boolean (*link_dynamic_object)
+ PARAMS ((struct bfd_link_info *, bfd *));
/* Called for each global symbol being written out by the linker.
This should write out the dynamic symbol information. */
- boolean (*write_dynamic_symbol) PARAMS ((bfd *, struct bfd_link_info *,
- struct aout_link_hash_entry *));
+ boolean (*write_dynamic_symbol)
+ PARAMS ((bfd *, struct bfd_link_info *, struct aout_link_hash_entry *));
/* If this callback is not NULL, the linker calls it for each reloc.
RELOC is a pointer to the unswapped reloc. If *SKIP is set to
true, the reloc will be skipped. *RELOCATION may be changed to
change the effects of the relocation. */
- boolean (*check_dynamic_reloc) PARAMS ((struct bfd_link_info *info,
- bfd *input_bfd,
- asection *input_section,
- struct aout_link_hash_entry *h,
- PTR reloc, bfd_byte *contents,
- boolean *skip,
- bfd_vma *relocation));
+ boolean (*check_dynamic_reloc)
+ PARAMS ((struct bfd_link_info *info, bfd *input_bfd,
+ asection *input_section, struct aout_link_hash_entry *h,
+ PTR reloc, bfd_byte *contents, boolean *skip,
+ bfd_vma *relocation));
/* Called at the end of a link to finish up any dynamic linking
information. */
- boolean (*finish_dynamic_link) PARAMS ((bfd *, struct bfd_link_info *));
+ boolean (*finish_dynamic_link)
+ PARAMS ((bfd *, struct bfd_link_info *));
};
#define aout_backend_info(abfd) \
- ((CONST struct aout_backend_data *)((abfd)->xvec->backend_data))
+ ((const struct aout_backend_data *)((abfd)->xvec->backend_data))
/* This is the layout in memory of a "struct exec" while we process it.
All 'lengths' are given as a number of bytes.
@@ -199,7 +266,7 @@ struct internal_exec
char a_relaxable; /* Enough info for linker relax */
};
-/* Magic number is written
+/* Magic number is written
< MSB >
3130292827262524232221201918171615141312111009080706050403020100
< FLAGS >< MACHINE TYPE >< MAGIC NUMBER >
@@ -273,7 +340,7 @@ enum machine_type {
#ifndef N_SET_DYNAMIC
# define N_SET_DYNAMIC(exec, dynamic) \
-((exec).a_info = (dynamic) ? ((exec).a_info | 0x80000000) : \
+((exec).a_info = (dynamic) ? (long) ((exec).a_info | 0x80000000) : \
((exec).a_info & 0x7fffffff))
#endif
@@ -308,7 +375,7 @@ typedef struct aout_symbol {
struct aoutdata {
struct internal_exec *hdr; /* exec file header */
aout_symbol_type *symbols; /* symtab for input bfd */
-
+
/* For ease, we do this */
asection *textsec;
asection *datasec;
@@ -423,151 +490,131 @@ struct aout_section_data_struct
/* Prototype declarations for functions defined in aoutx.h */
-boolean
-NAME(aout,squirt_out_relocs) PARAMS ((bfd *abfd, asection *section));
+extern boolean NAME(aout,squirt_out_relocs)
+ PARAMS ((bfd *, asection *));
-boolean
-NAME(aout,make_sections) PARAMS ((bfd *));
+extern boolean NAME(aout,make_sections)
+ PARAMS ((bfd *));
-const bfd_target *
-NAME(aout,some_aout_object_p) PARAMS ((bfd *abfd,
- struct internal_exec *execp,
- const bfd_target *(*callback)(bfd *)));
+extern const bfd_target * NAME(aout,some_aout_object_p)
+ PARAMS ((bfd *, struct internal_exec *, const bfd_target *(*) (bfd *)));
-boolean
-NAME(aout,mkobject) PARAMS ((bfd *abfd));
+extern boolean NAME(aout,mkobject)
+ PARAMS ((bfd *));
-enum machine_type
-NAME(aout,machine_type) PARAMS ((enum bfd_architecture arch,
- unsigned long machine,
- boolean *unknown));
+extern enum machine_type NAME(aout,machine_type)
+ PARAMS ((enum bfd_architecture, unsigned long, boolean *));
-boolean
-NAME(aout,set_arch_mach) PARAMS ((bfd *abfd, enum bfd_architecture arch,
- unsigned long machine));
+extern boolean NAME(aout,set_arch_mach)
+ PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-boolean
-NAME(aout,new_section_hook) PARAMS ((bfd *abfd, asection *newsect));
+extern boolean NAME(aout,new_section_hook)
+ PARAMS ((bfd *, asection *));
-boolean
-NAME(aout,set_section_contents) PARAMS ((bfd *abfd, sec_ptr section,
- PTR location, file_ptr offset, bfd_size_type count));
+extern boolean NAME(aout,set_section_contents)
+ PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
-asymbol *
-NAME(aout,make_empty_symbol) PARAMS ((bfd *abfd));
+extern asymbol * NAME(aout,make_empty_symbol)
+ PARAMS ((bfd *));
-boolean
-NAME(aout,translate_symbol_table) PARAMS ((bfd *, aout_symbol_type *,
- struct external_nlist *,
- bfd_size_type, char *,
- bfd_size_type,
- boolean dynamic));
+extern boolean NAME(aout,translate_symbol_table)
+ PARAMS ((bfd *, aout_symbol_type *, struct external_nlist *, bfd_size_type,
+ char *, bfd_size_type, boolean));
-boolean
-NAME(aout,slurp_symbol_table) PARAMS ((bfd *abfd));
+extern boolean NAME(aout,slurp_symbol_table)
+ PARAMS ((bfd *));
-boolean
-NAME(aout,write_syms) PARAMS ((bfd *abfd));
+extern boolean NAME(aout,write_syms)
+ PARAMS ((bfd *));
-void
-NAME(aout,reclaim_symbol_table) PARAMS ((bfd *abfd));
+extern void NAME(aout,reclaim_symbol_table)
+ PARAMS ((bfd *));
-long
-NAME(aout,get_symtab_upper_bound) PARAMS ((bfd *abfd));
+extern long NAME(aout,get_symtab_upper_bound)
+ PARAMS ((bfd *));
-long
-NAME(aout,get_symtab) PARAMS ((bfd *abfd, asymbol **location));
+extern long NAME(aout,get_symtab)
+ PARAMS ((bfd *, asymbol **));
-void
-NAME(aout,swap_ext_reloc_in) PARAMS ((bfd *, struct reloc_ext_external *,
- arelent *, asymbol **, bfd_size_type));
-void
-NAME(aout,swap_std_reloc_in) PARAMS ((bfd *, struct reloc_std_external *,
- arelent *, asymbol **, bfd_size_type));
+extern void NAME(aout,swap_ext_reloc_in)
+ PARAMS ((bfd *, struct reloc_ext_external *, arelent *, asymbol **,
+ bfd_size_type));
+extern void NAME(aout,swap_std_reloc_in)
+ PARAMS ((bfd *, struct reloc_std_external *, arelent *, asymbol **,
+ bfd_size_type));
-reloc_howto_type *
-NAME(aout,reloc_type_lookup) PARAMS ((bfd *abfd,
- bfd_reloc_code_real_type code));
+extern reloc_howto_type * NAME(aout,reloc_type_lookup)
+ PARAMS ((bfd *, bfd_reloc_code_real_type));
-boolean
-NAME(aout,slurp_reloc_table) PARAMS ((bfd *abfd, sec_ptr asect,
- asymbol **symbols));
+extern boolean NAME(aout,slurp_reloc_table)
+ PARAMS ((bfd *, sec_ptr, asymbol **));
-long
-NAME(aout,canonicalize_reloc) PARAMS ((bfd *abfd, sec_ptr section,
- arelent **relptr, asymbol **symbols));
+extern long NAME(aout,canonicalize_reloc)
+ PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
-long
-NAME(aout,get_reloc_upper_bound) PARAMS ((bfd *abfd, sec_ptr asect));
+extern long NAME(aout,get_reloc_upper_bound)
+ PARAMS ((bfd *, sec_ptr));
-void
-NAME(aout,reclaim_reloc) PARAMS ((bfd *ignore_abfd, sec_ptr ignore));
+extern void NAME(aout,reclaim_reloc)
+ PARAMS ((bfd *, sec_ptr));
-alent *
-NAME(aout,get_lineno) PARAMS ((bfd *ignore_abfd, asymbol *ignore_symbol));
+extern alent * NAME(aout,get_lineno)
+ PARAMS ((bfd *, asymbol *));
-void
-NAME(aout,print_symbol) PARAMS ((bfd *ignore_abfd, PTR file,
- asymbol *symbol, bfd_print_symbol_type how));
+extern void NAME(aout,print_symbol)
+ PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
-void
-NAME(aout,get_symbol_info) PARAMS ((bfd *ignore_abfd,
- asymbol *symbol, symbol_info *ret));
+extern void NAME(aout,get_symbol_info)
+ PARAMS ((bfd *, asymbol *, symbol_info *));
-boolean
-NAME(aout,find_nearest_line) PARAMS ((bfd *abfd, asection *section,
- asymbol **symbols, bfd_vma offset, CONST char **filename_ptr,
- CONST char **functionname_ptr, unsigned int *line_ptr));
+extern boolean NAME(aout,find_nearest_line)
+ PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
+ const char **, unsigned int *));
-long
-NAME(aout,read_minisymbols) PARAMS ((bfd *, boolean, PTR *, unsigned int *));
+extern long NAME(aout,read_minisymbols)
+ PARAMS ((bfd *, boolean, PTR *, unsigned int *));
-asymbol *
-NAME(aout,minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
- asymbol *));
+extern asymbol * NAME(aout,minisymbol_to_symbol)
+ PARAMS ((bfd *, boolean, const PTR, asymbol *));
-int
-NAME(aout,sizeof_headers) PARAMS ((bfd *abfd, boolean exec));
+extern int NAME(aout,sizeof_headers)
+ PARAMS ((bfd *, boolean));
-boolean
-NAME(aout,adjust_sizes_and_vmas) PARAMS ((bfd *abfd,
- bfd_size_type *text_size, file_ptr *text_end));
+extern boolean NAME(aout,adjust_sizes_and_vmas)
+ PARAMS ((bfd *, bfd_size_type *, file_ptr *));
-void
-NAME(aout,swap_exec_header_in) PARAMS ((bfd *abfd,
- struct external_exec *raw_bytes, struct internal_exec *execp));
+extern void NAME(aout,swap_exec_header_in)
+ PARAMS ((bfd *, struct external_exec *, struct internal_exec *));
-void
-NAME(aout,swap_exec_header_out) PARAMS ((bfd *abfd,
- struct internal_exec *execp, struct external_exec *raw_bytes));
+extern void NAME(aout,swap_exec_header_out)
+ PARAMS ((bfd *, struct internal_exec *, struct external_exec *));
-struct bfd_hash_entry *
-NAME(aout,link_hash_newfunc)
+extern struct bfd_hash_entry * NAME(aout,link_hash_newfunc)
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-boolean
-NAME(aout,link_hash_table_init)
- PARAMS ((struct aout_link_hash_table *, bfd *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *)));
+extern boolean NAME(aout,link_hash_table_init)
+ PARAMS ((struct aout_link_hash_table *, bfd *,
+ struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *)));
-struct bfd_link_hash_table *
-NAME(aout,link_hash_table_create) PARAMS ((bfd *));
+extern struct bfd_link_hash_table * NAME(aout,link_hash_table_create)
+ PARAMS ((bfd *));
-boolean
-NAME(aout,link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
+extern boolean NAME(aout,link_add_symbols)
+ PARAMS ((bfd *, struct bfd_link_info *));
-boolean
-NAME(aout,final_link) PARAMS ((bfd *, struct bfd_link_info *,
- void (*) (bfd *, file_ptr *, file_ptr *,
- file_ptr *)));
+extern boolean NAME(aout,final_link)
+ PARAMS ((bfd *, struct bfd_link_info *,
+ void (*) (bfd *, file_ptr *, file_ptr *, file_ptr *)));
-boolean
-NAME(aout,bfd_free_cached_info) PARAMS ((bfd *));
+extern boolean NAME(aout,bfd_free_cached_info)
+ PARAMS ((bfd *));
/* A.out uses the generic versions of these routines... */
+#define aout_16_get_section_contents _bfd_generic_get_section_contents
+
#define aout_32_get_section_contents _bfd_generic_get_section_contents
#define aout_64_get_section_contents _bfd_generic_get_section_contents
@@ -596,31 +643,32 @@ NAME(aout,bfd_free_cached_info) PARAMS ((bfd *));
obj_reloc_entry_size (abfd)); \
NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \
\
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false; \
- if (bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd) \
- != EXEC_BYTES_SIZE) \
+ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \
+ || bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \
+ abfd) != EXEC_BYTES_SIZE) \
return false; \
/* Now write out reloc info, followed by syms and strings */ \
\
if (bfd_get_outsymbols (abfd) != (asymbol **) NULL \
&& bfd_get_symcount (abfd) != 0) \
{ \
- if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*execp)), SEEK_SET) != 0) \
+ if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0)\
return false; \
\
- if (! NAME(aout,write_syms)(abfd)) return false; \
+ if (! NAME(aout,write_syms) (abfd)) \
+ return false; \
} \
\
- if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*execp)), SEEK_SET) != 0) \
+ if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0) \
return false; \
if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) \
return false; \
\
- if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*execp)), SEEK_SET) != 0) \
+ if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0) \
return false; \
- if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd))) \
+ if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) \
return false; \
- }
+ }
#endif
#endif /* ! defined (LIBAOUT_H) */
diff --git a/contrib/binutils/bfd/libbfd-in.h b/contrib/binutils/bfd/libbfd-in.h
index dc2cd11..ed417ca 100644
--- a/contrib/binutils/bfd/libbfd-in.h
+++ b/contrib/binutils/bfd/libbfd-in.h
@@ -5,10 +5,6 @@
Free Software Foundation, Inc.
Written by Cygnus Support.
-** NOTE: libbfd.h is a GENERATED file. Don't change it; instead,
-** change libbfd-in.h or the other BFD source files processed to
-** generate this file.
-
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
@@ -29,9 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
E.g. align to an 8-byte boundary with argument of 8. Take care never
to wrap around if the address is within boundary-1 of the end of the
address space. */
-#define BFD_ALIGN(this, boundary) \
- ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \
- ? (((bfd_vma) (this) + ((boundary) - 1)) & (~((boundary)-1))) \
+#define BFD_ALIGN(this, boundary) \
+ ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \
+ ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \
: ~ (bfd_vma) 0)
/* If you want to read and write large blocks, you might want to do it
@@ -87,20 +83,20 @@ struct areltdata {
#define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
-extern PTR bfd_malloc PARAMS ((size_t));
-extern PTR bfd_realloc PARAMS ((PTR, size_t));
-extern PTR bfd_zmalloc PARAMS ((size_t));
+extern PTR bfd_malloc PARAMS ((bfd_size_type));
+extern PTR bfd_realloc PARAMS ((PTR, bfd_size_type));
+extern PTR bfd_zmalloc PARAMS ((bfd_size_type));
extern bfd_error_handler_type _bfd_error_handler;
/* These routines allocate and free things on the BFD's objalloc. */
-extern PTR bfd_alloc PARAMS ((bfd *, size_t));
-extern PTR bfd_zalloc PARAMS ((bfd *, size_t));
+extern PTR bfd_alloc PARAMS ((bfd *, bfd_size_type));
+extern PTR bfd_zalloc PARAMS ((bfd *, bfd_size_type));
extern void bfd_release PARAMS ((bfd *, PTR));
bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd));
-bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index));
+bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *, file_ptr));
boolean _bfd_add_bfd_to_archive_cache PARAMS ((bfd *, file_ptr, bfd *));
boolean _bfd_generic_mkarchive PARAMS ((bfd *abfd));
const bfd_target *bfd_generic_archive_p PARAMS ((bfd *abfd));
@@ -116,6 +112,7 @@ boolean _bfd_compute_and_write_armap PARAMS ((bfd *, unsigned int elength));
bfd *_bfd_get_elt_at_filepos PARAMS ((bfd *archive, file_ptr filepos));
extern bfd *_bfd_generic_get_elt_at_index PARAMS ((bfd *, symindex));
bfd * _bfd_new_bfd PARAMS ((void));
+void _bfd_delete_bfd PARAMS ((bfd *));
boolean bfd_false PARAMS ((bfd *ignore));
boolean bfd_true PARAMS ((bfd *ignore));
@@ -162,8 +159,7 @@ int bfd_generic_stat_arch_elt PARAMS ((bfd *, struct stat *));
#define _bfd_generic_new_section_hook \
((boolean (*) PARAMS ((bfd *, asection *))) bfd_true)
extern boolean _bfd_generic_get_section_contents
- PARAMS ((bfd *, asection *, PTR location, file_ptr offset,
- bfd_size_type count));
+ PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
extern boolean _bfd_generic_get_section_contents_in_window
PARAMS ((bfd *, asection *, bfd_window *, file_ptr, bfd_size_type));
@@ -255,8 +251,7 @@ extern boolean _bfd_archive_coff_construct_extended_name_table
#define _bfd_nosymbols_get_symtab_upper_bound _bfd_n1
#define _bfd_nosymbols_get_symtab \
((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1)
-#define _bfd_nosymbols_make_empty_symbol \
- ((asymbol *(*) PARAMS ((bfd *))) bfd_nullvoidptr)
+#define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol
#define _bfd_nosymbols_print_symbol \
((void (*) PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type))) bfd_void)
#define _bfd_nosymbols_get_symbol_info \
@@ -323,6 +318,10 @@ extern boolean _bfd_generic_set_section_contents
((boolean (*) \
PARAMS ((bfd *, struct bfd_link_info *))) \
bfd_false)
+#define _bfd_nolink_bfd_merge_sections \
+ ((boolean (*) \
+ PARAMS ((bfd *, struct bfd_link_info *))) \
+ bfd_false)
#define _bfd_nolink_bfd_link_hash_table_create \
((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr)
#define _bfd_nolink_bfd_link_add_symbols \
@@ -369,6 +368,10 @@ extern boolean _bfd_dwarf2_find_nearest_line
const char **, unsigned int *, unsigned int,
PTR *));
+/* Create a new section entry. */
+extern struct bfd_hash_entry *bfd_section_hash_newfunc
+ PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+
/* A routine to create entries for a bfd_link_hash_table. */
extern struct bfd_hash_entry *_bfd_link_hash_newfunc
PARAMS ((struct bfd_hash_entry *entry,
@@ -436,7 +439,7 @@ extern unsigned int _bfd_count_link_order_relocs
/* Final link relocation routine. */
extern bfd_reloc_status_type _bfd_final_link_relocate
PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *,
- bfd_vma address, bfd_vma value, bfd_vma addend));
+ bfd_vma, bfd_vma, bfd_vma));
/* Relocate a particular location by a howto and a value. */
extern bfd_reloc_status_type _bfd_relocate_contents
@@ -447,6 +450,11 @@ extern bfd_reloc_status_type _bfd_relocate_contents
extern boolean _bfd_link_section_stabs
PARAMS ((bfd *, PTR *, asection *, asection *, PTR *));
+/* Eliminate stabs for discarded functions and symbols. */
+extern boolean _bfd_discard_section_stabs
+ PARAMS ((bfd *, asection *, PTR,
+ boolean (*) (bfd_vma, PTR), PTR));
+
/* Write out the .stab section when linking stabs in sections. */
extern boolean _bfd_write_section_stabs
@@ -462,6 +470,26 @@ extern boolean _bfd_write_stab_strings PARAMS ((bfd *, PTR *));
extern bfd_vma _bfd_stab_section_offset
PARAMS ((bfd *, PTR *, asection *, PTR *, bfd_vma));
+/* Attempt to merge a SEC_MERGE section. */
+
+extern boolean _bfd_merge_section
+ PARAMS ((bfd *, PTR *, asection *, PTR *));
+
+/* Attempt to merge SEC_MERGE sections. */
+
+extern boolean _bfd_merge_sections
+ PARAMS ((bfd *, PTR, void (*)(bfd *, asection *)));
+
+/* Write out a merged section. */
+
+extern boolean _bfd_write_merged_section
+ PARAMS ((bfd *, asection *, PTR));
+
+/* Find an offset within a modified SEC_MERGE section. */
+
+extern bfd_vma _bfd_merged_section_offset
+ PARAMS ((bfd *, asection **, PTR, bfd_vma, bfd_vma));
+
/* Create a string table. */
extern struct bfd_strtab_hash *_bfd_stringtab_init PARAMS ((void));
diff --git a/contrib/binutils/bfd/libbfd.c b/contrib/binutils/bfd/libbfd.c
index 695df8d..5aa51ae 100644
--- a/contrib/binutils/bfd/libbfd.c
+++ b/contrib/binutils/bfd/libbfd.c
@@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define getpagesize() 2048
#endif
-static int real_read PARAMS ((PTR, size_t, size_t, FILE *));
+static size_t real_read PARAMS ((PTR, size_t, size_t, FILE *));
/*
SECTION
@@ -153,13 +153,20 @@ _bfd_dummy_target (ignore_abfd)
PTR
bfd_malloc (size)
- size_t size;
+ bfd_size_type size;
{
PTR ptr;
- ptr = (PTR) malloc (size);
- if (ptr == NULL && size != 0)
+ if (size != (size_t) size)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
+
+ ptr = (PTR) malloc ((size_t) size);
+ if (ptr == NULL && (size_t) size != 0)
bfd_set_error (bfd_error_no_memory);
+
return ptr;
}
@@ -168,16 +175,22 @@ bfd_malloc (size)
PTR
bfd_realloc (ptr, size)
PTR ptr;
- size_t size;
+ bfd_size_type size;
{
PTR ret;
+ if (size != (size_t) size)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
+
if (ptr == NULL)
- ret = malloc (size);
+ ret = malloc ((size_t) size);
else
- ret = realloc (ptr, size);
+ ret = realloc (ptr, (size_t) size);
- if (ret == NULL)
+ if (ret == NULL && (size_t) size != 0)
bfd_set_error (bfd_error_no_memory);
return ret;
@@ -187,18 +200,24 @@ bfd_realloc (ptr, size)
PTR
bfd_zmalloc (size)
- size_t size;
+ bfd_size_type size;
{
PTR ptr;
- ptr = (PTR) malloc (size);
+ if (size != (size_t) size)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
- if (size != 0)
+ ptr = (PTR) malloc ((size_t) size);
+
+ if ((size_t) size != 0)
{
if (ptr == NULL)
bfd_set_error (bfd_error_no_memory);
else
- memset (ptr, 0, size);
+ memset (ptr, 0, (size_t) size);
}
return ptr;
@@ -213,8 +232,8 @@ bfd_zmalloc (size)
contents (0 for non-archive elements). For archive entries this is the
first octet in the file, NOT the beginning of the archive header. */
-static int
-real_read (where, a,b, file)
+static size_t
+real_read (where, a, b, file)
PTR where;
size_t a;
size_t b;
@@ -242,17 +261,15 @@ real_read (where, a,b, file)
#endif
}
-/* Return value is amount read (FIXME: how are errors and end of file dealt
- with? We never call bfd_set_error, which is probably a mistake). */
+/* Return value is amount read. */
bfd_size_type
-bfd_read (ptr, size, nitems, abfd)
+bfd_bread (ptr, size, abfd)
PTR ptr;
bfd_size_type size;
- bfd_size_type nitems;
bfd *abfd;
{
- int nread;
+ size_t nread;
if ((abfd->flags & BFD_IN_MEMORY) != 0)
{
@@ -260,7 +277,7 @@ bfd_read (ptr, size, nitems, abfd)
bfd_size_type get;
bim = (struct bfd_in_memory *) abfd->iostream;
- get = size * nitems;
+ get = size;
if (abfd->where + get > bim->size)
{
if (bim->size < (bfd_size_type) abfd->where)
@@ -269,13 +286,13 @@ bfd_read (ptr, size, nitems, abfd)
get = bim->size - abfd->where;
bfd_set_error (bfd_error_file_truncated);
}
- memcpy (ptr, bim->buffer + abfd->where, get);
+ memcpy (ptr, bim->buffer + abfd->where, (size_t) get);
abfd->where += get;
return get;
}
- nread = real_read (ptr, 1, (size_t) (size*nitems), bfd_cache_lookup(abfd));
- if (nread > 0)
+ nread = real_read (ptr, 1, (size_t) size, bfd_cache_lookup (abfd));
+ if (nread != (size_t) -1)
abfd->where += nread;
/* Set bfd_error if we did not read as much data as we expected.
@@ -285,7 +302,7 @@ bfd_read (ptr, size, nitems, abfd)
A BFD backend may wish to override bfd_error_file_truncated to
provide something more useful (eg. no_symbols or wrong_format). */
- if (nread != (int) (size * nitems))
+ if (nread != size)
{
if (ferror (bfd_cache_lookup (abfd)))
bfd_set_error (bfd_error_system_call);
@@ -386,7 +403,7 @@ bfd_get_file_window (abfd, offset, size, windowp, writable)
{
static size_t pagesize;
bfd_window_internal *i = windowp->i;
- size_t size_to_alloc = size;
+ bfd_size_type size_to_alloc = size;
if (debug_windows)
fprintf (stderr, "bfd_get_file_window (%p, %6ld, %6ld, %p<%p,%lx,%p>, %d)",
@@ -402,7 +419,9 @@ bfd_get_file_window (abfd, offset, size, windowp, writable)
if (i == 0)
{
- windowp->i = i = (bfd_window_internal *) bfd_zmalloc (sizeof (bfd_window_internal));
+ i = ((bfd_window_internal *)
+ bfd_zmalloc ((bfd_size_type) sizeof (bfd_window_internal)));
+ windowp->i = i;
if (i == 0)
return false;
i->data = 0;
@@ -497,12 +516,11 @@ bfd_get_file_window (abfd, offset, size, windowp, writable)
{
if (size_to_alloc == 0)
return true;
- bfd_set_error (bfd_error_no_memory);
return false;
}
if (bfd_seek (abfd, offset, SEEK_SET) != 0)
return false;
- i->size = bfd_read (i->data, size, 1, abfd);
+ i->size = bfd_bread (i->data, size, abfd);
if (i->size != size)
return false;
i->mapped = 0;
@@ -523,24 +541,25 @@ bfd_get_file_window (abfd, offset, size, windowp, writable)
#endif /* USE_MMAP */
bfd_size_type
-bfd_write (ptr, size, nitems, abfd)
- CONST PTR ptr;
+bfd_bwrite (ptr, size, abfd)
+ const PTR ptr;
bfd_size_type size;
- bfd_size_type nitems;
bfd *abfd;
{
- long nwrote;
+ size_t nwrote;
if ((abfd->flags & BFD_IN_MEMORY) != 0)
{
struct bfd_in_memory *bim = (struct bfd_in_memory *) (abfd->iostream);
- size *= nitems;
+ size = (size_t) size;
if (abfd->where + size > bim->size)
{
- long newsize, oldsize = (bim->size + 127) & ~127;
+ bfd_size_type newsize, oldsize;
+
+ oldsize = (bim->size + 127) & ~(bfd_size_type) 127;
bim->size = abfd->where + size;
/* Round up to cut down on memory fragmentation */
- newsize = (bim->size + 127) & ~127;
+ newsize = (bim->size + 127) & ~(bfd_size_type) 127;
if (newsize > oldsize)
{
bim->buffer = bfd_realloc (bim->buffer, newsize);
@@ -551,20 +570,18 @@ bfd_write (ptr, size, nitems, abfd)
}
}
}
- memcpy (bim->buffer + abfd->where, ptr, size);
+ memcpy (bim->buffer + abfd->where, ptr, (size_t) size);
abfd->where += size;
return size;
}
- nwrote = fwrite (ptr, 1, (size_t) (size * nitems),
- bfd_cache_lookup (abfd));
- if (nwrote > 0)
+ nwrote = fwrite (ptr, 1, (size_t) size, bfd_cache_lookup (abfd));
+ if (nwrote != (size_t) -1)
abfd->where += nwrote;
- if ((bfd_size_type) nwrote != size * nitems)
+ if (nwrote != size)
{
#ifdef ENOSPC
- if (nwrote >= 0)
- errno = ENOSPC;
+ errno = ENOSPC;
#endif
bfd_set_error (bfd_error_system_call);
}
@@ -576,7 +593,7 @@ INTERNAL_FUNCTION
bfd_write_bigendian_4byte_int
SYNOPSIS
- void bfd_write_bigendian_4byte_int(bfd *abfd, int i);
+ void bfd_write_bigendian_4byte_int (bfd *, unsigned int);
DESCRIPTION
Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big
@@ -587,15 +604,15 @@ DESCRIPTION
void
bfd_write_bigendian_4byte_int (abfd, i)
bfd *abfd;
- int i;
+ unsigned int i;
{
bfd_byte buffer[4];
- bfd_putb32(i, buffer);
- if (bfd_write((PTR)buffer, 4, 1, abfd) != 4)
+ bfd_putb32 ((bfd_vma) i, buffer);
+ if (bfd_bwrite ((PTR) buffer, (bfd_size_type) 4, abfd) != 4)
abort ();
}
-long
+bfd_vma
bfd_tell (abfd)
bfd *abfd;
{
@@ -604,7 +621,7 @@ bfd_tell (abfd)
if ((abfd->flags & BFD_IN_MEMORY) != 0)
return abfd->where;
- ptr = ftell (bfd_cache_lookup(abfd));
+ ptr = ftell (bfd_cache_lookup (abfd));
if (abfd->my_archive)
ptr -= abfd->origin;
@@ -657,7 +674,7 @@ bfd_seek (abfd, position, direction)
{
int result;
FILE *f;
- file_ptr file_position;
+ long file_position;
/* For the time being, a BFD may not seek to it's end. The problem
is that we don't easily have a way to recognize the end of an
element in an archive. */
@@ -678,22 +695,22 @@ bfd_seek (abfd, position, direction)
else
abfd->where += position;
- if ((bfd_size_type) abfd->where > bim->size)
+ if (abfd->where > bim->size)
{
if ((abfd->direction == write_direction) ||
(abfd->direction == both_direction))
{
- long newsize, oldsize = (bim->size + 127) & ~127;
+ bfd_size_type newsize, oldsize;
+ oldsize = (bim->size + 127) & ~(bfd_size_type) 127;
bim->size = abfd->where;
/* Round up to cut down on memory fragmentation */
- newsize = (bim->size + 127) & ~127;
+ newsize = (bim->size + 127) & ~(bfd_size_type) 127;
if (newsize > oldsize)
{
bim->buffer = bfd_realloc (bim->buffer, newsize);
if (bim->buffer == 0)
{
bim->size = 0;
- bfd_set_error (bfd_error_no_memory);
return -1;
}
}
@@ -724,7 +741,7 @@ bfd_seek (abfd, position, direction)
if (where_am_i_now != abfd->where)
abort ();
#endif
- if (direction == SEEK_SET && position == abfd->where)
+ if (direction == SEEK_SET && (bfd_vma) position == abfd->where)
return 0;
}
else
@@ -819,9 +836,9 @@ DESCRIPTION
.#define bfd_put_signed_8 \
. bfd_put_8
.#define bfd_get_8(abfd, ptr) \
-. (*(unsigned char *) (ptr))
+. (*(unsigned char *) (ptr) & 0xff)
.#define bfd_get_signed_8(abfd, ptr) \
-. ((*(unsigned char *) (ptr) ^ 0x80) - 0x80)
+. (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
.
.#define bfd_put_16(abfd, val, ptr) \
. BFD_SEND(abfd, bfd_putx16, ((val),(ptr)))
@@ -851,14 +868,14 @@ DESCRIPTION
. BFD_SEND(abfd, bfd_getx_signed_64, (ptr))
.
.#define bfd_get(bits, abfd, ptr) \
-. ((bits) == 8 ? bfd_get_8 (abfd, ptr) \
+. ( (bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \
. : (bits) == 16 ? bfd_get_16 (abfd, ptr) \
. : (bits) == 32 ? bfd_get_32 (abfd, ptr) \
. : (bits) == 64 ? bfd_get_64 (abfd, ptr) \
. : (abort (), (bfd_vma) - 1))
.
.#define bfd_put(bits, abfd, val, ptr) \
-. ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \
+. ( (bits) == 8 ? bfd_put_8 (abfd, val, ptr) \
. : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \
. : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \
. : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
@@ -873,7 +890,7 @@ FUNCTION
DESCRIPTION
These macros have the same function as their <<bfd_get_x>>
- bretheren, except that they are used for removing information
+ brethren, except that they are used for removing information
for the header records of object files. Believe it or not,
some object files keep their header records in big endian
order and their data in little endian order.
@@ -881,42 +898,89 @@ DESCRIPTION
.{* Byte swapping macros for file header data. *}
.
.#define bfd_h_put_8(abfd, val, ptr) \
-. bfd_put_8 (abfd, val, ptr)
+. bfd_put_8 (abfd, val, ptr)
.#define bfd_h_put_signed_8(abfd, val, ptr) \
-. bfd_put_8 (abfd, val, ptr)
+. bfd_put_8 (abfd, val, ptr)
.#define bfd_h_get_8(abfd, ptr) \
-. bfd_get_8 (abfd, ptr)
+. bfd_get_8 (abfd, ptr)
.#define bfd_h_get_signed_8(abfd, ptr) \
-. bfd_get_signed_8 (abfd, ptr)
+. bfd_get_signed_8 (abfd, ptr)
.
.#define bfd_h_put_16(abfd, val, ptr) \
-. BFD_SEND(abfd, bfd_h_putx16,(val,ptr))
+. BFD_SEND (abfd, bfd_h_putx16, (val, ptr))
.#define bfd_h_put_signed_16 \
-. bfd_h_put_16
+. bfd_h_put_16
.#define bfd_h_get_16(abfd, ptr) \
-. BFD_SEND(abfd, bfd_h_getx16,(ptr))
+. BFD_SEND (abfd, bfd_h_getx16, (ptr))
.#define bfd_h_get_signed_16(abfd, ptr) \
-. BFD_SEND(abfd, bfd_h_getx_signed_16, (ptr))
+. BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr))
.
.#define bfd_h_put_32(abfd, val, ptr) \
-. BFD_SEND(abfd, bfd_h_putx32,(val,ptr))
+. BFD_SEND (abfd, bfd_h_putx32, (val, ptr))
.#define bfd_h_put_signed_32 \
-. bfd_h_put_32
+. bfd_h_put_32
.#define bfd_h_get_32(abfd, ptr) \
-. BFD_SEND(abfd, bfd_h_getx32,(ptr))
+. BFD_SEND (abfd, bfd_h_getx32, (ptr))
.#define bfd_h_get_signed_32(abfd, ptr) \
-. BFD_SEND(abfd, bfd_h_getx_signed_32, (ptr))
+. BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr))
.
.#define bfd_h_put_64(abfd, val, ptr) \
-. BFD_SEND(abfd, bfd_h_putx64,(val, ptr))
+. BFD_SEND (abfd, bfd_h_putx64, (val, ptr))
.#define bfd_h_put_signed_64 \
-. bfd_h_put_64
+. bfd_h_put_64
.#define bfd_h_get_64(abfd, ptr) \
-. BFD_SEND(abfd, bfd_h_getx64,(ptr))
+. BFD_SEND (abfd, bfd_h_getx64, (ptr))
.#define bfd_h_get_signed_64(abfd, ptr) \
-. BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr))
+. BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))
.
-*/
+.{* Refinements on the above, which should eventually go away. Save
+. cluttering the source with (bfd_vma) and (bfd_byte *) casts. *}
+.
+.#define H_PUT_64(abfd, val, where) \
+. bfd_h_put_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+.
+.#define H_PUT_32(abfd, val, where) \
+. bfd_h_put_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+.
+.#define H_PUT_16(abfd, val, where) \
+. bfd_h_put_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+.
+.#define H_PUT_8 bfd_h_put_8
+.
+.#define H_PUT_S64(abfd, val, where) \
+. bfd_h_put_signed_64 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+.
+.#define H_PUT_S32(abfd, val, where) \
+. bfd_h_put_signed_32 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+.
+.#define H_PUT_S16(abfd, val, where) \
+. bfd_h_put_signed_16 ((abfd), (bfd_vma) (val), (bfd_byte *) (where))
+.
+.#define H_PUT_S8 bfd_h_put_signed_8
+.
+.#define H_GET_64(abfd, where) \
+. bfd_h_get_64 ((abfd), (bfd_byte *) (where))
+.
+.#define H_GET_32(abfd, where) \
+. bfd_h_get_32 ((abfd), (bfd_byte *) (where))
+.
+.#define H_GET_16(abfd, where) \
+. bfd_h_get_16 ((abfd), (bfd_byte *) (where))
+.
+.#define H_GET_8 bfd_h_get_8
+.
+.#define H_GET_S64(abfd, where) \
+. bfd_h_get_signed_64 ((abfd), (bfd_byte *) (where))
+.
+.#define H_GET_S32(abfd, where) \
+. bfd_h_get_signed_32 ((abfd), (bfd_byte *) (where))
+.
+.#define H_GET_S16(abfd, where) \
+. bfd_h_get_signed_16 ((abfd), (bfd_byte *) (where))
+.
+.#define H_GET_S8 bfd_h_get_signed_8
+.
+.*/
/* Sign extension to bfd_signed_vma. */
#define COERCE16(x) (((bfd_signed_vma) (x) ^ 0x8000) - 0x8000)
@@ -1240,14 +1304,14 @@ _bfd_generic_get_section_contents (abfd, section, location, offset, count)
if (count == 0)
return true;
- if ((bfd_size_type) (offset + count) > section->_raw_size)
+ if (offset + count > section->_raw_size)
{
bfd_set_error (bfd_error_invalid_operation);
return false;
}
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
- || bfd_read (location, (bfd_size_type) 1, count, abfd) != count)
+ || bfd_bread (location, count, abfd) != count)
return false;
return true;
@@ -1272,10 +1336,11 @@ _bfd_generic_get_section_contents_in_window (abfd, section, w, offset, count)
/* @@ FIXME : If the internal window has a refcount of 1 and was
allocated with malloc instead of mmap, just reuse it. */
bfd_free_window (w);
- w->i = (bfd_window_internal *) bfd_zmalloc (sizeof (bfd_window_internal));
+ w->i = ((bfd_window_internal *)
+ bfd_zmalloc ((bfd_size_type) sizeof (bfd_window_internal)));
if (w->i == NULL)
return false;
- w->i->data = (PTR) bfd_malloc ((size_t) count);
+ w->i->data = (PTR) bfd_malloc (count);
if (w->i->data == NULL)
{
free (w->i);
@@ -1288,7 +1353,7 @@ _bfd_generic_get_section_contents_in_window (abfd, section, w, offset, count)
w->data = w->i->data;
return bfd_get_section_contents (abfd, section, w->data, offset, count);
}
- if ((bfd_size_type) (offset+count) > section->_raw_size
+ if (offset + count > section->_raw_size
|| (bfd_get_file_window (abfd, section->filepos + offset, count, w, true)
== false))
return false;
@@ -1313,8 +1378,8 @@ _bfd_generic_set_section_contents (abfd, section, location, offset, count)
if (count == 0)
return true;
- if (bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) == -1
- || bfd_write (location, (bfd_size_type) 1, count, abfd) != count)
+ if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
+ || bfd_bwrite (location, count, abfd) != count)
return false;
return true;
@@ -1325,11 +1390,11 @@ INTERNAL_FUNCTION
bfd_log2
SYNOPSIS
- unsigned int bfd_log2(bfd_vma x);
+ unsigned int bfd_log2 (bfd_vma x);
DESCRIPTION
Return the log base 2 of the value supplied, rounded up. E.g., an
- @var{x} of 1025 returns 11.
+ @var{x} of 1025 returns 11. A @var{x} of 0 returns 0.
*/
unsigned int
@@ -1372,7 +1437,7 @@ _bfd_generic_verify_endian_match (ibfd, obfd)
else
msg = _("%s: compiled for a little endian system and target is big endian");
- (*_bfd_error_handler) (msg, bfd_get_filename (ibfd));
+ (*_bfd_error_handler) (msg, bfd_archive_filename (ibfd));
bfd_set_error (bfd_error_wrong_format);
return false;
@@ -1380,3 +1445,26 @@ _bfd_generic_verify_endian_match (ibfd, obfd)
return true;
}
+
+/* Give a warning at runtime if someone compiles code which calls
+ old routines. */
+void
+warn_deprecated (what, file, line, func)
+ const char *what;
+ const char *file;
+ int line;
+ const char *func;
+{
+ /* Poor man's tracking of functions we've already warned about. */
+ static size_t mask = 0;
+
+ if (~(size_t) func & ~mask)
+ {
+ fprintf (stderr, _("Deprecated %s called"), what);
+ if (func)
+ fprintf (stderr, _(" at %s line %d in %s\n"), file, line, func);
+ else
+ fprintf (stderr, "\n");
+ mask |= ~(size_t) func;
+ }
+}
diff --git a/contrib/binutils/bfd/libbfd.h b/contrib/binutils/bfd/libbfd.h
index 997856a..d055651 100644
--- a/contrib/binutils/bfd/libbfd.h
+++ b/contrib/binutils/bfd/libbfd.h
@@ -1,3 +1,8 @@
+/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically
+ generated from "libbfd-in.h", "init.c", "libbfd.c", "cache.c",
+ "reloc.c", "archures.c" and "elf.c".
+ Run "make headers" in your build bfd/ to regenerate. */
+
/* libbfd.h -- Declarations used by bfd library *implementation*.
(This include file is not for users of the library.)
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
@@ -5,10 +10,6 @@
Free Software Foundation, Inc.
Written by Cygnus Support.
-** NOTE: libbfd.h is a GENERATED file. Don't change it; instead,
-** change libbfd-in.h or the other BFD source files processed to
-** generate this file.
-
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
@@ -29,9 +30,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
E.g. align to an 8-byte boundary with argument of 8. Take care never
to wrap around if the address is within boundary-1 of the end of the
address space. */
-#define BFD_ALIGN(this, boundary) \
- ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \
- ? (((bfd_vma) (this) + ((boundary) - 1)) & (~((boundary)-1))) \
+#define BFD_ALIGN(this, boundary) \
+ ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \
+ ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \
: ~ (bfd_vma) 0)
/* If you want to read and write large blocks, you might want to do it
@@ -87,20 +88,20 @@ struct areltdata {
#define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
-extern PTR bfd_malloc PARAMS ((size_t));
-extern PTR bfd_realloc PARAMS ((PTR, size_t));
-extern PTR bfd_zmalloc PARAMS ((size_t));
+extern PTR bfd_malloc PARAMS ((bfd_size_type));
+extern PTR bfd_realloc PARAMS ((PTR, bfd_size_type));
+extern PTR bfd_zmalloc PARAMS ((bfd_size_type));
extern bfd_error_handler_type _bfd_error_handler;
/* These routines allocate and free things on the BFD's objalloc. */
-extern PTR bfd_alloc PARAMS ((bfd *, size_t));
-extern PTR bfd_zalloc PARAMS ((bfd *, size_t));
+extern PTR bfd_alloc PARAMS ((bfd *, bfd_size_type));
+extern PTR bfd_zalloc PARAMS ((bfd *, bfd_size_type));
extern void bfd_release PARAMS ((bfd *, PTR));
bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd));
-bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index));
+bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *, file_ptr));
boolean _bfd_add_bfd_to_archive_cache PARAMS ((bfd *, file_ptr, bfd *));
boolean _bfd_generic_mkarchive PARAMS ((bfd *abfd));
const bfd_target *bfd_generic_archive_p PARAMS ((bfd *abfd));
@@ -116,6 +117,7 @@ boolean _bfd_compute_and_write_armap PARAMS ((bfd *, unsigned int elength));
bfd *_bfd_get_elt_at_filepos PARAMS ((bfd *archive, file_ptr filepos));
extern bfd *_bfd_generic_get_elt_at_index PARAMS ((bfd *, symindex));
bfd * _bfd_new_bfd PARAMS ((void));
+void _bfd_delete_bfd PARAMS ((bfd *));
boolean bfd_false PARAMS ((bfd *ignore));
boolean bfd_true PARAMS ((bfd *ignore));
@@ -162,8 +164,7 @@ int bfd_generic_stat_arch_elt PARAMS ((bfd *, struct stat *));
#define _bfd_generic_new_section_hook \
((boolean (*) PARAMS ((bfd *, asection *))) bfd_true)
extern boolean _bfd_generic_get_section_contents
- PARAMS ((bfd *, asection *, PTR location, file_ptr offset,
- bfd_size_type count));
+ PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
extern boolean _bfd_generic_get_section_contents_in_window
PARAMS ((bfd *, asection *, bfd_window *, file_ptr, bfd_size_type));
@@ -255,8 +256,7 @@ extern boolean _bfd_archive_coff_construct_extended_name_table
#define _bfd_nosymbols_get_symtab_upper_bound _bfd_n1
#define _bfd_nosymbols_get_symtab \
((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1)
-#define _bfd_nosymbols_make_empty_symbol \
- ((asymbol *(*) PARAMS ((bfd *))) bfd_nullvoidptr)
+#define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol
#define _bfd_nosymbols_print_symbol \
((void (*) PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type))) bfd_void)
#define _bfd_nosymbols_get_symbol_info \
@@ -323,6 +323,10 @@ extern boolean _bfd_generic_set_section_contents
((boolean (*) \
PARAMS ((bfd *, struct bfd_link_info *))) \
bfd_false)
+#define _bfd_nolink_bfd_merge_sections \
+ ((boolean (*) \
+ PARAMS ((bfd *, struct bfd_link_info *))) \
+ bfd_false)
#define _bfd_nolink_bfd_link_hash_table_create \
((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr)
#define _bfd_nolink_bfd_link_add_symbols \
@@ -369,6 +373,10 @@ extern boolean _bfd_dwarf2_find_nearest_line
const char **, unsigned int *, unsigned int,
PTR *));
+/* Create a new section entry. */
+extern struct bfd_hash_entry *bfd_section_hash_newfunc
+ PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+
/* A routine to create entries for a bfd_link_hash_table. */
extern struct bfd_hash_entry *_bfd_link_hash_newfunc
PARAMS ((struct bfd_hash_entry *entry,
@@ -436,7 +444,7 @@ extern unsigned int _bfd_count_link_order_relocs
/* Final link relocation routine. */
extern bfd_reloc_status_type _bfd_final_link_relocate
PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *,
- bfd_vma address, bfd_vma value, bfd_vma addend));
+ bfd_vma, bfd_vma, bfd_vma));
/* Relocate a particular location by a howto and a value. */
extern bfd_reloc_status_type _bfd_relocate_contents
@@ -447,6 +455,11 @@ extern bfd_reloc_status_type _bfd_relocate_contents
extern boolean _bfd_link_section_stabs
PARAMS ((bfd *, PTR *, asection *, asection *, PTR *));
+/* Eliminate stabs for discarded functions and symbols. */
+extern boolean _bfd_discard_section_stabs
+ PARAMS ((bfd *, asection *, PTR,
+ boolean (*) (bfd_vma, PTR), PTR));
+
/* Write out the .stab section when linking stabs in sections. */
extern boolean _bfd_write_section_stabs
@@ -462,6 +475,26 @@ extern boolean _bfd_write_stab_strings PARAMS ((bfd *, PTR *));
extern bfd_vma _bfd_stab_section_offset
PARAMS ((bfd *, PTR *, asection *, PTR *, bfd_vma));
+/* Attempt to merge a SEC_MERGE section. */
+
+extern boolean _bfd_merge_section
+ PARAMS ((bfd *, PTR *, asection *, PTR *));
+
+/* Attempt to merge SEC_MERGE sections. */
+
+extern boolean _bfd_merge_sections
+ PARAMS ((bfd *, PTR, void (*)(bfd *, asection *)));
+
+/* Write out a merged section. */
+
+extern boolean _bfd_write_merged_section
+ PARAMS ((bfd *, asection *, PTR));
+
+/* Find an offset within a modified SEC_MERGE section. */
+
+extern bfd_vma _bfd_merged_section_offset
+ PARAMS ((bfd *, asection **, PTR, bfd_vma, bfd_vma));
+
/* Create a string table. */
extern struct bfd_strtab_hash *_bfd_stringtab_init PARAMS ((void));
@@ -554,7 +587,7 @@ extern boolean _bfd_sh_align_load_span
/* And more follows */
void
-bfd_write_bigendian_4byte_int PARAMS ((bfd *abfd, int i));
+bfd_write_bigendian_4byte_int PARAMS ((bfd *, unsigned int));
unsigned int
bfd_log2 PARAMS ((bfd_vma x));
@@ -604,10 +637,12 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_HI16_GOTOFF",
"BFD_RELOC_HI16_S_GOTOFF",
"BFD_RELOC_8_GOTOFF",
+ "BFD_RELOC_64_PLT_PCREL",
"BFD_RELOC_32_PLT_PCREL",
"BFD_RELOC_24_PLT_PCREL",
"BFD_RELOC_16_PLT_PCREL",
"BFD_RELOC_8_PLT_PCREL",
+ "BFD_RELOC_64_PLTOFF",
"BFD_RELOC_32_PLTOFF",
"BFD_RELOC_16_PLTOFF",
"BFD_RELOC_LO16_PLTOFF",
@@ -666,6 +701,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_SPARC_7",
"BFD_RELOC_SPARC_6",
"BFD_RELOC_SPARC_5",
+ "BFD_RELOC_SPARC_PLT32",
"BFD_RELOC_SPARC_PLT64",
"BFD_RELOC_SPARC_HIX22",
"BFD_RELOC_SPARC_LOX10",
@@ -680,16 +716,11 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_ALPHA_LITERAL",
"BFD_RELOC_ALPHA_ELF_LITERAL",
"BFD_RELOC_ALPHA_LITUSE",
- "BFD_RELOC_ALPHA_USER_LITERAL",
- "BFD_RELOC_ALPHA_USER_LITUSE_BASE",
- "BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF",
- "BFD_RELOC_ALPHA_USER_LITUSE_JSR",
- "BFD_RELOC_ALPHA_USER_GPDISP",
- "BFD_RELOC_ALPHA_USER_GPRELHIGH",
- "BFD_RELOC_ALPHA_USER_GPRELLOW",
"BFD_RELOC_ALPHA_HINT",
"BFD_RELOC_ALPHA_LINKAGE",
"BFD_RELOC_ALPHA_CODEADDR",
+ "BFD_RELOC_ALPHA_GPREL_HI16",
+ "BFD_RELOC_ALPHA_GPREL_LO16",
"BFD_RELOC_MIPS_JMP",
"BFD_RELOC_MIPS16_JMP",
"BFD_RELOC_MIPS16_GPREL",
@@ -749,6 +780,8 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_NS32K_DISP_8_PCREL",
"BFD_RELOC_NS32K_DISP_16_PCREL",
"BFD_RELOC_NS32K_DISP_32_PCREL",
+ "BFD_RELOC_PDP11_DISP_8_PCREL",
+ "BFD_RELOC_PDP11_DISP_6_PCREL",
"BFD_RELOC_PJ_CODE_HI16",
"BFD_RELOC_PJ_CODE_LO16",
"BFD_RELOC_PJ_CODE_DIR16",
@@ -785,6 +818,29 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_PPC_EMB_RELST_HA",
"BFD_RELOC_PPC_EMB_BIT_FLD",
"BFD_RELOC_PPC_EMB_RELSDA",
+ "BFD_RELOC_PPC64_HIGHER",
+ "BFD_RELOC_PPC64_HIGHER_S",
+ "BFD_RELOC_PPC64_HIGHEST",
+ "BFD_RELOC_PPC64_HIGHEST_S",
+ "BFD_RELOC_PPC64_TOC16_LO",
+ "BFD_RELOC_PPC64_TOC16_HI",
+ "BFD_RELOC_PPC64_TOC16_HA",
+ "BFD_RELOC_PPC64_TOC",
+ "BFD_RELOC_PPC64_PLTGOT16",
+ "BFD_RELOC_PPC64_PLTGOT16_LO",
+ "BFD_RELOC_PPC64_PLTGOT16_HI",
+ "BFD_RELOC_PPC64_PLTGOT16_HA",
+ "BFD_RELOC_PPC64_ADDR16_DS",
+ "BFD_RELOC_PPC64_ADDR16_LO_DS",
+ "BFD_RELOC_PPC64_GOT16_DS",
+ "BFD_RELOC_PPC64_GOT16_LO_DS",
+ "BFD_RELOC_PPC64_PLT16_LO_DS",
+ "BFD_RELOC_PPC64_SECTOFF_DS",
+ "BFD_RELOC_PPC64_SECTOFF_LO_DS",
+ "BFD_RELOC_PPC64_TOC16_DS",
+ "BFD_RELOC_PPC64_TOC16_LO_DS",
+ "BFD_RELOC_PPC64_PLTGOT16_DS",
+ "BFD_RELOC_PPC64_PLTGOT16_LO_DS",
"BFD_RELOC_I370_D12",
"BFD_RELOC_CTOR",
"BFD_RELOC_ARM_PCREL_BRANCH",
@@ -908,6 +964,29 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_MCORE_PCREL_32",
"BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2",
"BFD_RELOC_MCORE_RVA",
+ "BFD_RELOC_MMIX_GETA",
+ "BFD_RELOC_MMIX_GETA_1",
+ "BFD_RELOC_MMIX_GETA_2",
+ "BFD_RELOC_MMIX_GETA_3",
+ "BFD_RELOC_MMIX_CBRANCH",
+ "BFD_RELOC_MMIX_CBRANCH_J",
+ "BFD_RELOC_MMIX_CBRANCH_1",
+ "BFD_RELOC_MMIX_CBRANCH_2",
+ "BFD_RELOC_MMIX_CBRANCH_3",
+ "BFD_RELOC_MMIX_PUSHJ",
+ "BFD_RELOC_MMIX_PUSHJ_1",
+ "BFD_RELOC_MMIX_PUSHJ_2",
+ "BFD_RELOC_MMIX_PUSHJ_3",
+ "BFD_RELOC_MMIX_JMP",
+ "BFD_RELOC_MMIX_JMP_1",
+ "BFD_RELOC_MMIX_JMP_2",
+ "BFD_RELOC_MMIX_JMP_3",
+ "BFD_RELOC_MMIX_ADDR19",
+ "BFD_RELOC_MMIX_ADDR27",
+ "BFD_RELOC_MMIX_REG_OR_BYTE",
+ "BFD_RELOC_MMIX_REG",
+ "BFD_RELOC_MMIX_BASE_PLUS_OFFSET",
+ "BFD_RELOC_MMIX_LOCAL",
"BFD_RELOC_AVR_7_PCREL",
"BFD_RELOC_AVR_13_PCREL",
"BFD_RELOC_AVR_16_PM",
@@ -924,6 +1003,23 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_AVR_HI8_LDI_PM_NEG",
"BFD_RELOC_AVR_HH8_LDI_PM_NEG",
"BFD_RELOC_AVR_CALL",
+ "BFD_RELOC_390_12",
+ "BFD_RELOC_390_GOT12",
+ "BFD_RELOC_390_PLT32",
+ "BFD_RELOC_390_COPY",
+ "BFD_RELOC_390_GLOB_DAT",
+ "BFD_RELOC_390_JMP_SLOT",
+ "BFD_RELOC_390_RELATIVE",
+ "BFD_RELOC_390_GOTPC",
+ "BFD_RELOC_390_GOT16",
+ "BFD_RELOC_390_PC16DBL",
+ "BFD_RELOC_390_PLT16DBL",
+ "BFD_RELOC_390_PC32DBL",
+ "BFD_RELOC_390_PLT32DBL",
+ "BFD_RELOC_390_GOTPCDBL",
+ "BFD_RELOC_390_GOT64",
+ "BFD_RELOC_390_PLT64",
+ "BFD_RELOC_390_GOTENT",
"BFD_RELOC_VTABLE_INHERIT",
"BFD_RELOC_VTABLE_ENTRY",
"BFD_RELOC_IA64_IMM14",
@@ -963,6 +1059,8 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_IA64_PCREL64LSB",
"BFD_RELOC_IA64_LTOFF_FPTR22",
"BFD_RELOC_IA64_LTOFF_FPTR64I",
+ "BFD_RELOC_IA64_LTOFF_FPTR32MSB",
+ "BFD_RELOC_IA64_LTOFF_FPTR32LSB",
"BFD_RELOC_IA64_LTOFF_FPTR64MSB",
"BFD_RELOC_IA64_LTOFF_FPTR64LSB",
"BFD_RELOC_IA64_SEGREL32MSB",
@@ -998,6 +1096,17 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_CRIS_SIGNED_6",
"BFD_RELOC_CRIS_UNSIGNED_6",
"BFD_RELOC_CRIS_UNSIGNED_4",
+ "BFD_RELOC_CRIS_COPY",
+ "BFD_RELOC_CRIS_GLOB_DAT",
+ "BFD_RELOC_CRIS_JUMP_SLOT",
+ "BFD_RELOC_CRIS_RELATIVE",
+ "BFD_RELOC_CRIS_32_GOT",
+ "BFD_RELOC_CRIS_16_GOT",
+ "BFD_RELOC_CRIS_32_GOTPLT",
+ "BFD_RELOC_CRIS_16_GOTPLT",
+ "BFD_RELOC_CRIS_32_GOTREL",
+ "BFD_RELOC_CRIS_32_PLT_GOTREL",
+ "BFD_RELOC_CRIS_32_PLT_PCREL",
"BFD_RELOC_860_COPY",
"BFD_RELOC_860_GLOB_DAT",
"BFD_RELOC_860_JUMP_SLOT",
@@ -1030,6 +1139,16 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_860_HIGH",
"BFD_RELOC_860_HIGOT",
"BFD_RELOC_860_HIGOTOFF",
+ "BFD_RELOC_OPENRISC_ABS_26",
+ "BFD_RELOC_OPENRISC_REL_26",
+ "BFD_RELOC_H8_DIR16A8",
+ "BFD_RELOC_H8_DIR16R8",
+ "BFD_RELOC_H8_DIR24A8",
+ "BFD_RELOC_H8_DIR24R8",
+ "BFD_RELOC_H8_DIR32A16",
+ "BFD_RELOC_XSTORMY16_REL_12",
+ "BFD_RELOC_XSTORMY16_24",
+ "BFD_RELOC_XSTORMY16_FPTR16",
"@@overflow: BFD_RELOC_UNUSED@@",
};
#endif
@@ -1046,6 +1165,9 @@ bfd_generic_relax_section PARAMS ((bfd *abfd,
boolean
bfd_generic_gc_sections PARAMS ((bfd *, struct bfd_link_info *));
+boolean
+bfd_generic_merge_sections PARAMS ((bfd *, struct bfd_link_info *));
+
bfd_byte *
bfd_generic_get_relocated_section_contents PARAMS ((bfd *abfd,
struct bfd_link_info *link_info,
diff --git a/contrib/binutils/bfd/libcoff-in.h b/contrib/binutils/bfd/libcoff-in.h
index 8368cc8..bbccbba 100644
--- a/contrib/binutils/bfd/libcoff-in.h
+++ b/contrib/binutils/bfd/libcoff-in.h
@@ -4,9 +4,6 @@
Free Software Foundation, Inc.
Written by Cygnus Support.
-** NOTE: libcoff.h is a GENERATED file. Don't change it; instead,
-** change libcoff-in.h or coffcode.h.
-
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
@@ -176,7 +173,7 @@ struct xcoff_tdata
#define xcoff_data(abfd) ((abfd)->tdata.xcoff_obj_data)
-/* We take the address of the first element of a asymbol to ensure that the
+/* We take the address of the first element of an asymbol to ensure that the
* macro is only ever applied to an asymbol. */
#define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd)))
@@ -302,50 +299,64 @@ struct coff_link_hash_table
#define coff_hash_table(p) ((struct coff_link_hash_table *) ((p)->hash))
/* Functions in coffgen.c. */
-extern const bfd_target *coff_object_p PARAMS ((bfd *));
-extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int));
-extern long coff_get_symtab_upper_bound PARAMS ((bfd *));
-extern long coff_get_symtab PARAMS ((bfd *, asymbol **));
-extern int coff_count_linenumbers PARAMS ((bfd *));
-extern struct coff_symbol_struct *coff_symbol_from PARAMS ((bfd *, asymbol *));
-extern boolean coff_renumber_symbols PARAMS ((bfd *, int *));
-extern void coff_mangle_symbols PARAMS ((bfd *));
-extern boolean coff_write_symbols PARAMS ((bfd *));
-extern boolean coff_write_linenumbers PARAMS ((bfd *));
-extern alent *coff_get_lineno PARAMS ((bfd *, asymbol *));
-extern asymbol *coff_section_symbol PARAMS ((bfd *, char *));
-extern boolean _bfd_coff_get_external_symbols PARAMS ((bfd *));
-extern const char *_bfd_coff_read_string_table PARAMS ((bfd *));
-extern boolean _bfd_coff_free_symbols PARAMS ((bfd *));
-extern struct coff_ptr_struct *coff_get_normalized_symtab PARAMS ((bfd *));
-extern long coff_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
-extern asymbol *coff_make_empty_symbol PARAMS ((bfd *));
-extern void coff_print_symbol PARAMS ((bfd *, PTR filep, asymbol *,
- bfd_print_symbol_type how));
-extern void coff_get_symbol_info PARAMS ((bfd *, asymbol *,
- symbol_info *ret));
-extern boolean _bfd_coff_is_local_label_name PARAMS ((bfd *, const char *));
-extern asymbol *coff_bfd_make_debug_symbol PARAMS ((bfd *, PTR,
- unsigned long));
-extern boolean coff_find_nearest_line PARAMS ((bfd *,
- asection *,
- asymbol **,
- bfd_vma offset,
- CONST char **filename_ptr,
- CONST char **functionname_ptr,
- unsigned int *line_ptr));
-extern int coff_sizeof_headers PARAMS ((bfd *, boolean reloc));
+extern const bfd_target *coff_object_p
+ PARAMS ((bfd *));
+extern struct sec *coff_section_from_bfd_index
+ PARAMS ((bfd *, int));
+extern long coff_get_symtab_upper_bound
+ PARAMS ((bfd *));
+extern long coff_get_symtab
+ PARAMS ((bfd *, asymbol **));
+extern int coff_count_linenumbers
+ PARAMS ((bfd *));
+extern struct coff_symbol_struct *coff_symbol_from
+ PARAMS ((bfd *, asymbol *));
+extern boolean coff_renumber_symbols
+ PARAMS ((bfd *, int *));
+extern void coff_mangle_symbols
+ PARAMS ((bfd *));
+extern boolean coff_write_symbols
+ PARAMS ((bfd *));
+extern boolean coff_write_linenumbers
+ PARAMS ((bfd *));
+extern alent *coff_get_lineno
+ PARAMS ((bfd *, asymbol *));
+extern asymbol *coff_section_symbol
+ PARAMS ((bfd *, char *));
+extern boolean _bfd_coff_get_external_symbols
+ PARAMS ((bfd *));
+extern const char *_bfd_coff_read_string_table
+ PARAMS ((bfd *));
+extern boolean _bfd_coff_free_symbols
+ PARAMS ((bfd *));
+extern struct coff_ptr_struct *coff_get_normalized_symtab
+ PARAMS ((bfd *));
+extern long coff_get_reloc_upper_bound
+ PARAMS ((bfd *, sec_ptr));
+extern asymbol *coff_make_empty_symbol
+ PARAMS ((bfd *));
+extern void coff_print_symbol
+ PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type));
+extern void coff_get_symbol_info
+ PARAMS ((bfd *, asymbol *, symbol_info *ret));
+extern boolean _bfd_coff_is_local_label_name
+ PARAMS ((bfd *, const char *));
+extern asymbol *coff_bfd_make_debug_symbol
+ PARAMS ((bfd *, PTR, unsigned long));
+extern boolean coff_find_nearest_line
+ PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
+ const char **, unsigned int *));
+extern int coff_sizeof_headers
+ PARAMS ((bfd *, boolean));
extern boolean bfd_coff_reloc16_relax_section
PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *, boolean relocateable, asymbol **));
-extern bfd_vma bfd_coff_reloc16_get_value PARAMS ((arelent *,
- struct bfd_link_info *,
- asection *));
-extern void bfd_perform_slip PARAMS ((bfd *abfd, unsigned int slip,
- asection *input_section,
- bfd_vma val));
+ bfd_byte *, boolean, asymbol **));
+extern bfd_vma bfd_coff_reloc16_get_value
+ PARAMS ((arelent *, struct bfd_link_info *, asection *));
+extern void bfd_perform_slip
+ PARAMS ((bfd *, unsigned int, asection *, bfd_vma));
/* Functions and types in cofflink.c. */
@@ -559,10 +570,12 @@ extern boolean _bfd_coff_reloc_link_order
/* Functions in xcofflink.c. */
-extern long _bfd_xcoff_get_dynamic_symtab_upper_bound PARAMS ((bfd *));
+extern long _bfd_xcoff_get_dynamic_symtab_upper_bound
+ PARAMS ((bfd *));
extern long _bfd_xcoff_canonicalize_dynamic_symtab
PARAMS ((bfd *, asymbol **));
-extern long _bfd_xcoff_get_dynamic_reloc_upper_bound PARAMS ((bfd *));
+extern long _bfd_xcoff_get_dynamic_reloc_upper_bound
+ PARAMS ((bfd *));
extern long _bfd_xcoff_canonicalize_dynamic_reloc
PARAMS ((bfd *, arelent **, asymbol **));
extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
@@ -578,7 +591,8 @@ extern boolean _bfd_ppc_xcoff_relocate_section
/* Functions in coff-ppc.c. FIXME: These are called be pe.em in the
linker, and so should start with bfd and be declared in bfd.h. */
-extern boolean ppc_allocate_toc_section PARAMS ((struct bfd_link_info *));
+extern boolean ppc_allocate_toc_section
+ PARAMS ((struct bfd_link_info *));
extern boolean ppc_process_before_allocation
PARAMS ((bfd *, struct bfd_link_info *));
diff --git a/contrib/binutils/bfd/libcoff.h b/contrib/binutils/bfd/libcoff.h
index 34fed2d..f26a692 100644
--- a/contrib/binutils/bfd/libcoff.h
+++ b/contrib/binutils/bfd/libcoff.h
@@ -1,12 +1,13 @@
+/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically
+ generated from "libcoff-in.h" and "coffcode.h".
+ Run "make headers" in your build bfd/ to regenerate. */
+
/* BFD COFF object file private structure.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001
Free Software Foundation, Inc.
Written by Cygnus Support.
-** NOTE: libcoff.h is a GENERATED file. Don't change it; instead,
-** change libcoff-in.h or coffcode.h.
-
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
@@ -176,7 +177,7 @@ struct xcoff_tdata
#define xcoff_data(abfd) ((abfd)->tdata.xcoff_obj_data)
-/* We take the address of the first element of a asymbol to ensure that the
+/* We take the address of the first element of an asymbol to ensure that the
* macro is only ever applied to an asymbol. */
#define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd)))
@@ -302,50 +303,64 @@ struct coff_link_hash_table
#define coff_hash_table(p) ((struct coff_link_hash_table *) ((p)->hash))
/* Functions in coffgen.c. */
-extern const bfd_target *coff_object_p PARAMS ((bfd *));
-extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int));
-extern long coff_get_symtab_upper_bound PARAMS ((bfd *));
-extern long coff_get_symtab PARAMS ((bfd *, asymbol **));
-extern int coff_count_linenumbers PARAMS ((bfd *));
-extern struct coff_symbol_struct *coff_symbol_from PARAMS ((bfd *, asymbol *));
-extern boolean coff_renumber_symbols PARAMS ((bfd *, int *));
-extern void coff_mangle_symbols PARAMS ((bfd *));
-extern boolean coff_write_symbols PARAMS ((bfd *));
-extern boolean coff_write_linenumbers PARAMS ((bfd *));
-extern alent *coff_get_lineno PARAMS ((bfd *, asymbol *));
-extern asymbol *coff_section_symbol PARAMS ((bfd *, char *));
-extern boolean _bfd_coff_get_external_symbols PARAMS ((bfd *));
-extern const char *_bfd_coff_read_string_table PARAMS ((bfd *));
-extern boolean _bfd_coff_free_symbols PARAMS ((bfd *));
-extern struct coff_ptr_struct *coff_get_normalized_symtab PARAMS ((bfd *));
-extern long coff_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
-extern asymbol *coff_make_empty_symbol PARAMS ((bfd *));
-extern void coff_print_symbol PARAMS ((bfd *, PTR filep, asymbol *,
- bfd_print_symbol_type how));
-extern void coff_get_symbol_info PARAMS ((bfd *, asymbol *,
- symbol_info *ret));
-extern boolean _bfd_coff_is_local_label_name PARAMS ((bfd *, const char *));
-extern asymbol *coff_bfd_make_debug_symbol PARAMS ((bfd *, PTR,
- unsigned long));
-extern boolean coff_find_nearest_line PARAMS ((bfd *,
- asection *,
- asymbol **,
- bfd_vma offset,
- CONST char **filename_ptr,
- CONST char **functionname_ptr,
- unsigned int *line_ptr));
-extern int coff_sizeof_headers PARAMS ((bfd *, boolean reloc));
+extern const bfd_target *coff_object_p
+ PARAMS ((bfd *));
+extern struct sec *coff_section_from_bfd_index
+ PARAMS ((bfd *, int));
+extern long coff_get_symtab_upper_bound
+ PARAMS ((bfd *));
+extern long coff_get_symtab
+ PARAMS ((bfd *, asymbol **));
+extern int coff_count_linenumbers
+ PARAMS ((bfd *));
+extern struct coff_symbol_struct *coff_symbol_from
+ PARAMS ((bfd *, asymbol *));
+extern boolean coff_renumber_symbols
+ PARAMS ((bfd *, int *));
+extern void coff_mangle_symbols
+ PARAMS ((bfd *));
+extern boolean coff_write_symbols
+ PARAMS ((bfd *));
+extern boolean coff_write_linenumbers
+ PARAMS ((bfd *));
+extern alent *coff_get_lineno
+ PARAMS ((bfd *, asymbol *));
+extern asymbol *coff_section_symbol
+ PARAMS ((bfd *, char *));
+extern boolean _bfd_coff_get_external_symbols
+ PARAMS ((bfd *));
+extern const char *_bfd_coff_read_string_table
+ PARAMS ((bfd *));
+extern boolean _bfd_coff_free_symbols
+ PARAMS ((bfd *));
+extern struct coff_ptr_struct *coff_get_normalized_symtab
+ PARAMS ((bfd *));
+extern long coff_get_reloc_upper_bound
+ PARAMS ((bfd *, sec_ptr));
+extern asymbol *coff_make_empty_symbol
+ PARAMS ((bfd *));
+extern void coff_print_symbol
+ PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type));
+extern void coff_get_symbol_info
+ PARAMS ((bfd *, asymbol *, symbol_info *ret));
+extern boolean _bfd_coff_is_local_label_name
+ PARAMS ((bfd *, const char *));
+extern asymbol *coff_bfd_make_debug_symbol
+ PARAMS ((bfd *, PTR, unsigned long));
+extern boolean coff_find_nearest_line
+ PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
+ const char **, unsigned int *));
+extern int coff_sizeof_headers
+ PARAMS ((bfd *, boolean));
extern boolean bfd_coff_reloc16_relax_section
PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *, boolean relocateable, asymbol **));
-extern bfd_vma bfd_coff_reloc16_get_value PARAMS ((arelent *,
- struct bfd_link_info *,
- asection *));
-extern void bfd_perform_slip PARAMS ((bfd *abfd, unsigned int slip,
- asection *input_section,
- bfd_vma val));
+ bfd_byte *, boolean, asymbol **));
+extern bfd_vma bfd_coff_reloc16_get_value
+ PARAMS ((arelent *, struct bfd_link_info *, asection *));
+extern void bfd_perform_slip
+ PARAMS ((bfd *, unsigned int, asection *, bfd_vma));
/* Functions and types in cofflink.c. */
@@ -559,10 +574,12 @@ extern boolean _bfd_coff_reloc_link_order
/* Functions in xcofflink.c. */
-extern long _bfd_xcoff_get_dynamic_symtab_upper_bound PARAMS ((bfd *));
+extern long _bfd_xcoff_get_dynamic_symtab_upper_bound
+ PARAMS ((bfd *));
extern long _bfd_xcoff_canonicalize_dynamic_symtab
PARAMS ((bfd *, asymbol **));
-extern long _bfd_xcoff_get_dynamic_reloc_upper_bound PARAMS ((bfd *));
+extern long _bfd_xcoff_get_dynamic_reloc_upper_bound
+ PARAMS ((bfd *));
extern long _bfd_xcoff_canonicalize_dynamic_reloc
PARAMS ((bfd *, arelent **, asymbol **));
extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
@@ -578,7 +595,8 @@ extern boolean _bfd_ppc_xcoff_relocate_section
/* Functions in coff-ppc.c. FIXME: These are called be pe.em in the
linker, and so should start with bfd and be declared in bfd.h. */
-extern boolean ppc_allocate_toc_section PARAMS ((struct bfd_link_info *));
+extern boolean ppc_allocate_toc_section
+ PARAMS ((struct bfd_link_info *));
extern boolean ppc_process_before_allocation
PARAMS ((bfd *, struct bfd_link_info *));
@@ -586,39 +604,37 @@ extern boolean ppc_process_before_allocation
typedef struct coff_ptr_struct
{
-
- /* Remembers the offset from the first symbol in the file for
- this symbol. Generated by coff_renumber_symbols. */
-unsigned int offset;
-
- /* Should the value of this symbol be renumbered. Used for
- XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */
-unsigned int fix_value : 1;
-
- /* Should the tag field of this symbol be renumbered.
- Created by coff_pointerize_aux. */
-unsigned int fix_tag : 1;
-
- /* Should the endidx field of this symbol be renumbered.
- Created by coff_pointerize_aux. */
-unsigned int fix_end : 1;
-
- /* Should the x_csect.x_scnlen field be renumbered.
- Created by coff_pointerize_aux. */
-unsigned int fix_scnlen : 1;
-
- /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the
- index into the line number entries. Set by
- coff_slurp_symbol_table. */
-unsigned int fix_line : 1;
-
- /* The container for the symbol structure as read and translated
- from the file. */
-
-union {
- union internal_auxent auxent;
- struct internal_syment syment;
- } u;
+ /* Remembers the offset from the first symbol in the file for
+ this symbol. Generated by coff_renumber_symbols. */
+ unsigned int offset;
+
+ /* Should the value of this symbol be renumbered. Used for
+ XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */
+ unsigned int fix_value : 1;
+
+ /* Should the tag field of this symbol be renumbered.
+ Created by coff_pointerize_aux. */
+ unsigned int fix_tag : 1;
+
+ /* Should the endidx field of this symbol be renumbered.
+ Created by coff_pointerize_aux. */
+ unsigned int fix_end : 1;
+
+ /* Should the x_csect.x_scnlen field be renumbered.
+ Created by coff_pointerize_aux. */
+ unsigned int fix_scnlen : 1;
+
+ /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the
+ index into the line number entries. Set by coff_slurp_symbol_table. */
+ unsigned int fix_line : 1;
+
+ /* The container for the symbol structure as read and translated
+ from the file. */
+ union
+ {
+ union internal_auxent auxent;
+ struct internal_syment syment;
+ } u;
} combined_entry_type;
@@ -626,17 +642,17 @@ union {
typedef struct coff_symbol_struct
{
- /* The actual symbol which the rest of BFD works with */
-asymbol symbol;
+ /* The actual symbol which the rest of BFD works with */
+ asymbol symbol;
- /* A pointer to the hidden information for this symbol */
-combined_entry_type *native;
+ /* A pointer to the hidden information for this symbol */
+ combined_entry_type *native;
- /* A pointer to the linenumber information for this symbol */
-struct lineno_cache_entry *lineno;
+ /* A pointer to the linenumber information for this symbol */
+ struct lineno_cache_entry *lineno;
- /* Have the line numbers been relocated yet ? */
-boolean done_lineno;
+ /* Have the line numbers been relocated yet ? */
+ boolean done_lineno;
} coff_symbol_type;
/* COFF symbol classifications. */
@@ -656,227 +672,166 @@ enum coff_symbol_classification
typedef struct
{
- void (*_bfd_coff_swap_aux_in) PARAMS ((
- bfd *abfd,
- PTR ext,
- int type,
- int class,
- int indaux,
- int numaux,
- PTR in));
-
- void (*_bfd_coff_swap_sym_in) PARAMS ((
- bfd *abfd ,
- PTR ext,
- PTR in));
-
- void (*_bfd_coff_swap_lineno_in) PARAMS ((
- bfd *abfd,
- PTR ext,
- PTR in));
-
- unsigned int (*_bfd_coff_swap_aux_out) PARAMS ((
- bfd *abfd,
- PTR in,
- int type,
- int class,
- int indaux,
- int numaux,
- PTR ext));
-
- unsigned int (*_bfd_coff_swap_sym_out) PARAMS ((
- bfd *abfd,
- PTR in,
- PTR ext));
-
- unsigned int (*_bfd_coff_swap_lineno_out) PARAMS ((
- bfd *abfd,
- PTR in,
- PTR ext));
-
- unsigned int (*_bfd_coff_swap_reloc_out) PARAMS ((
- bfd *abfd,
- PTR src,
- PTR dst));
-
- unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS ((
- bfd *abfd,
- PTR in,
- PTR out));
-
- unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS ((
- bfd *abfd,
- PTR in,
- PTR out));
-
- unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS ((
- bfd *abfd,
- PTR in,
- PTR out));
-
- unsigned int _bfd_filhsz;
- unsigned int _bfd_aoutsz;
- unsigned int _bfd_scnhsz;
- unsigned int _bfd_symesz;
- unsigned int _bfd_auxesz;
- unsigned int _bfd_relsz;
- unsigned int _bfd_linesz;
- unsigned int _bfd_filnmlen;
- boolean _bfd_coff_long_filenames;
- boolean _bfd_coff_long_section_names;
- unsigned int _bfd_coff_default_section_alignment_power;
- boolean _bfd_coff_force_symnames_in_strings;
- unsigned int _bfd_coff_debug_string_prefix_length;
- void (*_bfd_coff_swap_filehdr_in) PARAMS ((
- bfd *abfd,
- PTR ext,
- PTR in));
- void (*_bfd_coff_swap_aouthdr_in) PARAMS ((
- bfd *abfd,
- PTR ext,
- PTR in));
- void (*_bfd_coff_swap_scnhdr_in) PARAMS ((
- bfd *abfd,
- PTR ext,
- PTR in));
- void (*_bfd_coff_swap_reloc_in) PARAMS ((
- bfd *abfd,
- PTR ext,
- PTR in));
- boolean (*_bfd_coff_bad_format_hook) PARAMS ((
- bfd *abfd,
- PTR internal_filehdr));
- boolean (*_bfd_coff_set_arch_mach_hook) PARAMS ((
- bfd *abfd,
- PTR internal_filehdr));
- PTR (*_bfd_coff_mkobject_hook) PARAMS ((
- bfd *abfd,
- PTR internal_filehdr,
- PTR internal_aouthdr));
- flagword (*_bfd_styp_to_sec_flags_hook) PARAMS ((
- bfd *abfd,
- PTR internal_scnhdr,
- const char *name,
- asection *section));
- void (*_bfd_set_alignment_hook) PARAMS ((
- bfd *abfd,
- asection *sec,
- PTR internal_scnhdr));
- boolean (*_bfd_coff_slurp_symbol_table) PARAMS ((
- bfd *abfd));
- boolean (*_bfd_coff_symname_in_debug) PARAMS ((
- bfd *abfd,
- struct internal_syment *sym));
- boolean (*_bfd_coff_pointerize_aux_hook) PARAMS ((
- bfd *abfd,
- combined_entry_type *table_base,
- combined_entry_type *symbol,
- unsigned int indaux,
- combined_entry_type *aux));
- boolean (*_bfd_coff_print_aux) PARAMS ((
- bfd *abfd,
- FILE *file,
- combined_entry_type *table_base,
- combined_entry_type *symbol,
- combined_entry_type *aux,
- unsigned int indaux));
- void (*_bfd_coff_reloc16_extra_cases) PARAMS ((
- bfd *abfd,
- struct bfd_link_info *link_info,
- struct bfd_link_order *link_order,
- arelent *reloc,
- bfd_byte *data,
- unsigned int *src_ptr,
- unsigned int *dst_ptr));
- int (*_bfd_coff_reloc16_estimate) PARAMS ((
- bfd *abfd,
- asection *input_section,
- arelent *r,
- unsigned int shrink,
- struct bfd_link_info *link_info));
- enum coff_symbol_classification (*_bfd_coff_classify_symbol) PARAMS ((
- bfd *abfd,
- struct internal_syment *));
- boolean (*_bfd_coff_compute_section_file_positions) PARAMS ((
- bfd *abfd));
- boolean (*_bfd_coff_start_final_link) PARAMS ((
- bfd *output_bfd,
- struct bfd_link_info *info));
- boolean (*_bfd_coff_relocate_section) PARAMS ((
- bfd *output_bfd,
- struct bfd_link_info *info,
- bfd *input_bfd,
- asection *input_section,
- bfd_byte *contents,
- struct internal_reloc *relocs,
- struct internal_syment *syms,
- asection **sections));
- reloc_howto_type *(*_bfd_coff_rtype_to_howto) PARAMS ((
- bfd *abfd,
- asection *sec,
- struct internal_reloc *rel,
- struct coff_link_hash_entry *h,
- struct internal_syment *sym,
- bfd_vma *addendp));
- boolean (*_bfd_coff_adjust_symndx) PARAMS ((
- bfd *obfd,
- struct bfd_link_info *info,
- bfd *ibfd,
- asection *sec,
- struct internal_reloc *reloc,
- boolean *adjustedp));
- boolean (*_bfd_coff_link_add_one_symbol) PARAMS ((
- struct bfd_link_info *info,
- bfd *abfd,
- const char *name,
- flagword flags,
- asection *section,
- bfd_vma value,
- const char *string,
- boolean copy,
- boolean collect,
- struct bfd_link_hash_entry **hashp));
-
- boolean (*_bfd_coff_link_output_has_begun) PARAMS ((
- bfd * abfd,
- struct coff_final_link_info * pfinfo));
- boolean (*_bfd_coff_final_link_postscript) PARAMS ((
- bfd * abfd,
- struct coff_final_link_info * pfinfo));
+ void (*_bfd_coff_swap_aux_in)
+ PARAMS ((bfd *, PTR, int, int, int, int, PTR));
+
+ void (*_bfd_coff_swap_sym_in)
+ PARAMS ((bfd *, PTR, PTR));
+
+ void (*_bfd_coff_swap_lineno_in)
+ PARAMS ((bfd *, PTR, PTR));
+
+ unsigned int (*_bfd_coff_swap_aux_out)
+ PARAMS ((bfd *, PTR, int, int, int, int, PTR));
+
+ unsigned int (*_bfd_coff_swap_sym_out)
+ PARAMS ((bfd *, PTR, PTR));
+
+ unsigned int (*_bfd_coff_swap_lineno_out)
+ PARAMS ((bfd *, PTR, PTR));
+
+ unsigned int (*_bfd_coff_swap_reloc_out)
+ PARAMS ((bfd *, PTR, PTR));
+
+ unsigned int (*_bfd_coff_swap_filehdr_out)
+ PARAMS ((bfd *, PTR, PTR));
+
+ unsigned int (*_bfd_coff_swap_aouthdr_out)
+ PARAMS ((bfd *, PTR, PTR));
+
+ unsigned int (*_bfd_coff_swap_scnhdr_out)
+ PARAMS ((bfd *, PTR, PTR));
+
+ unsigned int _bfd_filhsz;
+ unsigned int _bfd_aoutsz;
+ unsigned int _bfd_scnhsz;
+ unsigned int _bfd_symesz;
+ unsigned int _bfd_auxesz;
+ unsigned int _bfd_relsz;
+ unsigned int _bfd_linesz;
+ unsigned int _bfd_filnmlen;
+ boolean _bfd_coff_long_filenames;
+ boolean _bfd_coff_long_section_names;
+ unsigned int _bfd_coff_default_section_alignment_power;
+ boolean _bfd_coff_force_symnames_in_strings;
+ unsigned int _bfd_coff_debug_string_prefix_length;
+
+ void (*_bfd_coff_swap_filehdr_in)
+ PARAMS ((bfd *, PTR, PTR));
+
+ void (*_bfd_coff_swap_aouthdr_in)
+ PARAMS ((bfd *, PTR, PTR));
+
+ void (*_bfd_coff_swap_scnhdr_in)
+ PARAMS ((bfd *, PTR, PTR));
+
+ void (*_bfd_coff_swap_reloc_in)
+ PARAMS ((bfd *abfd, PTR, PTR));
+
+ boolean (*_bfd_coff_bad_format_hook)
+ PARAMS ((bfd *, PTR));
+
+ boolean (*_bfd_coff_set_arch_mach_hook)
+ PARAMS ((bfd *, PTR));
+
+ PTR (*_bfd_coff_mkobject_hook)
+ PARAMS ((bfd *, PTR, PTR));
+
+ boolean (*_bfd_styp_to_sec_flags_hook)
+ PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
+
+ void (*_bfd_set_alignment_hook)
+ PARAMS ((bfd *, asection *, PTR));
+
+ boolean (*_bfd_coff_slurp_symbol_table)
+ PARAMS ((bfd *));
+
+ boolean (*_bfd_coff_symname_in_debug)
+ PARAMS ((bfd *, struct internal_syment *));
+
+ boolean (*_bfd_coff_pointerize_aux_hook)
+ PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
+ unsigned int, combined_entry_type *));
+
+ boolean (*_bfd_coff_print_aux)
+ PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *,
+ combined_entry_type *, unsigned int));
+
+ void (*_bfd_coff_reloc16_extra_cases)
+ PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *,
+ bfd_byte *, unsigned int *, unsigned int *));
+
+ int (*_bfd_coff_reloc16_estimate)
+ PARAMS ((bfd *, asection *, arelent *, unsigned int,
+ struct bfd_link_info *));
+
+ enum coff_symbol_classification (*_bfd_coff_classify_symbol)
+ PARAMS ((bfd *, struct internal_syment *));
+
+ boolean (*_bfd_coff_compute_section_file_positions)
+ PARAMS ((bfd *));
+
+ boolean (*_bfd_coff_start_final_link)
+ PARAMS ((bfd *, struct bfd_link_info *));
+
+ boolean (*_bfd_coff_relocate_section)
+ PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+ struct internal_reloc *, struct internal_syment *, asection **));
+
+ reloc_howto_type *(*_bfd_coff_rtype_to_howto)
+ PARAMS ((bfd *, asection *, struct internal_reloc *,
+ struct coff_link_hash_entry *, struct internal_syment *,
+ bfd_vma *));
+
+ boolean (*_bfd_coff_adjust_symndx)\
+ PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
+ struct internal_reloc *, boolean *));
+
+ boolean (*_bfd_coff_link_add_one_symbol)
+ PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
+ asection *, bfd_vma, const char *, boolean, boolean,
+ struct bfd_link_hash_entry **));
+
+ boolean (*_bfd_coff_link_output_has_begun)
+ PARAMS ((bfd *, struct coff_final_link_info *));
+
+ boolean (*_bfd_coff_final_link_postscript)
+ PARAMS ((bfd *, struct coff_final_link_info *));
} bfd_coff_backend_data;
-#define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
+#define coff_backend_info(abfd) \
+ ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \
- ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
+ ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
#define bfd_coff_swap_sym_in(a,e,i) \
- ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i))
+ ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i))
#define bfd_coff_swap_lineno_in(a,e,i) \
- ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i))
+ ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i))
#define bfd_coff_swap_reloc_out(abfd, i, o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o))
+ ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o))
#define bfd_coff_swap_lineno_out(abfd, i, o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o))
+ ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o))
#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \
- ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o))
+ ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o))
#define bfd_coff_swap_sym_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o))
+ ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o))
#define bfd_coff_swap_scnhdr_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o))
+ ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o))
#define bfd_coff_swap_filehdr_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o))
+ ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o))
#define bfd_coff_swap_aouthdr_out(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o))
+ ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o))
#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz)
#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz)
@@ -886,88 +841,89 @@ typedef struct
#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz)
#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen)
-#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames)
+#define bfd_coff_long_filenames(abfd) \
+ (coff_backend_info (abfd)->_bfd_coff_long_filenames)
#define bfd_coff_long_section_names(abfd) \
- (coff_backend_info (abfd)->_bfd_coff_long_section_names)
+ (coff_backend_info (abfd)->_bfd_coff_long_section_names)
#define bfd_coff_default_section_alignment_power(abfd) \
- (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power)
+ (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power)
#define bfd_coff_swap_filehdr_in(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
+ ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
#define bfd_coff_swap_aouthdr_in(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o))
+ ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o))
#define bfd_coff_swap_scnhdr_in(abfd, i,o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
+ ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
#define bfd_coff_swap_reloc_in(abfd, i, o) \
- ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))
+ ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))
#define bfd_coff_bad_format_hook(abfd, filehdr) \
- ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
+ ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
- ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
+ ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
- ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
+ ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
-#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section)\
- ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
- (abfd, scnhdr, name, section))
+#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\
+ ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
+ (abfd, scnhdr, name, section, flags_ptr))
#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
- ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
+ ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
#define bfd_coff_slurp_symbol_table(abfd)\
- ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd))
+ ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd))
#define bfd_coff_symname_in_debug(abfd, sym)\
- ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))
+ ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))
#define bfd_coff_force_symnames_in_strings(abfd)\
- (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings)
+ (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings)
#define bfd_coff_debug_string_prefix_length(abfd)\
- (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length)
+ (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length)
#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\
- ((coff_backend_info (abfd)->_bfd_coff_print_aux)\
- (abfd, file, base, symbol, aux, indaux))
+ ((coff_backend_info (abfd)->_bfd_coff_print_aux)\
+ (abfd, file, base, symbol, aux, indaux))
#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)\
- ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
- (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
+ ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
+ (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\
- ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
- (abfd, section, reloc, shrink, link_info))
+ ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
+ (abfd, section, reloc, shrink, link_info))
#define bfd_coff_classify_symbol(abfd, sym)\
- ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\
- (abfd, sym))
+ ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\
+ (abfd, sym))
#define bfd_coff_compute_section_file_positions(abfd)\
- ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\
- (abfd))
+ ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\
+ (abfd))
#define bfd_coff_start_final_link(obfd, info)\
- ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\
- (obfd, info))
+ ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\
+ (obfd, info))
#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\
- ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\
- (obfd, info, ibfd, o, con, rel, isyms, secs))
+ ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\
+ (obfd, info, ibfd, o, con, rel, isyms, secs))
#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\
- ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\
- (abfd, sec, rel, h, sym, addendp))
+ ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\
+ (abfd, sec, rel, h, sym, addendp))
#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
- ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
- (obfd, info, ibfd, sec, rel, adjustedp))
+ ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
+ (obfd, info, ibfd, sec, rel, adjustedp))
#define bfd_coff_link_add_one_symbol(info,abfd,name,flags,section,value,string,cp,coll,hashp)\
- ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
- (info, abfd, name, flags, section, value, string, cp, coll, hashp))
+ ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
+ (info, abfd, name, flags, section, value, string, cp, coll, hashp))
#define bfd_coff_link_output_has_begun(a,p) \
- ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p))
+ ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p))
#define bfd_coff_final_link_postscript(a,p) \
- ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p))
+ ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p))
diff --git a/contrib/binutils/bfd/libecoff.h b/contrib/binutils/bfd/libecoff.h
index 934ada1..5f9e016 100644
--- a/contrib/binutils/bfd/libecoff.h
+++ b/contrib/binutils/bfd/libecoff.h
@@ -1,5 +1,6 @@
/* BFD ECOFF object file private structure.
- Copyright 1993, 1994, 1995, 1996, 1999 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1999, 2001
+ Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -165,7 +166,7 @@ typedef struct ecoff_symbol_struct
PTR native;
} ecoff_symbol_type;
-/* We take the address of the first element of a asymbol to ensure that the
+/* We take the address of the first element of an asymbol to ensure that the
macro is only ever applied to an asymbol. */
#define ecoffsymbol(asymbol) ((ecoff_symbol_type *) (&((asymbol)->the_bfd)))
@@ -320,7 +321,7 @@ extern long _bfd_ecoff_canonicalize_reloc
/* ecoff_bfd_reloc_type_lookup defined by backend. */
extern boolean _bfd_ecoff_set_arch_mach
- PARAMS ((bfd *, enum bfd_architecture, unsigned long machine));
+ PARAMS ((bfd *, enum bfd_architecture, unsigned long));
extern boolean _bfd_ecoff_set_section_contents
PARAMS ((bfd *, asection *, PTR location, file_ptr, bfd_size_type));
@@ -340,8 +341,8 @@ extern PTR _bfd_ecoff_mkobject_hook PARAMS ((bfd *, PTR filehdr, PTR aouthdr));
#define _bfd_ecoff_set_alignment_hook \
((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void)
extern boolean _bfd_ecoff_set_arch_mach_hook PARAMS ((bfd *abfd, PTR filehdr));
-extern flagword _bfd_ecoff_styp_to_sec_flags
- PARAMS ((bfd *abfd, PTR hdr, const char *name, asection *section));
+extern boolean _bfd_ecoff_styp_to_sec_flags
+ PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
extern boolean _bfd_ecoff_slurp_symbol_table PARAMS ((bfd *abfd));
/* ECOFF auxiliary information swapping routines. These are the same
diff --git a/contrib/binutils/bfd/libieee.h b/contrib/binutils/bfd/libieee.h
index aba9cb9..c48566c 100644
--- a/contrib/binutils/bfd/libieee.h
+++ b/contrib/binutils/bfd/libieee.h
@@ -1,5 +1,6 @@
/* IEEE-695 object file formats: definitions internal to BFD.
- Copyright 1990, 1991, 1992, 1994, 1996 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1994, 1996, 2001
+ Free Software Foundation, Inc.
Written by Cygnus Support. Mostly Steve Chamberlain's fault.
This file is part of BFD, the Binary File Descriptor library.
@@ -28,7 +29,7 @@ typedef struct ct {
struct ct *next;
} bfd_chain_type;
-typedef struct ieee_symbol
+typedef struct ieee_symbol
{
asymbol symbol;
struct ieee_symbol *next;
@@ -60,10 +61,11 @@ typedef struct ieee_per_section
} ieee_per_section_type;
#define ieee_per_section(x) ((ieee_per_section_type *)((x)->used_by_bfd))
-
+
typedef struct {
- unsigned char *input_p;
+ unsigned char *input_p;
unsigned char *first_byte;
+ unsigned char *last_byte;
bfd *abfd;
} common_header_type ;
@@ -71,7 +73,7 @@ typedef struct ieee_data_struct
{
common_header_type h;
boolean read_symbols;
- boolean read_data;
+ boolean read_data;
file_ptr output_cursor;
/* Map of section indexes to section ptrs */
asection **section_table;
@@ -79,31 +81,31 @@ typedef struct ieee_data_struct
ieee_address_descriptor_type ad;
ieee_module_begin_type mb;
ieee_w_variable_type w;
-
+
unsigned int section_count;
-
+
unsigned int map_idx;
/* List of GLOBAL EXPORT symbols */
ieee_symbol_type *external_symbols;
/* List of UNDEFINED symbols */
ieee_symbol_type *external_reference;
-
+
/* When the symbols have been canonicalized, they are in a
* special order, we remember various bases here.. */
unsigned int external_symbol_max_index;
unsigned int external_symbol_min_index;
unsigned int external_symbol_count;
int external_symbol_base_offset;
-
+
unsigned int external_reference_max_index;
unsigned int external_reference_min_index;
unsigned int external_reference_count;
int external_reference_base_offset;
-
+
boolean symbol_table_full;
-
+
boolean done_debug;
@@ -117,11 +119,11 @@ typedef struct {
bfd *abfd;
} ieee_ar_obstack_type;
-typedef struct ieee_ar_data_struct
+typedef struct ieee_ar_data_struct
{
common_header_type h;
ieee_ar_obstack_type *elements;
-
+
unsigned int element_index ;
unsigned int element_count;
diff --git a/contrib/binutils/bfd/linker.c b/contrib/binutils/bfd/linker.c
index 82805f9..e382895 100644
--- a/contrib/binutils/bfd/linker.c
+++ b/contrib/binutils/bfd/linker.c
@@ -445,28 +445,27 @@ _bfd_link_hash_newfunc (entry, table, string)
struct bfd_hash_table *table;
const char *string;
{
- struct bfd_link_hash_entry *ret = (struct bfd_link_hash_entry *) entry;
-
/* Allocate the structure if it has not already been allocated by a
subclass. */
- if (ret == (struct bfd_link_hash_entry *) NULL)
- ret = ((struct bfd_link_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry)));
- if (ret == (struct bfd_link_hash_entry *) NULL)
- return NULL;
+ if (entry == NULL)
+ {
+ entry = bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry));
+ if (entry == NULL)
+ return entry;
+ }
/* Call the allocation method of the superclass. */
- ret = ((struct bfd_link_hash_entry *)
- bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
-
- if (ret)
+ entry = bfd_hash_newfunc (entry, table, string);
+ if (entry)
{
+ struct bfd_link_hash_entry *h = (struct bfd_link_hash_entry *) entry;
+
/* Initialize the local fields. */
- ret->type = bfd_link_hash_new;
- ret->next = NULL;
+ h->type = bfd_link_hash_new;
+ h->next = NULL;
}
- return (struct bfd_hash_entry *) ret;
+ return entry;
}
/* Initialize a link hash table. The BFD argument is the one
@@ -483,6 +482,8 @@ _bfd_link_hash_table_init (table, abfd, newfunc)
table->creator = abfd->xvec;
table->undefs = NULL;
table->undefs_tail = NULL;
+ table->type = bfd_link_generic_hash_table;
+
return bfd_hash_table_init (&table->table, newfunc);
}
@@ -526,6 +527,8 @@ bfd_wrapped_link_hash_lookup (abfd, info, string, create, copy, follow)
boolean copy;
boolean follow;
{
+ bfd_size_type amt;
+
if (info->wrap_hash != NULL)
{
const char *l;
@@ -545,7 +548,8 @@ bfd_wrapped_link_hash_lookup (abfd, info, string, create, copy, follow)
/* This symbol is being wrapped. We want to replace all
references to SYM with references to __wrap_SYM. */
- n = (char *) bfd_malloc (strlen (l) + sizeof WRAP + 1);
+ amt = strlen (l) + sizeof WRAP + 1;
+ n = (char *) bfd_malloc (amt);
if (n == NULL)
return NULL;
@@ -576,7 +580,8 @@ bfd_wrapped_link_hash_lookup (abfd, info, string, create, copy, follow)
wrapped. We want to replace all references to __real_SYM
with references to SYM. */
- n = (char *) bfd_malloc (strlen (l + sizeof REAL - 1) + 2);
+ amt = strlen (l + sizeof REAL - 1) + 2;
+ n = (char *) bfd_malloc (amt);
if (n == NULL)
return NULL;
@@ -636,30 +641,29 @@ _bfd_generic_link_hash_newfunc (entry, table, string)
struct bfd_hash_table *table;
const char *string;
{
- struct generic_link_hash_entry *ret =
- (struct generic_link_hash_entry *) entry;
-
/* Allocate the structure if it has not already been allocated by a
subclass. */
- if (ret == (struct generic_link_hash_entry *) NULL)
- ret = ((struct generic_link_hash_entry *)
- bfd_hash_allocate (table, sizeof (struct generic_link_hash_entry)));
- if (ret == (struct generic_link_hash_entry *) NULL)
- return NULL;
+ if (entry == NULL)
+ {
+ entry = bfd_hash_allocate (table,
+ sizeof (struct generic_link_hash_entry));
+ if (entry == NULL)
+ return entry;
+ }
/* Call the allocation method of the superclass. */
- ret = ((struct generic_link_hash_entry *)
- _bfd_link_hash_newfunc ((struct bfd_hash_entry *) ret,
- table, string));
-
- if (ret)
+ entry = _bfd_link_hash_newfunc (entry, table, string);
+ if (entry)
{
+ struct generic_link_hash_entry *ret;
+
/* Set local fields. */
+ ret = (struct generic_link_hash_entry *) entry;
ret->written = false;
ret->sym = NULL;
}
- return (struct bfd_hash_entry *) ret;
+ return entry;
}
/* Create an generic link hash table. */
@@ -669,9 +673,9 @@ _bfd_generic_link_hash_table_create (abfd)
bfd *abfd;
{
struct generic_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct generic_link_hash_table);
- ret = ((struct generic_link_hash_table *)
- bfd_alloc (abfd, sizeof (struct generic_link_hash_table)));
+ ret = (struct generic_link_hash_table *) bfd_alloc (abfd, amt);
if (ret == NULL)
return (struct bfd_link_hash_table *) NULL;
if (! _bfd_link_hash_table_init (&ret->root, abfd,
@@ -702,7 +706,8 @@ generic_link_read_symbols (abfd)
symsize = bfd_get_symtab_upper_bound (abfd);
if (symsize < 0)
return false;
- bfd_get_outsymbols (abfd) = (asymbol **) bfd_alloc (abfd, symsize);
+ bfd_get_outsymbols (abfd) =
+ (asymbol **) bfd_alloc (abfd, (bfd_size_type) symsize);
if (bfd_get_outsymbols (abfd) == NULL && symsize != 0)
return false;
symcount = bfd_canonicalize_symtab (abfd, bfd_get_outsymbols (abfd));
@@ -779,12 +784,14 @@ generic_link_add_object_symbols (abfd, info, collect)
struct bfd_link_info *info;
boolean collect;
{
+ bfd_size_type symcount;
+ struct symbol_cache_entry **outsyms;
+
if (! generic_link_read_symbols (abfd))
return false;
- return generic_link_add_symbol_list (abfd, info,
- _bfd_generic_link_get_symcount (abfd),
- _bfd_generic_link_get_symbols (abfd),
- collect);
+ symcount = _bfd_generic_link_get_symcount (abfd);
+ outsyms = _bfd_generic_link_get_symbols (abfd);
+ return generic_link_add_symbol_list (abfd, info, symcount, outsyms, collect);
}
/* We build a hash table of all symbols defined in an archive. */
@@ -795,7 +802,7 @@ generic_link_add_object_symbols (abfd, info, collect)
struct archive_list
{
struct archive_list *next;
- int indx;
+ unsigned int indx;
};
/* An entry in an archive hash table. */
@@ -924,7 +931,7 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn)
register carsym *arsym;
int pass;
struct archive_hash_table arsym_hash;
- int indx;
+ unsigned int indx;
struct bfd_link_hash_entry **pundef;
if (! bfd_has_map (abfd))
@@ -1003,10 +1010,25 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn)
arh = archive_hash_lookup (&arsym_hash, h->root.string, false, false);
if (arh == (struct archive_hash_entry *) NULL)
{
- pundef = &(*pundef)->next;
- continue;
- }
+ /* If we haven't found the exact symbol we're looking for,
+ let's look for its import thunk */
+ if (info->pei386_auto_import)
+ {
+ bfd_size_type amt = strlen (h->root.string) + 10;
+ char *buf = (char *) bfd_malloc (amt);
+ if (buf == NULL)
+ return false;
+ sprintf (buf, "__imp_%s", h->root.string);
+ arh = archive_hash_lookup (&arsym_hash, buf, false, false);
+ free(buf);
+ }
+ if (arh == (struct archive_hash_entry *) NULL)
+ {
+ pundef = &(*pundef)->next;
+ continue;
+ }
+ }
/* Look at all the objects which define this symbol. */
for (l = arh->defs; l != (struct archive_list *) NULL; l = l->next)
{
@@ -1395,7 +1417,7 @@ static const enum link_action link_action[8][8] =
/* UNDEFW_ROW */ {WEAK, NOACT, NOACT, REF, REF, NOACT, REFC, WARNC },
/* DEF_ROW */ {DEF, DEF, DEF, MDEF, DEF, CDEF, MDEF, CYCLE },
/* DEFW_ROW */ {DEFW, DEFW, DEFW, NOACT, NOACT, NOACT, NOACT, CYCLE },
- /* COMMON_ROW */ {COM, COM, COM, CREF, CREF, BIG, REFC, WARNC },
+ /* COMMON_ROW */ {COM, COM, COM, CREF, COM, BIG, REFC, WARNC },
/* INDR_ROW */ {IND, IND, IND, MDEF, IND, CIND, MIND, CYCLE },
/* WARN_ROW */ {MWARN, WARN, WARN, CWARN, CWARN, WARN, CWARN, MWARN },
/* SET_ROW */ {SET, SET, SET, SET, SET, SET, CYCLE, CYCLE }
@@ -1698,7 +1720,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
case BIG:
/* We have found a common definition for a symbol which
already had a common definition. Use the maximum of the
- two sizes. */
+ two sizes, and use the section required by the larger symbol. */
BFD_ASSERT (h->type == bfd_link_hash_common);
if (! ((*info->callbacks->multiple_common)
(info, h->root.string,
@@ -1717,6 +1739,25 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
if (power > 4)
power = 4;
h->u.c.p->alignment_power = power;
+
+ /* Some systems have special treatment for small commons,
+ hence we want to select the section used by the larger
+ symbol. This makes sure the symbol does not go in a
+ small common section if it is now too large. */
+ if (section == bfd_com_section_ptr)
+ {
+ h->u.c.p->section
+ = bfd_make_section_old_way (abfd, "COMMON");
+ h->u.c.p->section->flags = SEC_ALLOC;
+ }
+ else if (section->owner != abfd)
+ {
+ h->u.c.p->section
+ = bfd_make_section_old_way (abfd, section->name);
+ h->u.c.p->section->flags = SEC_ALLOC;
+ }
+ else
+ h->u.c.p->section = section;
}
break;
@@ -1805,8 +1846,8 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
&& inh->u.i.link == h)
{
(*_bfd_error_handler)
- (_("%s: indirect symbol `%s' to `%s' is a loop"),
- bfd_get_filename (abfd), name, string);
+ (_("%s: indirect symbol `%s' to `%s' is a loop"),
+ bfd_archive_filename (abfd), name, string);
bfd_set_error (bfd_error_invalid_operation);
return false;
}
@@ -2004,7 +2045,7 @@ _bfd_generic_final_link (abfd, info)
input_section);
if (relsize < 0)
return false;
- relocs = (arelent **) bfd_malloc ((size_t) relsize);
+ relocs = (arelent **) bfd_malloc ((bfd_size_type) relsize);
if (!relocs && relsize != 0)
return false;
symbols = _bfd_generic_link_get_symbols (input_bfd);
@@ -2022,10 +2063,11 @@ _bfd_generic_final_link (abfd, info)
}
if (o->reloc_count > 0)
{
- o->orelocation = ((arelent **)
- bfd_alloc (abfd,
- (o->reloc_count
- * sizeof (arelent *))));
+ bfd_size_type amt;
+
+ amt = o->reloc_count;
+ amt *= sizeof (arelent *);
+ o->orelocation = (arelent **) bfd_alloc (abfd, amt);
if (!o->orelocation)
return false;
o->flags |= SEC_RELOC;
@@ -2078,13 +2120,15 @@ generic_add_output_symbol (output_bfd, psymalloc, sym)
if (bfd_get_symcount (output_bfd) >= *psymalloc)
{
asymbol **newsyms;
+ bfd_size_type amt;
if (*psymalloc == 0)
*psymalloc = 124;
else
*psymalloc *= 2;
- newsyms = (asymbol **) bfd_realloc (bfd_get_outsymbols (output_bfd),
- *psymalloc * sizeof (asymbol *));
+ amt = *psymalloc;
+ amt *= sizeof (asymbol *);
+ newsyms = (asymbol **) bfd_realloc (bfd_get_outsymbols (output_bfd), amt);
if (newsyms == (asymbol **) NULL)
return false;
bfd_get_outsymbols (output_bfd) = newsyms;
@@ -2288,6 +2332,12 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc)
case discard_all:
output = false;
break;
+ case discard_sec_merge:
+ output = true;
+ if (info->relocateable
+ || ! (sym->section->flags & SEC_MERGE))
+ break;
+ /* FALLTHROUGH */
case discard_l:
if (bfd_is_local_label (input_bfd, sym))
output = false;
@@ -2458,7 +2508,7 @@ _bfd_generic_reloc_link_order (abfd, info, sec, link_order)
if (sec->orelocation == (arelent **) NULL)
abort ();
- r = (arelent *) bfd_alloc (abfd, sizeof (arelent));
+ r = (arelent *) bfd_alloc (abfd, (bfd_size_type) sizeof (arelent));
if (r == (arelent *) NULL)
return false;
@@ -2504,13 +2554,15 @@ _bfd_generic_reloc_link_order (abfd, info, sec, link_order)
bfd_reloc_status_type rstat;
bfd_byte *buf;
boolean ok;
+ file_ptr loc;
size = bfd_get_reloc_size (r->howto);
buf = (bfd_byte *) bfd_zmalloc (size);
if (buf == (bfd_byte *) NULL)
return false;
rstat = _bfd_relocate_contents (r->howto, abfd,
- link_order->u.reloc.p->addend, buf);
+ (bfd_vma) link_order->u.reloc.p->addend,
+ buf);
switch (rstat)
{
case bfd_reloc_ok:
@@ -2532,10 +2584,9 @@ _bfd_generic_reloc_link_order (abfd, info, sec, link_order)
}
break;
}
- ok = bfd_set_section_contents (abfd, sec, (PTR) buf,
- (file_ptr)
- (link_order->offset *
- bfd_octets_per_byte (abfd)), size);
+ loc = link_order->offset * bfd_octets_per_byte (abfd);
+ ok = bfd_set_section_contents (abfd, sec, (PTR) buf, loc,
+ (bfd_size_type) size);
free (buf);
if (! ok)
return false;
@@ -2556,10 +2607,8 @@ bfd_new_link_order (abfd, section)
bfd *abfd;
asection *section;
{
- struct bfd_link_order *new;
-
- new = ((struct bfd_link_order *)
- bfd_alloc (abfd, sizeof (struct bfd_link_order)));
+ bfd_size_type amt = sizeof (struct bfd_link_order);
+ struct bfd_link_order *new = (struct bfd_link_order *) bfd_alloc (abfd, amt);
if (!new)
return NULL;
@@ -2588,6 +2637,8 @@ _bfd_default_link_order (abfd, info, sec, link_order)
asection *sec;
struct bfd_link_order *link_order;
{
+ file_ptr loc;
+
switch (link_order->type)
{
case bfd_undefined_link_order:
@@ -2601,12 +2652,10 @@ _bfd_default_link_order (abfd, info, sec, link_order)
case bfd_fill_link_order:
return default_fill_link_order (abfd, info, sec, link_order);
case bfd_data_link_order:
+ loc = link_order->offset * bfd_octets_per_byte (abfd);
return bfd_set_section_contents (abfd, sec,
(PTR) link_order->u.data.contents,
- (file_ptr)
- (link_order->offset *
- bfd_octets_per_byte (abfd)),
- link_order->size);
+ loc, link_order->size);
}
}
@@ -2619,29 +2668,36 @@ default_fill_link_order (abfd, info, sec, link_order)
asection *sec;
struct bfd_link_order *link_order;
{
- size_t size;
- char *space;
+ bfd_size_type size;
+ unsigned char *space;
size_t i;
- int fill;
+ unsigned int fill;
+ file_ptr loc;
boolean result;
BFD_ASSERT ((sec->flags & SEC_HAS_CONTENTS) != 0);
- size = (size_t) link_order->size;
- space = (char *) bfd_malloc (size);
- if (space == NULL && size != 0)
+ size = link_order->size;
+ if (size == 0)
+ return true;
+
+ space = (unsigned char *) bfd_malloc (size);
+ if (space == NULL)
return false;
fill = link_order->u.fill.value;
- for (i = 0; i < size; i += 2)
+ for (i = 0; i < size; i += 4)
+ space[i] = fill >> 24;
+ for (i = 1; i < size; i += 4)
+ space[i] = fill >> 16;
+ for (i = 2; i < size; i += 4)
space[i] = fill >> 8;
- for (i = 1; i < size; i += 2)
+ for (i = 3; i < size; i += 4)
space[i] = fill;
- result = bfd_set_section_contents (abfd, sec, space,
- (file_ptr)
- (link_order->offset *
- bfd_octets_per_byte (abfd)),
- link_order->size);
+
+ loc = link_order->offset * bfd_octets_per_byte (abfd);
+ result = bfd_set_section_contents (abfd, sec, space, loc, size);
+
free (space);
return result;
}
@@ -2661,6 +2717,8 @@ default_indirect_link_order (output_bfd, info, output_section, link_order,
bfd *input_bfd;
bfd_byte *contents = NULL;
bfd_byte *new_contents;
+ bfd_size_type sec_size;
+ file_ptr loc;
BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0);
@@ -2744,9 +2802,9 @@ default_indirect_link_order (output_bfd, info, output_section, link_order,
}
/* Get and relocate the section contents. */
- contents = ((bfd_byte *)
- bfd_malloc (bfd_section_size (input_bfd, input_section)));
- if (contents == NULL && bfd_section_size (input_bfd, input_section) != 0)
+ sec_size = bfd_section_size (input_bfd, input_section);
+ contents = ((bfd_byte *) bfd_malloc (sec_size));
+ if (contents == NULL && sec_size != 0)
goto error_return;
new_contents = (bfd_get_relocated_section_contents
(output_bfd, info, link_order, contents, info->relocateable,
@@ -2755,12 +2813,9 @@ default_indirect_link_order (output_bfd, info, output_section, link_order,
goto error_return;
/* Output the section contents. */
+ loc = link_order->offset * bfd_octets_per_byte (output_bfd);
if (! bfd_set_section_contents (output_bfd, output_section,
- (PTR) new_contents,
- (file_ptr)
- (link_order->offset *
- bfd_octets_per_byte (output_bfd)),
- link_order->size))
+ (PTR) new_contents, loc, link_order->size))
goto error_return;
if (contents != NULL)
diff --git a/contrib/binutils/bfd/merge.c b/contrib/binutils/bfd/merge.c
new file mode 100644
index 0000000..7b06c10
--- /dev/null
+++ b/contrib/binutils/bfd/merge.c
@@ -0,0 +1,955 @@
+/* SEC_MERGE support.
+ Copyright 2001 Free Software Foundation, Inc.
+ Written by Jakub Jelinek <jakub@redhat.com>.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* This file contains support for merging duplicate entities within sections,
+ as used in ELF SHF_MERGE. */
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+#include "hashtab.h"
+
+struct sec_merge_sec_info;
+
+/* An entry in the section merge hash table. */
+
+struct sec_merge_hash_entry
+{
+ struct bfd_hash_entry root;
+ /* Length of this entry. */
+ unsigned int len;
+ /* Start of this string needs to be aligned to
+ alignment octets (not 1 << align). */
+ unsigned int alignment;
+ union {
+ /* Index within the merged section. */
+ bfd_size_type index;
+ /* Entity size (if present in suffix hash tables). */
+ unsigned int entsize;
+ /* Entry this is a suffix of (if alignment is 0). */
+ struct sec_merge_hash_entry *suffix;
+ } u;
+ /* Which section is it in. */
+ struct sec_merge_sec_info *secinfo;
+ /* Next entity in the hash table. */
+ struct sec_merge_hash_entry *next;
+};
+
+/* The section merge hash table. */
+
+struct sec_merge_hash
+{
+ struct bfd_hash_table table;
+ /* Next available index. */
+ bfd_size_type size;
+ /* First entity in the SEC_MERGE sections of this type. */
+ struct sec_merge_hash_entry *first;
+ /* Last entity in the SEC_MERGE sections of this type. */
+ struct sec_merge_hash_entry *last;
+ /* Entity size. */
+ unsigned int entsize;
+ /* Are entries fixed size or zero terminated strings? */
+ boolean strings;
+};
+
+struct sec_merge_info
+{
+ /* Chain of sec_merge_infos. */
+ struct sec_merge_info *next;
+ /* Chain of sec_merge_sec_infos. */
+ struct sec_merge_sec_info *chain;
+ /* A hash table used to hold section content. */
+ struct sec_merge_hash *htab;
+};
+
+struct sec_merge_sec_info
+{
+ /* Chain of sec_merge_sec_infos. */
+ struct sec_merge_sec_info *next;
+ /* The corresponding section. */
+ asection *sec;
+ /* Pointer to merge_info pointing to us. */
+ PTR *psecinfo;
+ /* A hash table used to hold section content. */
+ struct sec_merge_hash *htab;
+ /* First string in this section. */
+ struct sec_merge_hash_entry *first;
+ /* Original section content. */
+ unsigned char contents[1];
+};
+
+static struct bfd_hash_entry *sec_merge_hash_newfunc
+ PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
+static struct sec_merge_hash_entry *sec_merge_hash_lookup
+ PARAMS ((struct sec_merge_hash *, const char *, unsigned int, boolean));
+static struct sec_merge_hash *sec_merge_init
+ PARAMS ((unsigned int, boolean));
+static struct sec_merge_hash_entry *sec_merge_add
+ PARAMS ((struct sec_merge_hash *, const char *, unsigned int,
+ struct sec_merge_sec_info *));
+static boolean sec_merge_emit
+ PARAMS ((bfd *, struct sec_merge_hash_entry *));
+static int cmplengthentry PARAMS ((const PTR, const PTR));
+static int last4_eq PARAMS ((const PTR, const PTR));
+static int last_eq PARAMS ((const PTR, const PTR));
+static boolean record_section
+ PARAMS ((struct sec_merge_info *, struct sec_merge_sec_info *));
+static void merge_strings PARAMS ((struct sec_merge_info *));
+
+/* Routine to create an entry in a section merge hashtab. */
+
+static struct bfd_hash_entry *
+sec_merge_hash_newfunc (entry, table, string)
+ struct bfd_hash_entry *entry;
+ struct bfd_hash_table *table;
+ const char *string;
+{
+ struct sec_merge_hash_entry *ret = (struct sec_merge_hash_entry *) entry;
+
+ /* Allocate the structure if it has not already been allocated by a
+ subclass. */
+ if (ret == (struct sec_merge_hash_entry *) NULL)
+ ret = ((struct sec_merge_hash_entry *)
+ bfd_hash_allocate (table, sizeof (struct sec_merge_hash_entry)));
+ if (ret == (struct sec_merge_hash_entry *) NULL)
+ return NULL;
+
+ /* Call the allocation method of the superclass. */
+ ret = ((struct sec_merge_hash_entry *)
+ bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
+
+ if (ret)
+ {
+ /* Initialize the local fields. */
+ ret->u.suffix = NULL;
+ ret->alignment = 0;
+ ret->secinfo = NULL;
+ ret->next = NULL;
+ }
+
+ return (struct bfd_hash_entry *)ret;
+}
+
+/* Look up an entry in a section merge hash table. */
+
+static struct sec_merge_hash_entry *
+sec_merge_hash_lookup (table, string, alignment, create)
+ struct sec_merge_hash *table;
+ const char *string;
+ unsigned int alignment;
+ boolean create;
+{
+ register const unsigned char *s;
+ register unsigned long hash;
+ register unsigned int c;
+ struct sec_merge_hash_entry *hashp;
+ unsigned int len, i;
+ unsigned int index;
+
+ hash = 0;
+ len = 0;
+ s = (const unsigned char *) string;
+ if (table->strings)
+ {
+ if (table->entsize == 1)
+ {
+ while ((c = *s++) != '\0')
+ {
+ hash += c + (c << 17);
+ hash ^= hash >> 2;
+ ++len;
+ }
+ hash += len + (len << 17);
+ }
+ else
+ {
+ for (;;)
+ {
+ for (i = 0; i < table->entsize; ++i)
+ if (s[i] != '\0')
+ break;
+ if (i == table->entsize)
+ break;
+ for (i = 0; i < table->entsize; ++i)
+ {
+ c = *s++;
+ hash += c + (c << 17);
+ hash ^= hash >> 2;
+ }
+ ++len;
+ }
+ hash += len + (len << 17);
+ len *= table->entsize;
+ }
+ hash ^= hash >> 2;
+ len += table->entsize;
+ }
+ else
+ {
+ for (i = 0; i < table->entsize; ++i)
+ {
+ c = *s++;
+ hash += c + (c << 17);
+ hash ^= hash >> 2;
+ }
+ len = table->entsize;
+ }
+
+ index = hash % table->table.size;
+ for (hashp = (struct sec_merge_hash_entry *) table->table.table[index];
+ hashp != (struct sec_merge_hash_entry *) NULL;
+ hashp = (struct sec_merge_hash_entry *) hashp->root.next)
+ {
+ if (hashp->root.hash == hash
+ && len == hashp->len
+ && memcmp (hashp->root.string, string, len) == 0)
+ {
+ /* If the string we found does not have at least the required
+ alignment, we need to insert another copy. */
+ if (hashp->alignment < alignment)
+ {
+ /* Mark the less aligned copy as deleted. */
+ hashp->len = 0;
+ hashp->alignment = 0;
+ break;
+ }
+ return hashp;
+ }
+ }
+
+ if (! create)
+ return (struct sec_merge_hash_entry *) NULL;
+
+ hashp = (struct sec_merge_hash_entry *)
+ sec_merge_hash_newfunc ((struct bfd_hash_entry *) NULL,
+ (struct bfd_hash_table *) table, string);
+ if (hashp == (struct sec_merge_hash_entry *) NULL)
+ return (struct sec_merge_hash_entry *) NULL;
+ hashp->root.string = string;
+ hashp->root.hash = hash;
+ hashp->len = len;
+ hashp->alignment = alignment;
+ hashp->root.next = table->table.table[index];
+ table->table.table[index] = (struct bfd_hash_entry *) hashp;
+
+ return hashp;
+}
+
+/* Create a new hash table. */
+
+static struct sec_merge_hash *
+sec_merge_init (entsize, strings)
+ unsigned int entsize;
+ boolean strings;
+{
+ struct sec_merge_hash *table;
+ bfd_size_type amt = sizeof (struct sec_merge_hash);
+
+ table = (struct sec_merge_hash *) bfd_malloc (amt);
+ if (table == NULL)
+ return NULL;
+
+ if (! bfd_hash_table_init (&table->table, sec_merge_hash_newfunc))
+ {
+ free (table);
+ return NULL;
+ }
+
+ table->size = 0;
+ table->first = NULL;
+ table->last = NULL;
+ table->entsize = entsize;
+ table->strings = strings;
+
+ return table;
+}
+
+/* Get the index of an entity in a hash table, adding it if it is not
+ already present. */
+
+static struct sec_merge_hash_entry *
+sec_merge_add (tab, str, alignment, secinfo)
+ struct sec_merge_hash *tab;
+ const char *str;
+ unsigned int alignment;
+ struct sec_merge_sec_info *secinfo;
+{
+ register struct sec_merge_hash_entry *entry;
+
+ entry = sec_merge_hash_lookup (tab, str, alignment, true);
+ if (entry == NULL)
+ return NULL;
+
+ if (entry->secinfo == NULL)
+ {
+ tab->size++;
+ entry->secinfo = secinfo;
+ if (tab->first == NULL)
+ tab->first = entry;
+ else
+ tab->last->next = entry;
+ tab->last = entry;
+ }
+
+ return entry;
+}
+
+static boolean
+sec_merge_emit (abfd, entry)
+ register bfd *abfd;
+ struct sec_merge_hash_entry *entry;
+{
+ struct sec_merge_sec_info *secinfo = entry->secinfo;
+ asection *sec = secinfo->sec;
+ char *pad = "";
+ bfd_size_type off = 0;
+ int alignment_power = bfd_get_section_alignment (abfd, sec->output_section);
+
+ if (alignment_power)
+ pad = bfd_zmalloc ((bfd_size_type) 1 << alignment_power);
+
+ for (; entry != NULL && entry->secinfo == secinfo; entry = entry->next)
+ {
+ register const char *str;
+ register size_t len;
+
+ len = off & (entry->alignment - 1);
+ if (len)
+ {
+ len = entry->alignment - len;
+ if (bfd_bwrite ((PTR) pad, (bfd_size_type) len, abfd) != len)
+ break;
+ off += len;
+ }
+
+ str = entry->root.string;
+ len = entry->len;
+
+ if (bfd_bwrite ((PTR) str, (bfd_size_type) len, abfd) != len)
+ break;
+
+ off += len;
+ }
+
+ if (alignment_power)
+ free (pad);
+
+ return entry == NULL || entry->secinfo != secinfo;
+}
+
+/* This function is called for each input file from the add_symbols
+ pass of the linker. */
+
+boolean
+_bfd_merge_section (abfd, psinfo, sec, psecinfo)
+ bfd *abfd;
+ PTR *psinfo;
+ asection *sec;
+ PTR *psecinfo;
+{
+ struct sec_merge_info *sinfo;
+ struct sec_merge_sec_info *secinfo;
+ unsigned int align;
+ bfd_size_type amt;
+
+ if (sec->_raw_size == 0
+ || (sec->flags & SEC_EXCLUDE)
+ || (sec->flags & SEC_MERGE) == 0
+ || sec->entsize == 0)
+ return true;
+
+ if ((sec->flags & SEC_RELOC) != 0)
+ {
+ /* We aren't prepared to handle relocations in merged sections. */
+ return true;
+ }
+
+ if (sec->output_section != NULL
+ && bfd_is_abs_section (sec->output_section))
+ {
+ /* The section is being discarded from the link, so we should
+ just ignore it. */
+ return true;
+ }
+
+ align = bfd_get_section_alignment (sec->owner, sec);
+ if ((sec->entsize < (unsigned int)(1 << align)
+ && ((sec->entsize & (sec->entsize - 1))
+ || !(sec->flags & SEC_STRINGS)))
+ || (sec->entsize > (unsigned int)(1 << align)
+ && (sec->entsize & ((1 << align) - 1))))
+ {
+ /* Sanity check. If string character size is smaller than
+ alignment, then we require character size to be a power
+ of 2, otherwise character size must be integer multiple
+ of alignment. For non-string constants, alignment must
+ be smaller than or equal to entity size and entity size
+ must be integer multiple of alignment. */
+ return true;
+ }
+
+ for (sinfo = (struct sec_merge_info *) *psinfo; sinfo; sinfo = sinfo->next)
+ if ((secinfo = sinfo->chain)
+ && ! ((secinfo->sec->flags ^ sec->flags) & (SEC_MERGE | SEC_STRINGS))
+ && secinfo->sec->entsize == sec->entsize
+ && ! strcmp (secinfo->sec->name, sec->name))
+ break;
+
+ if (sinfo == NULL)
+ {
+ /* Initialize the information we need to keep track of. */
+ sinfo = (struct sec_merge_info *)
+ bfd_alloc (abfd, (bfd_size_type) sizeof (struct sec_merge_info));
+ if (sinfo == NULL)
+ goto error_return;
+ sinfo->next = (struct sec_merge_info *) *psinfo;
+ sinfo->chain = NULL;
+ *psinfo = (PTR) sinfo;
+ sinfo->htab =
+ sec_merge_init (sec->entsize, (sec->flags & SEC_STRINGS));
+ if (sinfo->htab == NULL)
+ goto error_return;
+ }
+
+ /* Read the section from abfd. */
+
+ amt = sizeof (struct sec_merge_sec_info) + sec->_raw_size - 1;
+ *psecinfo = bfd_alloc (abfd, amt);
+ if (*psecinfo == NULL)
+ goto error_return;
+
+ secinfo = (struct sec_merge_sec_info *)*psecinfo;
+ if (sinfo->chain)
+ {
+ secinfo->next = sinfo->chain->next;
+ sinfo->chain->next = secinfo;
+ }
+ else
+ secinfo->next = secinfo;
+ sinfo->chain = secinfo;
+ secinfo->sec = sec;
+ secinfo->psecinfo = psecinfo;
+ secinfo->htab = sinfo->htab;
+ secinfo->first = NULL;
+
+ if (! bfd_get_section_contents (sec->owner, sec, secinfo->contents,
+ (bfd_vma) 0, sec->_raw_size))
+ goto error_return;
+
+ return true;
+
+ error_return:
+ *psecinfo = NULL;
+ return false;
+}
+
+/* Compare two sec_merge_hash_entry structures. This is called via qsort. */
+
+static int
+cmplengthentry (a, b)
+ const PTR a;
+ const PTR b;
+{
+ struct sec_merge_hash_entry * A = *(struct sec_merge_hash_entry **) a;
+ struct sec_merge_hash_entry * B = *(struct sec_merge_hash_entry **) b;
+
+ if (A->len < B->len)
+ return 1;
+ else if (A->len > B->len)
+ return -1;
+
+ return memcmp (A->root.string, B->root.string, A->len);
+}
+
+static int
+last4_eq (a, b)
+ const PTR a;
+ const PTR b;
+{
+ struct sec_merge_hash_entry * A = (struct sec_merge_hash_entry *) a;
+ struct sec_merge_hash_entry * B = (struct sec_merge_hash_entry *) b;
+
+ if (memcmp (A->root.string + A->len - 5 * A->u.entsize,
+ B->root.string + B->len - 5 * A->u.entsize,
+ 4 * A->u.entsize) != 0)
+ /* This was a hashtable collision. */
+ return 0;
+
+ if (A->len <= B->len)
+ /* B cannot be a suffix of A unless A is equal to B, which is guaranteed
+ not to be equal by the hash table. */
+ return 0;
+
+ if (A->alignment < B->alignment
+ || ((A->len - B->len) & (B->alignment - 1)))
+ /* The suffix is not sufficiently aligned. */
+ return 0;
+
+ return memcmp (A->root.string + (A->len - B->len),
+ B->root.string, B->len - 5 * A->u.entsize) == 0;
+}
+
+static int
+last_eq (a, b)
+ const PTR a;
+ const PTR b;
+{
+ struct sec_merge_hash_entry * A = (struct sec_merge_hash_entry *) a;
+ struct sec_merge_hash_entry * B = (struct sec_merge_hash_entry *) b;
+
+ if (B->len >= 5 * A->u.entsize)
+ /* Longer strings are just pushed into the hash table,
+ they'll be used when looking up for very short strings. */
+ return 0;
+
+ if (memcmp (A->root.string + A->len - 2 * A->u.entsize,
+ B->root.string + B->len - 2 * A->u.entsize,
+ A->u.entsize) != 0)
+ /* This was a hashtable collision. */
+ return 0;
+
+ if (A->len <= B->len)
+ /* B cannot be a suffix of A unless A is equal to B, which is guaranteed
+ not to be equal by the hash table. */
+ return 0;
+
+ if (A->alignment < B->alignment
+ || ((A->len - B->len) & (B->alignment - 1)))
+ /* The suffix is not sufficiently aligned. */
+ return 0;
+
+ return memcmp (A->root.string + (A->len - B->len),
+ B->root.string, B->len - 2 * A->u.entsize) == 0;
+}
+
+/* Record one section into the hash table. */
+static boolean
+record_section (sinfo, secinfo)
+ struct sec_merge_info *sinfo;
+ struct sec_merge_sec_info *secinfo;
+{
+ asection *sec = secinfo->sec;
+ struct sec_merge_hash_entry *entry;
+ boolean nul;
+ unsigned char *p, *end;
+ bfd_vma mask, eltalign;
+ unsigned int align, i;
+
+ align = bfd_get_section_alignment (sec->owner, sec);
+ end = secinfo->contents + sec->_raw_size;
+ nul = false;
+ mask = ((bfd_vma) 1 << align) - 1;
+ if (sec->flags & SEC_STRINGS)
+ {
+ for (p = secinfo->contents; p < end; )
+ {
+ eltalign = p - secinfo->contents;
+ eltalign = ((eltalign ^ (eltalign - 1)) + 1) >> 1;
+ if (!eltalign || eltalign > mask)
+ eltalign = mask + 1;
+ entry = sec_merge_add (sinfo->htab, p, (unsigned) eltalign, secinfo);
+ if (! entry)
+ goto error_return;
+ p += entry->len;
+ if (sec->entsize == 1)
+ {
+ while (p < end && *p == 0)
+ {
+ if (!nul && !((p - secinfo->contents) & mask))
+ {
+ nul = true;
+ entry = sec_merge_add (sinfo->htab, "",
+ (unsigned) mask + 1, secinfo);
+ if (! entry)
+ goto error_return;
+ }
+ p++;
+ }
+ }
+ else
+ {
+ while (p < end)
+ {
+ for (i = 0; i < sec->entsize; i++)
+ if (p[i] != '\0')
+ break;
+ if (i != sec->entsize)
+ break;
+ if (!nul && !((p - secinfo->contents) & mask))
+ {
+ nul = true;
+ entry = sec_merge_add (sinfo->htab, p,
+ (unsigned) mask + 1, secinfo);
+ if (! entry)
+ goto error_return;
+ }
+ p += sec->entsize;
+ }
+ }
+ }
+ }
+ else
+ {
+ for (p = secinfo->contents; p < end; p += sec->entsize)
+ {
+ entry = sec_merge_add (sinfo->htab, p, 1, secinfo);
+ if (! entry)
+ goto error_return;
+ }
+ }
+
+ return true;
+
+error_return:
+ for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next)
+ *secinfo->psecinfo = NULL;
+ return false;
+}
+
+/* This is a helper function for _bfd_merge_sections. It attempts to
+ merge strings matching suffixes of longer strings. */
+static void
+merge_strings (sinfo)
+ struct sec_merge_info *sinfo;
+{
+ struct sec_merge_hash_entry **array, **a, **end, *e;
+ struct sec_merge_sec_info *secinfo;
+ htab_t lasttab = NULL, last4tab = NULL;
+ bfd_size_type size, amt;
+
+ /* Now sort the strings by length, longest first. */
+ array = NULL;
+ amt = sinfo->htab->size * sizeof (struct sec_merge_hash_entry *);
+ array = (struct sec_merge_hash_entry **) bfd_malloc (amt);
+ if (array == NULL)
+ goto alloc_failure;
+
+ for (e = sinfo->htab->first, a = array; e; e = e->next)
+ if (e->alignment)
+ *a++ = e;
+
+ sinfo->htab->size = a - array;
+
+ qsort (array, (size_t) sinfo->htab->size,
+ sizeof (struct sec_merge_hash_entry *), cmplengthentry);
+
+ last4tab = htab_create ((size_t) sinfo->htab->size * 4, NULL, last4_eq, NULL);
+ lasttab = htab_create ((size_t) sinfo->htab->size * 4, NULL, last_eq, NULL);
+ if (lasttab == NULL || last4tab == NULL)
+ goto alloc_failure;
+
+ /* Now insert the strings into hash tables (strings with last 4 characters
+ and strings with last character equal), look for longer strings which
+ we're suffix of. */
+ for (a = array, end = array + sinfo->htab->size; a < end; a++)
+ {
+ register hashval_t hash;
+ unsigned int c;
+ unsigned int i;
+ const unsigned char *s;
+ PTR *p;
+
+ e = *a;
+ e->u.entsize = sinfo->htab->entsize;
+ if (e->len <= e->u.entsize)
+ break;
+ if (e->len > 4 * e->u.entsize)
+ {
+ s = e->root.string + e->len - e->u.entsize;
+ hash = 0;
+ for (i = 0; i < 4 * e->u.entsize; i++)
+ {
+ c = *--s;
+ hash += c + (c << 17);
+ hash ^= hash >> 2;
+ }
+ p = htab_find_slot_with_hash (last4tab, e, hash, INSERT);
+ if (p == NULL)
+ goto alloc_failure;
+ if (*p)
+ {
+ struct sec_merge_hash_entry *ent;
+
+ ent = (struct sec_merge_hash_entry *) *p;
+ e->u.suffix = ent;
+ e->alignment = 0;
+ continue;
+ }
+ else
+ *p = (PTR) e;
+ }
+ s = e->root.string + e->len - e->u.entsize;
+ hash = 0;
+ for (i = 0; i < e->u.entsize; i++)
+ {
+ c = *--s;
+ hash += c + (c << 17);
+ hash ^= hash >> 2;
+ }
+ p = htab_find_slot_with_hash (lasttab, e, hash, INSERT);
+ if (p == NULL)
+ goto alloc_failure;
+ if (*p)
+ {
+ struct sec_merge_hash_entry *ent;
+
+ ent = (struct sec_merge_hash_entry *) *p;
+ e->u.suffix = ent;
+ e->alignment = 0;
+ }
+ else
+ *p = (PTR) e;
+ }
+
+alloc_failure:
+ if (array)
+ free (array);
+ if (lasttab)
+ htab_delete (lasttab);
+ if (last4tab)
+ htab_delete (last4tab);
+
+ /* Now assign positions to the strings we want to keep. */
+ size = 0;
+ secinfo = sinfo->htab->first->secinfo;
+ for (e = sinfo->htab->first; e; e = e->next)
+ {
+ if (e->secinfo != secinfo)
+ {
+ secinfo->sec->_cooked_size = size;
+ secinfo = e->secinfo;
+ }
+ if (e->alignment)
+ {
+ if (e->secinfo->first == NULL)
+ {
+ e->secinfo->first = e;
+ size = 0;
+ }
+ size = (size + e->alignment - 1) & ~((bfd_vma) e->alignment - 1);
+ e->u.index = size;
+ size += e->len;
+ }
+ }
+ secinfo->sec->_cooked_size = size;
+
+ /* And now adjust the rest, removing them from the chain (but not hashtable)
+ at the same time. */
+ for (a = &sinfo->htab->first, e = *a; e; e = e->next)
+ if (e->alignment)
+ a = &e->next;
+ else
+ {
+ *a = e->next;
+ if (e->len)
+ {
+ e->secinfo = e->u.suffix->secinfo;
+ e->alignment = e->u.suffix->alignment;
+ e->u.index = e->u.suffix->u.index + (e->u.suffix->len - e->len);
+ }
+ }
+}
+
+/* This function is called once after all SEC_MERGE sections are registered
+ with _bfd_merge_section. */
+
+boolean
+_bfd_merge_sections (abfd, xsinfo, remove_hook)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ PTR xsinfo;
+ void (*remove_hook) PARAMS((bfd *, asection *));
+{
+ struct sec_merge_info *sinfo;
+
+ for (sinfo = (struct sec_merge_info *) xsinfo; sinfo; sinfo = sinfo->next)
+ {
+ struct sec_merge_sec_info * secinfo;
+
+ if (! sinfo->chain)
+ continue;
+
+ /* Move sinfo->chain to head of the chain, terminate it. */
+ secinfo = sinfo->chain;
+ sinfo->chain = secinfo->next;
+ secinfo->next = NULL;
+
+ /* Record the sections into the hash table. */
+ for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next)
+ if (secinfo->sec->flags & SEC_EXCLUDE)
+ {
+ *secinfo->psecinfo = NULL;
+ if (remove_hook)
+ (*remove_hook) (abfd, secinfo->sec);
+ }
+ else if (! record_section (sinfo, secinfo))
+ break;
+
+ if (secinfo)
+ continue;
+
+ if (sinfo->htab->strings)
+ merge_strings (sinfo);
+ else
+ {
+ struct sec_merge_hash_entry *e;
+ bfd_size_type size = 0;
+
+ /* Things are much simpler for non-strings.
+ Just assign them slots in the section. */
+ secinfo = NULL;
+ for (e = sinfo->htab->first; e; e = e->next)
+ {
+ if (e->secinfo->first == NULL)
+ {
+ if (secinfo)
+ secinfo->sec->_cooked_size = size;
+ e->secinfo->first = e;
+ size = 0;
+ }
+ size = (size + e->alignment - 1)
+ & ~((bfd_vma) e->alignment - 1);
+ e->u.index = size;
+ size += e->len;
+ secinfo = e->secinfo;
+ }
+ secinfo->sec->_cooked_size = size;
+ }
+
+ /* Finally shrink all input sections which have not made it into
+ the hash table at all. */
+ for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next)
+ if (secinfo->first == NULL)
+ {
+ secinfo->sec->_cooked_size = 0;
+ secinfo->sec->flags |= SEC_EXCLUDE;
+ }
+ }
+
+ return true;
+}
+
+/* Write out the merged section. */
+
+boolean
+_bfd_write_merged_section (output_bfd, sec, psecinfo)
+ bfd *output_bfd;
+ asection *sec;
+ PTR psecinfo;
+{
+ struct sec_merge_sec_info *secinfo;
+ file_ptr pos;
+
+ secinfo = (struct sec_merge_sec_info *) psecinfo;
+
+ if (!secinfo->first)
+ return true;
+
+ pos = sec->output_section->filepos + sec->output_offset;
+ if (bfd_seek (output_bfd, pos, SEEK_SET) != 0)
+ return false;
+
+ if (! sec_merge_emit (output_bfd, secinfo->first))
+ return false;
+
+ return true;
+}
+
+/* Adjust an address in the SEC_MERGE section. Given OFFSET within
+ *PSEC, this returns the new offset in the adjusted SEC_MERGE
+ section and writes the new section back into *PSEC. */
+
+bfd_vma
+_bfd_merged_section_offset (output_bfd, psec, psecinfo, offset, addend)
+ bfd *output_bfd ATTRIBUTE_UNUSED;
+ asection **psec;
+ PTR psecinfo;
+ bfd_vma offset, addend;
+{
+ struct sec_merge_sec_info *secinfo;
+ struct sec_merge_hash_entry *entry;
+ unsigned char *p;
+ asection *sec = *psec;
+
+ secinfo = (struct sec_merge_sec_info *) psecinfo;
+
+ if (offset + addend >= sec->_raw_size)
+ {
+ if (offset + addend > sec->_raw_size)
+ {
+ (*_bfd_error_handler)
+ (_("%s: access beyond end of merged section (%ld + %ld)"),
+ bfd_get_filename (sec->owner), (long) offset, (long) addend);
+ }
+ return (secinfo->first ? sec->_cooked_size : 0);
+ }
+
+ if (secinfo->htab->strings)
+ {
+ if (sec->entsize == 1)
+ {
+ p = secinfo->contents + offset + addend - 1;
+ while (*p && p >= secinfo->contents)
+ --p;
+ ++p;
+ }
+ else
+ {
+ p = secinfo->contents
+ + ((offset + addend) / sec->entsize) * sec->entsize;
+ p -= sec->entsize;
+ while (p >= secinfo->contents)
+ {
+ unsigned int i;
+
+ for (i = 0; i < sec->entsize; ++i)
+ if (p[i] != '\0')
+ break;
+ if (i == sec->entsize)
+ break;
+ p -= sec->entsize;
+ }
+ p += sec->entsize;
+ }
+ }
+ else
+ {
+ p = secinfo->contents
+ + ((offset + addend) / sec->entsize) * sec->entsize;
+ }
+ entry = sec_merge_hash_lookup (secinfo->htab, p, 0, false);
+ if (!entry)
+ {
+ if (! secinfo->htab->strings)
+ abort ();
+ /* This should only happen if somebody points into the padding
+ after a NUL character but before next entity. */
+ if (*p)
+ abort ();
+ if (! secinfo->htab->first)
+ abort ();
+ entry = secinfo->htab->first;
+ p = secinfo->contents
+ + ((offset + addend) / sec->entsize + 1) * sec->entsize
+ - entry->len;
+ }
+
+ *psec = entry->secinfo->sec;
+ return entry->u.index + (secinfo->contents + offset - p);
+}
diff --git a/contrib/binutils/bfd/netbsd-core.c b/contrib/binutils/bfd/netbsd-core.c
index c93d6a4..2787c46 100644
--- a/contrib/binutils/bfd/netbsd-core.c
+++ b/contrib/binutils/bfd/netbsd-core.c
@@ -1,5 +1,6 @@
/* BFD back end for NetBSD style core files
- Copyright 1988, 1989, 1991, 1992, 1993, 1996, 1998, 1999, 2000
+ Copyright 1988, 1989, 1991, 1992, 1993, 1996, 1998, 1999, 2000, 2001,
+ 2002
Free Software Foundation, Inc.
Written by Paul Kranenburg, EUR
@@ -39,12 +40,12 @@ struct netbsd_core_struct {
/* forward declarations */
-static const bfd_target * netbsd_core_file_p PARAMS ((bfd *abfd));
-static char * netbsd_core_file_failing_command PARAMS ((bfd *abfd));
-static int netbsd_core_file_failing_signal PARAMS ((bfd *abfd));
-static boolean netbsd_core_file_matches_executable_p
- PARAMS ((bfd *core_bfd, bfd *exec_bfd));
-static void swap_abort PARAMS ((void));
+static const bfd_target *netbsd_core_file_p PARAMS ((bfd *abfd));
+static char *netbsd_core_file_failing_command PARAMS ((bfd *abfd));
+static int netbsd_core_file_failing_signal PARAMS ((bfd *abfd));
+static boolean netbsd_core_file_matches_executable_p
+ PARAMS ((bfd *core_bfd, bfd *exec_bfd));
+static void swap_abort PARAMS ((void));
/* Handle NetBSD-style core dump file. */
@@ -54,117 +55,116 @@ netbsd_core_file_p (abfd)
bfd *abfd;
{
- int i, val, offset;
- asection *asect, *asect2;
- struct core core;
- struct coreseg coreseg;
-
- val = bfd_read ((void *)&core, 1, sizeof core, abfd);
- if (val != sizeof core) {
- /* Too small to be a core file */
- bfd_set_error(bfd_error_wrong_format);
- return 0;
+ int i, val;
+ file_ptr offset;
+ asection *asect, *asect2;
+ struct core core;
+ struct coreseg coreseg;
+ bfd_size_type amt = sizeof core;
+
+ val = bfd_bread ((void *) &core, amt, abfd);
+ if (val != sizeof core)
+ {
+ /* Too small to be a core file */
+ bfd_set_error (bfd_error_wrong_format);
+ return 0;
+ }
+
+ if (CORE_GETMAGIC (core) != COREMAGIC)
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return 0;
+ }
+
+ amt = sizeof (struct netbsd_core_struct);
+ rawptr = (struct netbsd_core_struct *) bfd_zalloc (abfd, amt);
+ if (rawptr == NULL)
+ return 0;
+
+ rawptr->core = core;
+ abfd->tdata.netbsd_core_data = rawptr;
+
+ offset = core.c_hdrsize;
+ for (i = 0; i < core.c_nseg; i++)
+ {
+ const char *sname;
+ flagword flags;
+
+ if (bfd_seek (abfd, offset, SEEK_SET) != 0)
+ goto punt;
+
+ val = bfd_bread ((void *) &coreseg, (bfd_size_type) sizeof coreseg, abfd);
+ if (val != sizeof coreseg)
+ {
+ bfd_set_error (bfd_error_file_truncated);
+ goto punt;
}
-
- if (CORE_GETMAGIC(core) != COREMAGIC) {
- bfd_set_error(bfd_error_wrong_format);
- return 0;
+ if (CORE_GETMAGIC (coreseg) != CORESEGMAGIC)
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ goto punt;
}
- rawptr = (struct netbsd_core_struct *)
- bfd_zalloc (abfd, sizeof (struct netbsd_core_struct));
- if (rawptr == NULL) {
- bfd_set_error(bfd_error_no_memory);
- return 0;
+ offset += core.c_seghdrsize;
+
+ switch (CORE_GETFLAG (coreseg))
+ {
+ case CORE_CPU:
+ sname = ".reg";
+ flags = SEC_ALLOC + SEC_HAS_CONTENTS;
+ break;
+ case CORE_DATA:
+ sname = ".data";
+ flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
+ break;
+ case CORE_STACK:
+ sname = ".stack";
+ flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
+ break;
+ default:
+ sname = ".unknown";
+ flags = SEC_ALLOC + SEC_HAS_CONTENTS;
+ break;
}
+ asect = bfd_make_section_anyway (abfd, sname);
+ if (asect == NULL)
+ goto punt;
- rawptr->core = core;
- abfd->tdata.netbsd_core_data = rawptr;
-
- offset = core.c_hdrsize;
- for (i = 0; i < core.c_nseg; i++) {
-
- if (bfd_seek (abfd, offset, SEEK_SET) != 0)
- goto punt;
-
- val = bfd_read ((void *)&coreseg, 1, sizeof coreseg, abfd);
- if (val != sizeof coreseg) {
- bfd_set_error(bfd_error_file_truncated);
- goto punt;
- }
- if (CORE_GETMAGIC(coreseg) != CORESEGMAGIC) {
- bfd_set_error(bfd_error_wrong_format);
- goto punt;
- }
-
- offset += core.c_seghdrsize;
-
- asect = (asection *) bfd_zalloc (abfd, sizeof (asection));
- if (asect == NULL) {
- bfd_set_error(bfd_error_no_memory);
- goto punt;
- }
-
- asect->_raw_size = coreseg.c_size;
- asect->vma = coreseg.c_addr;
- asect->filepos = offset;
- asect->alignment_power = 2;
- asect->next = abfd->sections;
- abfd->sections = asect;
- abfd->section_count++;
- offset += coreseg.c_size;
-
- switch (CORE_GETFLAG(coreseg)) {
- case CORE_CPU:
- asect->name = ".reg";
- asect->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
-#ifdef CORE_FPU_OFFSET
- /* Hackish... */
- asect->_raw_size = CORE_FPU_OFFSET;
- asect2 = (asection *)bfd_zalloc (abfd,
- sizeof (asection));
- if (asect2 == NULL) {
- bfd_set_error(bfd_error_no_memory);
- goto punt;
- }
- asect2->_raw_size = coreseg.c_size - CORE_FPU_OFFSET;
- asect2->vma = 0;
- asect2->filepos = asect->filepos + CORE_FPU_OFFSET;
- asect2->alignment_power = 2;
- asect2->next = abfd->sections;
- asect2->name = ".reg2";
- asect2->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
- abfd->sections = asect2;
- abfd->section_count++;
-#endif
+ asect->flags = flags;
+ asect->_raw_size = coreseg.c_size;
+ asect->vma = coreseg.c_addr;
+ asect->filepos = offset;
+ asect->alignment_power = 2;
+
+ offset += coreseg.c_size;
- break;
- case CORE_DATA:
- asect->name = ".data";
- asect->flags = SEC_ALLOC+SEC_LOAD+SEC_HAS_CONTENTS;
- break;
- case CORE_STACK:
- asect->name = ".stack";
- asect->flags = SEC_ALLOC+SEC_LOAD+SEC_HAS_CONTENTS;
- break;
- }
+#ifdef CORE_FPU_OFFSET
+ switch (CORE_GETFLAG (coreseg))
+ {
+ case CORE_CPU:
+ /* Hackish... */
+ asect->_raw_size = CORE_FPU_OFFSET;
+ asect2 = bfd_make_section_anyway (abfd, ".reg2");
+ if (asect2 == NULL)
+ goto punt;
+ asect2->_raw_size = coreseg.c_size - CORE_FPU_OFFSET;
+ asect2->vma = 0;
+ asect2->filepos = asect->filepos + CORE_FPU_OFFSET;
+ asect2->alignment_power = 2;
+ asect2->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
+ break;
}
+#endif
+ }
- /* OK, we believe you. You're a core file (sure, sure). */
- return abfd->xvec;
+ /* OK, we believe you. You're a core file (sure, sure). */
+ return abfd->xvec;
-punt: {
- asection *anext;
- for (asect = abfd->sections; asect; asect = anext) {
- anext = asect->next;
- free((void *)asect);
- }
- }
- free ((void *)rawptr);
- abfd->tdata.netbsd_core_data = NULL;
- abfd->sections = NULL;
- abfd->section_count = 0;
- return 0;
+ punt:
+ bfd_release (abfd, abfd->tdata.any);
+ abfd->tdata.any = NULL;
+ bfd_section_list_clear (abfd);
+ return 0;
}
static char*
@@ -187,7 +187,8 @@ netbsd_core_file_failing_signal (abfd)
/* ARGSUSED */
static boolean
netbsd_core_file_matches_executable_p (core_bfd, exec_bfd)
- bfd *core_bfd, *exec_bfd;
+ bfd *core_bfd ATTRIBUTE_UNUSED;
+ bfd *exec_bfd ATTRIBUTE_UNUSED;
{
return true; /* FIXME, We have no way of telling at this point */
}
diff --git a/contrib/binutils/bfd/opncls.c b/contrib/binutils/bfd/opncls.c
index 0c3d2c9..0b285d4 100644
--- a/contrib/binutils/bfd/opncls.c
+++ b/contrib/binutils/bfd/opncls.c
@@ -49,7 +49,7 @@ _bfd_new_bfd ()
{
bfd *nbfd;
- nbfd = (bfd *) bfd_zmalloc (sizeof (bfd));
+ nbfd = (bfd *) bfd_zmalloc ((bfd_size_type) sizeof (bfd));
if (nbfd == NULL)
return NULL;
@@ -57,6 +57,7 @@ _bfd_new_bfd ()
if (nbfd->memory == NULL)
{
bfd_set_error (bfd_error_no_memory);
+ free (nbfd);
return NULL;
}
@@ -65,10 +66,16 @@ _bfd_new_bfd ()
nbfd->direction = no_direction;
nbfd->iostream = NULL;
nbfd->where = 0;
+ if (!bfd_hash_table_init (&nbfd->section_htab, bfd_section_hash_newfunc))
+ {
+ free (nbfd);
+ return NULL;
+ }
nbfd->sections = (asection *) NULL;
+ nbfd->section_tail = &nbfd->sections;
nbfd->format = bfd_unknown;
nbfd->my_archive = (bfd *) NULL;
- nbfd->origin = 0;
+ nbfd->origin = 0;
nbfd->opened_once = false;
nbfd->output_has_begun = false;
nbfd->section_count = 0;
@@ -96,6 +103,17 @@ _bfd_new_bfd_contained_in (obfd)
return nbfd;
}
+/* Delete a BFD. */
+
+void
+_bfd_delete_bfd (abfd)
+ bfd *abfd;
+{
+ bfd_hash_table_free (&abfd->section_htab);
+ objalloc_free ((struct objalloc *) abfd->memory);
+ free (abfd);
+}
+
/*
SECTION
Opening and closing BFDs
@@ -107,7 +125,7 @@ FUNCTION
bfd_openr
SYNOPSIS
- bfd *bfd_openr(CONST char *filename, CONST char *target);
+ bfd *bfd_openr(const char *filename, const char *target);
DESCRIPTION
Open the file @var{filename} (using <<fopen>>) with the target
@@ -122,8 +140,8 @@ DESCRIPTION
bfd *
bfd_openr (filename, target)
- CONST char *filename;
- CONST char *target;
+ const char *filename;
+ const char *target;
{
bfd *nbfd;
const bfd_target *target_vec;
@@ -135,9 +153,8 @@ bfd_openr (filename, target)
target_vec = bfd_find_target (target, nbfd);
if (target_vec == NULL)
{
- objalloc_free ((struct objalloc *) nbfd->memory);
- free (nbfd);
bfd_set_error (bfd_error_invalid_target);
+ _bfd_delete_bfd (nbfd);
return NULL;
}
@@ -148,8 +165,7 @@ bfd_openr (filename, target)
{
/* File didn't exist, or some such */
bfd_set_error (bfd_error_system_call);
- objalloc_free ((struct objalloc *) nbfd->memory);
- free (nbfd);
+ _bfd_delete_bfd (nbfd);
return NULL;
}
@@ -169,7 +185,7 @@ FUNCTION
bfd_fdopenr
SYNOPSIS
- bfd *bfd_fdopenr(CONST char *filename, CONST char *target, int fd);
+ bfd *bfd_fdopenr(const char *filename, const char *target, int fd);
DESCRIPTION
<<bfd_fdopenr>> is to <<bfd_fopenr>> much like <<fdopen>> is to <<fopen>>.
@@ -192,8 +208,8 @@ DESCRIPTION
bfd *
bfd_fdopenr (filename, target, fd)
- CONST char *filename;
- CONST char *target;
+ const char *filename;
+ const char *target;
int fd;
{
bfd *nbfd;
@@ -216,8 +232,7 @@ bfd_fdopenr (filename, target, fd)
if (target_vec == NULL)
{
bfd_set_error (bfd_error_invalid_target);
- objalloc_free ((struct objalloc *) nbfd->memory);
- free (nbfd);
+ _bfd_delete_bfd (nbfd);
return NULL;
}
@@ -236,8 +251,7 @@ bfd_fdopenr (filename, target, fd)
if (nbfd->iostream == NULL)
{
- objalloc_free ((struct objalloc *) nbfd->memory);
- free (nbfd);
+ _bfd_delete_bfd (nbfd);
return NULL;
}
@@ -259,8 +273,7 @@ bfd_fdopenr (filename, target, fd)
if (! bfd_cache_init (nbfd))
{
- objalloc_free ((struct objalloc *) nbfd->memory);
- free (nbfd);
+ _bfd_delete_bfd (nbfd);
return NULL;
}
nbfd->opened_once = true;
@@ -299,19 +312,17 @@ bfd_openstreamr (filename, target, streamarg)
if (target_vec == NULL)
{
bfd_set_error (bfd_error_invalid_target);
- objalloc_free ((struct objalloc *) nbfd->memory);
- free (nbfd);
+ _bfd_delete_bfd (nbfd);
return NULL;
}
nbfd->iostream = (PTR) stream;
nbfd->filename = filename;
nbfd->direction = read_direction;
-
+
if (! bfd_cache_init (nbfd))
{
- objalloc_free ((struct objalloc *) nbfd->memory);
- free (nbfd);
+ _bfd_delete_bfd (nbfd);
return NULL;
}
@@ -328,7 +339,7 @@ FUNCTION
bfd_openw
SYNOPSIS
- bfd *bfd_openw(CONST char *filename, CONST char *target);
+ bfd *bfd_openw(const char *filename, const char *target);
DESCRIPTION
Create a BFD, associated with file @var{filename}, using the
@@ -340,8 +351,8 @@ DESCRIPTION
bfd *
bfd_openw (filename, target)
- CONST char *filename;
- CONST char *target;
+ const char *filename;
+ const char *target;
{
bfd *nbfd;
const bfd_target *target_vec;
@@ -358,8 +369,7 @@ bfd_openw (filename, target)
target_vec = bfd_find_target (target, nbfd);
if (target_vec == NULL)
{
- objalloc_free ((struct objalloc *) nbfd->memory);
- free (nbfd);
+ _bfd_delete_bfd (nbfd);
return NULL;
}
@@ -369,8 +379,7 @@ bfd_openw (filename, target)
if (bfd_open_file (nbfd) == NULL)
{
bfd_set_error (bfd_error_system_call); /* File not writeable, etc */
- objalloc_free ((struct objalloc *) nbfd->memory);
- free (nbfd);
+ _bfd_delete_bfd (nbfd);
return NULL;
}
@@ -429,7 +438,7 @@ bfd_close (abfd)
if (stat (abfd->filename, &buf) == 0)
{
- int mask = umask (0);
+ unsigned int mask = umask (0);
umask (mask);
chmod (abfd->filename,
(0777
@@ -437,8 +446,7 @@ bfd_close (abfd)
}
}
- objalloc_free ((struct objalloc *) abfd->memory);
- free (abfd);
+ _bfd_delete_bfd (abfd);
return ret;
}
@@ -484,7 +492,7 @@ bfd_close_all_done (abfd)
if (stat (abfd->filename, &buf) == 0)
{
- int mask = umask (0);
+ unsigned int mask = umask (0);
umask (mask);
chmod (abfd->filename,
(0777
@@ -492,8 +500,7 @@ bfd_close_all_done (abfd)
}
}
- objalloc_free ((struct objalloc *) abfd->memory);
- free (abfd);
+ _bfd_delete_bfd (abfd);
return ret;
}
@@ -503,7 +510,7 @@ FUNCTION
bfd_create
SYNOPSIS
- bfd *bfd_create(CONST char *filename, bfd *templ);
+ bfd *bfd_create(const char *filename, bfd *templ);
DESCRIPTION
Create a new BFD in the manner of
@@ -515,7 +522,7 @@ DESCRIPTION
bfd *
bfd_create (filename, templ)
- CONST char *filename;
+ const char *filename;
bfd *templ;
{
bfd *nbfd;
@@ -560,9 +567,10 @@ bfd_make_writable(abfd)
return false;
}
- bim = (struct bfd_in_memory *) bfd_malloc (sizeof (struct bfd_in_memory));
+ bim = ((struct bfd_in_memory *)
+ bfd_malloc ((bfd_size_type) sizeof (struct bfd_in_memory)));
abfd->iostream = (PTR) bim;
- /* bfd_write will grow these as needed */
+ /* bfd_bwrite will grow these as needed */
bim->size = 0;
bim->buffer = 0;
@@ -613,7 +621,7 @@ bfd_make_readable(abfd)
abfd->sections = (asection *) NULL;
abfd->format = bfd_unknown;
abfd->my_archive = (bfd *) NULL;
- abfd->origin = 0;
+ abfd->origin = 0;
abfd->opened_once = false;
abfd->output_has_begun = false;
abfd->section_count = 0;
@@ -650,10 +658,16 @@ DESCRIPTION
PTR
bfd_alloc (abfd, size)
bfd *abfd;
- size_t size;
+ bfd_size_type size;
{
PTR ret;
+ if (size != (unsigned long) size)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
+
ret = objalloc_alloc (abfd->memory, (unsigned long) size);
if (ret == NULL)
bfd_set_error (bfd_error_no_memory);
@@ -663,17 +677,18 @@ bfd_alloc (abfd, size)
PTR
bfd_zalloc (abfd, size)
bfd *abfd;
- size_t size;
+ bfd_size_type size;
{
PTR res;
res = bfd_alloc (abfd, size);
if (res)
- memset (res, 0, size);
+ memset (res, 0, (size_t) size);
return res;
}
-/* Free a block allocated for a BFD. */
+/* Free a block allocated for a BFD.
+ Note: Also frees all more recently allocated blocks! */
void
bfd_release (abfd, block)
diff --git a/contrib/binutils/bfd/osf-core.c b/contrib/binutils/bfd/osf-core.c
index c458ecf..edf5470 100644
--- a/contrib/binutils/bfd/osf-core.c
+++ b/contrib/binutils/bfd/osf-core.c
@@ -1,5 +1,6 @@
/* BFD back-end for OSF/1 core files.
- Copyright 1993, 1994, 1995, 1998, 1999 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -29,25 +30,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* forward declarations */
-static asection *
-make_bfd_asection PARAMS ((bfd *, CONST char *, flagword, bfd_size_type,
- bfd_vma, file_ptr));
-static asymbol *
-osf_core_make_empty_symbol PARAMS ((bfd *));
-static const bfd_target *
-osf_core_core_file_p PARAMS ((bfd *));
-static char *
-osf_core_core_file_failing_command PARAMS ((bfd *));
-static int
-osf_core_core_file_failing_signal PARAMS ((bfd *));
-static boolean
-osf_core_core_file_matches_executable_p PARAMS ((bfd *, bfd *));
-static void
-swap_abort PARAMS ((void));
+static asection *make_bfd_asection
+ PARAMS ((bfd *, const char *, flagword, bfd_size_type, bfd_vma, file_ptr));
+static const bfd_target *osf_core_core_file_p PARAMS ((bfd *));
+static char *osf_core_core_file_failing_command PARAMS ((bfd *));
+static int osf_core_core_file_failing_signal PARAMS ((bfd *));
+static boolean osf_core_core_file_matches_executable_p PARAMS ((bfd *, bfd *));
+static void swap_abort PARAMS ((void));
/* These are stored in the bfd's tdata */
-struct osf_core_struct
+struct osf_core_struct
{
int sig;
char cmd[MAXCOMLEN + 1];
@@ -60,7 +53,7 @@ struct osf_core_struct
static asection *
make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos)
bfd *abfd;
- CONST char *name;
+ const char *name;
flagword flags;
bfd_size_type _raw_size;
bfd_vma vma;
@@ -81,16 +74,6 @@ make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos)
return asect;
}
-static asymbol *
-osf_core_make_empty_symbol (abfd)
- bfd *abfd;
-{
- asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol));
- if (new)
- new->the_bfd = abfd;
- return new;
-}
-
static const bfd_target *
osf_core_core_file_p (abfd)
bfd *abfd;
@@ -99,8 +82,10 @@ osf_core_core_file_p (abfd)
int i;
char *secname;
struct core_filehdr core_header;
+ bfd_size_type amt;
- val = bfd_read ((PTR)&core_header, 1, sizeof core_header, abfd);
+ amt = sizeof core_header;
+ val = bfd_bread ((PTR) &core_header, amt, abfd);
if (val != sizeof core_header)
return NULL;
@@ -108,7 +93,7 @@ osf_core_core_file_p (abfd)
return NULL;
core_hdr (abfd) = (struct osf_core_struct *)
- bfd_zalloc (abfd, sizeof (struct osf_core_struct));
+ bfd_zalloc (abfd, (bfd_size_type) sizeof (struct osf_core_struct));
if (!core_hdr (abfd))
return NULL;
@@ -120,7 +105,8 @@ osf_core_core_file_p (abfd)
struct core_scnhdr core_scnhdr;
flagword flags;
- val = bfd_read ((PTR)&core_scnhdr, 1, sizeof core_scnhdr, abfd);
+ amt = sizeof core_scnhdr;
+ val = bfd_bread ((PTR) &core_scnhdr, amt, abfd);
if (val != sizeof core_scnhdr)
break;
@@ -152,12 +138,18 @@ osf_core_core_file_p (abfd)
(bfd_size_type) core_scnhdr.size,
(bfd_vma) core_scnhdr.vaddr,
(file_ptr) core_scnhdr.scnptr))
- return NULL;
+ goto fail;
}
/* OK, we believe you. You're a core file (sure, sure). */
return abfd->xvec;
+
+ fail:
+ bfd_release (abfd, core_hdr (abfd));
+ core_hdr (abfd) = NULL;
+ bfd_section_list_clear (abfd);
+ return NULL;
}
static char *
@@ -178,22 +170,12 @@ osf_core_core_file_failing_signal (abfd)
/* ARGSUSED */
static boolean
osf_core_core_file_matches_executable_p (core_bfd, exec_bfd)
- bfd *core_bfd, *exec_bfd;
+ bfd *core_bfd ATTRIBUTE_UNUSED;
+ bfd *exec_bfd ATTRIBUTE_UNUSED;
{
return true; /* FIXME, We have no way of telling at this point */
}
-#define osf_core_get_symtab_upper_bound _bfd_nosymbols_get_symtab_upper_bound
-#define osf_core_get_symtab _bfd_nosymbols_get_symtab
-#define osf_core_print_symbol _bfd_nosymbols_print_symbol
-#define osf_core_get_symbol_info _bfd_nosymbols_get_symbol_info
-#define osf_core_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name
-#define osf_core_get_lineno _bfd_nosymbols_get_lineno
-#define osf_core_find_nearest_line _bfd_nosymbols_find_nearest_line
-#define osf_core_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
-#define osf_core_read_minisymbols _bfd_nosymbols_read_minisymbols
-#define osf_core_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol
-
/* If somebody calls any byte-swapping routines, shoot them. */
static void
swap_abort()
@@ -239,18 +221,18 @@ const bfd_target osf_core_vec =
bfd_false, bfd_false,
bfd_false, bfd_false
},
-
- BFD_JUMP_TABLE_GENERIC (_bfd_generic),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (osf_core),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
- BFD_JUMP_TABLE_SYMBOLS (osf_core),
- BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
- BFD_JUMP_TABLE_WRITE (_bfd_generic),
- BFD_JUMP_TABLE_LINK (_bfd_nolink),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
+ BFD_JUMP_TABLE_GENERIC (_bfd_generic),
+ BFD_JUMP_TABLE_COPY (_bfd_generic),
+ BFD_JUMP_TABLE_CORE (osf_core),
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
+ BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
+ BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
+ BFD_JUMP_TABLE_WRITE (_bfd_generic),
+ BFD_JUMP_TABLE_LINK (_bfd_nolink),
+ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
-
+
(PTR) 0 /* backend_data */
};
diff --git a/contrib/binutils/bfd/peXXigen.c b/contrib/binutils/bfd/peXXigen.c
index a3141ba..37f4d1a 100644
--- a/contrib/binutils/bfd/peXXigen.c
+++ b/contrib/binutils/bfd/peXXigen.c
@@ -95,8 +95,9 @@ static void add_data_entry
PARAMS ((bfd *, struct internal_extra_pe_aouthdr *, int, char *, bfd_vma));
static boolean pe_print_pdata PARAMS ((bfd *, PTR));
static boolean pe_print_reloc PARAMS ((bfd *, PTR));
-
-/**********************************************************************/
+static boolean pe_print_idata PARAMS ((bfd *, PTR));
+static boolean pe_print_edata PARAMS ((bfd *, PTR));
+
void
_bfd_XXi_swap_sym_in (abfd, ext1, in1)
@@ -110,26 +111,21 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1)
if (ext->e.e_name[0] == 0)
{
in->_n._n_n._n_zeroes = 0;
- in->_n._n_n._n_offset =
- bfd_h_get_32 (abfd, (bfd_byte *) ext->e.e.e_offset);
+ in->_n._n_n._n_offset = H_GET_32 (abfd, ext->e.e.e_offset);
}
else
- {
- memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN);
- }
+ memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN);
+
+ in->n_value = H_GET_32 (abfd, ext->e_value);
+ in->n_scnum = H_GET_16 (abfd, ext->e_scnum);
- in->n_value = bfd_h_get_32 (abfd, (bfd_byte *) ext->e_value);
- in->n_scnum = bfd_h_get_16 (abfd, (bfd_byte *) ext->e_scnum);
if (sizeof (ext->e_type) == 2)
- {
- in->n_type = bfd_h_get_16 (abfd, (bfd_byte *) ext->e_type);
- }
+ in->n_type = H_GET_16 (abfd, ext->e_type);
else
- {
- in->n_type = bfd_h_get_32 (abfd, (bfd_byte *) ext->e_type);
- }
- in->n_sclass = bfd_h_get_8 (abfd, ext->e_sclass);
- in->n_numaux = bfd_h_get_8 (abfd, ext->e_numaux);
+ in->n_type = H_GET_32 (abfd, ext->e_type);
+
+ in->n_sclass = H_GET_8 (abfd, ext->e_sclass);
+ in->n_numaux = H_GET_8 (abfd, ext->e_numaux);
#ifndef STRICT_PE_FORMAT
/* This is for Gnu-created DLLs. */
@@ -166,6 +162,7 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1)
if (in->n_scnum == 0)
{
asection *sec;
+
for (sec = abfd->sections; sec; sec = sec->next)
{
if (strcmp (sec->name, in->n_name) == 0)
@@ -175,16 +172,18 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1)
}
}
}
+
if (in->n_scnum == 0)
{
int unused_section_number = 0;
asection *sec;
char *name;
+
for (sec = abfd->sections; sec; sec = sec->next)
if (unused_section_number <= sec->target_index)
unused_section_number = sec->target_index + 1;
- name = bfd_alloc (abfd, strlen (in->n_name) + 10);
+ name = bfd_alloc (abfd, (bfd_size_type) strlen (in->n_name) + 10);
if (name == NULL)
return;
strcpy (name, in->n_name);
@@ -229,28 +228,25 @@ _bfd_XXi_swap_sym_out (abfd, inp, extp)
{
struct internal_syment *in = (struct internal_syment *) inp;
SYMENT *ext = (SYMENT *) extp;
+
if (in->_n._n_name[0] == 0)
{
- bfd_h_put_32 (abfd, 0, (bfd_byte *) ext->e.e.e_zeroes);
- bfd_h_put_32 (abfd, in->_n._n_n._n_offset, (bfd_byte *) ext->e.e.e_offset);
+ H_PUT_32 (abfd, 0, ext->e.e.e_zeroes);
+ H_PUT_32 (abfd, in->_n._n_n._n_offset, ext->e.e.e_offset);
}
else
- {
- memcpy (ext->e.e_name, in->_n._n_name, SYMNMLEN);
- }
+ memcpy (ext->e.e_name, in->_n._n_name, SYMNMLEN);
+
+ H_PUT_32 (abfd, in->n_value, ext->e_value);
+ H_PUT_16 (abfd, in->n_scnum, ext->e_scnum);
- bfd_h_put_32 (abfd, in->n_value, (bfd_byte *) ext->e_value);
- bfd_h_put_16 (abfd, in->n_scnum, (bfd_byte *) ext->e_scnum);
if (sizeof (ext->e_type) == 2)
- {
- bfd_h_put_16 (abfd, in->n_type, (bfd_byte *) ext->e_type);
- }
+ H_PUT_16 (abfd, in->n_type, ext->e_type);
else
- {
- bfd_h_put_32 (abfd, in->n_type, (bfd_byte *) ext->e_type);
- }
- bfd_h_put_8 (abfd, in->n_sclass, ext->e_sclass);
- bfd_h_put_8 (abfd, in->n_numaux, ext->e_numaux);
+ H_PUT_32 (abfd, in->n_type, ext->e_type);
+
+ H_PUT_8 (abfd, in->n_sclass, ext->e_sclass);
+ H_PUT_8 (abfd, in->n_numaux, ext->e_numaux);
return SYMESZ;
}
@@ -274,13 +270,10 @@ _bfd_XXi_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
if (ext->x_file.x_fname[0] == 0)
{
in->x_file.x_n.x_zeroes = 0;
- in->x_file.x_n.x_offset =
- bfd_h_get_32 (abfd, (bfd_byte *) ext->x_file.x_n.x_offset);
+ in->x_file.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset);
}
else
- {
- memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
- }
+ memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
return;
case C_STAT:
@@ -291,19 +284,16 @@ _bfd_XXi_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
in->x_scn.x_scnlen = GET_SCN_SCNLEN (abfd, ext);
in->x_scn.x_nreloc = GET_SCN_NRELOC (abfd, ext);
in->x_scn.x_nlinno = GET_SCN_NLINNO (abfd, ext);
- in->x_scn.x_checksum =
- bfd_h_get_32 (abfd, (bfd_byte *) ext->x_scn.x_checksum);
- in->x_scn.x_associated =
- bfd_h_get_16 (abfd, (bfd_byte *) ext->x_scn.x_associated);
- in->x_scn.x_comdat =
- bfd_h_get_8 (abfd, (bfd_byte *) ext->x_scn.x_comdat);
+ in->x_scn.x_checksum = H_GET_32 (abfd, ext->x_scn.x_checksum);
+ in->x_scn.x_associated = H_GET_16 (abfd, ext->x_scn.x_associated);
+ in->x_scn.x_comdat = H_GET_8 (abfd, ext->x_scn.x_comdat);
return;
}
break;
}
- in->x_sym.x_tagndx.l = bfd_h_get_32 (abfd, (bfd_byte *) ext->x_sym.x_tagndx);
- in->x_sym.x_tvndx = bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_tvndx);
+ in->x_sym.x_tagndx.l = H_GET_32 (abfd, ext->x_sym.x_tagndx);
+ in->x_sym.x_tvndx = H_GET_16 (abfd, ext->x_sym.x_tvndx);
if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
{
@@ -313,19 +303,18 @@ _bfd_XXi_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
else
{
in->x_sym.x_fcnary.x_ary.x_dimen[0] =
- bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
+ H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
in->x_sym.x_fcnary.x_ary.x_dimen[1] =
- bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
+ H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
in->x_sym.x_fcnary.x_ary.x_dimen[2] =
- bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
+ H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
in->x_sym.x_fcnary.x_ary.x_dimen[3] =
- bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
+ H_GET_16 (abfd, ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
}
if (ISFCN (type))
{
- in->x_sym.x_misc.x_fsize =
- bfd_h_get_32 (abfd, (bfd_byte *) ext->x_sym.x_misc.x_fsize);
+ in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize);
}
else
{
@@ -353,15 +342,12 @@ _bfd_XXi_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
case C_FILE:
if (in->x_file.x_fname[0] == 0)
{
- bfd_h_put_32 (abfd, 0, (bfd_byte *) ext->x_file.x_n.x_zeroes);
- bfd_h_put_32 (abfd,
- in->x_file.x_n.x_offset,
- (bfd_byte *) ext->x_file.x_n.x_offset);
+ H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes);
+ H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
}
else
- {
- memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
- }
+ memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
+
return AUXESZ;
case C_STAT:
@@ -372,19 +358,16 @@ _bfd_XXi_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
PUT_SCN_SCNLEN (abfd, in->x_scn.x_scnlen, ext);
PUT_SCN_NRELOC (abfd, in->x_scn.x_nreloc, ext);
PUT_SCN_NLINNO (abfd, in->x_scn.x_nlinno, ext);
- bfd_h_put_32 (abfd, in->x_scn.x_checksum,
- (bfd_byte *) ext->x_scn.x_checksum);
- bfd_h_put_16 (abfd, in->x_scn.x_associated,
- (bfd_byte *) ext->x_scn.x_associated);
- bfd_h_put_8 (abfd, in->x_scn.x_comdat,
- (bfd_byte *) ext->x_scn.x_comdat);
+ H_PUT_32 (abfd, in->x_scn.x_checksum, ext->x_scn.x_checksum);
+ H_PUT_16 (abfd, in->x_scn.x_associated, ext->x_scn.x_associated);
+ H_PUT_8 (abfd, in->x_scn.x_comdat, ext->x_scn.x_comdat);
return AUXESZ;
}
break;
}
- bfd_h_put_32 (abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx);
- bfd_h_put_16 (abfd, in->x_sym.x_tvndx, (bfd_byte *) ext->x_sym.x_tvndx);
+ H_PUT_32 (abfd, in->x_sym.x_tagndx.l, ext->x_sym.x_tagndx);
+ H_PUT_16 (abfd, in->x_sym.x_tvndx, ext->x_sym.x_tvndx);
if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
{
@@ -393,19 +376,18 @@ _bfd_XXi_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
}
else
{
- bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0],
- (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
- bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1],
- (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
- bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2],
- (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
- bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3],
- (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
+ H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0],
+ ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
+ H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1],
+ ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
+ H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2],
+ ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
+ H_PUT_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3],
+ ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
}
if (ISFCN (type))
- bfd_h_put_32 (abfd, in->x_sym.x_misc.x_fsize,
- (bfd_byte *) ext->x_sym.x_misc.x_fsize);
+ H_PUT_32 (abfd, in->x_sym.x_misc.x_fsize, ext->x_sym.x_misc.x_fsize);
else
{
PUT_LNSZ_LNNO (abfd, in->x_sym.x_misc.x_lnsz.x_lnno, ext);
@@ -424,7 +406,7 @@ _bfd_XXi_swap_lineno_in (abfd, ext1, in1)
LINENO *ext = (LINENO *) ext1;
struct internal_lineno *in = (struct internal_lineno *) in1;
- in->l_addr.l_symndx = bfd_h_get_32 (abfd, (bfd_byte *) ext->l_addr.l_symndx);
+ in->l_addr.l_symndx = H_GET_32 (abfd, ext->l_addr.l_symndx);
in->l_lnno = GET_LINENO_LNNO (abfd, ext);
}
@@ -436,8 +418,7 @@ _bfd_XXi_swap_lineno_out (abfd, inp, outp)
{
struct internal_lineno *in = (struct internal_lineno *) inp;
struct external_lineno *ext = (struct external_lineno *) outp;
- bfd_h_put_32 (abfd, in->l_addr.l_symndx, (bfd_byte *)
- ext->l_addr.l_symndx);
+ H_PUT_32 (abfd, in->l_addr.l_symndx, ext->l_addr.l_symndx);
PUT_LINENO_LNNO (abfd, in->l_lnno, ext);
return LINESZ;
@@ -454,63 +435,62 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
AOUTHDR *aouthdr_ext = (AOUTHDR *) aouthdr_ext1;
struct internal_aouthdr *aouthdr_int = (struct internal_aouthdr *)aouthdr_int1;
- aouthdr_int->magic = bfd_h_get_16 (abfd, (bfd_byte *) aouthdr_ext->magic);
- aouthdr_int->vstamp = bfd_h_get_16 (abfd, (bfd_byte *) aouthdr_ext->vstamp);
- aouthdr_int->tsize =
- GET_AOUTHDR_TSIZE (abfd, (bfd_byte *) aouthdr_ext->tsize);
- aouthdr_int->dsize =
- GET_AOUTHDR_DSIZE (abfd, (bfd_byte *) aouthdr_ext->dsize);
- aouthdr_int->bsize =
- GET_AOUTHDR_BSIZE (abfd, (bfd_byte *) aouthdr_ext->bsize);
- aouthdr_int->entry =
- GET_AOUTHDR_ENTRY (abfd, (bfd_byte *) aouthdr_ext->entry);
+ aouthdr_int->magic = H_GET_16 (abfd, aouthdr_ext->magic);
+ aouthdr_int->vstamp = H_GET_16 (abfd, aouthdr_ext->vstamp);
+ aouthdr_int->tsize = GET_AOUTHDR_TSIZE (abfd, aouthdr_ext->tsize);
+ aouthdr_int->dsize = GET_AOUTHDR_DSIZE (abfd, aouthdr_ext->dsize);
+ aouthdr_int->bsize = GET_AOUTHDR_BSIZE (abfd, aouthdr_ext->bsize);
+ aouthdr_int->entry = GET_AOUTHDR_ENTRY (abfd, aouthdr_ext->entry);
aouthdr_int->text_start =
- GET_AOUTHDR_TEXT_START (abfd, (bfd_byte *) aouthdr_ext->text_start);
+ GET_AOUTHDR_TEXT_START (abfd, aouthdr_ext->text_start);
#ifndef COFF_WITH_pep
/* PE32+ does not have data_start member! */
aouthdr_int->data_start =
- GET_AOUTHDR_DATA_START (abfd, (bfd_byte *) aouthdr_ext->data_start);
+ GET_AOUTHDR_DATA_START (abfd, aouthdr_ext->data_start);
#endif
a = &aouthdr_int->pe;
- a->ImageBase = GET_OPTHDR_IMAGE_BASE (abfd, (bfd_byte *) src->ImageBase);
- a->SectionAlignment = bfd_h_get_32 (abfd, (bfd_byte *) src->SectionAlignment);
- a->FileAlignment = bfd_h_get_32 (abfd, (bfd_byte *) src->FileAlignment);
+ a->ImageBase = GET_OPTHDR_IMAGE_BASE (abfd, src->ImageBase);
+ a->SectionAlignment = H_GET_32 (abfd, src->SectionAlignment);
+ a->FileAlignment = H_GET_32 (abfd, src->FileAlignment);
a->MajorOperatingSystemVersion =
- bfd_h_get_16 (abfd, (bfd_byte *) src->MajorOperatingSystemVersion);
+ H_GET_16 (abfd, src->MajorOperatingSystemVersion);
a->MinorOperatingSystemVersion =
- bfd_h_get_16 (abfd, (bfd_byte *) src->MinorOperatingSystemVersion);
- a->MajorImageVersion = bfd_h_get_16 (abfd, (bfd_byte *) src->MajorImageVersion);
- a->MinorImageVersion = bfd_h_get_16 (abfd, (bfd_byte *) src->MinorImageVersion);
- a->MajorSubsystemVersion = bfd_h_get_16 (abfd, (bfd_byte *) src->MajorSubsystemVersion);
- a->MinorSubsystemVersion = bfd_h_get_16 (abfd, (bfd_byte *) src->MinorSubsystemVersion);
- a->Reserved1 = bfd_h_get_32 (abfd, (bfd_byte *) src->Reserved1);
- a->SizeOfImage = bfd_h_get_32 (abfd, (bfd_byte *) src->SizeOfImage);
- a->SizeOfHeaders = bfd_h_get_32 (abfd, (bfd_byte *) src->SizeOfHeaders);
- a->CheckSum = bfd_h_get_32 (abfd, (bfd_byte *) src->CheckSum);
- a->Subsystem = bfd_h_get_16 (abfd, (bfd_byte *) src->Subsystem);
- a->DllCharacteristics = bfd_h_get_16 (abfd, (bfd_byte *) src->DllCharacteristics);
- a->SizeOfStackReserve = GET_OPTHDR_SIZE_OF_STACK_RESERVE (abfd, (bfd_byte *) src->SizeOfStackReserve);
- a->SizeOfStackCommit = GET_OPTHDR_SIZE_OF_STACK_COMMIT (abfd, (bfd_byte *) src->SizeOfStackCommit);
- a->SizeOfHeapReserve = GET_OPTHDR_SIZE_OF_HEAP_RESERVE (abfd, (bfd_byte *) src->SizeOfHeapReserve);
- a->SizeOfHeapCommit = GET_OPTHDR_SIZE_OF_HEAP_COMMIT (abfd, (bfd_byte *) src->SizeOfHeapCommit);
- a->LoaderFlags = bfd_h_get_32 (abfd, (bfd_byte *) src->LoaderFlags);
- a->NumberOfRvaAndSizes = bfd_h_get_32 (abfd, (bfd_byte *) src->NumberOfRvaAndSizes);
+ H_GET_16 (abfd, src->MinorOperatingSystemVersion);
+ a->MajorImageVersion = H_GET_16 (abfd, src->MajorImageVersion);
+ a->MinorImageVersion = H_GET_16 (abfd, src->MinorImageVersion);
+ a->MajorSubsystemVersion = H_GET_16 (abfd, src->MajorSubsystemVersion);
+ a->MinorSubsystemVersion = H_GET_16 (abfd, src->MinorSubsystemVersion);
+ a->Reserved1 = H_GET_32 (abfd, src->Reserved1);
+ a->SizeOfImage = H_GET_32 (abfd, src->SizeOfImage);
+ a->SizeOfHeaders = H_GET_32 (abfd, src->SizeOfHeaders);
+ a->CheckSum = H_GET_32 (abfd, src->CheckSum);
+ a->Subsystem = H_GET_16 (abfd, src->Subsystem);
+ a->DllCharacteristics = H_GET_16 (abfd, src->DllCharacteristics);
+ a->SizeOfStackReserve =
+ GET_OPTHDR_SIZE_OF_STACK_RESERVE (abfd, src->SizeOfStackReserve);
+ a->SizeOfStackCommit =
+ GET_OPTHDR_SIZE_OF_STACK_COMMIT (abfd, src->SizeOfStackCommit);
+ a->SizeOfHeapReserve =
+ GET_OPTHDR_SIZE_OF_HEAP_RESERVE (abfd, src->SizeOfHeapReserve);
+ a->SizeOfHeapCommit =
+ GET_OPTHDR_SIZE_OF_HEAP_COMMIT (abfd, src->SizeOfHeapCommit);
+ a->LoaderFlags = H_GET_32 (abfd, src->LoaderFlags);
+ a->NumberOfRvaAndSizes = H_GET_32 (abfd, src->NumberOfRvaAndSizes);
{
int idx;
+
for (idx = 0; idx < 16; idx++)
{
/* If data directory is empty, rva also should be 0. */
int size =
- bfd_h_get_32 (abfd, (bfd_byte *) src->DataDirectory[idx][1]);
+ H_GET_32 (abfd, src->DataDirectory[idx][1]);
a->DataDirectory[idx].Size = size;
if (size)
- {
- a->DataDirectory[idx].VirtualAddress =
- bfd_h_get_32 (abfd, (bfd_byte *) src->DataDirectory[idx][0]);
- }
+ a->DataDirectory[idx].VirtualAddress =
+ H_GET_32 (abfd, src->DataDirectory[idx][0]);
else
a->DataDirectory[idx].VirtualAddress = 0;
}
@@ -523,6 +503,7 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
aouthdr_int->entry &= 0xffffffff;
#endif
}
+
if (aouthdr_int->tsize)
{
aouthdr_int->text_start += a->ImageBase;
@@ -530,6 +511,7 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
aouthdr_int->text_start &= 0xffffffff;
#endif
}
+
#ifndef COFF_WITH_pep
/* PE32+ does not have data_start member! */
if (aouthdr_int->dsize)
@@ -547,7 +529,6 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
thunk_size = a->DataDirectory[12].Size;
import_table_size = a->DataDirectory[1].Size;
#endif
-
}
/* A support function for below. */
@@ -562,12 +543,12 @@ add_data_entry (abfd, aout, idx, name, base)
{
asection *sec = bfd_get_section_by_name (abfd, name);
- /* add import directory information if it exists */
+ /* Add import directory information if it exists. */
if ((sec != NULL)
&& (coff_section_data (abfd, sec) != NULL)
&& (pei_section_data (abfd, sec) != NULL))
{
- /* If data directory is empty, rva also should be 0 */
+ /* If data directory is empty, rva also should be 0. */
int size = pei_section_data (abfd, sec)->virt_size;
aout->DataDirectory[idx].Size = size;
@@ -614,6 +595,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
aouthdr_in->text_start &= 0xffffffff;
#endif
}
+
if (aouthdr_in->dsize)
{
aouthdr_in->data_start -= ib;
@@ -621,6 +603,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
aouthdr_in->data_start &= 0xffffffff;
#endif
}
+
if (aouthdr_in->entry)
{
aouthdr_in->entry -= ib;
@@ -691,79 +674,67 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out)
}
extra->SizeOfHeaders = abfd->sections->filepos;
- bfd_h_put_16 (abfd, aouthdr_in->magic, (bfd_byte *) aouthdr_out->standard.magic);
+ H_PUT_16 (abfd, aouthdr_in->magic, aouthdr_out->standard.magic);
#define LINKER_VERSION 256 /* That is, 2.56 */
/* This piece of magic sets the "linker version" field to
LINKER_VERSION. */
- bfd_h_put_16 (abfd,
- LINKER_VERSION / 100 + (LINKER_VERSION % 100) * 256,
- (bfd_byte *) aouthdr_out->standard.vstamp);
-
- PUT_AOUTHDR_TSIZE (abfd, aouthdr_in->tsize, (bfd_byte *) aouthdr_out->standard.tsize);
- PUT_AOUTHDR_DSIZE (abfd, aouthdr_in->dsize, (bfd_byte *) aouthdr_out->standard.dsize);
- PUT_AOUTHDR_BSIZE (abfd, aouthdr_in->bsize, (bfd_byte *) aouthdr_out->standard.bsize);
- PUT_AOUTHDR_ENTRY (abfd, aouthdr_in->entry, (bfd_byte *) aouthdr_out->standard.entry);
+ H_PUT_16 (abfd, (LINKER_VERSION / 100 + (LINKER_VERSION % 100) * 256),
+ aouthdr_out->standard.vstamp);
+
+ PUT_AOUTHDR_TSIZE (abfd, aouthdr_in->tsize, aouthdr_out->standard.tsize);
+ PUT_AOUTHDR_DSIZE (abfd, aouthdr_in->dsize, aouthdr_out->standard.dsize);
+ PUT_AOUTHDR_BSIZE (abfd, aouthdr_in->bsize, aouthdr_out->standard.bsize);
+ PUT_AOUTHDR_ENTRY (abfd, aouthdr_in->entry, aouthdr_out->standard.entry);
PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start,
- (bfd_byte *) aouthdr_out->standard.text_start);
+ aouthdr_out->standard.text_start);
#ifndef COFF_WITH_pep
/* PE32+ does not have data_start member! */
PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start,
- (bfd_byte *) aouthdr_out->standard.data_start);
+ aouthdr_out->standard.data_start);
#endif
- PUT_OPTHDR_IMAGE_BASE (abfd, extra->ImageBase,
- (bfd_byte *) aouthdr_out->ImageBase);
- bfd_h_put_32 (abfd, extra->SectionAlignment,
- (bfd_byte *) aouthdr_out->SectionAlignment);
- bfd_h_put_32 (abfd, extra->FileAlignment,
- (bfd_byte *) aouthdr_out->FileAlignment);
- bfd_h_put_16 (abfd, extra->MajorOperatingSystemVersion,
- (bfd_byte *) aouthdr_out->MajorOperatingSystemVersion);
- bfd_h_put_16 (abfd, extra->MinorOperatingSystemVersion,
- (bfd_byte *) aouthdr_out->MinorOperatingSystemVersion);
- bfd_h_put_16 (abfd, extra->MajorImageVersion,
- (bfd_byte *) aouthdr_out->MajorImageVersion);
- bfd_h_put_16 (abfd, extra->MinorImageVersion,
- (bfd_byte *) aouthdr_out->MinorImageVersion);
- bfd_h_put_16 (abfd, extra->MajorSubsystemVersion,
- (bfd_byte *) aouthdr_out->MajorSubsystemVersion);
- bfd_h_put_16 (abfd, extra->MinorSubsystemVersion,
- (bfd_byte *) aouthdr_out->MinorSubsystemVersion);
- bfd_h_put_32 (abfd, extra->Reserved1,
- (bfd_byte *) aouthdr_out->Reserved1);
- bfd_h_put_32 (abfd, extra->SizeOfImage,
- (bfd_byte *) aouthdr_out->SizeOfImage);
- bfd_h_put_32 (abfd, extra->SizeOfHeaders,
- (bfd_byte *) aouthdr_out->SizeOfHeaders);
- bfd_h_put_32 (abfd, extra->CheckSum,
- (bfd_byte *) aouthdr_out->CheckSum);
- bfd_h_put_16 (abfd, extra->Subsystem,
- (bfd_byte *) aouthdr_out->Subsystem);
- bfd_h_put_16 (abfd, extra->DllCharacteristics,
- (bfd_byte *) aouthdr_out->DllCharacteristics);
+ PUT_OPTHDR_IMAGE_BASE (abfd, extra->ImageBase, aouthdr_out->ImageBase);
+ H_PUT_32 (abfd, extra->SectionAlignment, aouthdr_out->SectionAlignment);
+ H_PUT_32 (abfd, extra->FileAlignment, aouthdr_out->FileAlignment);
+ H_PUT_16 (abfd, extra->MajorOperatingSystemVersion,
+ aouthdr_out->MajorOperatingSystemVersion);
+ H_PUT_16 (abfd, extra->MinorOperatingSystemVersion,
+ aouthdr_out->MinorOperatingSystemVersion);
+ H_PUT_16 (abfd, extra->MajorImageVersion, aouthdr_out->MajorImageVersion);
+ H_PUT_16 (abfd, extra->MinorImageVersion, aouthdr_out->MinorImageVersion);
+ H_PUT_16 (abfd, extra->MajorSubsystemVersion,
+ aouthdr_out->MajorSubsystemVersion);
+ H_PUT_16 (abfd, extra->MinorSubsystemVersion,
+ aouthdr_out->MinorSubsystemVersion);
+ H_PUT_32 (abfd, extra->Reserved1, aouthdr_out->Reserved1);
+ H_PUT_32 (abfd, extra->SizeOfImage, aouthdr_out->SizeOfImage);
+ H_PUT_32 (abfd, extra->SizeOfHeaders, aouthdr_out->SizeOfHeaders);
+ H_PUT_32 (abfd, extra->CheckSum, aouthdr_out->CheckSum);
+ H_PUT_16 (abfd, extra->Subsystem, aouthdr_out->Subsystem);
+ H_PUT_16 (abfd, extra->DllCharacteristics, aouthdr_out->DllCharacteristics);
PUT_OPTHDR_SIZE_OF_STACK_RESERVE (abfd, extra->SizeOfStackReserve,
- (bfd_byte *) aouthdr_out->SizeOfStackReserve);
+ aouthdr_out->SizeOfStackReserve);
PUT_OPTHDR_SIZE_OF_STACK_COMMIT (abfd, extra->SizeOfStackCommit,
- (bfd_byte *) aouthdr_out->SizeOfStackCommit);
+ aouthdr_out->SizeOfStackCommit);
PUT_OPTHDR_SIZE_OF_HEAP_RESERVE (abfd, extra->SizeOfHeapReserve,
- (bfd_byte *) aouthdr_out->SizeOfHeapReserve);
+ aouthdr_out->SizeOfHeapReserve);
PUT_OPTHDR_SIZE_OF_HEAP_COMMIT (abfd, extra->SizeOfHeapCommit,
- (bfd_byte *) aouthdr_out->SizeOfHeapCommit);
- bfd_h_put_32 (abfd, extra->LoaderFlags,
- (bfd_byte *) aouthdr_out->LoaderFlags);
- bfd_h_put_32 (abfd, extra->NumberOfRvaAndSizes,
- (bfd_byte *) aouthdr_out->NumberOfRvaAndSizes);
+ aouthdr_out->SizeOfHeapCommit);
+ H_PUT_32 (abfd, extra->LoaderFlags, aouthdr_out->LoaderFlags);
+ H_PUT_32 (abfd, extra->NumberOfRvaAndSizes,
+ aouthdr_out->NumberOfRvaAndSizes);
{
int idx;
+
for (idx = 0; idx < 16; idx++)
{
- bfd_h_put_32 (abfd, extra->DataDirectory[idx].VirtualAddress,
- (bfd_byte *) aouthdr_out->DataDirectory[idx][0]);
- bfd_h_put_32 (abfd, extra->DataDirectory[idx].Size,
- (bfd_byte *) aouthdr_out->DataDirectory[idx][1]);
+ H_PUT_32 (abfd, extra->DataDirectory[idx].VirtualAddress,
+ aouthdr_out->DataDirectory[idx][0]);
+ H_PUT_32 (abfd, extra->DataDirectory[idx].Size,
+ aouthdr_out->DataDirectory[idx][1]);
}
}
@@ -832,63 +803,51 @@ _bfd_XXi_only_swap_filehdr_out (abfd, in, out)
filehdr_in->pe.dos_message[15] = 0x0;
filehdr_in->pe.nt_signature = NT_SIGNATURE;
- bfd_h_put_16 (abfd, filehdr_in->f_magic, (bfd_byte *) filehdr_out->f_magic);
- bfd_h_put_16 (abfd, filehdr_in->f_nscns, (bfd_byte *) filehdr_out->f_nscns);
+ H_PUT_16 (abfd, filehdr_in->f_magic, filehdr_out->f_magic);
+ H_PUT_16 (abfd, filehdr_in->f_nscns, filehdr_out->f_nscns);
- bfd_h_put_32 (abfd, time (0), (bfd_byte *) filehdr_out->f_timdat);
- PUT_FILEHDR_SYMPTR (abfd, (bfd_vma) filehdr_in->f_symptr,
- (bfd_byte *) filehdr_out->f_symptr);
- bfd_h_put_32 (abfd, filehdr_in->f_nsyms, (bfd_byte *) filehdr_out->f_nsyms);
- bfd_h_put_16 (abfd, filehdr_in->f_opthdr, (bfd_byte *) filehdr_out->f_opthdr);
- bfd_h_put_16 (abfd, filehdr_in->f_flags, (bfd_byte *) filehdr_out->f_flags);
+ H_PUT_32 (abfd, time (0), filehdr_out->f_timdat);
+ PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr,
+ filehdr_out->f_symptr);
+ H_PUT_32 (abfd, filehdr_in->f_nsyms, filehdr_out->f_nsyms);
+ H_PUT_16 (abfd, filehdr_in->f_opthdr, filehdr_out->f_opthdr);
+ H_PUT_16 (abfd, filehdr_in->f_flags, filehdr_out->f_flags);
- /* put in extra dos header stuff. This data remains essentially
+ /* Put in extra dos header stuff. This data remains essentially
constant, it just has to be tacked on to the beginning of all exes
- for NT */
- bfd_h_put_16 (abfd, filehdr_in->pe.e_magic, (bfd_byte *) filehdr_out->e_magic);
- bfd_h_put_16 (abfd, filehdr_in->pe.e_cblp, (bfd_byte *) filehdr_out->e_cblp);
- bfd_h_put_16 (abfd, filehdr_in->pe.e_cp, (bfd_byte *) filehdr_out->e_cp);
- bfd_h_put_16 (abfd, filehdr_in->pe.e_crlc, (bfd_byte *) filehdr_out->e_crlc);
- bfd_h_put_16 (abfd, filehdr_in->pe.e_cparhdr,
- (bfd_byte *) filehdr_out->e_cparhdr);
- bfd_h_put_16 (abfd, filehdr_in->pe.e_minalloc,
- (bfd_byte *) filehdr_out->e_minalloc);
- bfd_h_put_16 (abfd, filehdr_in->pe.e_maxalloc,
- (bfd_byte *) filehdr_out->e_maxalloc);
- bfd_h_put_16 (abfd, filehdr_in->pe.e_ss, (bfd_byte *) filehdr_out->e_ss);
- bfd_h_put_16 (abfd, filehdr_in->pe.e_sp, (bfd_byte *) filehdr_out->e_sp);
- bfd_h_put_16 (abfd, filehdr_in->pe.e_csum, (bfd_byte *) filehdr_out->e_csum);
- bfd_h_put_16 (abfd, filehdr_in->pe.e_ip, (bfd_byte *) filehdr_out->e_ip);
- bfd_h_put_16 (abfd, filehdr_in->pe.e_cs, (bfd_byte *) filehdr_out->e_cs);
- bfd_h_put_16 (abfd, filehdr_in->pe.e_lfarlc, (bfd_byte *) filehdr_out->e_lfarlc);
- bfd_h_put_16 (abfd, filehdr_in->pe.e_ovno, (bfd_byte *) filehdr_out->e_ovno);
- {
- int idx;
- for (idx = 0; idx < 4; idx++)
- bfd_h_put_16 (abfd, filehdr_in->pe.e_res[idx],
- (bfd_byte *) filehdr_out->e_res[idx]);
- }
- bfd_h_put_16 (abfd, filehdr_in->pe.e_oemid, (bfd_byte *) filehdr_out->e_oemid);
- bfd_h_put_16 (abfd, filehdr_in->pe.e_oeminfo,
- (bfd_byte *) filehdr_out->e_oeminfo);
- {
- int idx;
- for (idx = 0; idx < 10; idx++)
- bfd_h_put_16 (abfd, filehdr_in->pe.e_res2[idx],
- (bfd_byte *) filehdr_out->e_res2[idx]);
- }
- bfd_h_put_32 (abfd, filehdr_in->pe.e_lfanew, (bfd_byte *) filehdr_out->e_lfanew);
+ for NT. */
+ H_PUT_16 (abfd, filehdr_in->pe.e_magic, filehdr_out->e_magic);
+ H_PUT_16 (abfd, filehdr_in->pe.e_cblp, filehdr_out->e_cblp);
+ H_PUT_16 (abfd, filehdr_in->pe.e_cp, filehdr_out->e_cp);
+ H_PUT_16 (abfd, filehdr_in->pe.e_crlc, filehdr_out->e_crlc);
+ H_PUT_16 (abfd, filehdr_in->pe.e_cparhdr, filehdr_out->e_cparhdr);
+ H_PUT_16 (abfd, filehdr_in->pe.e_minalloc, filehdr_out->e_minalloc);
+ H_PUT_16 (abfd, filehdr_in->pe.e_maxalloc, filehdr_out->e_maxalloc);
+ H_PUT_16 (abfd, filehdr_in->pe.e_ss, filehdr_out->e_ss);
+ H_PUT_16 (abfd, filehdr_in->pe.e_sp, filehdr_out->e_sp);
+ H_PUT_16 (abfd, filehdr_in->pe.e_csum, filehdr_out->e_csum);
+ H_PUT_16 (abfd, filehdr_in->pe.e_ip, filehdr_out->e_ip);
+ H_PUT_16 (abfd, filehdr_in->pe.e_cs, filehdr_out->e_cs);
+ H_PUT_16 (abfd, filehdr_in->pe.e_lfarlc, filehdr_out->e_lfarlc);
+ H_PUT_16 (abfd, filehdr_in->pe.e_ovno, filehdr_out->e_ovno);
- {
- int idx;
- for (idx = 0; idx < 16; idx++)
- bfd_h_put_32 (abfd, filehdr_in->pe.dos_message[idx],
- (bfd_byte *) filehdr_out->dos_message[idx]);
- }
+ for (idx = 0; idx < 4; idx++)
+ H_PUT_16 (abfd, filehdr_in->pe.e_res[idx], filehdr_out->e_res[idx]);
+
+ H_PUT_16 (abfd, filehdr_in->pe.e_oemid, filehdr_out->e_oemid);
+ H_PUT_16 (abfd, filehdr_in->pe.e_oeminfo, filehdr_out->e_oeminfo);
+
+ for (idx = 0; idx < 10; idx++)
+ H_PUT_16 (abfd, filehdr_in->pe.e_res2[idx], filehdr_out->e_res2[idx]);
+
+ H_PUT_32 (abfd, filehdr_in->pe.e_lfanew, filehdr_out->e_lfanew);
+
+ for (idx = 0; idx < 16; idx++)
+ H_PUT_32 (abfd, filehdr_in->pe.dos_message[idx],
+ filehdr_out->dos_message[idx]);
/* Also put in the NT signature. */
- bfd_h_put_32 (abfd, filehdr_in->pe.nt_signature,
- (bfd_byte *) filehdr_out->nt_signature);
+ H_PUT_32 (abfd, filehdr_in->pe.nt_signature, filehdr_out->nt_signature);
return FILHSZ;
}
@@ -902,14 +861,13 @@ _bfd_XX_only_swap_filehdr_out (abfd, in, out)
struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
FILHDR *filehdr_out = (FILHDR *) out;
- bfd_h_put_16 (abfd, filehdr_in->f_magic, (bfd_byte *) filehdr_out->f_magic);
- bfd_h_put_16 (abfd, filehdr_in->f_nscns, (bfd_byte *) filehdr_out->f_nscns);
- bfd_h_put_32 (abfd, filehdr_in->f_timdat, (bfd_byte *) filehdr_out->f_timdat);
- PUT_FILEHDR_SYMPTR (abfd, (bfd_vma) filehdr_in->f_symptr,
- (bfd_byte *) filehdr_out->f_symptr);
- bfd_h_put_32 (abfd, filehdr_in->f_nsyms, (bfd_byte *) filehdr_out->f_nsyms);
- bfd_h_put_16 (abfd, filehdr_in->f_opthdr, (bfd_byte *) filehdr_out->f_opthdr);
- bfd_h_put_16 (abfd, filehdr_in->f_flags, (bfd_byte *) filehdr_out->f_flags);
+ H_PUT_16 (abfd, filehdr_in->f_magic, filehdr_out->f_magic);
+ H_PUT_16 (abfd, filehdr_in->f_nscns, filehdr_out->f_nscns);
+ H_PUT_32 (abfd, filehdr_in->f_timdat, filehdr_out->f_timdat);
+ PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr, filehdr_out->f_symptr);
+ H_PUT_32 (abfd, filehdr_in->f_nsyms, filehdr_out->f_nsyms);
+ H_PUT_16 (abfd, filehdr_in->f_opthdr, filehdr_out->f_opthdr);
+ H_PUT_16 (abfd, filehdr_in->f_flags, filehdr_out->f_flags);
return FILHSZ;
}
@@ -932,12 +890,11 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
((scnhdr_int->s_vaddr
- pe_data (abfd)->pe_opthdr.ImageBase)
& 0xffffffff),
- (bfd_byte *) scnhdr_ext->s_vaddr);
+ scnhdr_ext->s_vaddr);
/* NT wants the size data to be rounded up to the next
NT_FILE_ALIGNMENT, but zero if it has no content (as in .bss,
sometimes). */
-
if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0)
{
ps = scnhdr_int->s_size;
@@ -950,17 +907,17 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
}
PUT_SCNHDR_SIZE (abfd, ss,
- (bfd_byte *) scnhdr_ext->s_size);
+ scnhdr_ext->s_size);
/* s_paddr in PE is really the virtual size. */
- PUT_SCNHDR_PADDR (abfd, ps, (bfd_byte *) scnhdr_ext->s_paddr);
+ PUT_SCNHDR_PADDR (abfd, ps, scnhdr_ext->s_paddr);
PUT_SCNHDR_SCNPTR (abfd, scnhdr_int->s_scnptr,
- (bfd_byte *) scnhdr_ext->s_scnptr);
+ scnhdr_ext->s_scnptr);
PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr,
- (bfd_byte *) scnhdr_ext->s_relptr);
+ scnhdr_ext->s_relptr);
PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr,
- (bfd_byte *) scnhdr_ext->s_lnnoptr);
+ scnhdr_ext->s_lnnoptr);
/* Extra flags must be set when dealing with NT. All sections should also
have the IMAGE_SCN_MEM_READ (0x40000000) flag set. In addition, the
@@ -978,7 +935,8 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
{
int flags = scnhdr_int->s_flags;
- bfd_h_put_32 (abfd, flags, (bfd_byte *) scnhdr_ext->s_flags);
+
+ H_PUT_32 (abfd, flags, scnhdr_ext->s_flags);
}
if (coff_data (abfd)->link_info
@@ -994,41 +952,37 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
executables, but the 17-th bit has been observed to be there.
Overflow is not an issue: a 4G-line program will overflow a
bunch of other fields long before this! */
- bfd_h_put_16 (abfd, scnhdr_int->s_nlnno & 0xffff,
- (bfd_byte *) scnhdr_ext->s_nlnno);
- bfd_h_put_16 (abfd, scnhdr_int->s_nlnno >> 16,
- (bfd_byte *) scnhdr_ext->s_nreloc);
+ H_PUT_16 (abfd, (scnhdr_int->s_nlnno & 0xffff), scnhdr_ext->s_nlnno);
+ H_PUT_16 (abfd, (scnhdr_int->s_nlnno >> 16), scnhdr_ext->s_nreloc);
}
else
{
if (scnhdr_int->s_nlnno <= 0xffff)
- bfd_h_put_16 (abfd, scnhdr_int->s_nlnno,
- (bfd_byte *) scnhdr_ext->s_nlnno);
+ H_PUT_16 (abfd, scnhdr_int->s_nlnno, scnhdr_ext->s_nlnno);
else
{
(*_bfd_error_handler) (_("%s: line number overflow: 0x%lx > 0xffff"),
bfd_get_filename (abfd),
scnhdr_int->s_nlnno);
bfd_set_error (bfd_error_file_truncated);
- bfd_h_put_16 (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nlnno);
+ H_PUT_16 (abfd, 0xffff, scnhdr_ext->s_nlnno);
ret = 0;
}
+
if (scnhdr_int->s_nreloc <= 0xffff)
- bfd_h_put_16 (abfd, scnhdr_int->s_nreloc,
- (bfd_byte *) scnhdr_ext->s_nreloc);
+ H_PUT_16 (abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc);
else
{
- /* PE can deal with large #s of relocs, but not here */
- bfd_h_put_16 (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nreloc);
+ /* PE can deal with large #s of relocs, but not here. */
+ H_PUT_16 (abfd, 0xffff, scnhdr_ext->s_nreloc);
scnhdr_int->s_flags |= IMAGE_SCN_LNK_NRELOC_OVFL;
- bfd_h_put_32 (abfd, scnhdr_int->s_flags,
- (bfd_byte *) scnhdr_ext->s_flags);
+ H_PUT_32 (abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags);
#if 0
(*_bfd_error_handler) (_("%s: reloc overflow 1: 0x%lx > 0xffff"),
bfd_get_filename (abfd),
scnhdr_int->s_nreloc);
bfd_set_error (bfd_error_file_truncated);
- bfd_h_put_16 (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nreloc);
+ H_PUT_16 (abfd, 0xffff, scnhdr_ext->s_nreloc);
ret = 0;
#endif
}
@@ -1036,26 +990,26 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out)
return ret;
}
-static char * dir_names[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] = {
- N_("Export Directory [.edata (or where ever we found it)]"),
- N_("Import Directory [parts of .idata]"),
- N_("Resource Directory [.rsrc]"),
- N_("Exception Directory [.pdata]"),
- N_("Security Directory"),
- N_("Base Relocation Directory [.reloc]"),
- N_("Debug Directory"),
- N_("Description Directory"),
- N_("Special Directory"),
- N_("Thread Storage Directory [.tls]"),
- N_("Load Configuration Directory"),
- N_("Bound Import Directory"),
- N_("Import Address Table Directory"),
- N_("Delay Import Directory"),
- N_("Reserved"),
- N_("Reserved")
-};
-
-/**********************************************************************/
+static char * dir_names[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] =
+ {
+ N_("Export Directory [.edata (or where ever we found it)]"),
+ N_("Import Directory [parts of .idata]"),
+ N_("Resource Directory [.rsrc]"),
+ N_("Exception Directory [.pdata]"),
+ N_("Security Directory"),
+ N_("Base Relocation Directory [.reloc]"),
+ N_("Debug Directory"),
+ N_("Description Directory"),
+ N_("Special Directory"),
+ N_("Thread Storage Directory [.tls]"),
+ N_("Load Configuration Directory"),
+ N_("Bound Import Directory"),
+ N_("Import Address Table Directory"),
+ N_("Delay Import Directory"),
+ N_("Reserved"),
+ N_("Reserved")
+ };
+
#ifdef POWERPC_LE_PE
/* The code for the PPC really falls in the "architecture dependent"
category. However, it's not clear that anyone will ever care, so
@@ -1064,7 +1018,6 @@ static char * dir_names[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] = {
PPC- specific code. */
#endif
-/**********************************************************************/
static boolean
pe_print_idata (abfd, vfile)
bfd *abfd;
@@ -1082,6 +1035,7 @@ pe_print_idata (abfd, vfile)
bfd_size_type datasize = 0;
bfd_size_type dataoff;
bfd_size_type i;
+ bfd_size_type amt;
int onaline = 20;
pe_data_type *pe = pe_data (abfd);
@@ -1143,15 +1097,13 @@ pe_print_idata (abfd, vfile)
bfd_byte *data = 0;
int offset;
- data = (bfd_byte *) bfd_malloc ((size_t) bfd_section_size (abfd,
- rel_section));
- if (data == NULL && bfd_section_size (abfd, rel_section) != 0)
+ amt = bfd_section_size (abfd, rel_section);
+ data = (bfd_byte *) bfd_malloc (amt);
+ if (data == NULL && amt != 0)
return false;
- bfd_get_section_contents (abfd,
- rel_section,
- (PTR) data, 0,
- bfd_section_size (abfd, rel_section));
+ bfd_get_section_contents (abfd, rel_section, (PTR) data, (bfd_vma) 0,
+ amt);
offset = abfd->start_address - rel_section->vma;
@@ -1181,13 +1133,13 @@ pe_print_idata (abfd, vfile)
fprintf (file,
_(" Table Stamp Chain Name Thunk\n"));
- data = (bfd_byte *) bfd_malloc (dataoff + datasize);
+ amt = dataoff + datasize;
+ data = (bfd_byte *) bfd_malloc (amt);
if (data == NULL)
return false;
/* Read the whole section. Some of the fields might be before dataoff. */
- if (! bfd_get_section_contents (abfd, section, (PTR) data,
- 0, dataoff + datasize))
+ if (! bfd_get_section_contents (abfd, section, (PTR) data, (bfd_vma) 0, amt))
return false;
adj = section->vma - extra->ImageBase;
@@ -1205,13 +1157,11 @@ pe_print_idata (abfd, vfile)
/* print (i + extra->DataDirectory[1].VirtualAddress) */
fprintf (file, " %08lx\t", (unsigned long) (i + adj + dataoff));
-
+#if 0
if (i + 20 > datasize)
- {
- /* Check stuff. */
- ;
- }
-
+ /* Check stuff. */
+ ;
+#endif
hint_addr = bfd_get_32 (abfd, data + i + dataoff);
time_stamp = bfd_get_32 (abfd, data + i + 4 + dataoff);
forward_chain = bfd_get_32 (abfd, data + i + 8 + dataoff);
@@ -1299,11 +1249,10 @@ pe_print_idata (abfd, vfile)
fprintf (file, _("\tvma: Hint/Ord Member-Name\n"));
differ = 1;
}
+
if (iat_member == 0)
- {
- fprintf (file,
- _("\t>>> Ran out of IAT members!\n"));
- }
+ fprintf (file,
+ _("\t>>> Ran out of IAT members!\n"));
else
{
ordinal = bfd_get_16 (abfd, data + iat_member - adj);
@@ -1318,15 +1267,13 @@ pe_print_idata (abfd, vfile)
if (hint_addr != 0 && hint_member == 0)
break;
}
+
if (differ == 0)
- {
- fprintf (file,
- _("\tThe Import Address Table is identical\n"));
- }
+ fprintf (file,
+ _("\tThe Import Address Table is identical\n"));
}
fprintf (file, "\n");
-
}
free (data);
@@ -1342,24 +1289,23 @@ pe_print_edata (abfd, vfile)
FILE *file = (FILE *) vfile;
bfd_byte *data;
asection *section;
-
bfd_size_type datasize = 0;
bfd_size_type dataoff;
bfd_size_type i;
-
bfd_signed_vma adj;
- struct EDT_type {
- long export_flags; /* reserved - should be zero */
+ struct EDT_type
+ {
+ long export_flags; /* reserved - should be zero */
long time_stamp;
short major_ver;
short minor_ver;
- bfd_vma name; /* rva - relative to image base */
- long base; /* ordinal base */
- unsigned long num_functions; /* Number in the export address table */
- unsigned long num_names; /* Number in the name pointer table */
- bfd_vma eat_addr; /* rva to the export address table */
- bfd_vma npt_addr; /* rva to the Export Name Pointer Table */
- bfd_vma ot_addr; /* rva to the Ordinal Table */
+ bfd_vma name; /* rva - relative to image base */
+ long base; /* ordinal base */
+ unsigned long num_functions;/* Number in the export address table */
+ unsigned long num_names; /* Number in the name pointer table */
+ bfd_vma eat_addr; /* rva to the export address table */
+ bfd_vma npt_addr; /* rva to the Export Name Pointer Table */
+ bfd_vma ot_addr; /* rva to the Ordinal Table */
} edt;
pe_data_type *pe = pe_data (abfd);
@@ -1384,9 +1330,11 @@ pe_print_edata (abfd, vfile)
else
{
addr += extra->ImageBase;
+
for (section = abfd->sections; section != NULL; section = section->next)
{
datasize = bfd_section_size (abfd, section);
+
if (addr >= section->vma && addr < section->vma + datasize)
break;
}
@@ -1409,8 +1357,8 @@ pe_print_edata (abfd, vfile)
if (data == NULL)
return false;
- if (! bfd_get_section_contents (abfd, section, (PTR) data, dataoff,
- datasize))
+ if (! bfd_get_section_contents (abfd, section, (PTR) data,
+ (file_ptr) dataoff, datasize))
return false;
/* Go get Export Directory Table. */
@@ -1428,7 +1376,7 @@ pe_print_edata (abfd, vfile)
adj = section->vma - extra->ImageBase + dataoff;
- /* Dump the EDT first first */
+ /* Dump the EDT first. */
fprintf (file,
_("\nThe Export Tables (interpreted %s section contents)\n\n"),
section->name);
@@ -1482,7 +1430,8 @@ pe_print_edata (abfd, vfile)
/* The next table to find is the Export Address Table. It's basically
a list of pointers that either locate a function in this dll, or
forward the call to another dll. Something like:
- typedef union {
+ typedef union
+ {
long export_rva;
long forwarder_rva;
} export_address_table_entry;
@@ -1596,18 +1545,16 @@ pe_print_pdata (abfd, vfile)
_(" \t\tAddress Address Handler Data Address Mask\n"));
#endif
- if (bfd_section_size (abfd, section) == 0)
+ datasize = bfd_section_size (abfd, section);
+ if (datasize == 0)
return true;
- data = (bfd_byte *) bfd_malloc ((size_t) bfd_section_size (abfd, section));
- datasize = bfd_section_size (abfd, section);
+ data = (bfd_byte *) bfd_malloc (datasize);
if (data == NULL && datasize != 0)
return false;
- bfd_get_section_contents (abfd,
- section,
- (PTR) data, 0,
- bfd_section_size (abfd, section));
+ bfd_get_section_contents (abfd, section, (PTR) data, (bfd_vma) 0,
+ datasize);
start = 0;
@@ -1631,10 +1578,8 @@ pe_print_pdata (abfd, vfile)
if (begin_addr == 0 && end_addr == 0 && eh_handler == 0
&& eh_data == 0 && prolog_end_addr == 0)
- {
- /* We are probably into the padding of the section now. */
- break;
- }
+ /* We are probably into the padding of the section now. */
+ break;
em_data = ((eh_handler & 0x1) << 2) | (prolog_end_addr & 0x3);
eh_handler &= ~(bfd_vma) 0x3;
@@ -1687,21 +1632,22 @@ pe_print_pdata (abfd, vfile)
}
#define IMAGE_REL_BASED_HIGHADJ 4
-static const char * const tbl[] = {
- "ABSOLUTE",
- "HIGH",
- "LOW",
- "HIGHLOW",
- "HIGHADJ",
- "MIPS_JMPADDR",
- "SECTION",
- "REL32",
- "RESERVED1",
- "MIPS_JMPADDR16",
- "DIR64",
- "HIGH3ADJ"
- "UNKNOWN", /* MUST be last */
-};
+static const char * const tbl[] =
+ {
+ "ABSOLUTE",
+ "HIGH",
+ "LOW",
+ "HIGHLOW",
+ "HIGHADJ",
+ "MIPS_JMPADDR",
+ "SECTION",
+ "REL32",
+ "RESERVED1",
+ "MIPS_JMPADDR16",
+ "DIR64",
+ "HIGH3ADJ"
+ "UNKNOWN", /* MUST be last */
+ };
static boolean
pe_print_reloc (abfd, vfile)
@@ -1711,7 +1657,7 @@ pe_print_reloc (abfd, vfile)
FILE *file = (FILE *) vfile;
bfd_byte *data = 0;
asection *section = bfd_get_section_by_name (abfd, ".reloc");
- bfd_size_type datasize = 0;
+ bfd_size_type datasize;
bfd_size_type i;
bfd_size_type start, stop;
@@ -1724,15 +1670,13 @@ pe_print_reloc (abfd, vfile)
fprintf (file,
_("\n\nPE File Base Relocations (interpreted .reloc section contents)\n"));
- data = (bfd_byte *) bfd_malloc ((size_t) bfd_section_size (abfd, section));
datasize = bfd_section_size (abfd, section);
+ data = (bfd_byte *) bfd_malloc (datasize);
if (data == NULL && datasize != 0)
return false;
- bfd_get_section_contents (abfd,
- section,
- (PTR) data, 0,
- bfd_section_size (abfd, section));
+ bfd_get_section_contents (abfd, section, (PTR) data, (bfd_vma) 0,
+ datasize);
start = 0;
@@ -1745,16 +1689,13 @@ pe_print_reloc (abfd, vfile)
long number, size;
/* The .reloc section is a sequence of blocks, with a header consisting
- of two 32 bit quantities, followed by a number of 16 bit entries */
-
+ of two 32 bit quantities, followed by a number of 16 bit entries. */
virtual_address = bfd_get_32 (abfd, data+i);
size = bfd_get_32 (abfd, data+i+4);
number = (size - 8) / 2;
if (size == 0)
- {
- break;
- }
+ break;
fprintf (file,
_("\nVirtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n"),
@@ -1785,6 +1726,7 @@ pe_print_reloc (abfd, vfile)
fprintf (file, "\n");
}
+
i += size;
}
@@ -1845,6 +1787,7 @@ _bfd_XX_print_private_bfd_data_common (abfd, vfile)
fprintf (file, "SizeOfImage\t\t%08lx\n", i->SizeOfImage);
fprintf (file, "SizeOfHeaders\t\t%08lx\n", i->SizeOfHeaders);
fprintf (file, "CheckSum\t\t%08lx\n", i->CheckSum);
+
switch (i->Subsystem)
{
case IMAGE_SUBSYSTEM_UNKNOWN:
@@ -1875,6 +1818,7 @@ _bfd_XX_print_private_bfd_data_common (abfd, vfile)
subsystem_name = "EFI runtime driver";
break;
}
+
fprintf (file, "Subsystem\t\t%08x", i->Subsystem);
if (subsystem_name)
fprintf (file, "\t(%s)", subsystem_name);
@@ -1922,7 +1866,7 @@ _bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd)
pe_data (obfd)->pe_opthdr = pe_data (ibfd)->pe_opthdr;
pe_data (obfd)->dll = pe_data (ibfd)->dll;
- /* for strip: if we removed .reloc, we'll make a real mess of things
+ /* For strip: if we removed .reloc, we'll make a real mess of things
if we don't remove this entry as well. */
if (! pe_data (obfd)->has_reloc_section)
{
@@ -1933,6 +1877,7 @@ _bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd)
}
/* Copy private section data. */
+
boolean
_bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
bfd *ibfd;
@@ -1949,18 +1894,20 @@ _bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
{
if (coff_section_data (obfd, osec) == NULL)
{
- osec->used_by_bfd =
- (PTR) bfd_zalloc (obfd, sizeof (struct coff_section_tdata));
+ bfd_size_type amt = sizeof (struct coff_section_tdata);
+ osec->used_by_bfd = (PTR) bfd_zalloc (obfd, amt);
if (osec->used_by_bfd == NULL)
return false;
}
+
if (pei_section_data (obfd, osec) == NULL)
{
- coff_section_data (obfd, osec)->tdata =
- (PTR) bfd_zalloc (obfd, sizeof (struct pei_section_tdata));
+ bfd_size_type amt = sizeof (struct pei_section_tdata);
+ coff_section_data (obfd, osec)->tdata = (PTR) bfd_zalloc (obfd, amt);
if (coff_section_data (obfd, osec)->tdata == NULL)
return false;
}
+
pei_section_data (obfd, osec)->virt_size =
pei_section_data (ibfd, isec)->virt_size;
pei_section_data (obfd, osec)->pe_flags =
diff --git a/contrib/binutils/bfd/po/Make-in b/contrib/binutils/bfd/po/Make-in
index 2414748..a288585 100644
--- a/contrib/binutils/bfd/po/Make-in
+++ b/contrib/binutils/bfd/po/Make-in
@@ -205,12 +205,12 @@ clean: mostlyclean
distclean: clean
rm -f Makefile Makefile.in *.mo *.msg *.cat *.cat.m
- rm -f SRC-POTFILES BLD-POTFILES SRC-POTFILES.in BLD-POTFILES.in
+ rm -f SRC-POTFILES BLD-POTFILES
maintainer-clean: distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
- rm -f $(GMOFILES)
+ rm -f $(GMOFILES) SRC-POTFILES.in BLD-POTFILES.in
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
dist distdir: update-po $(DISTFILES)
diff --git a/contrib/binutils/bfd/po/SRC-POTFILES.in b/contrib/binutils/bfd/po/SRC-POTFILES.in
index ab40ed1..0ef9b4a 100644
--- a/contrib/binutils/bfd/po/SRC-POTFILES.in
+++ b/contrib/binutils/bfd/po/SRC-POTFILES.in
@@ -12,6 +12,7 @@ aout64.c
aoutf1.h
aoutx.h
archive.c
+archive64.c
archures.c
armnetbsd.c
bfd.c
@@ -36,7 +37,6 @@ coff-i960.c
coff-m68k.c
coff-m88k.c
coff-mips.c
-coff-pmac.c
coff-rs6000.c
coff-sh.c
coff-sparc.c
@@ -81,10 +81,14 @@ cpu-m68k.c
cpu-m88k.c
cpu-mcore.c
cpu-mips.c
+cpu-mmix.c
cpu-ns32k.c
+cpu-openrisc.c
+cpu-pdp11.c
cpu-pj.c
cpu-powerpc.c
cpu-rs6000.c
+cpu-s390.c
cpu-sh.c
cpu-sparc.c
cpu-tic30.c
@@ -94,6 +98,7 @@ cpu-v850.c
cpu-vax.c
cpu-w65.c
cpu-we32k.c
+cpu-xstormy16.c
cpu-z8k.c
demo64.c
dwarf1.c
@@ -104,9 +109,11 @@ ecoffswap.h
efi-app-ia32.c
efi-app-ia64.c
elf-bfd.h
+elf-eh-frame.c
elf-hppa.h
elf-m10200.c
elf-m10300.c
+elf-strtab.c
elf.c
elf32-arc.c
elf32-arm.h
@@ -116,6 +123,7 @@ elf32-d10v.c
elf32-d30v.c
elf32-fr30.c
elf32-gen.c
+elf32-h8300.c
elf32-hppa.c
elf32-hppa.h
elf32-i370.c
@@ -129,18 +137,25 @@ elf32-m68k.c
elf32-m88k.c
elf32-mcore.c
elf32-mips.c
+elf32-openrisc.c
elf32-pj.c
elf32-ppc.c
+elf32-s390.c
elf32-sh-lin.c
+elf32-sh-nbsd.c
elf32-sh.c
elf32-sparc.c
elf32-v850.c
+elf32-xstormy16.c
elf32.c
elf64-alpha.c
elf64-gen.c
elf64-hppa.c
elf64-hppa.h
elf64-mips.c
+elf64-mmix.c
+elf64-ppc.c
+elf64-s390.c
elf64-sparc.c
elf64-x86-64.c
elf64.c
@@ -184,6 +199,7 @@ libieee.h
libnlm.h
liboasys.h
libpei.h
+libxcoff.h
linker.c
lynx-core.c
m68k4knetbsd.c
@@ -191,7 +207,9 @@ m68klinux.c
m68klynx.c
m68knetbsd.c
m88kmach3.c
+merge.c
mipsbsd.c
+mmo.c
netbsd.h
newsos3.c
nlm-target.h
@@ -210,6 +228,7 @@ oasys.c
opncls.c
osf-core.c
pc532-mach.c
+pdp11.c
pe-arm.c
pe-i386.c
pe-mcore.c
@@ -244,6 +263,7 @@ tekhex.c
trad-core.c
vaxnetbsd.c
versados.c
+version.h
vms-gsd.c
vms-hdr.c
vms-misc.c
diff --git a/contrib/binutils/bfd/po/bfd.pot b/contrib/binutils/bfd/po/bfd.pot
index e77b05d..bb8a425 100644
--- a/contrib/binutils/bfd/po/bfd.pot
+++ b/contrib/binutils/bfd/po/bfd.pot
@@ -6,2016 +6,2092 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2001-01-11 11:54-0800\n"
+"POT-Creation-Date: 2002-01-17 12:55+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
-"Content-Transfer-Encoding: ENCODING\n"
+"Content-Transfer-Encoding: 8bit\n"
-#: aout-adobe.c:189
+#: aout-adobe.c:196
#, c-format
msgid "%s: Unknown section type in a.out.adobe file: %x\n"
msgstr ""
-#: aout-cris.c:205
+#: aout-cris.c:208
#, c-format
msgid "%s: Invalid relocation type exported: %d"
msgstr ""
-#: aout-cris.c:249
+#: aout-cris.c:252
#, c-format
msgid "%s: Invalid relocation type imported: %d"
msgstr ""
-#: aout-cris.c:260
+#: aout-cris.c:263
#, c-format
msgid "%s: Bad relocation record imported: %d"
msgstr ""
-#: aoutx.h:1259 aoutx.h:1673
+#: aoutx.h:1282 aoutx.h:1699
#, c-format
msgid "%s: can not represent section `%s' in a.out object file format"
msgstr ""
-#: aoutx.h:1643
+#: aoutx.h:1669
#, c-format
msgid ""
"%s: can not represent section for symbol `%s' in a.out object file format"
msgstr ""
-#: aoutx.h:1645
+#: aoutx.h:1671
msgid "*unknown*"
msgstr ""
-#: aoutx.h:3684
+#: aoutx.h:3735
#, c-format
msgid "%s: relocateable link from %s to %s not supported"
msgstr ""
-#: archive.c:1820
+#: archive.c:1826
msgid "Warning: writing archive was slow: rewriting timestamp\n"
msgstr ""
-#: archive.c:2086
+#: archive.c:2093
msgid "Reading archive file mod timestamp"
msgstr ""
#. FIXME: bfd can't call perror.
-#: archive.c:2113
+#: archive.c:2120
msgid "Writing updated armap timestamp"
msgstr ""
-#: bfd.c:273
+#: bfd.c:281
msgid "No error"
msgstr ""
-#: bfd.c:274
+#: bfd.c:282
msgid "System call error"
msgstr ""
-#: bfd.c:275
+#: bfd.c:283
msgid "Invalid bfd target"
msgstr ""
-#: bfd.c:276
+#: bfd.c:284
msgid "File in wrong format"
msgstr ""
-#: bfd.c:277
+#: bfd.c:285
+msgid "Archive object file in wrong format"
+msgstr ""
+
+#: bfd.c:286
msgid "Invalid operation"
msgstr ""
-#: bfd.c:278
+#: bfd.c:287
msgid "Memory exhausted"
msgstr ""
-#: bfd.c:279
+#: bfd.c:288
msgid "No symbols"
msgstr ""
-#: bfd.c:280
+#: bfd.c:289
msgid "Archive has no index; run ranlib to add one"
msgstr ""
-#: bfd.c:281
+#: bfd.c:290
msgid "No more archived files"
msgstr ""
-#: bfd.c:282
+#: bfd.c:291
msgid "Malformed archive"
msgstr ""
-#: bfd.c:283
+#: bfd.c:292
msgid "File format not recognized"
msgstr ""
-#: bfd.c:284
+#: bfd.c:293
msgid "File format is ambiguous"
msgstr ""
-#: bfd.c:285
+#: bfd.c:294
msgid "Section has no contents"
msgstr ""
-#: bfd.c:286
+#: bfd.c:295
msgid "Nonrepresentable section on output"
msgstr ""
-#: bfd.c:287
+#: bfd.c:296
msgid "Symbol needs debug section which does not exist"
msgstr ""
-#: bfd.c:288
+#: bfd.c:297
msgid "Bad value"
msgstr ""
-#: bfd.c:289
+#: bfd.c:298
msgid "File truncated"
msgstr ""
-#: bfd.c:290
+#: bfd.c:299
msgid "File too big"
msgstr ""
-#: bfd.c:291
+#: bfd.c:300
msgid "#<Invalid error code>"
msgstr ""
-#: bfd.c:675
+#: bfd.c:707
#, c-format
-msgid "bfd assertion fail %s:%d"
+msgid "BFD %s assertion fail %s:%d"
msgstr ""
-#: bfd.c:693
+#: bfd.c:726
#, c-format
-msgid "BFD internal error, aborting at %s line %d in %s\n"
+msgid "BFD %s internal error, aborting at %s line %d in %s\n"
msgstr ""
-#: bfd.c:697
+#: bfd.c:730
#, c-format
-msgid "BFD internal error, aborting at %s line %d\n"
+msgid "BFD %sinternal error, aborting at %s line %d\n"
msgstr ""
-#: bfd.c:699
+#: bfd.c:732
msgid "Please report this bug.\n"
msgstr ""
-#: binary.c:303
+#: binary.c:306
#, c-format
msgid "Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx."
msgstr ""
-#: coff-a29k.c:122
+#: coff-a29k.c:119
msgid "Missing IHCONST"
msgstr ""
-#: coff-a29k.c:181
+#: coff-a29k.c:180
msgid "Missing IHIHALF"
msgstr ""
-#: coff-a29k.c:213
+#: coff-a29k.c:212
msgid "Unrecognized reloc"
msgstr ""
-#: coff-a29k.c:425
+#: coff-a29k.c:408
msgid "missing IHCONST reloc"
msgstr ""
-#: coff-a29k.c:516
+#: coff-a29k.c:498
msgid "missing IHIHALF reloc"
msgstr ""
-#: coff-alpha.c:880 coff-alpha.c:917
+#: coff-alpha.c:881 coff-alpha.c:918
msgid "GP relative relocation used when GP not defined"
msgstr ""
-#: coff-alpha.c:1486 elf64-alpha.c:4004
+#: coff-alpha.c:1485
msgid "using multiple gp values"
msgstr ""
-#: coff-alpha.c:1992 coff-mips.c:1434
+#: coff-alpha.c:1989 coff-mips.c:1433
msgid "GP relative relocation when GP not defined"
msgstr ""
-#: coff-arm.c:1018 elf32-arm.h:246
+#: coff-arm.c:1051 elf32-arm.h:285
#, c-format
msgid "%s: unable to find THUMB glue '%s' for `%s'"
msgstr ""
-#: coff-arm.c:1047 elf32-arm.h:281
+#: coff-arm.c:1080 elf32-arm.h:320
#, c-format
msgid "%s: unable to find ARM glue '%s' for `%s'"
msgstr ""
-#: coff-arm.c:1335 coff-arm.c:1430 elf32-arm.h:841 elf32-arm.h:946
+#: coff-arm.c:1375 coff-arm.c:1470 elf32-arm.h:886 elf32-arm.h:990
#, c-format
msgid "%s(%s): warning: interworking not enabled."
msgstr ""
-#: coff-arm.c:1339 elf32-arm.h:949
+#: coff-arm.c:1379 elf32-arm.h:993
#, c-format
msgid " first occurrence: %s: arm call to thumb"
msgstr ""
-#: coff-arm.c:1434 elf32-arm.h:844
+#: coff-arm.c:1474 elf32-arm.h:889
#, c-format
msgid " first occurrence: %s: thumb call to arm"
msgstr ""
-#: coff-arm.c:1437
+#: coff-arm.c:1477
msgid " consider relinking with --support-old-code enabled"
msgstr ""
-#: coff-arm.c:1726 coff-tic80.c:682 cofflink.c:2991
+#: coff-arm.c:1767 coff-tic80.c:686 cofflink.c:3017
#, c-format
msgid "%s: bad reloc address 0x%lx in section `%s'"
msgstr ""
-#: coff-arm.c:2063
+#: coff-arm.c:2107
#, c-format
msgid "%s: illegal symbol index in reloc: %d"
msgstr ""
-#: coff-arm.c:2191
+#: coff-arm.c:2235
#, c-format
msgid "%s: ERROR: compiled for APCS-%d whereas target %s uses APCS-%d"
msgstr ""
-#: coff-arm.c:2206
+#: coff-arm.c:2250
#, c-format
msgid ""
"%s: ERROR: passes floats in float registers whereas target %s uses integer "
"registers"
msgstr ""
-#: coff-arm.c:2209
+#: coff-arm.c:2253
#, c-format
msgid ""
"%s: ERROR: passes floats in integer registers whereas target %s uses float "
"registers"
msgstr ""
-#: coff-arm.c:2224
+#: coff-arm.c:2268
#, c-format
msgid ""
"%s: ERROR: compiled as position independent code, whereas target %s is "
"absolute position"
msgstr ""
-#: coff-arm.c:2227
+#: coff-arm.c:2271
#, c-format
msgid ""
"%s: ERROR: compiled as absolute position code, whereas target %s is position "
"independent"
msgstr ""
-#: coff-arm.c:2256
+#: coff-arm.c:2300
#, c-format
msgid "Warning: input file %s supports interworking, whereas %s does not."
msgstr ""
-#: coff-arm.c:2259
+#: coff-arm.c:2303
#, c-format
msgid "Warning: input file %s does not support interworking, whereas %s does."
msgstr ""
-#: coff-arm.c:2286
+#: coff-arm.c:2330
#, c-format
msgid "private flags = %x:"
msgstr ""
-#: coff-arm.c:2294 elf32-arm.h:2210
+#: coff-arm.c:2338 elf32-arm.h:2408
msgid " [floats passed in float registers]"
msgstr ""
-#: coff-arm.c:2296
+#: coff-arm.c:2340
msgid " [floats passed in integer registers]"
msgstr ""
-#: coff-arm.c:2299 elf32-arm.h:2213
+#: coff-arm.c:2343 elf32-arm.h:2411
msgid " [position independent]"
msgstr ""
-#: coff-arm.c:2301
+#: coff-arm.c:2345
msgid " [absolute position]"
msgstr ""
-#: coff-arm.c:2305
+#: coff-arm.c:2349
msgid " [interworking flag not initialised]"
msgstr ""
-#: coff-arm.c:2307
+#: coff-arm.c:2351
msgid " [interworking supported]"
msgstr ""
-#: coff-arm.c:2309
+#: coff-arm.c:2353
msgid " [interworking not supported]"
msgstr ""
-#: coff-arm.c:2357
+#: coff-arm.c:2401
#, c-format
msgid ""
"Warning: Not setting interworking flag of %s, since it has already been "
"specified as non-interworking"
msgstr ""
-#: coff-arm.c:2361
+#: coff-arm.c:2405
#, c-format
msgid "Warning: Clearing the interworking flag of %s due to outside request"
msgstr ""
-#: coffcode.h:2136
-#, c-format
-msgid "Unrecognized TI COFF target id '0x%x'"
+#: coff-i960.c:136 coff-i960.c:485
+msgid "uncertain calling convention for non-COFF symbol"
+msgstr ""
+
+#: coff-m68k.c:481 coff-mips.c:2431 elf32-m68k.c:2212
+msgid "unsupported reloc type"
+msgstr ""
+
+#: coff-mips.c:875 elf32-mips.c:1987 elf64-mips.c:1739
+msgid "GP relative relocation when _gp not defined"
+msgstr ""
+
+#. No other sections should appear in -membedded-pic
+#. code.
+#: coff-mips.c:2468
+msgid "reloc against unsupported section"
msgstr ""
-#: coffcode.h:4194
+#: coff-mips.c:2476
+msgid "reloc not properly aligned"
+msgstr ""
+
+#: coff-rs6000.c:2710 coff64-rs6000.c:1164
#, c-format
-msgid "%s: warning: illegal symbol index %ld in line numbers"
+msgid "%s: unsupported relocation type 0x%02x"
msgstr ""
-#: coffcode.h:4208
+#: coff-rs6000.c:2756 coff64-rs6000.c:1210
#, c-format
-msgid "%s: warning: duplicate line number information for `%s'"
+msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry"
msgstr ""
-#: coffcode.h:4568
+#: coff-rs6000.c:3006 coff64-rs6000.c:2060
#, c-format
-msgid "%s: Unrecognized storage class %d for %s symbol `%s'"
+msgid "%s: symbol `%s' has unrecognized smclas %d"
msgstr ""
-#: coffcode.h:4699
+#: coff-tic54x.c:279 coff-tic80.c:449
#, c-format
-msgid "warning: %s: local symbol `%s' has no section"
+msgid "Unrecognized reloc type 0x%x"
msgstr ""
-#: coff-tic54x.c:376 coffcode.h:4810
+#: coff-tic54x.c:390 coffcode.h:4847
#, c-format
msgid "%s: warning: illegal symbol index %ld in relocs"
msgstr ""
-#: coffcode.h:4848
+#: coff-w65.c:363
#, c-format
-msgid "%s: illegal relocation type %d at address 0x%lx"
+msgid "ignoring reloc %s\n"
msgstr ""
-#: coffgen.c:1631
+#: coffcode.h:1081
#, c-format
-msgid "%s: bad string table size %lu"
+msgid "%s (%s): Section flag %s (0x%x) ignored"
msgstr ""
-#: coffgen.c:2093
+#: coffcode.h:2125
#, c-format
-msgid "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld"
+msgid "Unrecognized TI COFF target id '0x%x'"
msgstr ""
-#: coff-i960.c:136 coff-i960.c:485
-msgid "uncertain calling convention for non-COFF symbol"
+#: coffcode.h:4236
+#, c-format
+msgid "%s: warning: illegal symbol index %ld in line numbers"
msgstr ""
-#: cofflink.c:526 elflink.h:1648
+#: coffcode.h:4250
#, c-format
-msgid "Warning: type of symbol `%s' changed from %d to %d in %s"
+msgid "%s: warning: duplicate line number information for `%s'"
msgstr ""
-#: cofflink.c:2289
+#: coffcode.h:4609
#, c-format
-msgid "%s: relocs in section `%s', but it has no contents"
+msgid "%s: Unrecognized storage class %d for %s symbol `%s'"
msgstr ""
-#: cofflink.c:2628 coffswap.h:894
+#: coffcode.h:4740
#, c-format
-msgid "%s: %s: reloc overflow: 0x%lx > 0xffff"
+msgid "warning: %s: local symbol `%s' has no section"
msgstr ""
-#: cofflink.c:2637 coffswap.h:880
+#: coffcode.h:4885
#, c-format
-msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff"
+msgid "%s: illegal relocation type %d at address 0x%lx"
msgstr ""
-#: coff-m68k.c:475 coff-mips.c:2432 elf32-m68k.c:2265
-msgid "unsupported reloc type"
+#: coffgen.c:1661
+#, c-format
+msgid "%s: bad string table size %lu"
msgstr ""
-#: coff-mips.c:875 elf32-mips.c:1417
-msgid "GP relative relocation when _gp not defined"
+#: coffgen.c:2138
+#, c-format
+msgid "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld"
msgstr ""
-#. No other sections should appear in -membedded-pic
-#. code.
-#: coff-mips.c:2469
-msgid "reloc against unsupported section"
+#: cofflink.c:536 elflink.h:1967
+#, c-format
+msgid "Warning: type of symbol `%s' changed from %d to %d in %s"
msgstr ""
-#: coff-mips.c:2477
-msgid "reloc not properly aligned"
+#: cofflink.c:2317
+#, c-format
+msgid "%s: relocs in section `%s', but it has no contents"
msgstr ""
-#: coff-tic54x.c:263 coff-tic80.c:445
+#: cofflink.c:2653 coffswap.h:889
#, c-format
-msgid "Unrecognized reloc type 0x%x"
+msgid "%s: %s: reloc overflow: 0x%lx > 0xffff"
msgstr ""
-#: coff-w65.c:369
+#: cofflink.c:2662 coffswap.h:876
#, c-format
-msgid "ignoring reloc %s\n"
+msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff"
+msgstr ""
+
+#: dwarf2.c:381
+msgid "Dwarf Error: Can't find .debug_str section."
+msgstr ""
+
+#: dwarf2.c:398
+#, c-format
+msgid ""
+"Dwarf Error: DW_FORM_strp offset (%u) greater than or equal to .debug_str "
+"size (%u)."
msgstr ""
-#: dwarf2.c:423
+#: dwarf2.c:542
msgid "Dwarf Error: Can't find .debug_abbrev section."
msgstr ""
-#: dwarf2.c:441
+#: dwarf2.c:559
#, c-format
-msgid "Dwarf Error: Abbrev offset (%u) bigger than abbrev size (%u)."
+msgid ""
+"Dwarf Error: Abbrev offset (%u) greater than or equal to abbrev size (%u)."
msgstr ""
-#: dwarf2.c:624
+#: dwarf2.c:756
#, c-format
msgid "Dwarf Error: Invalid or unhandled FORM value: %d."
msgstr ""
-#: dwarf2.c:697
+#: dwarf2.c:843
msgid "Dwarf Error: mangled line number section (bad file number)."
msgstr ""
-#: dwarf2.c:782
+#: dwarf2.c:929
msgid "Dwarf Error: Can't find .debug_line section."
msgstr ""
-#: dwarf2.c:806
+#: dwarf2.c:952
#, c-format
-msgid "Dwarf Error: Line offset (%u) bigger than line size (%u)."
+msgid "Dwarf Error: Line offset (%u) greater than or equal to line size (%u)."
msgstr ""
-#: dwarf2.c:973
+#: dwarf2.c:1143
msgid "Dwarf Error: mangled line number section."
msgstr ""
-#: dwarf2.c:1152 dwarf2.c:1306
+#: dwarf2.c:1318 dwarf2.c:1532
#, c-format
msgid "Dwarf Error: Could not find abbrev number %d."
msgstr ""
-#: dwarf2.c:1267
+#: dwarf2.c:1493
#, c-format
msgid ""
"Dwarf Error: found dwarf version '%hu', this reader only handles version 2 "
"information."
msgstr ""
-#: dwarf2.c:1274
+#: dwarf2.c:1500
#, c-format
msgid ""
"Dwarf Error: found address size '%u', this reader can not handle sizes "
"greater than '%u'."
msgstr ""
-#: dwarf2.c:1297
+#: dwarf2.c:1523
#, c-format
msgid "Dwarf Error: Bad abbrev number: %d."
msgstr ""
-#: ecoff.c:1323
+#: ecoff.c:1328
#, c-format
msgid "Unknown basic type %d"
msgstr ""
-#: ecoff.c:1592
+#: ecoff.c:1597
#, c-format
msgid ""
"\n"
" End+1 symbol: %ld"
msgstr ""
-#: ecoff.c:1599 ecoff.c:1602
+#: ecoff.c:1604 ecoff.c:1607
#, c-format
msgid ""
"\n"
" First symbol: %ld"
msgstr ""
-#: ecoff.c:1614
+#: ecoff.c:1619
#, c-format
msgid ""
"\n"
" End+1 symbol: %-7ld Type: %s"
msgstr ""
-#: ecoff.c:1621
+#: ecoff.c:1626
#, c-format
msgid ""
"\n"
" Local symbol: %ld"
msgstr ""
-#: ecoff.c:1629
+#: ecoff.c:1634
#, c-format
msgid ""
"\n"
" struct; End+1 symbol: %ld"
msgstr ""
-#: ecoff.c:1634
+#: ecoff.c:1639
#, c-format
msgid ""
"\n"
" union; End+1 symbol: %ld"
msgstr ""
-#: ecoff.c:1639
+#: ecoff.c:1644
#, c-format
msgid ""
"\n"
" enum; End+1 symbol: %ld"
msgstr ""
-#: ecoff.c:1645
+#: ecoff.c:1650
#, c-format
msgid ""
"\n"
" Type: %s"
msgstr ""
-#: elf32-arm.h:1179
+#: elf-hppa.h:1366 elf-hppa.h:1399 elf32-ppc.c:3062 elf32-sh.c:3201
+#: elf64-x86-64.c:1275
#, c-format
-msgid "%s: Warning: Arm BLX instruction targets Arm function '%s'."
+msgid ""
+"%s: warning: unresolvable relocation against symbol `%s' from %s section"
+msgstr ""
+
+#: elf-m10200.c:463 elf-m10300.c:673 elf32-arm.h:2074 elf32-avr.c:835
+#: elf32-cris.c:1392 elf32-d10v.c:482 elf32-fr30.c:653 elf32-h8300.c:547
+#: elf32-i860.c:1048 elf32-m32r.c:1281 elf32-openrisc.c:455 elf32-v850.c:1691
+#: elf64-mmix.c:1164
+msgid "internal error: out of range error"
+msgstr ""
+
+#: elf-m10200.c:467 elf-m10300.c:677 elf32-arm.h:2078 elf32-avr.c:839
+#: elf32-cris.c:1396 elf32-d10v.c:486 elf32-fr30.c:657 elf32-h8300.c:551
+#: elf32-i860.c:1052 elf32-m32r.c:1285 elf32-mips.c:7565 elf32-openrisc.c:459
+#: elf32-v850.c:1695 elf64-mips.c:4464 elf64-mmix.c:1168
+msgid "internal error: unsupported relocation error"
msgstr ""
-#: elf32-arm.h:1375
+#: elf-m10200.c:471 elf-m10300.c:681 elf32-arm.h:2082 elf32-d10v.c:490
+#: elf32-h8300.c:555 elf32-m32r.c:1289
+msgid "internal error: dangerous error"
+msgstr ""
+
+#: elf-m10200.c:475 elf-m10300.c:685 elf32-arm.h:2086 elf32-avr.c:847
+#: elf32-cris.c:1404 elf32-d10v.c:494 elf32-fr30.c:665 elf32-h8300.c:559
+#: elf32-i860.c:1060 elf32-m32r.c:1293 elf32-openrisc.c:467 elf32-v850.c:1715
+#: elf64-mmix.c:1176
+msgid "internal error: unknown error"
+msgstr ""
+
+#: elf.c:345
#, c-format
-msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'."
+msgid "%s: invalid string offset %u >= %lu for section `%s'"
+msgstr ""
+
+#: elf.c:450
+#, c-format
+msgid "%s: invalid SHT_GROUP entry"
msgstr ""
-#: elf-hppa.h:1369 elf-hppa.h:1402 elf32-arm.h:1853 elf32-i386.c:1428
-#: elf32-ppc.c:3096 elf32-sh.c:2997 elf64-x86-64.c:271
+#: elf.c:531
#, c-format
+msgid "%s: no group info for section %s"
+msgstr ""
+
+#: elf.c:842
msgid ""
-"%s: warning: unresolvable relocation against symbol `%s' from %s section"
+"\n"
+"Program Header:\n"
msgstr ""
-#: elf-m10200.c:455 elf-m10300.c:669 elf32-arm.h:1927 elf32-avr.c:842
-#: elf32-cris.c:431 elf32-d10v.c:478 elf32-fr30.c:651 elf32-i860.c:1051
-#: elf32-m32r.c:1265 elf32-v850.c:1672
-msgid "internal error: out of range error"
+#: elf.c:891
+msgid ""
+"\n"
+"Dynamic Section:\n"
msgstr ""
-#: elf-m10200.c:459 elf-m10300.c:673 elf32-arm.h:1931 elf32-avr.c:846
-#: elf32-cris.c:435 elf32-d10v.c:482 elf32-fr30.c:655 elf32-i860.c:1055
-#: elf32-m32r.c:1269 elf32-v850.c:1676
-msgid "internal error: unsupported relocation error"
+#: elf.c:1020
+msgid ""
+"\n"
+"Version definitions:\n"
msgstr ""
-#: elf-m10200.c:463 elf-m10300.c:677 elf32-arm.h:1935 elf32-d10v.c:486
-#: elf32-m32r.c:1273
-msgid "internal error: dangerous error"
+#: elf.c:1043
+msgid ""
+"\n"
+"Version References:\n"
msgstr ""
-#: elf-m10200.c:467 elf-m10300.c:681 elf32-arm.h:1939 elf32-avr.c:854
-#: elf32-cris.c:443 elf32-d10v.c:490 elf32-fr30.c:663 elf32-i860.c:1063
-#: elf32-m32r.c:1277 elf32-v850.c:1696
-msgid "internal error: unknown error"
+#: elf.c:1048
+#, c-format
+msgid " required from %s:\n"
+msgstr ""
+
+#: elf.c:1675
+#, c-format
+msgid "%s: invalid link %lu for reloc section %s (index %u)"
+msgstr ""
+
+#: elf.c:3289
+#, c-format
+msgid "%s: Not enough room for program headers (allocated %u, need %u)"
msgstr ""
-#: elf32-arm.h:1967
+#: elf.c:3393
+#, c-format
+msgid "%s: Not enough room for program headers, try linking with -N"
+msgstr ""
+
+#: elf.c:3518
#, c-format
msgid ""
-"Warning: Not setting interwork flag of %s since it has already been "
-"specified as non-interworking"
+"Error: First section in segment (%s) starts at 0x%x whereas the segment "
+"starts at 0x%x"
msgstr ""
-#: elf32-arm.h:1971
+#: elf.c:3804
#, c-format
-msgid "Warning: Clearing the interwork flag of %s due to outside request"
+msgid "%s: warning: allocated section `%s' not in segment"
msgstr ""
-#: elf32-arm.h:2019
+#: elf.c:4138
+#, c-format
+msgid "%s: symbol `%s' required but not present"
+msgstr ""
+
+#: elf.c:4147
#, c-format
msgid ""
-"Warning: Clearing the interwork flag in %s because non-interworking code in "
-"%s has been linked with it"
+"elf_symbol_from_bfd_symbol 0x%.8lx, name = %s, sym num = %d, flags = 0x%.8lx%"
+"s\n"
+msgstr ""
+
+#: elf.c:4391
+#, c-format
+msgid "%s: warning: Empty loadable segment detected\n"
+msgstr ""
+
+#: elf.c:5804
+#, c-format
+msgid "%s: unsupported relocation type %s"
+msgstr ""
+
+#: elf32-arm.h:1224
+#, c-format
+msgid "%s: Warning: Arm BLX instruction targets Arm function '%s'."
msgstr ""
-#: elf32-arm.h:2113
+#: elf32-arm.h:1420
+#, c-format
+msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'."
+msgstr ""
+
+#: elf32-arm.h:1904 elf32-i386.c:1776 elf32-sh.c:3133
+#, c-format
+msgid "%s(%s+0x%lx): %s relocation against SEC_MERGE section"
+msgstr ""
+
+#: elf32-arm.h:1998
#, c-format
msgid ""
-"Error: %s compiled for EABI version %d, whereas %s is compiled for version %d"
+"%s: warning: unresolvable relocation %d against symbol `%s' from %s section"
msgstr ""
-#: elf32-arm.h:2127
+#: elf32-arm.h:2114
#, c-format
-msgid "Error: %s compiled for APCS-%d, whereas %s is compiled for APCS-%d"
+msgid ""
+"Warning: Not setting interwork flag of %s since it has already been "
+"specified as non-interworking"
msgstr ""
-#: elf32-arm.h:2138
+#: elf32-arm.h:2118
+#, c-format
+msgid "Warning: Clearing the interwork flag of %s due to outside request"
+msgstr ""
+
+#: elf32-arm.h:2166
#, c-format
msgid ""
-"Error: %s passes floats in %s registers, whereas %s passes them in %s "
-"registers"
+"Warning: Clearing the interwork flag in %s because non-interworking code in %"
+"s has been linked with it"
msgstr ""
-#: elf32-arm.h:2141 elf32-arm.h:2143
-msgid "float"
+#: elf32-arm.h:2261
+#, c-format
+msgid ""
+"Error: %s compiled for EABI version %d, whereas %s is compiled for version %d"
msgstr ""
-#: elf32-arm.h:2141 elf32-arm.h:2143
-msgid "integer"
+#: elf32-arm.h:2275
+#, c-format
+msgid "Error: %s compiled for APCS-%d, whereas %s is compiled for APCS-%d"
msgstr ""
-#: elf32-arm.h:2150
+#: elf32-arm.h:2287
#, c-format
-msgid "Error: %s uses %s floating point, whereas %s uses %s floating point"
+msgid ""
+"Error: %s passes floats in FP registers, whereas %s passes them in integer "
+"registers"
msgstr ""
-#: elf32-arm.h:2153 elf32-arm.h:2155
-msgid "soft"
+#: elf32-arm.h:2292
+#, c-format
+msgid ""
+"Error: %s passes floats in integer registers, whereas %s passes them in FP "
+"registers"
msgstr ""
-#: elf32-arm.h:2153 elf32-arm.h:2155
-msgid "hard"
+#: elf32-arm.h:2303
+#, c-format
+msgid "Error: %s uses VFP instructions, whereas %s FPA instructions"
msgstr ""
-#: elf32-arm.h:2162
+#: elf32-arm.h:2308
#, c-format
-msgid "Warning: %s %s interworking, whereas %s %s"
+msgid "Error: %s uses FPA instructions, whereas %s VFP instructions"
msgstr ""
-#: elf32-arm.h:2165
-msgid "supports"
+#: elf32-arm.h:2328
+#, c-format
+msgid "Error: %s uses software FP, whereas %s uses hardware FP"
msgstr ""
-#: elf32-arm.h:2165
-msgid "does not support"
+#: elf32-arm.h:2333
+#, c-format
+msgid "Error: %s uses hardware FP, whereas %s uses software FP"
msgstr ""
-#: elf32-arm.h:2167
-msgid "does not"
+#: elf32-arm.h:2348
+#, c-format
+msgid "Warning: %s supports interworking, whereas %s does not"
msgstr ""
-#: elf32-arm.h:2167
-msgid "does"
+#: elf32-arm.h:2355
+#, c-format
+msgid "Warning: %s does not support interworking, whereas %s does"
msgstr ""
#. Ignore init flag - it may not be set, despite the flags field
#. containing valid data.
-#: elf32-arm.h:2193 elf32-cris.c:615 elf32-m68k.c:430 elf32-mips.c:2695
+#: elf32-arm.h:2386 elf32-cris.c:2970 elf32-m68k.c:410 elf32-mips.c:3232
#, c-format
msgid "private flags = %lx:"
msgstr ""
-#: elf32-arm.h:2202
+#: elf32-arm.h:2395
msgid " [interworking enabled]"
msgstr ""
-#: elf32-arm.h:2205
+#: elf32-arm.h:2398
msgid " [APCS-26]"
msgstr ""
-#: elf32-arm.h:2207
+#: elf32-arm.h:2400
msgid " [APCS-32]"
msgstr ""
-#: elf32-arm.h:2216
+#: elf32-arm.h:2403
+msgid " [VFP float format]"
+msgstr ""
+
+#: elf32-arm.h:2405
+msgid " [FPA float format]"
+msgstr ""
+
+#: elf32-arm.h:2414
msgid " [new ABI]"
msgstr ""
-#: elf32-arm.h:2219
+#: elf32-arm.h:2417
msgid " [old ABI]"
msgstr ""
-#: elf32-arm.h:2222
+#: elf32-arm.h:2420
msgid " [software FP]"
msgstr ""
-#: elf32-arm.h:2229
+#: elf32-arm.h:2428
msgid " [Version1 EABI]"
msgstr ""
-#: elf32-arm.h:2232
+#: elf32-arm.h:2431 elf32-arm.h:2442
msgid " [sorted symbol table]"
msgstr ""
-#: elf32-arm.h:2234
+#: elf32-arm.h:2433 elf32-arm.h:2444
msgid " [unsorted symbol table]"
msgstr ""
-#: elf32-arm.h:2240
+#: elf32-arm.h:2439
+msgid " [Version2 EABI]"
+msgstr ""
+
+#: elf32-arm.h:2447
+msgid " [dynamic symbols use segment index]"
+msgstr ""
+
+#: elf32-arm.h:2450
+msgid " [mapping symbols precede others]"
+msgstr ""
+
+#: elf32-arm.h:2457
msgid " <EABI version unrecognised>"
msgstr ""
-#: elf32-arm.h:2247
+#: elf32-arm.h:2464
msgid " [relocatable executable]"
msgstr ""
-#: elf32-arm.h:2250
+#: elf32-arm.h:2467
msgid " [has entry point]"
msgstr ""
-#: elf32-arm.h:2255
+#: elf32-arm.h:2472
msgid "<Unrecognised flag bits set>"
msgstr ""
-#: elf32-avr.c:850 elf32-cris.c:439 elf32-fr30.c:659 elf32-i860.c:1059
-#: elf32-v850.c:1680
+#: elf32-avr.c:843 elf32-cris.c:1400 elf32-fr30.c:661 elf32-i860.c:1056
+#: elf32-openrisc.c:463 elf32-v850.c:1699 elf64-mmix.c:1172
msgid "internal error: dangerous relocation"
msgstr ""
-#: elf32-cris.c:618
-msgid " [symbols have a _ prefix]"
+#: elf32-cris.c:949
+#, c-format
+msgid "%s: unresolvable relocation %s against symbol `%s' from %s section"
msgstr ""
-#: elf32-cris.c:657
+#: elf32-cris.c:1012
#, c-format
-msgid "%s: uses _-prefixed symbols, but writing file with non-prefixed symbols"
+msgid ""
+"%s: No PLT nor GOT for relocation %s against symbol `%s' from %s section"
+msgstr ""
+
+#: elf32-cris.c:1015 elf32-cris.c:1142
+msgid "[whose name is lost]"
msgstr ""
-#: elf32-cris.c:658
+#: elf32-cris.c:1131
#, c-format
-msgid "%s: uses non-prefixed symbols, but writing file with _-prefixed symbols"
+msgid ""
+"%s: relocation %s with non-zero addend %d against local symbol from %s "
+"section"
+msgstr ""
+
+#: elf32-cris.c:1138
+#, c-format
+msgid ""
+"%s: relocation %s with non-zero addend %d against symbol `%s' from %s section"
msgstr ""
-#: elf32-hppa.c:606
+#: elf32-cris.c:1156
#, c-format
-msgid "%s(%s+0x%lx): cannot find stub entry %s"
+msgid ""
+"%s: relocation %s is not allowed for global symbol: `%s' from %s section"
msgstr ""
-#: elf32-hppa.c:667
+#: elf32-cris.c:1275
#, c-format
-msgid "%s: cannot create stub entry %s"
+msgid "%s: Internal inconsistency; no relocation section %s"
msgstr ""
-#: elf32-hppa.c:859
+#: elf32-cris.c:2508
#, c-format
-msgid "%s(%s+0x%lx): cannot relocate %s, recompile with -ffunction-sections"
+msgid ""
+"%s, section %s:\n"
+" relocation %s should not be used in a shared object; recompile with -fPIC"
msgstr ""
-#: elf32-hppa.c:872 elf32-hppa.c:1568
+#: elf32-cris.c:2973
+msgid " [symbols have a _ prefix]"
+msgstr ""
+
+#: elf32-cris.c:3012
#, c-format
-msgid "Could not find relocation section for %s"
+msgid "%s: uses _-prefixed symbols, but writing file with non-prefixed symbols"
+msgstr ""
+
+#: elf32-cris.c:3013
+#, c-format
+msgid "%s: uses non-prefixed symbols, but writing file with _-prefixed symbols"
msgstr ""
-#: elf32-hppa.c:1011 elf32-hppa.c:3362
+#: elf32-gen.c:82 elf64-gen.c:82
+#, c-format
+msgid "%s: Relocations in generic ELF (EM: %d)"
+msgstr ""
+
+#: elf32-hppa.c:646
+#, c-format
+msgid "%s: cannot create stub entry %s"
+msgstr ""
+
+#: elf32-hppa.c:937 elf32-hppa.c:3540
#, c-format
msgid "%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections"
msgstr ""
-#: elf32-hppa.c:1323
+#: elf32-hppa.c:1312
#, c-format
msgid ""
"%s: relocation %s can not be used when making a shared object; recompile "
"with -fPIC"
msgstr ""
-#: elf32-hppa.c:1343
+#: elf32-hppa.c:1332
#, c-format
msgid ""
"%s: relocation %s should not be used when making a shared object; recompile "
"with -fPIC"
msgstr ""
-#: elf32-hppa.c:2755
+#: elf32-hppa.c:1525
+#, c-format
+msgid "Could not find relocation section for %s"
+msgstr ""
+
+#: elf32-hppa.c:2862
#, c-format
msgid "%s: duplicate export stub %s"
msgstr ""
-#: elf32-hppa.c:3253
+#: elf32-hppa.c:3424
#, c-format
msgid "%s(%s+0x%lx): fixing %s"
msgstr ""
-#: elf32-hppa.c:3856
+#: elf32-hppa.c:4064
#, c-format
msgid "%s(%s+0x%lx): cannot handle %s for %s"
msgstr ""
-#: elf32-hppa.c:4173
+#: elf32-hppa.c:4403
msgid ".got section not immediately after .plt section"
msgstr ""
-#: elf32-i386.c:273
+#: elf32-i386.c:298
#, c-format
msgid "%s: invalid relocation type %d"
msgstr ""
-#: elf32-m32r.c:916
+#: elf32-i386.c:718 elf32-s390.c:636 elf64-s390.c:595
+#, c-format
+msgid "%s: bad symbol index: %d"
+msgstr ""
+
+#: elf32-i386.c:863 elf32-s390.c:790 elf64-ppc.c:2085 elf64-s390.c:759
+#, c-format
+msgid "%s: bad relocation section name `%s'"
+msgstr ""
+
+#: elf32-i386.c:2067 elf32-s390.c:1949 elf64-ppc.c:3908 elf64-s390.c:1953
+#, c-format
+msgid "%s(%s+0x%lx): unresolvable relocation against symbol `%s'"
+msgstr ""
+
+#: elf32-i386.c:2105 elf32-s390.c:1987 elf64-s390.c:1991
+#, c-format
+msgid "%s(%s+0x%lx): reloc against `%s': error %d"
+msgstr ""
+
+#: elf32-m32r.c:924
msgid "SDA relocation when _SDA_BASE_ not defined"
msgstr ""
-#: elf32-m32r.c:1000 elf32-ppc.c:2963
+#: elf32-ia64.c:3538 elf32-m32r.c:1008 elf32-ppc.c:2930 elf64-ia64.c:3538
#, c-format
msgid "%s: unknown relocation type %d"
msgstr ""
-#: elf32-m32r.c:1208
+#: elf32-m32r.c:1224
#, c-format
msgid "%s: The target (%s) of an %s relocation is in the wrong section (%s)"
msgstr ""
-#: elf32-m32r.c:2010
+#: elf32-m32r.c:2001
#, c-format
msgid "%s: Instruction set mismatch with previous modules"
msgstr ""
-#: elf32-m32r.c:2033
+#: elf32-m32r.c:2024
#, c-format
msgid "private flags = %lx"
msgstr ""
-#: elf32-m32r.c:2038
+#: elf32-m32r.c:2029
msgid ": m32r instructions"
msgstr ""
-#: elf32-m32r.c:2039
+#: elf32-m32r.c:2030
msgid ": m32rx instructions"
msgstr ""
-#: elf32-m68k.c:433
+#: elf32-m68k.c:413
msgid " [cpu32]"
msgstr ""
-#: elf32-mcore.c:366 elf32-mcore.c:493
+#: elf32-mcore.c:353 elf32-mcore.c:479
#, c-format
msgid "%s: Relocation %s (%d) is not currently supported.\n"
msgstr ""
-#: elf32-mcore.c:452
+#: elf32-mcore.c:438
#, c-format
msgid "%s: Unknown relocation type %d\n"
msgstr ""
-#: elf32-mips.c:1576
+#: elf32-mips.c:2146 elf64-mips.c:1972
msgid "32bits gp relative relocation occurs for an external symbol"
msgstr ""
-#: elf32-mips.c:1725
+#: elf32-mips.c:2295
#, c-format
msgid "Linking mips16 objects into %s format is not supported"
msgstr ""
-#: elf32-mips.c:2582
+#: elf32-mips.c:3119
#, c-format
msgid "%s: linking PIC files with non-PIC files"
msgstr ""
-#: elf32-mips.c:2592
+#: elf32-mips.c:3129
#, c-format
msgid "%s: linking abicalls files with non-abicalls files"
msgstr ""
-#: elf32-mips.c:2621
+#: elf32-mips.c:3158
#, c-format
msgid "%s: ISA mismatch (-mips%d) with previous modules (-mips%d)"
msgstr ""
-#: elf32-mips.c:2630
+#: elf32-mips.c:3167
#, c-format
msgid "%s: ISA mismatch (%d) with previous modules (%d)"
msgstr ""
-#: elf32-mips.c:2653
+#: elf32-mips.c:3190
#, c-format
msgid "%s: ABI mismatch: linking %s module with previous %s modules"
msgstr ""
-#: elf32-mips.c:2667 elf32-ppc.c:1477 elf64-sparc.c:2971
+#: elf32-mips.c:3204 elf32-ppc.c:1470 elf64-ppc.c:1538 elf64-sparc.c:3033
#, c-format
msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"
msgstr ""
-#: elf32-mips.c:2698
+#: elf32-mips.c:3235
msgid " [abi=O32]"
msgstr ""
-#: elf32-mips.c:2700
+#: elf32-mips.c:3237
msgid " [abi=O64]"
msgstr ""
-#: elf32-mips.c:2702
+#: elf32-mips.c:3239
msgid " [abi=EABI32]"
msgstr ""
-#: elf32-mips.c:2704
+#: elf32-mips.c:3241
msgid " [abi=EABI64]"
msgstr ""
-#: elf32-mips.c:2706
+#: elf32-mips.c:3243
msgid " [abi unknown]"
msgstr ""
-#: elf32-mips.c:2708
+#: elf32-mips.c:3245
msgid " [abi=N32]"
msgstr ""
-#: elf32-mips.c:2710
+#: elf32-mips.c:3247
msgid " [abi=64]"
msgstr ""
-#: elf32-mips.c:2712
+#: elf32-mips.c:3249
msgid " [no abi set]"
msgstr ""
-#: elf32-mips.c:2715
+#: elf32-mips.c:3252
msgid " [mips1]"
msgstr ""
-#: elf32-mips.c:2717
+#: elf32-mips.c:3254
msgid " [mips2]"
msgstr ""
-#: elf32-mips.c:2719
+#: elf32-mips.c:3256
msgid " [mips3]"
msgstr ""
-#: elf32-mips.c:2721
+#: elf32-mips.c:3258
msgid " [mips4]"
msgstr ""
-#: elf32-mips.c:2723
+#: elf32-mips.c:3260
msgid " [mips5]"
msgstr ""
-#: elf32-mips.c:2725
+#: elf32-mips.c:3262
msgid " [mips32]"
msgstr ""
-#: elf32-mips.c:2727
+#: elf32-mips.c:3264
msgid " [mips64]"
msgstr ""
-#: elf32-mips.c:2729
+#: elf32-mips.c:3266
msgid " [unknown ISA]"
msgstr ""
-#: elf32-mips.c:2732
+#: elf32-mips.c:3269
msgid " [32bitmode]"
msgstr ""
-#: elf32-mips.c:2734
+#: elf32-mips.c:3271
msgid " [not 32bitmode]"
msgstr ""
-#: elf32-mips.c:4388
+#: elf32-mips.c:4947
msgid "static procedure (no name)"
msgstr ""
-#: elf32-mips.c:5005 elf64-alpha.c:4377
+#: elf32-mips.c:5565 elf64-mips.c:6694
#, c-format
msgid "%s: illegal section name `%s'"
msgstr ""
-#: elf32-mips.c:5570
+#: elf32-mips.c:6132 elf64-mips.c:3150
msgid "not enough GOT space for local GOT entries"
msgstr ""
-#: elf32-mips.c:6686
+#: elf32-mips.c:7238 elf64-mips.c:4203
#, c-format
msgid "%s: %s+0x%lx: jump to stub routine which is not jal"
msgstr ""
-#: elf32-mips.c:7673
+#: elf32-mips.c:8237 elf64-mips.c:5891
#, c-format
-msgid "Malformed reloc detected for section %s"
+msgid "%s: Malformed reloc detected for section %s"
msgstr ""
-#: elf32-mips.c:7750
+#: elf32-mips.c:8315 elf64-mips.c:5969
#, c-format
msgid "%s: CALL16 reloc at 0x%lx not against global symbol"
msgstr ""
-#: elf32-ppc.c:1443
+#: elf32-ppc.c:1436 elf64-ppc.c:1503
#, c-format
msgid ""
"%s: compiled with -mrelocatable and linked with modules compiled normally"
msgstr ""
-#: elf32-ppc.c:1451
+#: elf32-ppc.c:1444 elf64-ppc.c:1511
#, c-format
msgid ""
"%s: compiled normally and linked with modules compiled with -mrelocatable"
msgstr ""
-#: elf32-ppc.c:1578
+#: elf32-ppc.c:1568
#, c-format
msgid "%s: Unknown special linker type %d"
msgstr ""
-#: elf32-ppc.c:2245 elf32-ppc.c:2279 elf32-ppc.c:2314
+#: elf32-ppc.c:2218 elf32-ppc.c:2252 elf32-ppc.c:2287
#, c-format
msgid "%s: relocation %s cannot be used when making a shared object"
msgstr ""
-#: elf32-ppc.c:3129
+#: elf32-ppc.c:3097 elf64-ppc.c:3500
#, c-format
msgid "%s: unknown relocation type %d for symbol %s"
msgstr ""
-#: elf32-ppc.c:3493 elf32-ppc.c:3514 elf32-ppc.c:3564
+#: elf32-ppc.c:3452 elf32-ppc.c:3473 elf32-ppc.c:3523
#, c-format
msgid ""
"%s: The target (%s) of a %s relocation is in the wrong output section (%s)"
msgstr ""
-#: elf32-ppc.c:3630
+#: elf32-ppc.c:3589
#, c-format
msgid "%s: Relocation %s is not yet supported for symbol %s."
msgstr ""
-#: elf32-sh.c:1084
+#: elf32-sh.c:1101
#, c-format
msgid "%s: 0x%lx: warning: bad R_SH_USES offset"
msgstr ""
-#: elf32-sh.c:1096
+#: elf32-sh.c:1113
#, c-format
msgid "%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x"
msgstr ""
-#: elf32-sh.c:1113
+#: elf32-sh.c:1130
#, c-format
msgid "%s: 0x%lx: warning: bad R_SH_USES load offset"
msgstr ""
-#: elf32-sh.c:1128
+#: elf32-sh.c:1145
#, c-format
msgid "%s: 0x%lx: warning: could not find expected reloc"
msgstr ""
-#: elf32-sh.c:1165
+#: elf32-sh.c:1202
#, c-format
msgid "%s: 0x%lx: warning: symbol in unexpected section"
msgstr ""
-#: elf32-sh.c:1287
+#: elf32-sh.c:1323
#, c-format
msgid "%s: 0x%lx: warning: could not find expected COUNT reloc"
msgstr ""
-#: elf32-sh.c:1296
+#: elf32-sh.c:1332
#, c-format
msgid "%s: 0x%lx: warning: bad count"
msgstr ""
-#: elf32-sh.c:1689 elf32-sh.c:2076
+#: elf32-sh.c:1741 elf32-sh.c:2132
#, c-format
msgid "%s: 0x%lx: fatal: reloc overflow while relaxing"
msgstr ""
-#: elf32-sparc.c:1512 elf64-sparc.c:2262
+#: elf32-sh.c:3267
+#, c-format
+msgid "%s: 0x%lx: fatal: unaligned branch target for relax-support relocation"
+msgstr ""
+
+#: elf32-sparc.c:1554 elf64-sparc.c:2286
#, c-format
msgid "%s: probably compiled without -fPIC?"
msgstr ""
-#: elf32-sparc.c:1962
+#: elf32-sparc.c:2007
#, c-format
msgid "%s: compiled for a 64 bit system and target is 32 bit"
msgstr ""
-#: elf32-sparc.c:1976
+#: elf32-sparc.c:2021
#, c-format
msgid "%s: linking little endian files with big endian files"
msgstr ""
-#: elf32-v850.c:677
+#: elf32-v850.c:682
#, c-format
msgid "Variable `%s' cannot occupy in multiple small data regions"
msgstr ""
-#: elf32-v850.c:680
+#: elf32-v850.c:685
#, c-format
msgid ""
"Variable `%s' can only be in one of the small, zero, and tiny data regions"
msgstr ""
-#: elf32-v850.c:683
+#: elf32-v850.c:688
#, c-format
msgid ""
"Variable `%s' cannot be in both small and zero data regions simultaneously"
msgstr ""
-#: elf32-v850.c:686
+#: elf32-v850.c:691
#, c-format
msgid ""
"Variable `%s' cannot be in both small and tiny data regions simultaneously"
msgstr ""
-#: elf32-v850.c:689
+#: elf32-v850.c:694
#, c-format
msgid ""
"Variable `%s' cannot be in both zero and tiny data regions simultaneously"
msgstr ""
-#: elf32-v850.c:1066
+#: elf32-v850.c:1072
msgid "FAILED to find previous HI16 reloc\n"
msgstr ""
-#: elf32-v850.c:1684
+#: elf32-v850.c:1703
msgid "could not locate special linker symbol __gp"
msgstr ""
-#: elf32-v850.c:1688
+#: elf32-v850.c:1707
msgid "could not locate special linker symbol __ep"
msgstr ""
-#: elf32-v850.c:1692
+#: elf32-v850.c:1711
msgid "could not locate special linker symbol __ctbp"
msgstr ""
-#: elf32-v850.c:1881
+#: elf32-v850.c:1877
#, c-format
msgid "%s: Architecture mismatch with previous modules"
msgstr ""
-#: elf32-v850.c:1900
+#: elf32-v850.c:1897
#, c-format
msgid "private flags = %lx: "
msgstr ""
-#: elf32-v850.c:1905
+#: elf32-v850.c:1902
msgid "v850 architecture"
msgstr ""
-#: elf32-v850.c:1906
+#: elf32-v850.c:1903
msgid "v850e architecture"
msgstr ""
-#: elf32-v850.c:1907
+#: elf32-v850.c:1904
msgid "v850ea architecture"
msgstr ""
-#: elf64-alpha.c:951
+#: elf64-alpha.c:858
msgid "GPDISP relocation did not find ldah and lda instructions"
msgstr ""
-#: elf64-alpha.c:3014
+#: elf64-alpha.c:2934
#, c-format
msgid "%s: .got subsegment exceeds 64K (size %d)"
msgstr ""
-#: elf64-sparc.c:1248
+#: elf64-alpha.c:3518 elf64-alpha.c:3530
#, c-format
-msgid "%s: check_relocs: unhandled reloc type %d"
+msgid "%s: gp-relative relocation against dynamic symbol %s"
msgstr ""
-#: elf64-sparc.c:1285
-msgid "%s: Only registers %%g[2367] can be declared using STT_REGISTER"
-msgstr ""
-
-#: elf64-sparc.c:1305
-msgid ""
-"Register %%g%d used incompatibly: previously declared in %s to %s, in %s "
-"redefined to %s"
-msgstr ""
-
-#: elf64-sparc.c:1328
+#: elf64-hppa.c:2070
#, c-format
-msgid "Symbol `%s' has differing types: previously %s, REGISTER in %s"
+msgid "stub entry for %s cannot load .plt, dp offset = %ld"
msgstr ""
-#: elf64-sparc.c:1374
+#: elf64-mmix.c:1268
#, c-format
-msgid "Symbol `%s' has differing types: REGISTER in %s, %s in %s"
+msgid "%s: register relocation against non-register symbol: %s in %s"
msgstr ""
-#: elf64-sparc.c:2952
-#, c-format
-msgid "%s: linking UltraSPARC specific with HAL specific code"
+#: elf64-mmix.c:1270
+msgid "(unknown)"
msgstr ""
-#: elf.c:325
+#: elf64-mmix.c:1305
#, c-format
-msgid "%s: invalid string offset %u >= %lu for section `%s'"
+msgid "%s: directive LOCAL valid only with a register or absolute value"
msgstr ""
-#: elf.c:566
+#: elf64-mmix.c:1333
+#, c-format
msgid ""
-"\n"
-"Program Header:\n"
+"%s: LOCAL directive: Register $%ld is not a local register. First global "
+"register is $%ld."
msgstr ""
-#: elf.c:614
+#: elf64-mmix.c:1609
+#, c-format
msgid ""
-"\n"
-"Dynamic Section:\n"
+"%s: Error: multiple definition of `%s'; start of %s is set in a earlier "
+"linked file\n"
msgstr ""
-#: elf.c:743
-msgid ""
-"\n"
-"Version definitions:\n"
+#: elf64-mmix.c:1668
+msgid "Register section has contents\n"
msgstr ""
-#: elf.c:766
-msgid ""
-"\n"
-"Version References:\n"
+#: elf64-ppc.c:1466 libbfd.c:1436
+#, c-format
+msgid "%s: compiled for a big endian system and target is little endian"
msgstr ""
-#: elf.c:771
+#: elf64-ppc.c:1468 libbfd.c:1438
#, c-format
-msgid " required from %s:\n"
+msgid "%s: compiled for a little endian system and target is big endian"
msgstr ""
-#: elf.c:1359
+#: elf64-ppc.c:3166
#, c-format
-msgid "%s: invalid link %lu for reloc section %s (index %u)"
+msgid "linkage table overflow against `%s'"
msgstr ""
-#: elf.c:2113
-#, c-format
-msgid ""
-"creating section symbol, name = %s, value = 0x%.8lx, index = %d, section = "
-"0x%.8lx\n"
+#: elf64-ppc.c:3244
+msgid "stub section size doesn't match calculated size"
msgstr ""
-#: elf.c:2716
+#: elf64-ppc.c:3845
#, c-format
-msgid "%s: Not enough room for program headers (allocated %u, need %u)"
+msgid "%s: Relocation %s is not supported for symbol %s."
msgstr ""
-#: elf.c:2815
+#: elf64-ppc.c:3889
#, c-format
-msgid "%s: Not enough room for program headers, try linking with -N"
+msgid "%s: error: relocation %s not a multiple of 4"
msgstr ""
-#: elf.c:2941
+#: elf64-sparc.c:1277
#, c-format
-msgid "Error: First section in segment (%s) starts at 0x%x"
+msgid "%s: check_relocs: unhandled reloc type %d"
msgstr ""
-#: elf.c:2944
+#: elf64-sparc.c:1314
#, c-format
-msgid " whereas segment starts at 0x%x"
+msgid "%s: Only registers %%g[2367] can be declared using STT_REGISTER"
msgstr ""
-#: elf.c:3217
+#: elf64-sparc.c:1334
#, c-format
-msgid "%s: warning: allocated section `%s' not in segment"
+msgid "Register %%g%d used incompatibly: %s in %s"
msgstr ""
-#: elf.c:3616
+#: elf64-sparc.c:1338 elf64-sparc.c:1362 elf64-sparc.c:1411
#, c-format
-msgid "%s: symbol `%s' required but not present"
+msgid " previously %s in %s"
msgstr ""
-#: elf.c:3625
+#: elf64-sparc.c:1359 elf64-sparc.c:1408
#, c-format
-msgid ""
-"elf_symbol_from_bfd_symbol 0x%.8lx, name = %s, sym num = %d, flags = "
-"0x%.8lx%s\n"
+msgid "Symbol `%s' has differing types: %s in %s"
msgstr ""
-#: elf.c:3866
+#: elf64-sparc.c:3014
#, c-format
-msgid "%s: warning: Empty loadable segment detected\n"
+msgid "%s: linking UltraSPARC specific with HAL specific code"
msgstr ""
-#: elf.c:5213
+#: elfcode.h:1218
#, c-format
-msgid "%s: unsupported relocation type %s"
+msgid "%s: version count (%ld) does not match symbol count (%ld)"
msgstr ""
-#: elfcode.h:1084
+#: elflink.c:434
#, c-format
-msgid "%s: version count (%ld) does not match symbol count (%ld)"
+msgid "%s: Section %s is too large to add hole of %ld bytes"
msgstr ""
-#: elflink.c:432
+#: elflink.h:1113
#, c-format
-msgid "%s: Section %s is already to large to put hole of %ld bytes in"
+msgid "%s: warning: unexpected redefinition of `%s'"
msgstr ""
-#: elflink.h:1465
+#: elflink.h:1784
#, c-format
msgid "%s: %s: invalid version %u (max %d)"
msgstr ""
-#: elflink.h:1506
+#: elflink.h:1825
#, c-format
msgid "%s: %s: invalid needed version %d"
msgstr ""
-#: elflink.h:1626
+#: elflink.h:1945
#, c-format
msgid "Warning: size of symbol `%s' changed from %lu to %lu in %s"
msgstr ""
-#: elflink.h:1872
-#, c-format
-msgid "%s: warning: unexpected redefinition of `%s'"
-msgstr ""
-
-#: elflink.h:3659
+#: elflink.h:4020
#, c-format
msgid "warning: type and size of dynamic symbol `%s' are not defined"
msgstr ""
-#: elflink.h:3931
+#: elflink.h:4329
#, c-format
msgid "%s: undefined versioned symbol name %s"
msgstr ""
-#: elflink.h:5180
+#: elflink.h:4559 elflink.h:4567 elflink.h:6218 elflink.h:7295
+msgid "Error: out of memory"
+msgstr ""
+
+#: elflink.h:4729
+msgid "Not enough memory to sort relocations"
+msgstr ""
+
+#: elflink.h:5995
#, c-format
msgid "%s: could not find output section %s for input section %s"
msgstr ""
-#: i386linux.c:450 m68klinux.c:454 sparclinux.c:452
+#: elflink.h:6568
+msgid "warning: relocation against removed section; zeroing"
+msgstr ""
+
+#: elflink.h:6598
+msgid "warning: relocation against removed section"
+msgstr ""
+
+#: elflink.h:6611
+#, c-format
+msgid "local symbols in discarded section %s"
+msgstr ""
+
+#: i386linux.c:455 m68klinux.c:459 sparclinux.c:456
#, c-format
msgid "Output file requires shared library `%s'\n"
msgstr ""
-#: i386linux.c:458 m68klinux.c:462 sparclinux.c:460
+#: i386linux.c:463 m68klinux.c:467 sparclinux.c:464
#, c-format
msgid "Output file requires shared library `%s.so.%s'\n"
msgstr ""
-#: i386linux.c:646 i386linux.c:696 m68klinux.c:653 m68klinux.c:701
-#: sparclinux.c:649 sparclinux.c:699
+#: i386linux.c:653 i386linux.c:703 m68klinux.c:660 m68klinux.c:708
+#: sparclinux.c:655 sparclinux.c:705
#, c-format
msgid "Symbol %s not defined for fixups\n"
msgstr ""
-#: i386linux.c:720 m68klinux.c:725 sparclinux.c:723
+#: i386linux.c:727 m68klinux.c:732 sparclinux.c:729
msgid "Warning: fixup count mismatch\n"
msgstr ""
-#: ieee.c:167
+#: ieee.c:235
#, c-format
msgid "%s: string too long (%d chars, max 65535)"
msgstr ""
-#: ieee.c:297
+#: ieee.c:365
#, c-format
msgid "%s: unrecognized symbol `%s' flags 0x%x"
msgstr ""
-#: ieee.c:793
+#: ieee.c:877
#, c-format
msgid "%s: unimplemented ATI record %u for symbol %u"
msgstr ""
-#: ieee.c:818
+#: ieee.c:902
#, c-format
msgid "%s: unexpected ATN type %d in external part"
msgstr ""
-#: ieee.c:840
+#: ieee.c:924
#, c-format
msgid "%s: unexpected type after ATN"
msgstr ""
-#: ihex.c:259
+#: ihex.c:258
#, c-format
msgid "%s:%d: unexpected character `%s' in Intel Hex file\n"
msgstr ""
-#: ihex.c:369
+#: ihex.c:368
#, c-format
-msgid "%s:%d: bad checksum in Intel Hex file (expected %u, found %u)"
+msgid "%s:%u: bad checksum in Intel Hex file (expected %u, found %u)"
msgstr ""
-#: ihex.c:421
+#: ihex.c:422
#, c-format
-msgid "%s:%d: bad extended address record length in Intel Hex file"
+msgid "%s:%u: bad extended address record length in Intel Hex file"
msgstr ""
-#: ihex.c:438
+#: ihex.c:439
#, c-format
-msgid "%s:%d: bad extended start address length in Intel Hex file"
+msgid "%s:%u: bad extended start address length in Intel Hex file"
msgstr ""
-#: ihex.c:455
+#: ihex.c:456
#, c-format
-msgid "%s:%d: bad extended linear address record length in Intel Hex file"
+msgid "%s:%u: bad extended linear address record length in Intel Hex file"
msgstr ""
-#: ihex.c:472
+#: ihex.c:473
#, c-format
-msgid "%s:%d: bad extended linear start address length in Intel Hex file"
+msgid "%s:%u: bad extended linear start address length in Intel Hex file"
msgstr ""
-#: ihex.c:489
+#: ihex.c:490
#, c-format
-msgid "%s:%d: unrecognized ihex type %u in Intel Hex file\n"
+msgid "%s:%u: unrecognized ihex type %u in Intel Hex file\n"
msgstr ""
-#: ihex.c:609
+#: ihex.c:610
#, c-format
msgid "%s: internal error in ihex_read_section"
msgstr ""
-#: ihex.c:644
+#: ihex.c:645
#, c-format
msgid "%s: bad section length in ihex_read_section"
msgstr ""
-#: ihex.c:858
+#: ihex.c:863
#, c-format
msgid "%s: address 0x%s out of range for Intex Hex file"
msgstr ""
-#: libbfd.c:471
+#: libbfd.c:492
#, c-format
msgid "not mapping: data=%lx mapped=%d\n"
msgstr ""
-#: libbfd.c:474
+#: libbfd.c:495
msgid "not mapping: env var not set\n"
msgstr ""
-#: libbfd.c:1370
-#, c-format
-msgid "%s: compiled for a big endian system and target is little endian"
-msgstr ""
-
-#: libbfd.c:1372
+#: libbfd.c:1463
#, c-format
-msgid "%s: compiled for a little endian system and target is big endian"
+msgid "Deprecated %s called"
msgstr ""
-#: linker.c:2678
+#: libbfd.c:1465
#, c-format
-msgid "Attempt to do relocateable link with %s input and %s output"
+msgid " at %s line %d in %s\n"
msgstr ""
-#: oasys.c:1016
+#: linker.c:1849
#, c-format
-msgid "%s: can not represent section `%s' in oasys"
+msgid "%s: indirect symbol `%s' to `%s' is a loop"
msgstr ""
-#: osf-core.c:146
+#: linker.c:2745
#, c-format
-msgid "Unhandled OSF/1 core file section type %d\n"
+msgid "Attempt to do relocateable link with %s input and %s output"
msgstr ""
-#. XXX code yet to be written.
-#: peicode.h:807
+#: merge.c:897
#, c-format
-msgid "%s: Unhandled import type; %x"
+msgid "%s: access beyond end of merged section (%ld + %ld)"
msgstr ""
-#: peicode.h:812
+#: mmo.c:460
#, c-format
-msgid "%s: Unrecognised import type; %x"
+msgid "%s: No core to allocate section name %s\n"
msgstr ""
-#: peicode.h:826
+#: mmo.c:537
#, c-format
-msgid "%s: Unrecognised import name type; %x"
+msgid "%s: No core to allocate a symbol %d bytes long\n"
msgstr ""
-#: peicode.h:1183
+#: mmo.c:1190
#, c-format
-msgid "%s: Unrecognised machine type (0x%x) in Import Library Format archive"
+msgid "%s: invalid mmo file: initialization value for $255 is not `Main'\n"
msgstr ""
-#: peicode.h:1195
+#: mmo.c:1336
#, c-format
msgid ""
-"%s: Recognised but unhandled machine type (0x%x) in Import Library Format "
-"archive"
+"%s: unsupported wide character sequence 0x%02X 0x%02X after symbol name "
+"starting with `%s'\n"
msgstr ""
-#: peicode.h:1212
+#: mmo.c:1571
#, c-format
-msgid "%s: size field is zero in Import Library Format header"
+msgid "%s: invalid mmo file: unsupported lopcode `%d'\n"
msgstr ""
-#: peicode.h:1240
+#: mmo.c:1581
#, c-format
-msgid "%s: string not null terminated in ILF object file."
+msgid "%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n"
msgstr ""
-#: peigen.c:993
+#: mmo.c:1617
#, c-format
-msgid "%s: line number overflow: 0x%lx > 0xffff"
+msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n"
msgstr ""
-#: peigen.c:1011
+#: mmo.c:1663
#, c-format
-msgid "%s: reloc overflow 1: 0x%lx > 0xffff"
-msgstr ""
-
-#: peigen.c:1024
-msgid "Export Directory [.edata (or where ever we found it)]"
-msgstr ""
-
-#: peigen.c:1025
-msgid "Import Directory [parts of .idata]"
-msgstr ""
-
-#: peigen.c:1026
-msgid "Resource Directory [.rsrc]"
-msgstr ""
-
-#: peigen.c:1027
-msgid "Exception Directory [.pdata]"
-msgstr ""
-
-#: peigen.c:1028
-msgid "Security Directory"
-msgstr ""
-
-#: peigen.c:1029
-msgid "Base Relocation Directory [.reloc]"
-msgstr ""
-
-#: peigen.c:1030
-msgid "Debug Directory"
-msgstr ""
-
-#: peigen.c:1031
-msgid "Description Directory"
-msgstr ""
-
-#: peigen.c:1032
-msgid "Special Directory"
-msgstr ""
-
-#: peigen.c:1033
-msgid "Thread Storage Directory [.tls]"
-msgstr ""
-
-#: peigen.c:1034
-msgid "Load Configuration Directory"
-msgstr ""
-
-#: peigen.c:1035
-msgid "Bound Import Directory"
-msgstr ""
-
-#: peigen.c:1036
-msgid "Import Address Table Directory"
-msgstr ""
-
-#: peigen.c:1037
-msgid "Delay Import Directory"
-msgstr ""
-
-#: peigen.c:1038 peigen.c:1039
-msgid "Reserved"
-msgstr ""
-
-#: peigen.c:1103
msgid ""
-"\n"
-"There is an import table, but the section containing it could not be found\n"
+"%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n"
msgstr ""
-#: peigen.c:1108
+#: mmo.c:1702
#, c-format
-msgid ""
-"\n"
-"There is an import table in %s at 0x%lx\n"
+msgid "%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n"
msgstr ""
-#: peigen.c:1147
+#: mmo.c:1711
#, c-format
msgid ""
-"\n"
-"Function descriptor located at the start address: %04lx\n"
+"%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n"
msgstr ""
-#: peigen.c:1150
+#: mmo.c:1734
#, c-format
-msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n"
-msgstr ""
-
-#: peigen.c:1156
msgid ""
-"\n"
-"No reldata section! Function descriptor not decoded.\n"
+"%s: invalid mmo file: leading byte of operand word must be 0 or 1, got %d "
+"for lop_fixrx\n"
msgstr ""
-#: peigen.c:1161
+#: mmo.c:1757
#, c-format
-msgid ""
-"\n"
-"The Import Tables (interpreted %s section contents)\n"
-msgstr ""
-
-#: peigen.c:1164
-msgid " vma: Hint Time Forward DLL First\n"
-msgstr ""
-
-#: peigen.c:1166
-msgid " Table Stamp Chain Name Thunk\n"
+msgid "%s: cannot allocate file name for file number %d, %d bytes\n"
msgstr ""
-#: peigen.c:1216
+#: mmo.c:1777
#, c-format
msgid ""
-"\n"
-"\tDLL Name: %s\n"
-msgstr ""
-
-#: peigen.c:1220 peigen.c:1283
-msgid "\tvma: Hint/Ord Member-Name\n"
-msgstr ""
-
-#: peigen.c:1282
-msgid "\tThe Import Address Table (difference found)\n"
-msgstr ""
-
-#: peigen.c:1289
-msgid "\t>>> Ran out of IAT members!\n"
-msgstr ""
-
-#: peigen.c:1308
-msgid "\tThe Import Address Table is identical\n"
-msgstr ""
-
-#: peigen.c:1381
-msgid ""
-"\n"
-"There is an export table, but the section containing it could not be found\n"
+"%s: invalid mmo file: file number %d `%s', was already entered as `%s'\n"
msgstr ""
-#: peigen.c:1386
+#: mmo.c:1790
#, c-format
msgid ""
-"\n"
-"There is an export table in %s at 0x%lx\n"
+"%s: invalid mmo file: file name for number %d was not specified before use\n"
msgstr ""
-#: peigen.c:1417
+#: mmo.c:1896
#, c-format
msgid ""
-"\n"
-"The Export Tables (interpreted %s section contents)\n"
-"\n"
+"%s: invalid mmo file: fields y and z of lop_stab non-zero, y: %d, z: %d\n"
msgstr ""
-#: peigen.c:1421
+#: mmo.c:1932
#, c-format
-msgid "Export Flags \t\t\t%lx\n"
+msgid "%s: invalid mmo file: lop_end not last item in file\n"
msgstr ""
-#: peigen.c:1424
+#: mmo.c:1945
#, c-format
-msgid "Time/Date stamp \t\t%lx\n"
+msgid ""
+"%s: invalid mmo file: YZ of lop_end (%ld) not equal to the number of tetras "
+"to the preceding lop_stab (%ld)\n"
msgstr ""
-#: peigen.c:1427
+#: mmo.c:2610
#, c-format
-msgid "Major/Minor \t\t\t%d/%d\n"
-msgstr ""
-
-#: peigen.c:1430
-msgid "Name \t\t\t\t"
+msgid "%s: invalid symbol table: duplicate symbol `%s'\n"
msgstr ""
-#: peigen.c:1436
+#: mmo.c:2898
#, c-format
-msgid "Ordinal Base \t\t\t%ld\n"
-msgstr ""
-
-#: peigen.c:1439
-msgid "Number in:\n"
+msgid ""
+"%s: Bad symbol definition: `Main' set to %s rather than the start address %"
+"s\n"
msgstr ""
-#: peigen.c:1442
+#: mmo.c:2932
#, c-format
-msgid "\tExport Address Table \t\t%08lx\n"
+msgid ""
+"%s: warning: symbol table too large for mmo, larger than 65535 32-bit words: "
+"%d. Only `Main' will be emitted.\n"
msgstr ""
-#: peigen.c:1446
+#: mmo.c:2977
#, c-format
-msgid "\t[Name Pointer/Ordinal] Table\t%08lx\n"
-msgstr ""
-
-#: peigen.c:1449
-msgid "Table Addresses\n"
-msgstr ""
-
-#: peigen.c:1452
-msgid "\tExport Address Table \t\t"
+msgid "%s: internal error, symbol table changed size from %d to %d words\n"
msgstr ""
-#: peigen.c:1457
-msgid "\tName Pointer Table \t\t"
-msgstr ""
-
-#: peigen.c:1462
-msgid "\tOrdinal Table \t\t\t"
-msgstr ""
-
-#: peigen.c:1476
+#: mmo.c:3032
#, c-format
-msgid ""
-"\n"
-"Export Address Table -- Ordinal Base %ld\n"
+msgid "%s: internal error, internal register section %s had contents\n"
msgstr ""
-#: peigen.c:1495
-msgid "Forwarder RVA"
-msgstr ""
-
-#: peigen.c:1506
-msgid "Export RVA"
-msgstr ""
-
-#: peigen.c:1513
-msgid ""
-"\n"
-"[Ordinal/Name Pointer] Table\n"
+#: mmo.c:3084
+#, c-format
+msgid "%s: no initialized registers; section length 0\n"
msgstr ""
-#: peigen.c:1568
+#: mmo.c:3090
#, c-format
-msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n"
+msgid "%s: too many initialized registers; section length %ld\n"
msgstr ""
-#: peigen.c:1572
+#: mmo.c:3095
+#, c-format
msgid ""
-"\n"
-"The Function Table (interpreted .pdata section contents)\n"
-msgstr ""
-
-#: peigen.c:1575
-msgid " vma:\t\t\tBegin Address End Address Unwind Info\n"
+"%s: invalid start address for initialized registers of length %ld: 0x%lx%"
+"08lx\n"
msgstr ""
-#: peigen.c:1578
-msgid " vma:\t\tBegin End EH EH PrologEnd Exception\n"
+#: oasys.c:1036
+#, c-format
+msgid "%s: can not represent section `%s' in oasys"
msgstr ""
-#: peigen.c:1580
-msgid " \t\tAddress Address Handler Data Address Mask\n"
+#: osf-core.c:132
+#, c-format
+msgid "Unhandled OSF/1 core file section type %d\n"
msgstr ""
-#: peigen.c:1652
-msgid " Register save millicode"
+#: pe-mips.c:658
+#, c-format
+msgid "%s: `ld -r' not supported with PE MIPS objects\n"
msgstr ""
-#: peigen.c:1655
-msgid " Register restore millicode"
+#. OK, at this point the following variables are set up:
+#. src = VMA of the memory we're fixing up
+#. mem = pointer to memory we're fixing up
+#. val = VMA of what we need to refer to
+#.
+#: pe-mips.c:794
+#, c-format
+msgid "%s: unimplemented %s\n"
msgstr ""
-#: peigen.c:1658
-msgid " Glue code sequence"
+#: pe-mips.c:820
+#, c-format
+msgid "%s: jump too far away\n"
msgstr ""
-#: peigen.c:1709
-msgid ""
-"\n"
-"\n"
-"PE File Base Relocations (interpreted .reloc section contents)\n"
+#: pe-mips.c:847
+#, c-format
+msgid "%s: bad pair/reflo after refhi\n"
msgstr ""
-#: peigen.c:1744
+#. XXX code yet to be written.
+#: peicode.h:785
#, c-format
-msgid ""
-"\n"
-"Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n"
+msgid "%s: Unhandled import type; %x"
msgstr ""
-#: peigen.c:1757
+#: peicode.h:790
#, c-format
-msgid "\treloc %4d offset %4x [%4lx] %s"
+msgid "%s: Unrecognised import type; %x"
msgstr ""
-#. The MS dumpbin program reportedly ands with 0xff0f before
-#. printing the characteristics field. Not sure why. No reason to
-#. emulate it here.
-#: peigen.c:1796
+#: peicode.h:804
#, c-format
-msgid ""
-"\n"
-"Characteristics 0x%x\n"
+msgid "%s: Unrecognised import name type; %x"
msgstr ""
-#: pe-mips.c:653
+#: peicode.h:1162
#, c-format
-msgid "%s: `ld -r' not supported with PE MIPS objects\n"
+msgid "%s: Unrecognised machine type (0x%x) in Import Library Format archive"
msgstr ""
-#. OK, at this point the following variables are set up:
-#. src = VMA of the memory we're fixing up
-#. mem = pointer to memory we're fixing up
-#. val = VMA of what we need to refer to
-#.
-#: pe-mips.c:789
+#: peicode.h:1174
#, c-format
-msgid "%s: unimplemented %s\n"
+msgid ""
+"%s: Recognised but unhandled machine type (0x%x) in Import Library Format "
+"archive"
msgstr ""
-#: pe-mips.c:815
+#: peicode.h:1191
#, c-format
-msgid "%s: jump too far away\n"
+msgid "%s: size field is zero in Import Library Format header"
msgstr ""
-#: pe-mips.c:842
+#: peicode.h:1219
#, c-format
-msgid "%s: bad pair/reflo after refhi\n"
+msgid "%s: string not null terminated in ILF object file."
msgstr ""
-#: ppcboot.c:422
+#: ppcboot.c:416
msgid ""
"\n"
"ppcboot header:\n"
msgstr ""
-#: ppcboot.c:423
+#: ppcboot.c:417
#, c-format
msgid "Entry offset = 0x%.8lx (%ld)\n"
msgstr ""
-#: ppcboot.c:424
+#: ppcboot.c:418
#, c-format
msgid "Length = 0x%.8lx (%ld)\n"
msgstr ""
-#: ppcboot.c:427
+#: ppcboot.c:421
#, c-format
msgid "Flag field = 0x%.2x\n"
msgstr ""
-#: ppcboot.c:433
+#: ppcboot.c:427
#, c-format
msgid "Partition name = \"%s\"\n"
msgstr ""
-#: ppcboot.c:452
+#: ppcboot.c:446
#, c-format
msgid ""
"\n"
"Partition[%d] start = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n"
msgstr ""
-#: ppcboot.c:458
+#: ppcboot.c:452
#, c-format
msgid "Partition[%d] end = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n"
msgstr ""
-#: ppcboot.c:464
+#: ppcboot.c:458
#, c-format
msgid "Partition[%d] sector = 0x%.8lx (%ld)\n"
msgstr ""
-#: ppcboot.c:465
+#: ppcboot.c:459
#, c-format
msgid "Partition[%d] length = 0x%.8lx (%ld)\n"
msgstr ""
-#: som.c:5355
+#: som.c:5402
msgid "som_sizeof_headers unimplemented"
msgstr ""
-#: srec.c:300
+#: srec.c:301
#, c-format
msgid "%s:%d: Unexpected character `%s' in S-record file\n"
msgstr ""
-#: syms.c:968
+#: syms.c:996
msgid "Unsupported .stab relocation"
msgstr ""
-#: vms-gsd.c:354
+#: vms-gsd.c:356
#, c-format
msgid "bfd_make_section (%s) failed"
msgstr ""
-#: vms-gsd.c:368
+#: vms-gsd.c:371
#, c-format
msgid "bfd_set_section_flags (%s, %x) failed"
msgstr ""
-#: vms-gsd.c:404
+#: vms-gsd.c:407
#, c-format
msgid "Size mismatch section %s=%lx, %s=%lx"
msgstr ""
-#: vms-gsd.c:699
+#: vms-gsd.c:704
#, c-format
msgid "unknown gsd/egsd subtype %d"
msgstr ""
-#: vms-hdr.c:403
+#: vms-hdr.c:406
msgid "Object module NOT error-free !\n"
msgstr ""
-#: vms-misc.c:539
+#: vms-misc.c:543
#, c-format
msgid "Stack overflow (%d) in _bfd_vms_push"
msgstr ""
-#: vms-misc.c:557
+#: vms-misc.c:561
msgid "Stack underflow in _bfd_vms_pop"
msgstr ""
-#: vms-misc.c:915
+#: vms-misc.c:919
msgid "_bfd_vms_output_counted called with zero bytes"
msgstr ""
-#: vms-misc.c:920
+#: vms-misc.c:924
msgid "_bfd_vms_output_counted called with too many bytes"
msgstr ""
-#: vms-misc.c:1051
+#: vms-misc.c:1055
#, c-format
msgid "Symbol %s replaced by %s\n"
msgstr ""
-#: vms-misc.c:1113
+#: vms-misc.c:1117
#, c-format
msgid "failed to enter %s"
msgstr ""
-#: vms-tir.c:68
+#: vms-tir.c:78
msgid "No Mem !"
msgstr ""
-#: vms-tir.c:302
+#: vms-tir.c:313
msgid "Bad section index in ETIR_S_C_STA_PQ"
msgstr ""
-#: vms-tir.c:317
+#: vms-tir.c:328
#, c-format
msgid "Unsupported STA cmd %d"
msgstr ""
-#: vms-tir.c:322 vms-tir.c:1274
+#: vms-tir.c:333 vms-tir.c:1301
#, c-format
msgid "Reserved STA cmd %d"
msgstr ""
-#: vms-tir.c:428
+#: vms-tir.c:443
#, c-format
msgid "ETIR_S_C_STO_GBL: no symbol \"%s\""
msgstr ""
-#: vms-tir.c:449
+#: vms-tir.c:465
#, c-format
msgid "ETIR_S_C_STO_CA: no symbol \"%s\""
msgstr ""
-#: vms-tir.c:462
+#: vms-tir.c:478
msgid "ETIR_S_C_STO_RB/AB: Not supported"
msgstr ""
-#: vms-tir.c:520
+#: vms-tir.c:538
msgid "ETIR_S_C_STO_LP_PSB: Not supported"
msgstr ""
-#: vms-tir.c:526
+#: vms-tir.c:544
msgid "ETIR_S_C_STO_HINT_GBL: not implemented"
msgstr ""
-#: vms-tir.c:532
+#: vms-tir.c:550
msgid "ETIR_S_C_STO_HINT_PS: not implemented"
msgstr ""
-#: vms-tir.c:536 vms-tir.c:1446
+#: vms-tir.c:554 vms-tir.c:1473
#, c-format
msgid "Reserved STO cmd %d"
msgstr ""
-#: vms-tir.c:649
+#: vms-tir.c:667
msgid "ETIR_S_C_OPR_INSV: Not supported"
msgstr ""
-#: vms-tir.c:667
+#: vms-tir.c:685
msgid "ETIR_S_C_OPR_USH: Not supported"
msgstr ""
-#: vms-tir.c:673
+#: vms-tir.c:691
msgid "ETIR_S_C_OPR_ROT: Not supported"
msgstr ""
-#: vms-tir.c:692
+#: vms-tir.c:710
msgid "ETIR_S_C_OPR_REDEF: Not supported"
msgstr ""
-#: vms-tir.c:698
+#: vms-tir.c:716
msgid "ETIR_S_C_OPR_DFLIT: Not supported"
msgstr ""
-#: vms-tir.c:702 vms-tir.c:1641
+#: vms-tir.c:720 vms-tir.c:1668
#, c-format
msgid "Reserved OPR cmd %d"
msgstr ""
-#: vms-tir.c:770 vms-tir.c:1710
+#: vms-tir.c:788 vms-tir.c:1737
#, c-format
msgid "Reserved CTL cmd %d"
msgstr ""
-#: vms-tir.c:798
+#: vms-tir.c:816
msgid "ETIR_S_C_STC_LP: not supported"
msgstr ""
-#: vms-tir.c:816
+#: vms-tir.c:834
msgid "ETIR_S_C_STC_GBL: not supported"
msgstr ""
-#: vms-tir.c:824
+#: vms-tir.c:842
msgid "ETIR_S_C_STC_GCA: not supported"
msgstr ""
-#: vms-tir.c:833
+#: vms-tir.c:851
msgid "ETIR_S_C_STC_PS: not supported"
msgstr ""
@@ -2024,11 +2100,11 @@ msgstr ""
#. * arg: -
#. *
#.
-#: vms-tir.c:1174
+#: vms-tir.c:1199
msgid "Stack-from-image not implemented"
msgstr ""
-#: vms-tir.c:1194
+#: vms-tir.c:1219
msgid "Stack-entry-mask not fully implemented"
msgstr ""
@@ -2041,171 +2117,526 @@ msgstr ""
#. * compare argument descriptor with symbol argument (ARG$V_PASSMECH)
#. * and stack TRUE (args match) or FALSE (args dont match) value
#.
-#: vms-tir.c:1210
+#: vms-tir.c:1235
msgid "PASSMECH not fully implemented"
msgstr ""
-#: vms-tir.c:1230
+#: vms-tir.c:1256
msgid "Stack-local-symbol not fully implemented"
msgstr ""
-#: vms-tir.c:1245
+#: vms-tir.c:1271
msgid "Stack-literal not fully implemented"
msgstr ""
-#: vms-tir.c:1267
+#: vms-tir.c:1294
msgid "Stack-local-symbol-entry-point-mask not fully implemented"
msgstr ""
-#: vms-tir.c:1442
+#: vms-tir.c:1469
#, c-format
msgid "Unimplemented STO cmd %d"
msgstr ""
-#: vms-tir.c:1581
+#: vms-tir.c:1608
msgid "TIR_S_C_OPR_ASH incomplete"
msgstr ""
-#: vms-tir.c:1595
+#: vms-tir.c:1622
msgid "TIR_S_C_OPR_USH incomplete"
msgstr ""
-#: vms-tir.c:1609
+#: vms-tir.c:1636
msgid "TIR_S_C_OPR_ROT incomplete"
msgstr ""
#.
#. * redefine symbol to current location
#.
-#: vms-tir.c:1630
+#: vms-tir.c:1657
msgid "TIR_S_C_OPR_REDEF not supported"
msgstr ""
#.
#. * define a literal
#.
-#: vms-tir.c:1637
+#: vms-tir.c:1664
msgid "TIR_S_C_OPR_DFLIT not supported"
msgstr ""
-#: vms-tir.c:1691
+#: vms-tir.c:1718
msgid "TIR_S_C_CTL_DFLOC not fully implemented"
msgstr ""
-#: vms-tir.c:1699
+#: vms-tir.c:1726
msgid "TIR_S_C_CTL_STLOC not fully implemented"
msgstr ""
-#: vms-tir.c:1707
+#: vms-tir.c:1734
msgid "TIR_S_C_CTL_STKDL not fully implemented"
msgstr ""
-#: vms-tir.c:1761
+#: vms-tir.c:1791
#, c-format
msgid "Obj code %d not found"
msgstr ""
-#: vms-tir.c:2102
+#: vms-tir.c:2137
#, c-format
msgid "SEC_RELOC with no relocs in section %s"
msgstr ""
-#: vms-tir.c:2376
+#: vms-tir.c:2424
#, c-format
msgid "Unhandled relocation %s"
msgstr ""
-#: xcofflink.c:1634
+#: xcofflink.c:1241
#, c-format
msgid "%s: `%s' has line numbers but no enclosing section"
msgstr ""
-#: xcofflink.c:1686
+#: xcofflink.c:1294
#, c-format
msgid "%s: class %d symbol `%s' has no aux entries"
msgstr ""
-#: xcofflink.c:1709
+#: xcofflink.c:1317
#, c-format
msgid "%s: symbol `%s' has unrecognized csect type %d"
msgstr ""
-#: xcofflink.c:1721
+#: xcofflink.c:1329
#, c-format
msgid "%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d"
msgstr ""
-#: xcofflink.c:1760
+#: xcofflink.c:1365
#, c-format
msgid "%s: XMC_TC0 symbol `%s' is class %d scnlen %d"
msgstr ""
-#: xcofflink.c:1883
-#, c-format
-msgid "%s: symbol `%s' has unrecognized smclas %d"
-msgstr ""
-
-#: xcofflink.c:1902
+#: xcofflink.c:1517
#, c-format
msgid "%s: csect `%s' not in enclosing section"
msgstr ""
-#: xcofflink.c:2006
+#: xcofflink.c:1624
#, c-format
msgid "%s: misplaced XTY_LD `%s'"
msgstr ""
-#: xcofflink.c:2317
+#: xcofflink.c:1948
#, c-format
msgid "%s: reloc %s:%d not in csect"
msgstr ""
-#: xcofflink.c:2452
+#: xcofflink.c:2083
#, c-format
msgid "%s: XCOFF shared object when not producing XCOFF output"
msgstr ""
-#: xcofflink.c:2473
+#: xcofflink.c:2104
#, c-format
msgid "%s: dynamic object with no .loader section"
msgstr ""
-#: xcofflink.c:3113
+#: xcofflink.c:2749
#, c-format
msgid "%s: no such symbol"
msgstr ""
-#: xcofflink.c:3704
+#: xcofflink.c:2890
+msgid "error: undefined symbol __rtinit"
+msgstr ""
+
+#: xcofflink.c:3458
#, c-format
msgid "warning: attempt to export undefined symbol `%s'"
msgstr ""
-#: xcofflink.c:4698
+#: xcofflink.c:4452
#, c-format
msgid "TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling"
msgstr ""
-#: xcofflink.c:5523 xcofflink.c:5879 xcofflink.c:5916 xcofflink.c:6233
+#: xcofflink.c:5292 xcofflink.c:5754 xcofflink.c:5816 xcofflink.c:6117
#, c-format
msgid "%s: loader reloc in unrecognized section `%s'"
msgstr ""
-#: xcofflink.c:5545 xcofflink.c:6244
+#: xcofflink.c:5314 xcofflink.c:6128
#, c-format
msgid "%s: `%s' in loader reloc but not loader sym"
msgstr ""
-#: xcofflink.c:5560
+#: xcofflink.c:5329
#, c-format
msgid "%s: loader reloc in read-only section %s"
msgstr ""
-#: xcofflink.c:6440
+#: elf32-ia64.c:2190 elf64-ia64.c:2190
+msgid "@pltoff reloc against local symbol"
+msgstr ""
+
+#: elf32-ia64.c:2248 elf64-ia64.c:2248
+msgid "non-zero addend in @fptr reloc"
+msgstr ""
+
+#: elf32-ia64.c:3414 elf64-ia64.c:3414
#, c-format
-msgid "%s: unsupported relocation type 0x%02x"
+msgid "%s: short data segment overflowed (0x%lx >= 0x400000)"
msgstr ""
-#: xcofflink.c:6486
+#: elf32-ia64.c:3425 elf64-ia64.c:3425
#, c-format
-msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry"
+msgid "%s: __gp does not cover short data segment"
+msgstr ""
+
+#: elf32-ia64.c:3729 elf64-ia64.c:3729
+#, c-format
+msgid "%s: linking non-pic code in a shared library"
+msgstr ""
+
+#: elf32-ia64.c:3762 elf64-ia64.c:3762
+#, c-format
+msgid "%s: @gprel relocation against dynamic symbol %s"
+msgstr ""
+
+#: elf32-ia64.c:3901 elf64-ia64.c:3901
+#, c-format
+msgid "%s: dynamic relocation against speculation fixup"
+msgstr ""
+
+#: elf32-ia64.c:3909 elf64-ia64.c:3909
+#, c-format
+msgid "%s: speculation fixup against undefined weak symbol"
+msgstr ""
+
+#: elf32-ia64.c:4093 elf64-ia64.c:4093
+msgid "unsupported reloc"
+msgstr ""
+
+#: elf32-ia64.c:4373 elf64-ia64.c:4373
+#, c-format
+msgid "%s: linking trap-on-NULL-dereference with non-trapping files"
+msgstr ""
+
+#: elf32-ia64.c:4382 elf64-ia64.c:4382
+#, c-format
+msgid "%s: linking big-endian files with little-endian files"
+msgstr ""
+
+#: elf32-ia64.c:4391 elf64-ia64.c:4391
+#, c-format
+msgid "%s: linking 64-bit files with 32-bit files"
+msgstr ""
+
+#: elf32-ia64.c:4400 elf64-ia64.c:4400
+#, c-format
+msgid "%s: linking constant-gp files with non-constant-gp files"
+msgstr ""
+
+#: elf32-ia64.c:4410 elf64-ia64.c:4410
+#, c-format
+msgid "%s: linking auto-pic files with non-auto-pic files"
+msgstr ""
+
+#: peigen.c:964 pepigen.c:964
+#, c-format
+msgid "%s: line number overflow: 0x%lx > 0xffff"
+msgstr ""
+
+#: peigen.c:981 pepigen.c:981
+#, c-format
+msgid "%s: reloc overflow 1: 0x%lx > 0xffff"
+msgstr ""
+
+#: peigen.c:995 pepigen.c:995
+msgid "Export Directory [.edata (or where ever we found it)]"
+msgstr ""
+
+#: peigen.c:996 pepigen.c:996
+msgid "Import Directory [parts of .idata]"
+msgstr ""
+
+#: peigen.c:997 pepigen.c:997
+msgid "Resource Directory [.rsrc]"
+msgstr ""
+
+#: peigen.c:998 pepigen.c:998
+msgid "Exception Directory [.pdata]"
+msgstr ""
+
+#: peigen.c:999 pepigen.c:999
+msgid "Security Directory"
+msgstr ""
+
+#: peigen.c:1000 pepigen.c:1000
+msgid "Base Relocation Directory [.reloc]"
+msgstr ""
+
+#: peigen.c:1001 pepigen.c:1001
+msgid "Debug Directory"
+msgstr ""
+
+#: peigen.c:1002 pepigen.c:1002
+msgid "Description Directory"
+msgstr ""
+
+#: peigen.c:1003 pepigen.c:1003
+msgid "Special Directory"
+msgstr ""
+
+#: peigen.c:1004 pepigen.c:1004
+msgid "Thread Storage Directory [.tls]"
+msgstr ""
+
+#: peigen.c:1005 pepigen.c:1005
+msgid "Load Configuration Directory"
+msgstr ""
+
+#: peigen.c:1006 pepigen.c:1006
+msgid "Bound Import Directory"
+msgstr ""
+
+#: peigen.c:1007 pepigen.c:1007
+msgid "Import Address Table Directory"
+msgstr ""
+
+#: peigen.c:1008 pepigen.c:1008
+msgid "Delay Import Directory"
+msgstr ""
+
+#: peigen.c:1009 peigen.c:1010 pepigen.c:1009 pepigen.c:1010
+msgid "Reserved"
+msgstr ""
+
+#: peigen.c:1073 pepigen.c:1073
+msgid ""
+"\n"
+"There is an import table, but the section containing it could not be found\n"
+msgstr ""
+
+#: peigen.c:1078 pepigen.c:1078
+#, c-format
+msgid ""
+"\n"
+"There is an import table in %s at 0x%lx\n"
+msgstr ""
+
+#: peigen.c:1115 pepigen.c:1115
+#, c-format
+msgid ""
+"\n"
+"Function descriptor located at the start address: %04lx\n"
+msgstr ""
+
+#: peigen.c:1118 pepigen.c:1118
+#, c-format
+msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n"
+msgstr ""
+
+#: peigen.c:1124 pepigen.c:1124
+msgid ""
+"\n"
+"No reldata section! Function descriptor not decoded.\n"
+msgstr ""
+
+#: peigen.c:1129 pepigen.c:1129
+#, c-format
+msgid ""
+"\n"
+"The Import Tables (interpreted %s section contents)\n"
+msgstr ""
+
+#: peigen.c:1132 pepigen.c:1132
+msgid " vma: Hint Time Forward DLL First\n"
+msgstr ""
+
+#: peigen.c:1134 pepigen.c:1134
+msgid " Table Stamp Chain Name Thunk\n"
+msgstr ""
+
+#: peigen.c:1182 pepigen.c:1182
+#, c-format
+msgid ""
+"\n"
+"\tDLL Name: %s\n"
+msgstr ""
+
+#: peigen.c:1186 peigen.c:1249 pepigen.c:1186 pepigen.c:1249
+msgid "\tvma: Hint/Ord Member-Name\n"
+msgstr ""
+
+#: peigen.c:1248 pepigen.c:1248
+msgid "\tThe Import Address Table (difference found)\n"
+msgstr ""
+
+#: peigen.c:1255 pepigen.c:1255
+msgid "\t>>> Ran out of IAT members!\n"
+msgstr ""
+
+#: peigen.c:1273 pepigen.c:1273
+msgid "\tThe Import Address Table is identical\n"
+msgstr ""
+
+#: peigen.c:1345 pepigen.c:1345
+msgid ""
+"\n"
+"There is an export table, but the section containing it could not be found\n"
+msgstr ""
+
+#: peigen.c:1350 pepigen.c:1350
+#, c-format
+msgid ""
+"\n"
+"There is an export table in %s at 0x%lx\n"
+msgstr ""
+
+#: peigen.c:1381 pepigen.c:1381
+#, c-format
+msgid ""
+"\n"
+"The Export Tables (interpreted %s section contents)\n"
+"\n"
+msgstr ""
+
+#: peigen.c:1385 pepigen.c:1385
+#, c-format
+msgid "Export Flags \t\t\t%lx\n"
+msgstr ""
+
+#: peigen.c:1388 pepigen.c:1388
+#, c-format
+msgid "Time/Date stamp \t\t%lx\n"
+msgstr ""
+
+#: peigen.c:1391 pepigen.c:1391
+#, c-format
+msgid "Major/Minor \t\t\t%d/%d\n"
+msgstr ""
+
+#: peigen.c:1394 pepigen.c:1394
+msgid "Name \t\t\t\t"
+msgstr ""
+
+#: peigen.c:1400 pepigen.c:1400
+#, c-format
+msgid "Ordinal Base \t\t\t%ld\n"
+msgstr ""
+
+#: peigen.c:1403 pepigen.c:1403
+msgid "Number in:\n"
+msgstr ""
+
+#: peigen.c:1406 pepigen.c:1406
+#, c-format
+msgid "\tExport Address Table \t\t%08lx\n"
+msgstr ""
+
+#: peigen.c:1410 pepigen.c:1410
+#, c-format
+msgid "\t[Name Pointer/Ordinal] Table\t%08lx\n"
+msgstr ""
+
+#: peigen.c:1413 pepigen.c:1413
+msgid "Table Addresses\n"
+msgstr ""
+
+#: peigen.c:1416 pepigen.c:1416
+msgid "\tExport Address Table \t\t"
+msgstr ""
+
+#: peigen.c:1421 pepigen.c:1421
+msgid "\tName Pointer Table \t\t"
+msgstr ""
+
+#: peigen.c:1426 pepigen.c:1426
+msgid "\tOrdinal Table \t\t\t"
+msgstr ""
+
+#: peigen.c:1441 pepigen.c:1441
+#, c-format
+msgid ""
+"\n"
+"Export Address Table -- Ordinal Base %ld\n"
+msgstr ""
+
+#: peigen.c:1460 pepigen.c:1460
+msgid "Forwarder RVA"
+msgstr ""
+
+#: peigen.c:1471 pepigen.c:1471
+msgid "Export RVA"
+msgstr ""
+
+#: peigen.c:1478 pepigen.c:1478
+msgid ""
+"\n"
+"[Ordinal/Name Pointer] Table\n"
+msgstr ""
+
+#: peigen.c:1533 pepigen.c:1533
+#, c-format
+msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n"
+msgstr ""
+
+#: peigen.c:1537 pepigen.c:1537
+msgid ""
+"\n"
+"The Function Table (interpreted .pdata section contents)\n"
+msgstr ""
+
+#: peigen.c:1540 pepigen.c:1540
+msgid " vma:\t\t\tBegin Address End Address Unwind Info\n"
+msgstr ""
+
+#: peigen.c:1543 pepigen.c:1543
+msgid " vma:\t\tBegin End EH EH PrologEnd Exception\n"
+msgstr ""
+
+#: peigen.c:1545 pepigen.c:1545
+msgid " \t\tAddress Address Handler Data Address Mask\n"
+msgstr ""
+
+#: peigen.c:1613 pepigen.c:1613
+msgid " Register save millicode"
+msgstr ""
+
+#: peigen.c:1616 pepigen.c:1616
+msgid " Register restore millicode"
+msgstr ""
+
+#: peigen.c:1619 pepigen.c:1619
+msgid " Glue code sequence"
+msgstr ""
+
+#: peigen.c:1671 pepigen.c:1671
+msgid ""
+"\n"
+"\n"
+"PE File Base Relocations (interpreted .reloc section contents)\n"
+msgstr ""
+
+#: peigen.c:1701 pepigen.c:1701
+#, c-format
+msgid ""
+"\n"
+"Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n"
+msgstr ""
+
+#: peigen.c:1714 pepigen.c:1714
+#, c-format
+msgid "\treloc %4d offset %4x [%4lx] %s"
+msgstr ""
+
+#. The MS dumpbin program reportedly ands with 0xff0f before
+#. printing the characteristics field. Not sure why. No reason to
+#. emulate it here.
+#: peigen.c:1754 pepigen.c:1754
+#, c-format
+msgid ""
+"\n"
+"Characteristics 0x%x\n"
msgstr ""
diff --git a/contrib/binutils/bfd/ppcboot.c b/contrib/binutils/bfd/ppcboot.c
index b2250a0..9ac3f31 100644
--- a/contrib/binutils/bfd/ppcboot.c
+++ b/contrib/binutils/bfd/ppcboot.c
@@ -1,5 +1,5 @@
/* BFD back-end for PPCbug boot records.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Michael Meissner, Cygnus Support, <meissner@cygnus.com>
@@ -32,8 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
the file. objcopy cooperates by specially setting the start
address to zero by default. */
-#include <ctype.h>
-
+#include "safe-ctype.h"
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
@@ -97,7 +96,6 @@ static boolean ppcboot_get_section_contents
static long ppcboot_get_symtab_upper_bound PARAMS ((bfd *));
static char *mangle_name PARAMS ((bfd *, char *));
static long ppcboot_get_symtab PARAMS ((bfd *, asymbol **));
-static asymbol *ppcboot_make_empty_symbol PARAMS ((bfd *));
static void ppcboot_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
static boolean ppcboot_set_section_contents
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
@@ -114,7 +112,10 @@ ppcboot_mkobject (abfd)
bfd *abfd;
{
if (!ppcboot_get_tdata (abfd))
- ppcboot_set_tdata (abfd, bfd_zalloc (abfd, sizeof (ppcboot_data_t)));
+ {
+ bfd_size_type amt = sizeof (ppcboot_data_t);
+ ppcboot_set_tdata (abfd, bfd_zalloc (abfd, amt));
+ }
return true;
}
@@ -172,7 +173,8 @@ ppcboot_object_p (abfd)
return NULL;
}
- if (bfd_read ((PTR) &hdr, sizeof (hdr), 1, abfd) != sizeof (hdr))
+ if (bfd_bread ((PTR) &hdr, (bfd_size_type) sizeof (hdr), abfd)
+ != sizeof (hdr))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
@@ -216,7 +218,7 @@ ppcboot_object_p (abfd)
tdata->sec = sec;
memcpy ((PTR) &tdata->header, (PTR) &hdr, sizeof (ppcboot_hdr_t));
- ppcboot_set_arch_mach (abfd, bfd_arch_powerpc, 0);
+ ppcboot_set_arch_mach (abfd, bfd_arch_powerpc, 0L);
return abfd->xvec;
}
@@ -235,8 +237,8 @@ ppcboot_get_section_contents (abfd, section, location, offset, count)
file_ptr offset;
bfd_size_type count;
{
- if (bfd_seek (abfd, offset + sizeof (ppcboot_hdr_t), SEEK_SET) != 0
- || bfd_read (location, 1, count, abfd) != count)
+ if (bfd_seek (abfd, offset + (file_ptr) sizeof (ppcboot_hdr_t), SEEK_SET) != 0
+ || bfd_bread (location, count, abfd) != count)
return false;
return true;
}
@@ -259,7 +261,7 @@ mangle_name (abfd, suffix)
bfd *abfd;
char *suffix;
{
- int size;
+ bfd_size_type size;
char *buf;
char *p;
@@ -275,7 +277,7 @@ mangle_name (abfd, suffix)
/* Change any non-alphanumeric characters to underscores. */
for (p = buf; *p; p++)
- if (! isalnum ((unsigned char) *p))
+ if (! ISALNUM (*p))
*p = '_';
return buf;
@@ -292,8 +294,9 @@ ppcboot_get_symtab (abfd, alocation)
asection *sec = ppcboot_get_tdata (abfd)->sec;
asymbol *syms;
unsigned int i;
+ bfd_size_type amt = PPCBOOT_SYMS * sizeof (asymbol);
- syms = (asymbol *) bfd_alloc (abfd, PPCBOOT_SYMS * sizeof (asymbol));
+ syms = (asymbol *) bfd_alloc (abfd, amt);
if (syms == NULL)
return false;
@@ -328,17 +331,7 @@ ppcboot_get_symtab (abfd, alocation)
return PPCBOOT_SYMS;
}
-
-/* Make an empty symbol. */
-
-static asymbol *
-ppcboot_make_empty_symbol (abfd)
- bfd *abfd;
-{
- return (asymbol *) bfd_alloc (abfd, sizeof (asymbol));
-}
-
-
+#define ppcboot_make_empty_symbol _bfd_generic_make_empty_symbol
#define ppcboot_print_symbol _bfd_nosymbols_print_symbol
/* Get information about a symbol. */
@@ -475,6 +468,7 @@ ppcboot_bfd_print_private_bfd_data (abfd, farg)
bfd_generic_get_relocated_section_contents
#define ppcboot_bfd_relax_section bfd_generic_relax_section
#define ppcboot_bfd_gc_sections bfd_generic_gc_sections
+#define ppcboot_bfd_merge_sections bfd_generic_merge_sections
#define ppcboot_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ppcboot_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define ppcboot_bfd_final_link _bfd_generic_final_link
diff --git a/contrib/binutils/bfd/ptrace-core.c b/contrib/binutils/bfd/ptrace-core.c
index 704391a..f8db927 100644
--- a/contrib/binutils/bfd/ptrace-core.c
+++ b/contrib/binutils/bfd/ptrace-core.c
@@ -1,5 +1,5 @@
/* BFD backend for core files which use the ptrace_user structure
- Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001
+ Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002
Free Software Foundation, Inc.
The structure of this file is based on trad-core.c written by John Gilmore
of Cygnus Support.
@@ -64,8 +64,9 @@ ptrace_unix_core_file_p (abfd)
int val;
struct ptrace_user u;
struct trad_core_struct *rawptr;
+ bfd_size_type amt;
- val = bfd_read ((void *)&u, 1, sizeof u, abfd);
+ val = bfd_bread ((void *)&u, (bfd_size_type) sizeof u, abfd);
if (val != sizeof u || u.pt_magic != _BCS_PTRACE_MAGIC
|| u.pt_rev != _BCS_PTRACE_REV)
{
@@ -78,8 +79,8 @@ ptrace_unix_core_file_p (abfd)
/* Allocate both the upage and the struct core_data at once, so
a single free() will free them both. */
- rawptr = (struct trad_core_struct *)
- bfd_zalloc (abfd, sizeof (struct trad_core_struct));
+ amt = sizeof (struct trad_core_struct);
+ rawptr = (struct trad_core_struct *) bfd_zalloc (abfd, amt);
if (rawptr == NULL)
return 0;
@@ -88,22 +89,17 @@ ptrace_unix_core_file_p (abfd)
rawptr->u = u; /*Copy the uarea into the tdata part of the bfd */
- /* Create the sections. This is raunchy, but bfd_close wants to free
- them separately. */
+ /* Create the sections. */
- core_stacksec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
+ core_stacksec (abfd) = bfd_make_section_anyway (abfd, ".stack");
if (core_stacksec (abfd) == NULL)
- return NULL;
- core_datasec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
+ goto fail;
+ core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data");
if (core_datasec (abfd) == NULL)
- return NULL;
- core_regsec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
+ goto fail;
+ core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
if (core_regsec (abfd) == NULL)
- return NULL;
-
- core_stacksec (abfd)->name = ".stack";
- core_datasec (abfd)->name = ".data";
- core_regsec (abfd)->name = ".reg";
+ goto fail;
/* FIXME: Need to worry about shared memory, library data, and library
text. I don't think that any of these things are supported on the
@@ -130,12 +126,13 @@ ptrace_unix_core_file_p (abfd)
core_datasec (abfd)->alignment_power = 2;
core_regsec (abfd)->alignment_power = 2;
- abfd->sections = core_stacksec (abfd);
- core_stacksec (abfd)->next = core_datasec (abfd);
- core_datasec (abfd)->next = core_regsec (abfd);
- abfd->section_count = 3;
-
return abfd->xvec;
+
+ fail:
+ bfd_release (abfd, abfd->tdata.any);
+ abfd->tdata.any = NULL;
+ bfd_section_list_clear (abfd);
+ return NULL;
}
char *
diff --git a/contrib/binutils/bfd/reloc.c b/contrib/binutils/bfd/reloc.c
index 1c45f6f..d73ad24 100644
--- a/contrib/binutils/bfd/reloc.c
+++ b/contrib/binutils/bfd/reloc.c
@@ -65,31 +65,31 @@ CODE_FRAGMENT
.
.typedef enum bfd_reloc_status
.{
-. {* No errors detected *}
+. {* No errors detected *}
. bfd_reloc_ok,
.
-. {* The relocation was performed, but there was an overflow. *}
+. {* The relocation was performed, but there was an overflow. *}
. bfd_reloc_overflow,
.
-. {* The address to relocate was not within the section supplied. *}
+. {* The address to relocate was not within the section supplied. *}
. bfd_reloc_outofrange,
.
-. {* Used by special functions *}
+. {* Used by special functions *}
. bfd_reloc_continue,
.
-. {* Unsupported relocation size requested. *}
+. {* Unsupported relocation size requested. *}
. bfd_reloc_notsupported,
.
-. {* Unused *}
+. {* Unused *}
. bfd_reloc_other,
.
-. {* The symbol to relocate against was undefined. *}
+. {* The symbol to relocate against was undefined. *}
. bfd_reloc_undefined,
.
-. {* The relocation was performed, but may not be ok - presently
-. generated only when linking i960 coff files with i960 b.out
-. symbols. If this type is returned, the error_message argument
-. to bfd_perform_relocation will be set. *}
+. {* The relocation was performed, but may not be ok - presently
+. generated only when linking i960 coff files with i960 b.out
+. symbols. If this type is returned, the error_message argument
+. to bfd_perform_relocation will be set. *}
. bfd_reloc_dangerous
. }
. bfd_reloc_status_type;
@@ -97,16 +97,16 @@ CODE_FRAGMENT
.
.typedef struct reloc_cache_entry
.{
-. {* A pointer into the canonical table of pointers *}
+. {* A pointer into the canonical table of pointers *}
. struct symbol_cache_entry **sym_ptr_ptr;
.
-. {* offset in section *}
+. {* offset in section *}
. bfd_size_type address;
.
-. {* addend for relocation value *}
+. {* addend for relocation value *}
. bfd_vma addend;
.
-. {* Pointer to how to perform the required relocation *}
+. {* Pointer to how to perform the required relocation *}
. reloc_howto_type *howto;
.
.} arelent;
@@ -250,19 +250,19 @@ CODE_FRAGMENT
.
.enum complain_overflow
.{
-. {* Do not complain on overflow. *}
+. {* Do not complain on overflow. *}
. complain_overflow_dont,
.
-. {* Complain if the bitfield overflows, whether it is considered
-. as signed or unsigned. *}
+. {* Complain if the bitfield overflows, whether it is considered
+. as signed or unsigned. *}
. complain_overflow_bitfield,
.
-. {* Complain if the value overflows when considered as signed
-. number. *}
+. {* Complain if the value overflows when considered as signed
+. number. *}
. complain_overflow_signed,
.
-. {* Complain if the value overflows when considered as an
-. unsigned number. *}
+. {* Complain if the value overflows when considered as an
+. unsigned number. *}
. complain_overflow_unsigned
.};
@@ -280,97 +280,91 @@ CODE_FRAGMENT
.
.struct reloc_howto_struct
.{
-. {* The type field has mainly a documentary use - the back end can
-. do what it wants with it, though normally the back end's
-. external idea of what a reloc number is stored
-. in this field. For example, a PC relative word relocation
-. in a coff environment has the type 023 - because that's
-. what the outside world calls a R_PCRWORD reloc. *}
+. {* The type field has mainly a documentary use - the back end can
+. do what it wants with it, though normally the back end's
+. external idea of what a reloc number is stored
+. in this field. For example, a PC relative word relocation
+. in a coff environment has the type 023 - because that's
+. what the outside world calls a R_PCRWORD reloc. *}
. unsigned int type;
.
-. {* The value the final relocation is shifted right by. This drops
-. unwanted data from the relocation. *}
+. {* The value the final relocation is shifted right by. This drops
+. unwanted data from the relocation. *}
. unsigned int rightshift;
.
-. {* The size of the item to be relocated. This is *not* a
-. power-of-two measure. To get the number of bytes operated
-. on by a type of relocation, use bfd_get_reloc_size. *}
+. {* The size of the item to be relocated. This is *not* a
+. power-of-two measure. To get the number of bytes operated
+. on by a type of relocation, use bfd_get_reloc_size. *}
. int size;
.
-. {* The number of bits in the item to be relocated. This is used
-. when doing overflow checking. *}
+. {* The number of bits in the item to be relocated. This is used
+. when doing overflow checking. *}
. unsigned int bitsize;
.
-. {* Notes that the relocation is relative to the location in the
-. data section of the addend. The relocation function will
-. subtract from the relocation value the address of the location
-. being relocated. *}
+. {* Notes that the relocation is relative to the location in the
+. data section of the addend. The relocation function will
+. subtract from the relocation value the address of the location
+. being relocated. *}
. boolean pc_relative;
.
-. {* The bit position of the reloc value in the destination.
-. The relocated value is left shifted by this amount. *}
+. {* The bit position of the reloc value in the destination.
+. The relocated value is left shifted by this amount. *}
. unsigned int bitpos;
.
-. {* What type of overflow error should be checked for when
-. relocating. *}
+. {* What type of overflow error should be checked for when
+. relocating. *}
. enum complain_overflow complain_on_overflow;
.
-. {* If this field is non null, then the supplied function is
-. called rather than the normal function. This allows really
-. strange relocation methods to be accomodated (e.g., i960 callj
-. instructions). *}
+. {* If this field is non null, then the supplied function is
+. called rather than the normal function. This allows really
+. strange relocation methods to be accomodated (e.g., i960 callj
+. instructions). *}
. bfd_reloc_status_type (*special_function)
-. PARAMS ((bfd *abfd,
-. arelent *reloc_entry,
-. struct symbol_cache_entry *symbol,
-. PTR data,
-. asection *input_section,
-. bfd *output_bfd,
-. char **error_message));
+. PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *,
+. bfd *, char **));
.
-. {* The textual name of the relocation type. *}
+. {* The textual name of the relocation type. *}
. char *name;
.
-. {* Some formats record a relocation addend in the section contents
-. rather than with the relocation. For ELF formats this is the
-. distinction between USE_REL and USE_RELA (though the code checks
-. for USE_REL == 1/0). The value of this field is TRUE if the
-. addend is recorded with the section contents; when performing a
-. partial link (ld -r) the section contents (the data) will be
-. modified. The value of this field is FALSE if addends are
-. recorded with the relocation (in arelent.addend); when performing
-. a partial link the relocation will be modified.
-. All relocations for all ELF USE_RELA targets should set this field
-. to FALSE (values of TRUE should be looked on with suspicion).
-. However, the converse is not true: not all relocations of all ELF
-. USE_REL targets set this field to TRUE. Why this is so is peculiar
-. to each particular target. For relocs that aren't used in partial
-. links (e.g. GOT stuff) it doesn't matter what this is set to. *}
+. {* Some formats record a relocation addend in the section contents
+. rather than with the relocation. For ELF formats this is the
+. distinction between USE_REL and USE_RELA (though the code checks
+. for USE_REL == 1/0). The value of this field is TRUE if the
+. addend is recorded with the section contents; when performing a
+. partial link (ld -r) the section contents (the data) will be
+. modified. The value of this field is FALSE if addends are
+. recorded with the relocation (in arelent.addend); when performing
+. a partial link the relocation will be modified.
+. All relocations for all ELF USE_RELA targets should set this field
+. to FALSE (values of TRUE should be looked on with suspicion).
+. However, the converse is not true: not all relocations of all ELF
+. USE_REL targets set this field to TRUE. Why this is so is peculiar
+. to each particular target. For relocs that aren't used in partial
+. links (e.g. GOT stuff) it doesn't matter what this is set to. *}
. boolean partial_inplace;
.
-. {* The src_mask selects which parts of the read in data
-. are to be used in the relocation sum. E.g., if this was an 8 bit
-. byte of data which we read and relocated, this would be
-. 0x000000ff. When we have relocs which have an addend, such as
-. sun4 extended relocs, the value in the offset part of a
-. relocating field is garbage so we never use it. In this case
-. the mask would be 0x00000000. *}
+. {* The src_mask selects which parts of the read in data
+. are to be used in the relocation sum. E.g., if this was an 8 bit
+. byte of data which we read and relocated, this would be
+. 0x000000ff. When we have relocs which have an addend, such as
+. sun4 extended relocs, the value in the offset part of a
+. relocating field is garbage so we never use it. In this case
+. the mask would be 0x00000000. *}
. bfd_vma src_mask;
.
-. {* The dst_mask selects which parts of the instruction are replaced
-. into the instruction. In most cases src_mask == dst_mask,
-. except in the above special case, where dst_mask would be
-. 0x000000ff, and src_mask would be 0x00000000. *}
+. {* The dst_mask selects which parts of the instruction are replaced
+. into the instruction. In most cases src_mask == dst_mask,
+. except in the above special case, where dst_mask would be
+. 0x000000ff, and src_mask would be 0x00000000. *}
. bfd_vma dst_mask;
.
-. {* When some formats create PC relative instructions, they leave
-. the value of the pc of the place being relocated in the offset
-. slot of the instruction, so that a PC relative relocation can
-. be made just by adding in an ordinary offset (e.g., sun3 a.out).
-. Some formats leave the displacement part of an instruction
-. empty (e.g., m88k bcs); this flag signals the fact.*}
+. {* When some formats create PC relative instructions, they leave
+. the value of the pc of the place being relocated in the offset
+. slot of the instruction, so that a PC relative relocation can
+. be made just by adding in an ordinary offset (e.g., sun3 a.out).
+. Some formats leave the displacement part of an instruction
+. empty (e.g., m88k bcs); this flag signals the fact. *}
. boolean pcrel_offset;
-.
.};
*/
@@ -382,37 +376,43 @@ FUNCTION
DESCRIPTION
The HOWTO define is horrible and will go away.
-.#define HOWTO(C, R,S,B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
-. {(unsigned)C,R,S,B, P, BI, O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC}
+.#define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
+. { (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC }
DESCRIPTION
And will be replaced with the totally magic way. But for the
moment, we are compatible, so do it this way.
-.#define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,complain_overflow_dont,FUNCTION, NAME,false,0,0,IN)
+.#define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \
+. HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \
+. NAME, false, 0, 0, IN)
.
DESCRIPTION
This is used to fill in an empty howto entry in an array.
.#define EMPTY_HOWTO(C) \
-. HOWTO((C),0,0,0,false,0,complain_overflow_dont,NULL,NULL,false,0,0,false)
+. HOWTO ((C), 0, 0, 0, false, 0, complain_overflow_dont, NULL, \
+. NULL, false, 0, 0, false)
.
DESCRIPTION
Helper routine to turn a symbol into a relocation value.
-.#define HOWTO_PREPARE(relocation, symbol) \
-. { \
-. if (symbol != (asymbol *)NULL) { \
-. if (bfd_is_com_section (symbol->section)) { \
-. relocation = 0; \
-. } \
-. else { \
-. relocation = symbol->value; \
-. } \
-. } \
-.}
+.#define HOWTO_PREPARE(relocation, symbol) \
+. { \
+. if (symbol != (asymbol *) NULL) \
+. { \
+. if (bfd_is_com_section (symbol->section)) \
+. { \
+. relocation = 0; \
+. } \
+. else \
+. { \
+. relocation = symbol->value; \
+. } \
+. } \
+. }
*/
@@ -453,9 +453,10 @@ DESCRIPTION
How relocs are tied together in an <<asection>>:
-.typedef struct relent_chain {
+.typedef struct relent_chain
+.{
. arelent relent;
-. struct relent_chain *next;
+. struct relent_chain *next;
.} arelent_chain;
*/
@@ -626,8 +627,8 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
}
/* Is the address of the relocation really within the section? */
- if (reloc_entry->address > input_section->_cooked_size /
- bfd_octets_per_byte (abfd))
+ if (reloc_entry->address > (input_section->_cooked_size
+ / bfd_octets_per_byte (abfd)))
return bfd_reloc_outofrange;
/* Work out which section the relocation is targetted at and the
@@ -903,14 +904,14 @@ space consuming. For each target:
{
short x = bfd_get_16 (abfd, (bfd_byte *) data + octets);
DOIT (x);
- bfd_put_16 (abfd, x, (unsigned char *) data + octets);
+ bfd_put_16 (abfd, (bfd_vma) x, (unsigned char *) data + octets);
}
break;
case 2:
{
long x = bfd_get_32 (abfd, (bfd_byte *) data + octets);
DOIT (x);
- bfd_put_32 (abfd, x, (bfd_byte *) data + octets);
+ bfd_put_32 (abfd, (bfd_vma) x, (bfd_byte *) data + octets);
}
break;
case -2:
@@ -918,7 +919,7 @@ space consuming. For each target:
long x = bfd_get_32 (abfd, (bfd_byte *) data + octets);
relocation = -relocation;
DOIT (x);
- bfd_put_32 (abfd, x, (bfd_byte *) data + octets);
+ bfd_put_32 (abfd, (bfd_vma) x, (bfd_byte *) data + octets);
}
break;
@@ -927,7 +928,7 @@ space consuming. For each target:
long x = bfd_get_16 (abfd, (bfd_byte *) data + octets);
relocation = -relocation;
DOIT (x);
- bfd_put_16 (abfd, x, (bfd_byte *) data + octets);
+ bfd_put_16 (abfd, (bfd_vma) x, (bfd_byte *) data + octets);
}
break;
@@ -1022,7 +1023,8 @@ bfd_install_relocation (abfd, reloc_entry, data_start, data_start_offset,
}
/* Is the address of the relocation really within the section? */
- if (reloc_entry->address > input_section->_cooked_size)
+ if (reloc_entry->address > (input_section->_cooked_size
+ / bfd_octets_per_byte (abfd)))
return bfd_reloc_outofrange;
/* Work out which section the relocation is targetted at and the
@@ -1292,14 +1294,14 @@ space consuming. For each target:
{
short x = bfd_get_16 (abfd, (bfd_byte *) data);
DOIT (x);
- bfd_put_16 (abfd, x, (unsigned char *) data);
+ bfd_put_16 (abfd, (bfd_vma) x, (unsigned char *) data);
}
break;
case 2:
{
long x = bfd_get_32 (abfd, (bfd_byte *) data);
DOIT (x);
- bfd_put_32 (abfd, x, (bfd_byte *) data);
+ bfd_put_32 (abfd, (bfd_vma) x, (bfd_byte *) data);
}
break;
case -2:
@@ -1307,7 +1309,7 @@ space consuming. For each target:
long x = bfd_get_32 (abfd, (bfd_byte *) data);
relocation = -relocation;
DOIT (x);
- bfd_put_32 (abfd, x, (bfd_byte *) data);
+ bfd_put_32 (abfd, (bfd_vma) x, (bfd_byte *) data);
}
break;
@@ -1681,6 +1683,8 @@ ENUMX
ENUMX
BFD_RELOC_8_GOTOFF
ENUMX
+ BFD_RELOC_64_PLT_PCREL
+ENUMX
BFD_RELOC_32_PLT_PCREL
ENUMX
BFD_RELOC_24_PLT_PCREL
@@ -1689,6 +1693,8 @@ ENUMX
ENUMX
BFD_RELOC_8_PLT_PCREL
ENUMX
+ BFD_RELOC_64_PLTOFF
+ENUMX
BFD_RELOC_32_PLTOFF
ENUMX
BFD_RELOC_16_PLTOFF
@@ -1851,6 +1857,8 @@ ENUMEQX
BFD_RELOC_SPARC_DISP64
BFD_RELOC_64_PCREL
ENUMX
+ BFD_RELOC_SPARC_PLT32
+ENUMX
BFD_RELOC_SPARC_PLT64
ENUMX
BFD_RELOC_SPARC_HIX22
@@ -1927,27 +1935,6 @@ ENUMDOC
2 - byte-manipulation (byte offset reg)
3 - jsr (target of branch)
- The GNU linker currently doesn't do any of this optimizing.
-
-ENUM
- BFD_RELOC_ALPHA_USER_LITERAL
-ENUMX
- BFD_RELOC_ALPHA_USER_LITUSE_BASE
-ENUMX
- BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF
-ENUMX
- BFD_RELOC_ALPHA_USER_LITUSE_JSR
-ENUMX
- BFD_RELOC_ALPHA_USER_GPDISP
-ENUMX
- BFD_RELOC_ALPHA_USER_GPRELHIGH
-ENUMX
- BFD_RELOC_ALPHA_USER_GPRELLOW
-ENUMDOC
- The BFD_RELOC_ALPHA_USER_* relocations are used by the assembler to
- process the explicit !<reloc>!sequence relocations, and are mapped
- into the normal relocations at the end of processing.
-
ENUM
BFD_RELOC_ALPHA_HINT
ENUMDOC
@@ -1968,6 +1955,14 @@ ENUMDOC
which is filled by the linker.
ENUM
+ BFD_RELOC_ALPHA_GPREL_HI16
+ENUMX
+ BFD_RELOC_ALPHA_GPREL_LO16
+ENUMDOC
+ The GPREL_HI/LO relocations together form a 32-bit offset from the
+ GP register.
+
+ENUM
BFD_RELOC_MIPS_JMP
ENUMDOC
Bits 27..2 of the relocation address shifted right 2 bits;
@@ -2007,12 +2002,6 @@ ENUM
ENUMDOC
Like BFD_RELOC_LO16, but PC relative.
-ENUMEQ
- BFD_RELOC_MIPS_GPREL
- BFD_RELOC_GPREL16
-ENUMDOC
- Relocation relative to the global pointer.
-
ENUM
BFD_RELOC_MIPS_LITERAL
ENUMDOC
@@ -2022,9 +2011,6 @@ ENUM
BFD_RELOC_MIPS_GOT16
ENUMX
BFD_RELOC_MIPS_CALL16
-ENUMEQX
- BFD_RELOC_MIPS_GPREL32
- BFD_RELOC_GPREL32
ENUMX
BFD_RELOC_MIPS_GOT_HI16
ENUMX
@@ -2135,6 +2121,13 @@ ENUMDOC
ns32k relocations
ENUM
+ BFD_RELOC_PDP11_DISP_8_PCREL
+ENUMX
+ BFD_RELOC_PDP11_DISP_6_PCREL
+ENUMDOC
+ PDP11 relocations
+
+ENUM
BFD_RELOC_PJ_CODE_HI16
ENUMX
BFD_RELOC_PJ_CODE_LO16
@@ -2209,6 +2202,52 @@ ENUMX
BFD_RELOC_PPC_EMB_BIT_FLD
ENUMX
BFD_RELOC_PPC_EMB_RELSDA
+ENUMX
+ BFD_RELOC_PPC64_HIGHER
+ENUMX
+ BFD_RELOC_PPC64_HIGHER_S
+ENUMX
+ BFD_RELOC_PPC64_HIGHEST
+ENUMX
+ BFD_RELOC_PPC64_HIGHEST_S
+ENUMX
+ BFD_RELOC_PPC64_TOC16_LO
+ENUMX
+ BFD_RELOC_PPC64_TOC16_HI
+ENUMX
+ BFD_RELOC_PPC64_TOC16_HA
+ENUMX
+ BFD_RELOC_PPC64_TOC
+ENUMX
+ BFD_RELOC_PPC64_PLTGOT16
+ENUMX
+ BFD_RELOC_PPC64_PLTGOT16_LO
+ENUMX
+ BFD_RELOC_PPC64_PLTGOT16_HI
+ENUMX
+ BFD_RELOC_PPC64_PLTGOT16_HA
+ENUMX
+ BFD_RELOC_PPC64_ADDR16_DS
+ENUMX
+ BFD_RELOC_PPC64_ADDR16_LO_DS
+ENUMX
+ BFD_RELOC_PPC64_GOT16_DS
+ENUMX
+ BFD_RELOC_PPC64_GOT16_LO_DS
+ENUMX
+ BFD_RELOC_PPC64_PLT16_LO_DS
+ENUMX
+ BFD_RELOC_PPC64_SECTOFF_DS
+ENUMX
+ BFD_RELOC_PPC64_SECTOFF_LO_DS
+ENUMX
+ BFD_RELOC_PPC64_TOC16_DS
+ENUMX
+ BFD_RELOC_PPC64_TOC16_LO_DS
+ENUMX
+ BFD_RELOC_PPC64_PLTGOT16_DS
+ENUMX
+ BFD_RELOC_PPC64_PLTGOT16_LO_DS
ENUMDOC
Power(rs6000) and PowerPC relocations.
@@ -2678,6 +2717,78 @@ ENUMDOC
Motorola Mcore relocations.
ENUM
+ BFD_RELOC_MMIX_GETA
+ENUMX
+ BFD_RELOC_MMIX_GETA_1
+ENUMX
+ BFD_RELOC_MMIX_GETA_2
+ENUMX
+ BFD_RELOC_MMIX_GETA_3
+ENUMDOC
+ These are relocations for the GETA instruction.
+ENUM
+ BFD_RELOC_MMIX_CBRANCH
+ENUMX
+ BFD_RELOC_MMIX_CBRANCH_J
+ENUMX
+ BFD_RELOC_MMIX_CBRANCH_1
+ENUMX
+ BFD_RELOC_MMIX_CBRANCH_2
+ENUMX
+ BFD_RELOC_MMIX_CBRANCH_3
+ENUMDOC
+ These are relocations for a conditional branch instruction.
+ENUM
+ BFD_RELOC_MMIX_PUSHJ
+ENUMX
+ BFD_RELOC_MMIX_PUSHJ_1
+ENUMX
+ BFD_RELOC_MMIX_PUSHJ_2
+ENUMX
+ BFD_RELOC_MMIX_PUSHJ_3
+ENUMDOC
+ These are relocations for the PUSHJ instruction.
+ENUM
+ BFD_RELOC_MMIX_JMP
+ENUMX
+ BFD_RELOC_MMIX_JMP_1
+ENUMX
+ BFD_RELOC_MMIX_JMP_2
+ENUMX
+ BFD_RELOC_MMIX_JMP_3
+ENUMDOC
+ These are relocations for the JMP instruction.
+ENUM
+ BFD_RELOC_MMIX_ADDR19
+ENUMDOC
+ This is a relocation for a relative address as in a GETA instruction or
+ a branch.
+ENUM
+ BFD_RELOC_MMIX_ADDR27
+ENUMDOC
+ This is a relocation for a relative address as in a JMP instruction.
+ENUM
+ BFD_RELOC_MMIX_REG_OR_BYTE
+ENUMDOC
+ This is a relocation for an instruction field that may be a general
+ register or a value 0..255.
+ENUM
+ BFD_RELOC_MMIX_REG
+ENUMDOC
+ This is a relocation for an instruction field that may be a general
+ register.
+ENUM
+ BFD_RELOC_MMIX_BASE_PLUS_OFFSET
+ENUMDOC
+ This is a relocation for two instruction fields holding a register and
+ an offset, the equivalent of the relocation.
+ENUM
+ BFD_RELOC_MMIX_LOCAL
+ENUMDOC
+ This relocation is an assertion that the expression is not allocated as
+ a global register. It does not modify contents.
+
+ENUM
BFD_RELOC_AVR_7_PCREL
ENUMDOC
This is a 16 bit reloc for the AVR that stores 8 bit pc relative
@@ -2763,6 +2874,75 @@ ENUMDOC
into 22 bits.
ENUM
+ BFD_RELOC_390_12
+ENUMDOC
+ Direct 12 bit.
+ENUM
+ BFD_RELOC_390_GOT12
+ENUMDOC
+ 12 bit GOT offset.
+ENUM
+ BFD_RELOC_390_PLT32
+ENUMDOC
+ 32 bit PC relative PLT address.
+ENUM
+ BFD_RELOC_390_COPY
+ENUMDOC
+ Copy symbol at runtime.
+ENUM
+ BFD_RELOC_390_GLOB_DAT
+ENUMDOC
+ Create GOT entry.
+ENUM
+ BFD_RELOC_390_JMP_SLOT
+ENUMDOC
+ Create PLT entry.
+ENUM
+ BFD_RELOC_390_RELATIVE
+ENUMDOC
+ Adjust by program base.
+ENUM
+ BFD_RELOC_390_GOTPC
+ENUMDOC
+ 32 bit PC relative offset to GOT.
+ENUM
+ BFD_RELOC_390_GOT16
+ENUMDOC
+ 16 bit GOT offset.
+ENUM
+ BFD_RELOC_390_PC16DBL
+ENUMDOC
+ PC relative 16 bit shifted by 1.
+ENUM
+ BFD_RELOC_390_PLT16DBL
+ENUMDOC
+ 16 bit PC rel. PLT shifted by 1.
+ENUM
+ BFD_RELOC_390_PC32DBL
+ENUMDOC
+ PC relative 32 bit shifted by 1.
+ENUM
+ BFD_RELOC_390_PLT32DBL
+ENUMDOC
+ 32 bit PC rel. PLT shifted by 1.
+ENUM
+ BFD_RELOC_390_GOTPCDBL
+ENUMDOC
+ 32 bit PC rel. GOT shifted by 1.
+ENUM
+ BFD_RELOC_390_GOT64
+ENUMDOC
+ 64 bit GOT offset.
+ENUM
+ BFD_RELOC_390_PLT64
+ENUMDOC
+ 64 bit PC relative PLT address.
+ENUM
+ BFD_RELOC_390_GOTENT
+ENUMDOC
+ 32 bit rel. offset to GOT entry.
+
+ENUM
BFD_RELOC_VTABLE_INHERIT
ENUMX
BFD_RELOC_VTABLE_ENTRY
@@ -2860,6 +3040,10 @@ ENUMX
ENUMX
BFD_RELOC_IA64_LTOFF_FPTR64I
ENUMX
+ BFD_RELOC_IA64_LTOFF_FPTR32MSB
+ENUMX
+ BFD_RELOC_IA64_LTOFF_FPTR32LSB
+ENUMX
BFD_RELOC_IA64_LTOFF_FPTR64MSB
ENUMX
BFD_RELOC_IA64_LTOFF_FPTR64LSB
@@ -2945,6 +3129,44 @@ ENUMX
ENUMDOC
These relocs are only used within the CRIS assembler. They are not
(at present) written to any object files.
+ENUM
+ BFD_RELOC_CRIS_COPY
+ENUMX
+ BFD_RELOC_CRIS_GLOB_DAT
+ENUMX
+ BFD_RELOC_CRIS_JUMP_SLOT
+ENUMX
+ BFD_RELOC_CRIS_RELATIVE
+ENUMDOC
+ Relocs used in ELF shared libraries for CRIS.
+ENUM
+ BFD_RELOC_CRIS_32_GOT
+ENUMDOC
+ 32-bit offset to symbol-entry within GOT.
+ENUM
+ BFD_RELOC_CRIS_16_GOT
+ENUMDOC
+ 16-bit offset to symbol-entry within GOT.
+ENUM
+ BFD_RELOC_CRIS_32_GOTPLT
+ENUMDOC
+ 32-bit offset to symbol-entry within GOT, with PLT handling.
+ENUM
+ BFD_RELOC_CRIS_16_GOTPLT
+ENUMDOC
+ 16-bit offset to symbol-entry within GOT, with PLT handling.
+ENUM
+ BFD_RELOC_CRIS_32_GOTREL
+ENUMDOC
+ 32-bit offset to symbol, relative to GOT.
+ENUM
+ BFD_RELOC_CRIS_32_PLT_GOTREL
+ENUMDOC
+ 32-bit offset to symbol with PLT entry, relative to GOT.
+ENUM
+ BFD_RELOC_CRIS_32_PLT_PCREL
+ENUMDOC
+ 32-bit offset to symbol with PLT entry, relative to this relocation.
ENUM
BFD_RELOC_860_COPY
@@ -3013,6 +3235,35 @@ ENUMX
ENUMDOC
Intel i860 Relocations.
+ENUM
+ BFD_RELOC_OPENRISC_ABS_26
+ENUMX
+ BFD_RELOC_OPENRISC_REL_26
+ENUMDOC
+ OpenRISC Relocations.
+
+ENUM
+ BFD_RELOC_H8_DIR16A8
+ENUMX
+ BFD_RELOC_H8_DIR16R8
+ENUMX
+ BFD_RELOC_H8_DIR24A8
+ENUMX
+ BFD_RELOC_H8_DIR24R8
+ENUMX
+ BFD_RELOC_H8_DIR32A16
+ENUMDOC
+ H8 elf Relocations.
+
+ENUM
+ BFD_RELOC_XSTORMY16_REL_12
+ENUMX
+ BFD_RELOC_XSTORMY16_24
+ENUMX
+ BFD_RELOC_XSTORMY16_FPTR16
+ENUMDOC
+ Sony Xstormy16 Relocations.
+
ENDSENUM
BFD_RELOC_UNUSED
CODE_FRAGMENT
@@ -3159,6 +3410,28 @@ bfd_generic_gc_sections (abfd, link_info)
/*
INTERNAL_FUNCTION
+ bfd_generic_merge_sections
+
+SYNOPSIS
+ boolean bfd_generic_merge_sections
+ (bfd *, struct bfd_link_info *);
+
+DESCRIPTION
+ Provides default handling for SEC_MERGE section merging for back ends
+ which don't have SEC_MERGE support -- i.e., does nothing.
+*/
+
+/*ARGSUSED*/
+boolean
+bfd_generic_merge_sections (abfd, link_info)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
+{
+ return true;
+}
+
+/*
+INTERNAL_FUNCTION
bfd_generic_get_relocated_section_contents
SYNOPSIS
@@ -3197,7 +3470,7 @@ bfd_generic_get_relocated_section_contents (abfd, link_info, link_order, data,
if (reloc_size < 0)
goto error_return;
- reloc_vector = (arelent **) bfd_malloc ((size_t) reloc_size);
+ reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
if (reloc_vector == NULL && reloc_size != 0)
goto error_return;
@@ -3205,7 +3478,7 @@ bfd_generic_get_relocated_section_contents (abfd, link_info, link_order, data,
if (!bfd_get_section_contents (input_bfd,
input_section,
(PTR) data,
- 0,
+ (bfd_vma) 0,
input_section->_raw_size))
goto error_return;
diff --git a/contrib/binutils/bfd/reloc16.c b/contrib/binutils/bfd/reloc16.c
index 7de8d95..1d69a7f 100644
--- a/contrib/binutils/bfd/reloc16.c
+++ b/contrib/binutils/bfd/reloc16.c
@@ -1,5 +1,5 @@
/* 8 and 16 bit COFF relocation functions, for BFD.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -137,17 +137,16 @@ bfd_perform_slip (abfd, slip, input_section, value)
}
boolean
-bfd_coff_reloc16_relax_section (abfd, i, link_info, again)
+bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again)
bfd *abfd;
- asection *i;
+ asection *input_section;
struct bfd_link_info *link_info;
boolean *again;
{
/* Get enough memory to hold the stuff. */
- bfd *input_bfd = i->owner;
- asection *input_section = i;
- int *shrinks;
- int shrink = 0;
+ bfd *input_bfd = input_section->owner;
+ unsigned *shrinks;
+ unsigned shrink = 0;
long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
arelent **reloc_vector = NULL;
long reloc_count;
@@ -159,7 +158,7 @@ bfd_coff_reloc16_relax_section (abfd, i, link_info, again)
if (reloc_size < 0)
return false;
- reloc_vector = (arelent **) bfd_malloc (reloc_size);
+ reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
if (!reloc_vector && reloc_size > 0)
return false;
@@ -191,11 +190,14 @@ bfd_coff_reloc16_relax_section (abfd, i, link_info, again)
if (reloc_count > 0)
{
int another_pass = 0;
+ bfd_size_type amt;
/* Allocate and initialize the shrinks array for this section.
The last element is used as an accumlator of shrinks. */
- shrinks = (int *) bfd_malloc ((reloc_count + 1) * sizeof (int));
- memset (shrinks, 0, (reloc_count + 1) * sizeof (int));
+ amt = reloc_count + 1;
+ amt *= sizeof (unsigned);
+ shrinks = (unsigned *) bfd_malloc (amt);
+ memset (shrinks, 0, (size_t) amt);
/* Loop until nothing changes in this section. */
do {
@@ -268,11 +270,11 @@ bfd_coff_reloc16_get_relocated_section_contents(in_abfd,
if (!bfd_get_section_contents(input_bfd,
input_section,
data,
- 0,
+ (bfd_vma) 0,
input_section->_raw_size))
return NULL;
- reloc_vector = (arelent **) bfd_malloc ((size_t) reloc_size);
+ reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
if (!reloc_vector && reloc_size != 0)
return NULL;
diff --git a/contrib/binutils/bfd/sco5-core.c b/contrib/binutils/bfd/sco5-core.c
index 62f9c98..9f5b793 100644
--- a/contrib/binutils/bfd/sco5-core.c
+++ b/contrib/binutils/bfd/sco5-core.c
@@ -1,5 +1,5 @@
/* BFD back end for SCO5 core files (U-area and raw sections)
- Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Written by Jouke Numan <jnuman@hiscom.nl>
This file is part of BFD, the Binary File Descriptor library.
@@ -43,7 +43,6 @@ struct sco5_core_struct
static asection *
make_bfd_asection PARAMS ((bfd *, const char *, flagword, bfd_size_type,
bfd_vma, file_ptr));
-static asymbol *sco5_core_make_empty_symbol PARAMS ((bfd *));
static struct user *read_uarea PARAMS ((bfd *, int));
const bfd_target *sco5_core_file_p PARAMS ((bfd *abfd));
char *sco5_core_file_failing_command PARAMS ((bfd *abfd));
@@ -75,16 +74,6 @@ make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos)
return asect;
}
-static asymbol *
-sco5_core_make_empty_symbol (abfd)
- bfd *abfd;
-{
- asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol));
- if (new)
- new->the_bfd = abfd;
- return new;
-}
-
static struct user *
read_uarea(abfd, filepos)
bfd *abfd;
@@ -92,17 +81,17 @@ read_uarea(abfd, filepos)
{
struct sco5_core_struct *rawptr;
+ bfd_size_type amt = sizeof (struct sco5_core_struct);
- rawptr = ((struct sco5_core_struct *)
- bfd_zmalloc (sizeof (struct sco5_core_struct)));
+ rawptr = (struct sco5_core_struct *) bfd_zmalloc (amt);
if (rawptr == NULL)
return NULL;
abfd->tdata.sco5_core_data = rawptr;
- if ((bfd_seek (abfd, filepos, SEEK_SET) != 0)
- || (bfd_read ((void *)&rawptr->u, 1, sizeof rawptr->u, abfd)
- != sizeof rawptr->u))
+ if (bfd_seek (abfd, (file_ptr) filepos, SEEK_SET) != 0
+ || bfd_bread ((void *) &rawptr->u, (bfd_size_type) sizeof rawptr->u,
+ abfd) != sizeof rawptr->u)
{
bfd_set_error (bfd_error_wrong_format);
return NULL;
@@ -150,9 +139,10 @@ sco5_core_file_p (abfd)
coresize = statbuf.st_size;
}
/* Last long in core is sizeof struct coreoffsets, read it */
- if ((bfd_seek (abfd, coresize-sizeof coffset_siz, SEEK_SET) != 0)
- || (bfd_read ((void *)&coffset_siz, 1, sizeof coffset_siz, abfd)
- != sizeof coffset_siz) )
+ if ((bfd_seek (abfd, (file_ptr) (coresize - sizeof coffset_siz),
+ SEEK_SET) != 0)
+ || bfd_bread ((void *) &coffset_siz, (bfd_size_type) sizeof coffset_siz,
+ abfd) != sizeof coffset_siz)
{
bfd_set_error (bfd_error_wrong_format);
return NULL;
@@ -160,8 +150,8 @@ sco5_core_file_p (abfd)
/* Use it to seek start of coreoffsets region, read it and determine
validity */
- if ((bfd_seek (abfd, coresize-coffset_siz, SEEK_SET) != 0)
- || (bfd_read ((void *)&coffsets, 1, sizeof coffsets, abfd)
+ if ((bfd_seek (abfd, (file_ptr) (coresize - coffset_siz), SEEK_SET) != 0)
+ || (bfd_bread ((void *) &coffsets, (bfd_size_type) sizeof coffsets, abfd)
!= sizeof coffsets)
|| ((coffsets.u_info != 1) && (coffsets.u_info != C_VERSION)))
{
@@ -173,15 +163,15 @@ sco5_core_file_p (abfd)
{
/* Old version, no section heads, read info from user struct */
- u = read_uarea(abfd, coffsets.u_user);
+ u = read_uarea (abfd, coffsets.u_user);
if (! u)
- return NULL;
+ goto fail;
if (!make_bfd_asection (abfd, ".reg", SEC_HAS_CONTENTS,
(bfd_size_type) coffsets.u_usize,
0 - (bfd_vma) u->u_ar0,
(file_ptr) coffsets.u_user))
- return NULL;
+ goto fail;
if (!make_bfd_asection (abfd, ".data",
SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS,
@@ -189,14 +179,14 @@ sco5_core_file_p (abfd)
+ u->u_exdata.ux_bsize),
(bfd_vma) u->u_exdata.ux_datorg,
(file_ptr) coffsets.u_data))
- return NULL;
+ goto fail;
if (!make_bfd_asection (abfd, ".stack",
SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS,
(bfd_size_type) u->u_ssize * NBPC,
(bfd_vma) u->u_sub,
(file_ptr) coffsets.u_stack))
- return NULL;
+ goto fail;
return abfd->xvec; /* Done for version 1 */
}
@@ -207,18 +197,20 @@ sco5_core_file_p (abfd)
coresecthead and check its validity */
if ((bfd_seek (abfd,
- coresize - coffset_siz - 2 * sizeof coffset_siz,
+ (file_ptr) (coresize - coffset_siz - 2 * sizeof coffset_siz),
SEEK_SET) != 0)
- || (bfd_read ((void *)&nsecs, 1, sizeof nsecs, abfd) != sizeof nsecs)
- || (bfd_read ((void *)&cheadoffs, 1, sizeof cheadoffs, abfd)
- != sizeof cheadoffs)
- || (bfd_seek (abfd, cheadoffs, SEEK_SET) != 0)
- || (bfd_read ((void *)&chead, 1, sizeof chead, abfd) != sizeof chead)
+ || (bfd_bread ((void *) &nsecs, (bfd_size_type) sizeof nsecs, abfd)
+ != sizeof nsecs)
+ || (bfd_bread ((void *) &cheadoffs, (bfd_size_type) sizeof cheadoffs,
+ abfd) != sizeof cheadoffs)
+ || (bfd_seek (abfd, (file_ptr) cheadoffs, SEEK_SET) != 0)
+ || (bfd_bread ((void *) &chead, (bfd_size_type) sizeof chead, abfd)
+ != sizeof chead)
|| (chead.cs_stype != CORES_OFFSETS)
|| (chead.cs_x.csx_magic != COREMAGIC_NUMBER))
{
bfd_set_error (bfd_error_wrong_format);
- return NULL;
+ goto fail;
}
/* OK, we believe you. You're a core file (sure, sure). */
@@ -227,11 +219,12 @@ sco5_core_file_p (abfd)
nsecs--; /* We've seen CORES_OFFSETS already */
for (; nsecs; nsecs--)
{
- if ((bfd_seek (abfd, chead.cs_hseek, SEEK_SET) != 0)
- || bfd_read ((void *)&chead, 1, sizeof chead, abfd) != sizeof chead)
+ if ((bfd_seek (abfd, (file_ptr) chead.cs_hseek, SEEK_SET) != 0)
+ || (bfd_bread ((void *) &chead, (bfd_size_type) sizeof chead, abfd)
+ != sizeof chead))
{
bfd_set_error (bfd_error_wrong_format);
- return NULL;
+ goto fail;
}
switch (chead.cs_stype)
@@ -240,15 +233,15 @@ sco5_core_file_p (abfd)
if (chead.cs_x.csx_magic != COREMAGIC_NUMBER)
{
bfd_set_error (bfd_error_wrong_format);
- return NULL;
+ goto fail;
}
secname = NULL;
nsecs++; /* MAGIC not in section cnt!*/
break;
case CORES_UAREA: /* U-area, read in tdata */
- u = read_uarea(abfd, chead.cs_sseek);
+ u = read_uarea (abfd, chead.cs_sseek);
if (! u)
- return NULL;
+ goto fail;
/* This is tricky. As the "register section", we give them
the entire upage and stack. u.u_ar0 points to where
@@ -319,12 +312,20 @@ sco5_core_file_p (abfd)
(bfd_size_type) chead.cs_vsize,
(bfd_vma) chead.cs_vaddr,
(file_ptr) chead.cs_sseek))
- return NULL;
+ goto fail;
}
return abfd->xvec;
+ fail:
+ if (abfd->tdata.any)
+ {
+ bfd_release (abfd, abfd->tdata.any);
+ abfd->tdata.any = NULL;
+ }
+ bfd_section_list_clear (abfd);
+ return NULL;
}
char *
@@ -351,22 +352,12 @@ sco5_core_file_failing_signal (ignore_abfd)
/* ARGSUSED */
boolean
sco5_core_file_matches_executable_p (core_bfd, exec_bfd)
- bfd *core_bfd, *exec_bfd;
+ bfd *core_bfd ATTRIBUTE_UNUSED;
+ bfd *exec_bfd ATTRIBUTE_UNUSED;
{
return true; /* FIXME, We have no way of telling at this point */
}
-#define sco5_core_get_symtab_upper_bound _bfd_nosymbols_get_symtab_upper_bound
-#define sco5_core_get_symtab _bfd_nosymbols_get_symtab
-#define sco5_core_print_symbol _bfd_nosymbols_print_symbol
-#define sco5_core_get_symbol_info _bfd_nosymbols_get_symbol_info
-#define sco5_core_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name
-#define sco5_core_get_lineno _bfd_nosymbols_get_lineno
-#define sco5_core_find_nearest_line _bfd_nosymbols_find_nearest_line
-#define sco5_core_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
-#define sco5_core_read_minisymbols _bfd_nosymbols_read_minisymbols
-#define sco5_core_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol
-
/* If somebody calls any byte-swapping routines, shoot them. */
static void
swap_abort ()
@@ -413,15 +404,15 @@ const bfd_target sco5_core_vec =
bfd_false, bfd_false
},
- BFD_JUMP_TABLE_GENERIC (_bfd_generic),
- BFD_JUMP_TABLE_COPY (_bfd_generic),
- BFD_JUMP_TABLE_CORE (sco5),
- BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
- BFD_JUMP_TABLE_SYMBOLS (sco5_core),
- BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
- BFD_JUMP_TABLE_WRITE (_bfd_generic),
- BFD_JUMP_TABLE_LINK (_bfd_nolink),
- BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+ BFD_JUMP_TABLE_GENERIC (_bfd_generic),
+ BFD_JUMP_TABLE_COPY (_bfd_generic),
+ BFD_JUMP_TABLE_CORE (sco5),
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
+ BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
+ BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
+ BFD_JUMP_TABLE_WRITE (_bfd_generic),
+ BFD_JUMP_TABLE_LINK (_bfd_nolink),
+ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
diff --git a/contrib/binutils/bfd/section.c b/contrib/binutils/bfd/section.c
index fc03ce9..c1dc0b1 100644
--- a/contrib/binutils/bfd/section.c
+++ b/contrib/binutils/bfd/section.c
@@ -1,6 +1,6 @@
/* Object file "section" support for the BFD library.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001
+ 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -177,7 +177,7 @@ CODE_FRAGMENT
.
. int id;
.
-. {* Which section is it; 0..nth. *}
+. {* Which section in the bfd; 0..n-1 as sections are created in a bfd. *}
.
. int index;
.
@@ -205,9 +205,11 @@ CODE_FRAGMENT
. some relocation information too. *}
.#define SEC_RELOC 0x004
.
-.#if 0 {* Obsolete ? *}
-.#define SEC_BALIGN 0x008
-.#endif
+. {* ELF reserves 4 processor specific bits and 8 operating system
+. specific bits in sh_flags; at present we can get away with just
+. one in communicating between the assembler and BFD, but this
+. isn't a good long-term solution. *}
+.#define SEC_ARCH_BIT_0 0x008
.
. {* A signal to the OS that the section contains read only data. *}
.#define SEC_READONLY 0x010
@@ -290,9 +292,10 @@ CODE_FRAGMENT
. objects are to be further relocated. *}
.#define SEC_EXCLUDE 0x40000
.
-. {* The contents of this section are to be sorted by the
-. based on the address specified in the associated symbol
-. table. *}
+. {* The contents of this section are to be sorted based on the sum of
+. the symbol and addend values specified by the associated relocation
+. entries. Entries without associated relocation entries will be
+. appended to the end of the section in an unspecified order. *}
.#define SEC_SORT_ENTRIES 0x80000
.
. {* When linking, duplicate sections of the same name should be
@@ -350,6 +353,18 @@ CODE_FRAGMENT
. references found to any symbol in the section. *}
.#define SEC_CLINK 0x10000000
.
+. {* Attempt to merge identical entities in the section.
+. Entity size is given in the entsize field. *}
+.#define SEC_MERGE 0x20000000
+.
+. {* If given with SEC_MERGE, entities to merge are zero terminated
+. strings where entsize specifies character size instead of fixed
+. size entries. *}
+.#define SEC_STRINGS 0x40000000
+.
+. {* This section contains data about section groups. *}
+.#define SEC_GROUP 0x80000000
+.
. {* End of section flags. *}
.
. {* Some internal packed boolean fields. *}
@@ -364,13 +379,14 @@ CODE_FRAGMENT
. unsigned int linker_mark : 1;
.
. {* Another mark flag used by some of the linker backends. Set for
-. output sections that have a input section. *}
+. output sections that have an input section. *}
. unsigned int linker_has_input : 1;
.
. {* A mark flag used by some linker backends for garbage collection. *}
. unsigned int gc_mark : 1;
.
-. {* Used by the ELF code to mark sections which have been allocated to segments. *}
+. {* Used by the ELF code to mark sections which have been allocated
+. to segments. *}
. unsigned int segment_mark : 1;
.
. {* End of internal packed boolean fields. *}
@@ -466,14 +482,14 @@ CODE_FRAGMENT
.
. unsigned int lineno_count;
.
+. {* Entity size for merging purposes. *}
+.
+. unsigned int entsize;
+.
. {* Optional information about a COMDAT entry; NULL if not COMDAT. *}
.
. struct bfd_comdat_info *comdat;
.
-. {* Points to the kept section if this section is a link-once section,
-. and is discarded. *}
-. struct sec *kept_section;
-.
. {* When a section is being output, this value changes as more
. linenumbers are written out. *}
.
@@ -528,6 +544,12 @@ CODE_FRAGMENT
.#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
.#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
.
+.#define bfd_is_const_section(SEC) \
+. ( ((SEC) == bfd_abs_section_ptr) \
+. || ((SEC) == bfd_und_section_ptr) \
+. || ((SEC) == bfd_com_section_ptr) \
+. || ((SEC) == bfd_ind_section_ptr))
+.
.extern const struct symbol_cache_entry * const bfd_abs_symbol;
.extern const struct symbol_cache_entry * const bfd_com_symbol;
.extern const struct symbol_cache_entry * const bfd_und_symbol;
@@ -538,6 +560,32 @@ CODE_FRAGMENT
.#define bfd_get_section_size_after_reloc(section) \
. ((section)->reloc_done ? (section)->_cooked_size \
. : (abort (), (bfd_size_type) 1))
+.
+.{* Macros to handle insertion and deletion of a bfd's sections. These
+. only handle the list pointers, ie. do not adjust section_count,
+. target_index etc. *}
+.#define bfd_section_list_remove(ABFD, PS) \
+. do \
+. { \
+. asection **_ps = PS; \
+. asection *_s = *_ps; \
+. *_ps = _s->next; \
+. if (_s->next == NULL) \
+. (ABFD)->section_tail = _ps; \
+. } \
+. while (0)
+.#define bfd_section_list_insert(ABFD, PS, S) \
+. do \
+. { \
+. asection **_ps = PS; \
+. asection *_s = S; \
+. _s->next = *_ps; \
+. *_ps = _s; \
+. if (_s->next == NULL) \
+. (ABFD)->section_tail = &_s->next; \
+. } \
+. while (0)
+.
*/
/* We use a macro to initialize the static asymbol structures because
@@ -584,11 +632,11 @@ static const asymbol global_syms[] =
/* line_filepos, userdata, contents, lineno, lineno_count, */ \
0, NULL, NULL, NULL, 0, \
\
- /* comdat, kept_section, moving_line_filepos, target_index, */ \
- NULL, NULL, 0, 0, \
+ /* entsize, comdat, moving_line_filepos, */ \
+ 0, NULL, 0, \
\
- /* used_by_bfd, constructor_chain, owner, */ \
- NULL, NULL, NULL, \
+ /* target_index, used_by_bfd, constructor_chain, owner, */ \
+ 0, NULL, NULL, NULL, \
\
/* symbol, */ \
(struct symbol_cache_entry *) &global_syms[IDX], \
@@ -607,6 +655,83 @@ STD_SECTION (bfd_abs_section, 0, bfd_abs_symbol, BFD_ABS_SECTION_NAME, 2);
STD_SECTION (bfd_ind_section, 0, bfd_ind_symbol, BFD_IND_SECTION_NAME, 3);
#undef STD_SECTION
+struct section_hash_entry
+{
+ struct bfd_hash_entry root;
+ asection section;
+};
+
+/* Initialize an entry in the section hash table. */
+
+struct bfd_hash_entry *
+bfd_section_hash_newfunc (entry, table, string)
+ struct bfd_hash_entry *entry;
+ struct bfd_hash_table *table;
+ const char *string;
+{
+ /* Allocate the structure if it has not already been allocated by a
+ subclass. */
+ if (entry == NULL)
+ {
+ entry = bfd_hash_allocate (table, sizeof (struct section_hash_entry));
+ if (entry == NULL)
+ return entry;
+ }
+
+ /* Call the allocation method of the superclass. */
+ entry = bfd_hash_newfunc (entry, table, string);
+ if (entry != NULL)
+ {
+ memset ((PTR) &((struct section_hash_entry *) entry)->section,
+ 0, sizeof (asection));
+ }
+
+ return entry;
+}
+
+#define section_hash_lookup(table, string, create, copy) \
+ ((struct section_hash_entry *) \
+ bfd_hash_lookup ((table), (string), (create), (copy)))
+
+/* Initializes a new section. NEWSECT->NAME is already set. */
+
+static asection *bfd_section_init PARAMS ((bfd *, asection *));
+
+static asection *
+bfd_section_init (abfd, newsect)
+ bfd *abfd;
+ asection *newsect;
+{
+ static int section_id = 0x10; /* id 0 to 3 used by STD_SECTION. */
+
+ newsect->id = section_id;
+ newsect->index = abfd->section_count;
+ newsect->owner = abfd;
+
+ /* Create a symbol whose only job is to point to this section. This
+ is useful for things like relocs which are relative to the base
+ of a section. */
+ newsect->symbol = bfd_make_empty_symbol (abfd);
+ if (newsect->symbol == NULL)
+ return NULL;
+
+ newsect->symbol->name = newsect->name;
+ newsect->symbol->value = 0;
+ newsect->symbol->section = newsect;
+ newsect->symbol->flags = BSF_SECTION_SYM;
+
+ newsect->symbol_ptr_ptr = &newsect->symbol;
+
+ if (! BFD_SEND (abfd, _new_section_hook, (abfd, newsect)))
+ return NULL;
+
+ section_id++;
+ abfd->section_count++;
+ *abfd->section_tail = newsect;
+ abfd->section_tail = &newsect->next;
+ return newsect;
+}
+
/*
DOCDD
INODE
@@ -619,6 +744,29 @@ These are the functions exported by the section handling part of BFD.
/*
FUNCTION
+ bfd_section_list_clear
+
+SYNOPSIS
+ void bfd_section_list_clear (bfd *);
+
+DESCRIPTION
+ Clears the section list, and also resets the section count and
+ hash table entries.
+*/
+
+void
+bfd_section_list_clear (abfd)
+ bfd *abfd;
+{
+ abfd->sections = NULL;
+ abfd->section_tail = &abfd->sections;
+ abfd->section_count = 0;
+ memset ((PTR) abfd->section_htab.table, 0,
+ abfd->section_htab.size * sizeof (struct bfd_hash_entry *));
+}
+
+/*
+FUNCTION
bfd_get_section_by_name
SYNOPSIS
@@ -640,11 +788,12 @@ bfd_get_section_by_name (abfd, name)
bfd *abfd;
const char *name;
{
- asection *sect;
+ struct section_hash_entry *sh;
+
+ sh = section_hash_lookup (&abfd->section_htab, name, false, false);
+ if (sh != NULL)
+ return &sh->section;
- for (sect = abfd->sections; sect != NULL; sect = sect->next)
- if (!strcmp (sect->name, name))
- return sect;
return NULL;
}
@@ -676,7 +825,7 @@ bfd_get_unique_section_name (abfd, templat, count)
char *sname;
len = strlen (templat);
- sname = bfd_malloc (len + 8);
+ sname = bfd_malloc ((bfd_size_type) len + 8);
if (sname == NULL)
return NULL;
strcpy (sname, templat);
@@ -691,7 +840,7 @@ bfd_get_unique_section_name (abfd, templat, count)
abort ();
sprintf (sname + len, ".%d", num++);
}
- while (bfd_get_section_by_name (abfd, sname) != NULL);
+ while (section_hash_lookup (&abfd->section_htab, sname, false, false));
if (count != NULL)
*count = num;
@@ -728,12 +877,40 @@ bfd_make_section_old_way (abfd, name)
bfd *abfd;
const char *name;
{
- asection *sec = bfd_get_section_by_name (abfd, name);
- if (sec == (asection *) NULL)
+ struct section_hash_entry *sh;
+ asection *newsect;
+
+ if (abfd->output_has_begun)
{
- sec = bfd_make_section (abfd, name);
+ bfd_set_error (bfd_error_invalid_operation);
+ return NULL;
}
- return sec;
+
+ if (strcmp (name, BFD_ABS_SECTION_NAME) == 0)
+ return bfd_abs_section_ptr;
+
+ if (strcmp (name, BFD_COM_SECTION_NAME) == 0)
+ return bfd_com_section_ptr;
+
+ if (strcmp (name, BFD_UND_SECTION_NAME) == 0)
+ return bfd_und_section_ptr;
+
+ if (strcmp (name, BFD_IND_SECTION_NAME) == 0)
+ return bfd_ind_section_ptr;
+
+ sh = section_hash_lookup (&abfd->section_htab, name, true, false);
+ if (sh == NULL)
+ return NULL;
+
+ newsect = &sh->section;
+ if (newsect->name != NULL)
+ {
+ /* Section already exists. */
+ return newsect;
+ }
+
+ newsect->name = name;
+ return bfd_section_init (abfd, newsect);
}
/*
@@ -758,10 +935,8 @@ bfd_make_section_anyway (abfd, name)
bfd *abfd;
const char *name;
{
- static int section_id = 0x10; /* id 0 to 3 used by STD_SECTION. */
+ struct section_hash_entry *sh;
asection *newsect;
- asection **prev = &abfd->sections;
- asection *sect = abfd->sections;
if (abfd->output_has_begun)
{
@@ -769,55 +944,24 @@ bfd_make_section_anyway (abfd, name)
return NULL;
}
- while (sect)
- {
- prev = &sect->next;
- sect = sect->next;
- }
-
- newsect = (asection *) bfd_zalloc (abfd, sizeof (asection));
- if (newsect == NULL)
+ sh = section_hash_lookup (&abfd->section_htab, name, true, false);
+ if (sh == NULL)
return NULL;
- newsect->name = name;
- newsect->id = section_id++;
- newsect->index = abfd->section_count++;
- newsect->flags = SEC_NO_FLAGS;
-
- newsect->userdata = NULL;
- newsect->contents = NULL;
- newsect->next = (asection *) NULL;
- newsect->relocation = (arelent *) NULL;
- newsect->reloc_count = 0;
- newsect->line_filepos = 0;
- newsect->owner = abfd;
- newsect->comdat = NULL;
- newsect->kept_section = NULL;
-
- /* Create a symbol whos only job is to point to this section. This is
- useful for things like relocs which are relative to the base of a
- section. */
- newsect->symbol = bfd_make_empty_symbol (abfd);
- if (newsect->symbol == NULL)
+ newsect = &sh->section;
+ if (newsect->name != NULL)
{
- bfd_release (abfd, newsect);
- return NULL;
- }
- newsect->symbol->name = name;
- newsect->symbol->value = 0;
- newsect->symbol->section = newsect;
- newsect->symbol->flags = BSF_SECTION_SYM;
-
- newsect->symbol_ptr_ptr = &newsect->symbol;
-
- if (BFD_SEND (abfd, _new_section_hook, (abfd, newsect)) != true)
- {
- bfd_release (abfd, newsect);
- return NULL;
+ /* We are making a section of the same name. It can't go in
+ section_htab without generating a unique section name and
+ that would be pointless; We don't need to traverse the
+ hash table. */
+ newsect = (asection *) bfd_zalloc (abfd, sizeof (asection));
+ if (newsect == NULL)
+ return NULL;
}
- *prev = newsect;
- return newsect;
+ newsect->name = name;
+ return bfd_section_init (abfd, newsect);
}
/*
@@ -839,35 +983,34 @@ bfd_make_section (abfd, name)
bfd *abfd;
const char *name;
{
- asection *sect = abfd->sections;
+ struct section_hash_entry *sh;
+ asection *newsect;
- if (strcmp (name, BFD_ABS_SECTION_NAME) == 0)
- {
- return bfd_abs_section_ptr;
- }
- if (strcmp (name, BFD_COM_SECTION_NAME) == 0)
- {
- return bfd_com_section_ptr;
- }
- if (strcmp (name, BFD_UND_SECTION_NAME) == 0)
+ if (abfd->output_has_begun)
{
- return bfd_und_section_ptr;
+ bfd_set_error (bfd_error_invalid_operation);
+ return NULL;
}
- if (strcmp (name, BFD_IND_SECTION_NAME) == 0)
- {
- return bfd_ind_section_ptr;
- }
+ if (strcmp (name, BFD_ABS_SECTION_NAME) == 0
+ || strcmp (name, BFD_COM_SECTION_NAME) == 0
+ || strcmp (name, BFD_UND_SECTION_NAME) == 0
+ || strcmp (name, BFD_IND_SECTION_NAME) == 0)
+ return NULL;
+
+ sh = section_hash_lookup (&abfd->section_htab, name, true, false);
+ if (sh == NULL)
+ return NULL;
- while (sect)
+ newsect = &sh->section;
+ if (newsect->name != NULL)
{
- if (!strcmp (sect->name, name))
- return NULL;
- sect = sect->next;
+ /* Section already exists. */
+ return newsect;
}
- /* The name is not already used; go ahead and make a new section. */
- return bfd_make_section_anyway (abfd, name);
+ newsect->name = name;
+ return bfd_section_init (abfd, newsect);
}
/*
@@ -1000,12 +1143,9 @@ FUNCTION
bfd_set_section_contents
SYNOPSIS
- boolean bfd_set_section_contents
- (bfd *abfd,
- asection *section,
- PTR data,
- file_ptr offset,
- bfd_size_type count);
+ boolean bfd_set_section_contents (bfd *abfd, asection *section,
+ PTR data, file_ptr offset,
+ bfd_size_type count);
DESCRIPTION
Sets the contents of the section @var{section} in BFD
@@ -1046,17 +1186,15 @@ bfd_set_section_contents (abfd, section, location, offset, count)
return (false);
}
- if (offset < 0)
+ sz = bfd_get_section_size_now (abfd, section);
+ if ((bfd_size_type) offset > sz
+ || count > sz
+ || offset + count > sz
+ || count != (size_t) count)
{
- bad_val:
bfd_set_error (bfd_error_bad_value);
return false;
}
- sz = bfd_get_section_size_now (abfd, section);
- if ((bfd_size_type) offset > sz
- || count > sz
- || offset + count > sz)
- goto bad_val;
switch (abfd->direction)
{
@@ -1079,7 +1217,7 @@ bfd_set_section_contents (abfd, section, location, offset, count)
/* Record a copy of the data in memory if desired. */
if (section->contents
&& location != section->contents + offset)
- memcpy (section->contents + offset, location, count);
+ memcpy (section->contents + offset, location, (size_t) count);
if (BFD_SEND (abfd, _bfd_set_section_contents,
(abfd, section, location, offset, count)))
@@ -1096,9 +1234,9 @@ FUNCTION
bfd_get_section_contents
SYNOPSIS
- boolean bfd_get_section_contents
- (bfd *abfd, asection *section, PTR location,
- file_ptr offset, bfd_size_type count);
+ boolean bfd_get_section_contents (bfd *abfd, asection *section,
+ PTR location, file_ptr offset,
+ bfd_size_type count);
DESCRIPTION
Read data from @var{section} in BFD @var{abfd}
@@ -1125,21 +1263,21 @@ bfd_get_section_contents (abfd, section, location, offset, count)
if (section->flags & SEC_CONSTRUCTOR)
{
- memset (location, 0, (unsigned) count);
+ memset (location, 0, (size_t) count);
return true;
}
- if (offset < 0)
+ /* Even if reloc_done is true, this function reads unrelocated
+ contents, so we want the raw size. */
+ sz = section->_raw_size;
+ if ((bfd_size_type) offset > sz
+ || count > sz
+ || offset + count > sz
+ || count != (size_t) count)
{
- bad_val:
bfd_set_error (bfd_error_bad_value);
return false;
}
- /* Even if reloc_done is true, this function reads unrelocated
- contents, so we want the raw size. */
- sz = section->_raw_size;
- if ((bfd_size_type) offset > sz || count > sz || offset + count > sz)
- goto bad_val;
if (count == 0)
/* Don't bother. */
@@ -1147,7 +1285,7 @@ bfd_get_section_contents (abfd, section, location, offset, count)
if ((section->flags & SEC_HAS_CONTENTS) == 0)
{
- memset (location, 0, (unsigned) count);
+ memset (location, 0, (size_t) count);
return true;
}
@@ -1166,7 +1304,8 @@ FUNCTION
bfd_copy_private_section_data
SYNOPSIS
- boolean bfd_copy_private_section_data(bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
+ boolean bfd_copy_private_section_data (bfd *ibfd, asection *isec,
+ bfd *obfd, asection *osec);
DESCRIPTION
Copy private section information from @var{isec} in the BFD
@@ -1239,7 +1378,8 @@ _bfd_strip_section_from_output (info, s)
asection *is;
for (is = abfd->sections; is != NULL; is = is->next)
{
- if (is != s && is->output_section == os)
+ if (is != s && is->output_section == os
+ && (is->flags & SEC_EXCLUDE) == 0)
break;
}
if (is != NULL)
@@ -1257,9 +1397,11 @@ _bfd_strip_section_from_output (info, s)
for (spp = &os->owner->sections; *spp; spp = &(*spp)->next)
if (*spp == os)
{
- *spp = os->next;
+ bfd_section_list_remove (os->owner, spp);
os->owner->section_count--;
break;
}
}
+
+ s->flags |= SEC_EXCLUDE;
}
diff --git a/contrib/binutils/bfd/sparclinux.c b/contrib/binutils/bfd/sparclinux.c
index b877018..28ff8c8 100644
--- a/contrib/binutils/bfd/sparclinux.c
+++ b/contrib/binutils/bfd/sparclinux.c
@@ -1,5 +1,5 @@
/* BFD back-end for linux flavored sparc a.out binaries.
- Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000
+ Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -37,7 +37,10 @@ USA. */
#include "libaout.h" /* BFD a.out internal data structures */
#define DEFAULT_ARCH bfd_arch_sparc
-#define MY(OP) CAT(sparclinux_,OP)
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define MY(OP) CONCAT2 (sparclinux_,OP)
#define TARGETNAME "a.out-sparc-linux"
extern const bfd_target MY(vec);
@@ -225,9 +228,9 @@ linux_link_hash_table_create (abfd)
bfd *abfd;
{
struct linux_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct linux_link_hash_table);
- ret = ((struct linux_link_hash_table *)
- bfd_alloc (abfd, sizeof (struct linux_link_hash_table)));
+ ret = (struct linux_link_hash_table *) bfd_alloc (abfd, amt);
if (ret == (struct linux_link_hash_table *) NULL)
return (struct bfd_link_hash_table *) NULL;
if (! NAME(aout,link_hash_table_init) (&ret->root, abfd,
@@ -407,7 +410,8 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
if (! (_bfd_generic_link_add_one_symbol
(info, linux_hash_table (info)->dynobj, SHARABLE_CONFLICTS,
- BSF_GLOBAL | BSF_CONSTRUCTOR, s, 0, NULL, false, false, NULL)))
+ BSF_GLOBAL | BSF_CONSTRUCTOR, s, (bfd_vma) 0, NULL,
+ false, false, NULL)))
return false;
}
@@ -446,7 +450,7 @@ linux_tally_symbols (h, data)
name = h->root.root.root.string + sizeof NEEDS_SHRLIB - 1;
p = strrchr (name, '_');
if (p != NULL)
- alloc = (char *) bfd_malloc (strlen (name) + 1);
+ alloc = (char *) bfd_malloc ((bfd_size_type) strlen (name) + 1);
if (p == NULL || alloc == NULL)
(*_bfd_error_handler) (_("Output file requires shared library `%s'\n"),
@@ -590,7 +594,8 @@ bfd_sparclinux_size_dynamic_sections (output_bfd, info)
".linux-dynamic");
if (s != NULL)
{
- s->_raw_size = 8 + linux_hash_table (info)->fixup_count * 8;
+ s->_raw_size = linux_hash_table (info)->fixup_count + 1;
+ s->_raw_size *= 8;
s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
if (s->contents == NULL)
return false;
@@ -633,7 +638,8 @@ linux_finish_dynamic_link (output_bfd, info)
#endif
fixup_table = s->contents;
- bfd_put_32 (output_bfd, linux_hash_table (info)->fixup_count, fixup_table);
+ bfd_put_32 (output_bfd,
+ (bfd_vma) linux_hash_table (info)->fixup_count, fixup_table);
fixup_table += 4;
/* Fill in fixup table. */
@@ -664,14 +670,14 @@ linux_finish_dynamic_link (output_bfd, info)
{
/* Relative address */
new_addr = new_addr - (f->value + 5);
- bfd_put_32 (output_bfd, new_addr, fixup_table);
+ bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
fixup_table += 4;
bfd_put_32 (output_bfd, f->value + 1, fixup_table);
fixup_table += 4;
}
else
{
- bfd_put_32 (output_bfd, new_addr, fixup_table);
+ bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
fixup_table += 4;
bfd_put_32 (output_bfd, f->value, fixup_table);
fixup_table += 4;
@@ -682,9 +688,9 @@ linux_finish_dynamic_link (output_bfd, info)
if (linux_hash_table (info)->local_builtins != 0)
{
/* Special marker so we know to switch to the other type of fixup */
- bfd_put_32 (output_bfd, 0, fixup_table);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
fixup_table += 4;
- bfd_put_32 (output_bfd, 0, fixup_table);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
fixup_table += 4;
++fixups_written;
for (f = linux_hash_table (info)->fixup_list; f != NULL; f = f->next)
@@ -710,7 +716,7 @@ linux_finish_dynamic_link (output_bfd, info)
new_addr, f->value);
#endif
- bfd_put_32 (output_bfd, new_addr, fixup_table);
+ bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
fixup_table += 4;
bfd_put_32 (output_bfd, f->value, fixup_table);
fixup_table += 4;
@@ -723,9 +729,9 @@ linux_finish_dynamic_link (output_bfd, info)
(*_bfd_error_handler) (_("Warning: fixup count mismatch\n"));
while (linux_hash_table (info)->fixup_count > fixups_written)
{
- bfd_put_32 (output_bfd, 0, fixup_table);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
fixup_table += 4;
- bfd_put_32 (output_bfd, 0, fixup_table);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
fixup_table += 4;
++fixups_written;
}
@@ -747,15 +753,16 @@ linux_finish_dynamic_link (output_bfd, info)
printf ("Builtin fixup table at %x\n", new_addr);
#endif
- bfd_put_32 (output_bfd, new_addr, fixup_table);
+ bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
}
else
- bfd_put_32 (output_bfd, 0, fixup_table);
+ bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table);
- if (bfd_seek (output_bfd, os->filepos + s->output_offset, SEEK_SET) != 0)
+ if (bfd_seek (output_bfd, (file_ptr) (os->filepos + s->output_offset),
+ SEEK_SET) != 0)
return false;
- if (bfd_write ((PTR) s->contents, 1, s->_raw_size, output_bfd)
+ if (bfd_bwrite ((PTR) s->contents, s->_raw_size, output_bfd)
!= s->_raw_size)
return false;
diff --git a/contrib/binutils/bfd/sparcnetbsd.c b/contrib/binutils/bfd/sparcnetbsd.c
index 9cb9637..64d0eb1 100644
--- a/contrib/binutils/bfd/sparcnetbsd.c
+++ b/contrib/binutils/bfd/sparcnetbsd.c
@@ -1,5 +1,5 @@
/* BFD back-end for NetBSD/sparc a.out-ish binaries.
- Copyright 1990, 1991, 1992, 1994, 1995, 1997, 1998, 2000
+ Copyright 1990, 1991, 1992, 1994, 1995, 1997, 1998, 2000, 2001
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -28,7 +28,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define DEFAULT_ARCH bfd_arch_sparc
#define DEFAULT_MID M_SPARC_NETBSD
-#define MY(OP) CAT(sparcnetbsd_,OP)
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define MY(OP) CONCAT2 (sparcnetbsd_,OP)
+
/* This needs to start with a.out so GDB knows it is an a.out variant. */
#define TARGETNAME "a.out-sparc-netbsd"
diff --git a/contrib/binutils/bfd/srec.c b/contrib/binutils/bfd/srec.c
index 33dfaa7..5dfad88 100644
--- a/contrib/binutils/bfd/srec.c
+++ b/contrib/binutils/bfd/srec.c
@@ -1,6 +1,6 @@
/* BFD back-end for s-record objects.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000
+ 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
@@ -108,7 +108,7 @@ DESCRIPTION
#include "sysdep.h"
#include "libbfd.h"
#include "libiberty.h"
-#include <ctype.h>
+#include "safe-ctype.h"
static void srec_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
static void srec_print_symbol
@@ -122,7 +122,7 @@ static const bfd_target *srec_object_p PARAMS ((bfd *));
static const bfd_target *symbolsrec_object_p PARAMS ((bfd *));
static boolean srec_read_section PARAMS ((bfd *, asection *, bfd_byte *));
-static boolean srec_write_record PARAMS ((bfd *, int, bfd_vma,
+static boolean srec_write_record PARAMS ((bfd *, unsigned int, bfd_vma,
const bfd_byte *,
const bfd_byte *));
static boolean srec_write_header PARAMS ((bfd *));
@@ -138,13 +138,12 @@ static boolean internal_srec_write_object_contents PARAMS ((bfd *, int));
static boolean srec_write_object_contents PARAMS ((bfd *));
static boolean symbolsrec_write_object_contents PARAMS ((bfd *));
static int srec_sizeof_headers PARAMS ((bfd *, boolean));
-static asymbol *srec_make_empty_symbol PARAMS ((bfd *));
static long srec_get_symtab_upper_bound PARAMS ((bfd *));
static long srec_get_symtab PARAMS ((bfd *, asymbol **));
/* Macros for converting between hex and binary. */
-static CONST char digs[] = "0123456789ABCDEF";
+static const char digs[] = "0123456789ABCDEF";
#define NIBBLE(x) hex_value(x)
#define HEX(buffer) ((NIBBLE((buffer)[0])<<4) + NIBBLE((buffer)[1]))
@@ -235,7 +234,8 @@ srec_mkobject (abfd)
if (abfd->tdata.srec_data == NULL)
{
- tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type));
+ bfd_size_type amt = sizeof (tdata_type);
+ tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, amt);
if (tdata == NULL)
return false;
abfd->tdata.srec_data = tdata;
@@ -260,7 +260,7 @@ srec_get_byte (abfd, errorptr)
{
bfd_byte c;
- if (bfd_read (&c, 1, 1, abfd) != 1)
+ if (bfd_bread (&c, (bfd_size_type) 1, abfd) != 1)
{
if (bfd_get_error () != bfd_error_file_truncated)
*errorptr = true;
@@ -290,7 +290,7 @@ srec_bad_byte (abfd, lineno, c, error)
{
char buf[10];
- if (! isprint (c))
+ if (! ISPRINT (c))
sprintf (buf, "\\%03o", (unsigned int) c);
else
{
@@ -299,7 +299,7 @@ srec_bad_byte (abfd, lineno, c, error)
}
(*_bfd_error_handler)
(_("%s:%d: Unexpected character `%s' in S-record file\n"),
- bfd_get_filename (abfd), lineno, buf);
+ bfd_archive_filename (abfd), lineno, buf);
bfd_set_error (bfd_error_bad_value);
}
}
@@ -313,8 +313,9 @@ srec_new_symbol (abfd, name, val)
bfd_vma val;
{
struct srec_symbol *n;
+ bfd_size_type amt = sizeof (struct srec_symbol);
- n = (struct srec_symbol *) bfd_alloc (abfd, sizeof (struct srec_symbol));
+ n = (struct srec_symbol *) bfd_alloc (abfd, amt);
if (n == NULL)
return false;
@@ -389,7 +390,7 @@ srec_scan (abfd)
case ' ':
do
{
- unsigned int alc;
+ bfd_size_type alc;
char *p, *symname;
bfd_vma symval;
@@ -416,9 +417,9 @@ srec_scan (abfd)
*p++ = c;
while ((c = srec_get_byte (abfd, &error)) != EOF
- && ! isspace (c))
+ && ! ISSPACE (c))
{
- if ((unsigned int) (p - symbuf) >= alc)
+ if ((bfd_size_type) (p - symbuf) >= alc)
{
char *n;
@@ -440,7 +441,7 @@ srec_scan (abfd)
}
*p++ = '\0';
- symname = bfd_alloc (abfd, p - symbuf);
+ symname = bfd_alloc (abfd, (bfd_size_type) (p - symbuf));
if (symname == NULL)
goto error_return;
strcpy (symname, symbuf);
@@ -503,7 +504,7 @@ srec_scan (abfd)
pos = bfd_tell (abfd) - 1;
- if (bfd_read (hdr, 1, 3, abfd) != 3)
+ if (bfd_bread (hdr, (bfd_size_type) 3, abfd) != 3)
goto error_return;
if (! ISHEX (hdr[1]) || ! ISHEX (hdr[2]))
@@ -521,13 +522,13 @@ srec_scan (abfd)
{
if (buf != NULL)
free (buf);
- buf = (bfd_byte *) bfd_malloc (bytes * 2);
+ buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2);
if (buf == NULL)
goto error_return;
bufsize = bytes * 2;
}
- if (bfd_read (buf, 1, bytes * 2, abfd) != bytes * 2)
+ if (bfd_bread (buf, (bfd_size_type) bytes * 2, abfd) != bytes * 2)
goto error_return;
/* Ignore the checksum byte. */
@@ -572,9 +573,11 @@ srec_scan (abfd)
{
char secbuf[20];
char *secname;
+ bfd_size_type amt;
sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
- secname = (char *) bfd_alloc (abfd, strlen (secbuf) + 1);
+ amt = strlen (secbuf) + 1;
+ secname = (char *) bfd_alloc (abfd, amt);
strcpy (secname, secbuf);
sec = bfd_make_section (abfd, secname);
if (sec == NULL)
@@ -642,7 +645,7 @@ srec_object_p (abfd)
srec_init ();
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_read (b, 1, 4, abfd) != 4)
+ || bfd_bread (b, (bfd_size_type) 4, abfd) != 4)
return NULL;
if (b[0] != 'S' || !ISHEX (b[1]) || !ISHEX (b[2]) || !ISHEX (b[3]))
@@ -672,7 +675,7 @@ symbolsrec_object_p (abfd)
srec_init ();
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_read (b, 1, 2, abfd) != 2)
+ || bfd_bread (b, (bfd_size_type) 2, abfd) != 2)
return NULL;
if (b[0] != '$' || b[1] != '$')
@@ -722,7 +725,7 @@ srec_read_section (abfd, section, contents)
ought to know the exact format. */
BFD_ASSERT (c == 'S');
- if (bfd_read (hdr, 1, 3, abfd) != 3)
+ if (bfd_bread (hdr, (bfd_size_type) 3, abfd) != 3)
goto error_return;
BFD_ASSERT (ISHEX (hdr[1]) && ISHEX (hdr[2]));
@@ -733,13 +736,13 @@ srec_read_section (abfd, section, contents)
{
if (buf != NULL)
free (buf);
- buf = (bfd_byte *) bfd_malloc (bytes * 2);
+ buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2);
if (buf == NULL)
goto error_return;
bufsize = bytes * 2;
}
- if (bfd_read (buf, 1, bytes * 2, abfd) != bytes * 2)
+ if (bfd_bread (buf, (bfd_size_type) bytes * 2, abfd) != bytes * 2)
goto error_return;
address = 0;
@@ -821,8 +824,7 @@ srec_get_section_contents (abfd, section, location, offset, count)
if (section->used_by_bfd == NULL)
{
section->used_by_bfd = bfd_alloc (abfd, section->_raw_size);
- if (section->used_by_bfd == NULL
- && section->_raw_size != 0)
+ if (section->used_by_bfd == NULL && section->_raw_size != 0)
return false;
if (! srec_read_section (abfd, section, section->used_by_bfd))
@@ -865,7 +867,7 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
register srec_data_list_type *entry;
entry = ((srec_data_list_type *)
- bfd_alloc (abfd, sizeof (srec_data_list_type)));
+ bfd_alloc (abfd, (bfd_size_type) sizeof (srec_data_list_type)));
if (entry == NULL)
return false;
@@ -873,7 +875,9 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
&& (section->flags & SEC_ALLOC)
&& (section->flags & SEC_LOAD))
{
- bfd_byte *data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do);
+ bfd_byte *data;
+
+ data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do);
if (data == NULL)
return false;
memcpy ((PTR) data, location, (size_t) bytes_to_do);
@@ -927,14 +931,14 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
static boolean
srec_write_record (abfd, type, address, data, end)
bfd *abfd;
- int type;
+ unsigned int type;
bfd_vma address;
const bfd_byte *data;
const bfd_byte *end;
{
char buffer[MAXCHUNK];
unsigned int check_sum = 0;
- CONST bfd_byte *src = data;
+ const bfd_byte *src = data;
char *dst = buffer;
char *length;
bfd_size_type wrlen;
@@ -981,7 +985,7 @@ srec_write_record (abfd, type, address, data, end)
*dst++ = '\r';
*dst++ = '\n';
wrlen = dst - buffer;
- if (bfd_write ((PTR) buffer, 1, wrlen, abfd) != wrlen)
+ if (bfd_bwrite ((PTR) buffer, wrlen, abfd) != wrlen)
return false;
return true;
}
@@ -998,7 +1002,7 @@ srec_write_header (abfd)
for (i = 0; i < 40 && abfd->filename[i]; i++)
*dst++ = abfd->filename[i];
- return srec_write_record (abfd, 0, 0, buffer, dst);
+ return srec_write_record (abfd, 0, (bfd_vma) 0, buffer, dst);
}
static boolean
@@ -1056,12 +1060,12 @@ srec_write_symbols (abfd)
if (count)
{
- size_t len;
+ bfd_size_type len;
asymbol **table = bfd_get_outsymbols (abfd);
sprintf (buffer, "$$ %s\r\n", abfd->filename);
len = strlen (buffer);
- if (bfd_write (buffer, len, 1, abfd) != len)
+ if (bfd_bwrite (buffer, len, abfd) != len)
return false;
for (i = 0; i < count; i++)
@@ -1071,7 +1075,6 @@ srec_write_symbols (abfd)
&& (s->flags & BSF_DEBUGGING) == 0)
{
/* Just dump out non debug symbols. */
- bfd_size_type l;
char buf2[40], *p;
sprintf_vma (buf2,
@@ -1081,14 +1084,14 @@ srec_write_symbols (abfd)
while (p[0] == '0' && p[1] != 0)
p++;
sprintf (buffer, " %s $%s\r\n", s->name, p);
- l = strlen (buffer);
- if (bfd_write (buffer, l, 1, abfd) != l)
+ len = strlen (buffer);
+ if (bfd_bwrite (buffer, len, abfd) != len)
return false;
}
}
sprintf (buffer, "$$ \r\n");
len = strlen (buffer);
- if (bfd_write (buffer, len, 1, abfd) != len)
+ if (bfd_bwrite (buffer, len, abfd) != len)
return false;
}
@@ -1146,16 +1149,6 @@ srec_sizeof_headers (abfd, exec)
return 0;
}
-static asymbol *
-srec_make_empty_symbol (abfd)
- bfd *abfd;
-{
- asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol));
- if (new)
- new->the_bfd = abfd;
- return new;
-}
-
/* Return the amount of memory needed to read the symbol table. */
static long
@@ -1172,7 +1165,7 @@ srec_get_symtab (abfd, alocation)
bfd *abfd;
asymbol **alocation;
{
- unsigned int symcount = bfd_get_symcount (abfd);
+ bfd_size_type symcount = bfd_get_symcount (abfd);
asymbol *csymbols;
unsigned int i;
@@ -1217,8 +1210,8 @@ srec_get_symbol_info (ignore_abfd, symbol, ret)
}
static void
-srec_print_symbol (ignore_abfd, afile, symbol, how)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
+srec_print_symbol (abfd, afile, symbol, how)
+ bfd *abfd;
PTR afile;
asymbol *symbol;
bfd_print_symbol_type how;
@@ -1230,7 +1223,7 @@ srec_print_symbol (ignore_abfd, afile, symbol, how)
fprintf (file, "%s", symbol->name);
break;
default:
- bfd_print_symbol_vandf ((PTR) file, symbol);
+ bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
fprintf (file, " %-5s %s",
symbol->section->name,
symbol->name);
@@ -1245,6 +1238,7 @@ srec_print_symbol (ignore_abfd, afile, symbol, how)
#define srec_bfd_is_local_label_name bfd_generic_is_local_label_name
#define srec_get_lineno _bfd_nosymbols_get_lineno
#define srec_find_nearest_line _bfd_nosymbols_find_nearest_line
+#define srec_make_empty_symbol _bfd_generic_make_empty_symbol
#define srec_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define srec_read_minisymbols _bfd_generic_read_minisymbols
#define srec_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
@@ -1262,6 +1256,7 @@ srec_print_symbol (ignore_abfd, afile, symbol, how)
bfd_generic_get_relocated_section_contents
#define srec_bfd_relax_section bfd_generic_relax_section
#define srec_bfd_gc_sections bfd_generic_gc_sections
+#define srec_bfd_merge_sections bfd_generic_merge_sections
#define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define srec_bfd_final_link _bfd_generic_final_link
diff --git a/contrib/binutils/bfd/stabs.c b/contrib/binutils/bfd/stabs.c
index 15b1af5..bba4a6d 100644
--- a/contrib/binutils/bfd/stabs.c
+++ b/contrib/binutils/bfd/stabs.c
@@ -1,5 +1,6 @@
/* Stabs in sections linking support.
- Copyright 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -25,8 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libbfd.h"
#include "aout/stab_gnu.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
/* Stabs entries use a 12 byte format:
4 byte string table index
@@ -178,7 +178,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
{
boolean first;
struct stab_info *sinfo;
- bfd_size_type count;
+ bfd_size_type count, amt;
struct stab_section_info *secinfo;
bfd_byte *stabbuf = NULL;
bfd_byte *stabstrbuf = NULL;
@@ -223,7 +223,8 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
{
/* Initialize the stabs information we need to keep track of. */
first = true;
- *psinfo = (PTR) bfd_alloc (abfd, sizeof (struct stab_info));
+ amt = sizeof (struct stab_info);
+ *psinfo = (PTR) bfd_alloc (abfd, amt);
if (*psinfo == NULL)
goto error_return;
sinfo = (struct stab_info *) *psinfo;
@@ -247,16 +248,16 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
count = stabsec->_raw_size / STABSIZE;
- *psecinfo = bfd_alloc (abfd,
- (sizeof (struct stab_section_info)
- + (count - 1) * sizeof (bfd_size_type)));
+ amt = sizeof (struct stab_section_info);
+ amt += (count - 1) * sizeof (bfd_size_type);
+ *psecinfo = bfd_alloc (abfd, amt);
if (*psecinfo == NULL)
goto error_return;
secinfo = (struct stab_section_info *) *psecinfo;
secinfo->excls = NULL;
secinfo->cumulative_skips = NULL;
- memset (secinfo->stridxs, 0, count * sizeof (bfd_size_type));
+ memset (secinfo->stridxs, 0, (size_t) count * sizeof (bfd_size_type));
/* Read the stabs information from abfd. */
@@ -265,9 +266,9 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
if (stabbuf == NULL || stabstrbuf == NULL)
goto error_return;
- if (! bfd_get_section_contents (abfd, stabsec, stabbuf, 0,
+ if (! bfd_get_section_contents (abfd, stabsec, stabbuf, (bfd_vma) 0,
stabsec->_raw_size)
- || ! bfd_get_section_contents (abfd, stabstrsec, stabstrbuf, 0,
+ || ! bfd_get_section_contents (abfd, stabstrsec, stabstrbuf, (bfd_vma) 0,
stabstrsec->_raw_size))
goto error_return;
@@ -362,7 +363,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
{
/* Skip the file number. */
++str;
- while (isdigit ((unsigned char) *str))
+ while (ISDIGIT (*str))
++str;
--str;
}
@@ -383,7 +384,8 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
/* Record this symbol, so that we can set the value
correctly. */
- ne = (struct stab_excl_list *) bfd_alloc (abfd, sizeof *ne);
+ amt = sizeof *ne;
+ ne = (struct stab_excl_list *) bfd_alloc (abfd, amt);
if (ne == NULL)
goto error_return;
ne->offset = sym - stabbuf;
@@ -471,8 +473,8 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
bfd_size_type i, offset;
bfd_size_type *pskips;
- secinfo->cumulative_skips =
- (bfd_size_type *) bfd_alloc (abfd, count * sizeof (bfd_size_type));
+ amt = count * sizeof (bfd_size_type);
+ secinfo->cumulative_skips = (bfd_size_type *) bfd_alloc (abfd, amt);
if (secinfo->cumulative_skips == NULL)
goto error_return;
@@ -500,6 +502,176 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo)
return false;
}
+
+/* This function is called for each input file before the stab
+ section is relocated. It discards stab entries for discarded
+ functions and variables. The function returns true iff
+ any entries have been deleted.
+*/
+
+boolean
+_bfd_discard_section_stabs (abfd, stabsec, psecinfo,
+ reloc_symbol_deleted_p, cookie)
+ bfd *abfd;
+ asection *stabsec;
+ PTR psecinfo;
+ boolean (*reloc_symbol_deleted_p) PARAMS ((bfd_vma, PTR));
+ PTR cookie;
+{
+ bfd_size_type count, amt;
+ struct stab_section_info *secinfo;
+ bfd_byte *stabbuf = NULL;
+ bfd_byte *sym, *symend;
+ bfd_size_type skip;
+ bfd_size_type *pstridx;
+ int deleting;
+
+ if (stabsec->_raw_size == 0)
+ {
+ /* This file does not contain stabs debugging information. */
+ return false;
+ }
+
+ if (stabsec->_raw_size % STABSIZE != 0)
+ {
+ /* Something is wrong with the format of these stab symbols.
+ Don't try to optimize them. */
+ return false;
+ }
+
+ if ((stabsec->output_section != NULL
+ && bfd_is_abs_section (stabsec->output_section)))
+ {
+ /* At least one of the sections is being discarded from the
+ link, so we should just ignore them. */
+ return false;
+ }
+
+ /* We should have initialized our data in _bfd_link_stab_sections.
+ If there was some bizarre error reading the string sections, though,
+ we might not have. Bail rather than asserting. */
+ if (psecinfo == NULL)
+ return false;
+
+ count = stabsec->_raw_size / STABSIZE;
+ secinfo = (struct stab_section_info *) psecinfo;
+
+ /* Read the stabs information from abfd. */
+
+ stabbuf = (bfd_byte *) bfd_malloc (stabsec->_raw_size);
+ if (stabbuf == NULL)
+ goto error_return;
+
+ if (! bfd_get_section_contents (abfd, stabsec, stabbuf, (bfd_vma) 0,
+ stabsec->_raw_size))
+ goto error_return;
+
+ /* Look through the stabs symbols and discard any information for
+ discarded functions. */
+
+ skip = 0;
+ deleting = -1;
+
+ symend = stabbuf + stabsec->_raw_size;
+ for (sym = stabbuf, pstridx = secinfo->stridxs;
+ sym < symend;
+ sym += STABSIZE, ++pstridx)
+ {
+ int type;
+
+ if (*pstridx == (bfd_size_type) -1)
+ {
+ /* This stab was deleted in a previous pass. */
+ continue;
+ }
+
+ type = sym[TYPEOFF];
+
+ if (type == N_FUN)
+ {
+ int strx = bfd_get_32 (abfd, sym + STRDXOFF);
+
+ if (strx == 0)
+ {
+ if (deleting)
+ {
+ skip++;
+ *pstridx = -1;
+ }
+ deleting = -1;
+ continue;
+ }
+ deleting = 0;
+ if ((*reloc_symbol_deleted_p) (sym + VALOFF - stabbuf, cookie))
+ deleting = 1;
+ }
+
+ if (deleting == 1)
+ {
+ *pstridx = -1;
+ skip++;
+ }
+ else if (deleting == -1)
+ {
+ /* Outside of a function. Check for deleted variables. */
+ if (type == N_STSYM || type == N_LCSYM)
+ if ((*reloc_symbol_deleted_p) (sym + VALOFF - stabbuf, cookie))
+ {
+ *pstridx = -1;
+ skip ++;
+ }
+ /* We should also check for N_GSYM entries which reference a
+ deleted global, but those are less harmful to debuggers
+ and would require parsing the stab strings. */
+ }
+ }
+
+ free (stabbuf);
+ stabbuf = NULL;
+
+ /* Shrink the stabsec as needed. */
+ stabsec->_cooked_size -= skip * STABSIZE;
+ if (stabsec->_cooked_size == 0)
+ stabsec->flags |= SEC_EXCLUDE;
+
+ /* Recalculate the `cumulative_skips' array now that stabs have been
+ deleted for this section. */
+
+ if (skip != 0)
+ {
+ bfd_size_type i, offset;
+ bfd_size_type *pskips;
+
+ if (secinfo->cumulative_skips == NULL)
+ {
+ amt = count * sizeof (bfd_size_type);
+ secinfo->cumulative_skips = (bfd_size_type *) bfd_alloc (abfd, amt);
+ if (secinfo->cumulative_skips == NULL)
+ goto error_return;
+ }
+
+ pskips = secinfo->cumulative_skips;
+ pstridx = secinfo->stridxs;
+ offset = 0;
+
+ for (i = 0; i < count; i++, pskips++, pstridx++)
+ {
+ *pskips = offset;
+ if (*pstridx == (bfd_size_type) -1)
+ offset += STABSIZE;
+ }
+
+ BFD_ASSERT (offset != 0);
+ }
+
+ return (skip > 0);
+
+ error_return:
+ if (stabbuf != NULL)
+ free (stabbuf);
+ return false;
+}
+
/* Write out the stab section. This is called with the relocated
contents. */
@@ -522,7 +694,8 @@ _bfd_write_section_stabs (output_bfd, psinfo, stabsec, psecinfo, contents)
if (secinfo == NULL)
return bfd_set_section_contents (output_bfd, stabsec->output_section,
- contents, stabsec->output_offset,
+ contents,
+ (file_ptr) stabsec->output_offset,
stabsec->_raw_size);
/* Handle each N_BINCL entry. */
@@ -571,7 +744,7 @@ _bfd_write_section_stabs (output_bfd, psinfo, stabsec, psecinfo, contents)
BFD_ASSERT ((bfd_size_type) (tosym - contents) == stabsec->_cooked_size);
return bfd_set_section_contents (output_bfd, stabsec->output_section,
- contents, stabsec->output_offset,
+ contents, (file_ptr) stabsec->output_offset,
stabsec->_cooked_size);
}
@@ -600,8 +773,8 @@ _bfd_write_stab_strings (output_bfd, psinfo)
<= sinfo->stabstr->output_section->_raw_size);
if (bfd_seek (output_bfd,
- (sinfo->stabstr->output_section->filepos
- + sinfo->stabstr->output_offset),
+ (file_ptr) (sinfo->stabstr->output_section->filepos
+ + sinfo->stabstr->output_offset),
SEEK_SET) != 0)
return false;
diff --git a/contrib/binutils/bfd/sunos.c b/contrib/binutils/bfd/sunos.c
index f4ada70..30fd019 100644
--- a/contrib/binutils/bfd/sunos.c
+++ b/contrib/binutils/bfd/sunos.c
@@ -1,5 +1,6 @@
/* BFD backend for SunOS binaries.
- Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000
+ Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
+ 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -20,7 +21,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define TARGETNAME "a.out-sunos-big"
-#define MY(OP) CAT(sunos_big_,OP)
+
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define MY(OP) CONCAT2 (sunos_big_,OP)
#include "bfd.h"
#include "bfdlink.h"
@@ -142,6 +147,7 @@ sunos_read_dynamic_info (abfd)
struct external_sun4_dynamic dyninfo;
unsigned long dynver;
struct external_sun4_dynamic_link linkinfo;
+ bfd_size_type amt;
if (obj_aout_dynamic_info (abfd) != (PTR) NULL)
return true;
@@ -152,8 +158,8 @@ sunos_read_dynamic_info (abfd)
return false;
}
- info = ((struct sunos_dynamic_info *)
- bfd_zalloc (abfd, sizeof (struct sunos_dynamic_info)));
+ amt = sizeof (struct sunos_dynamic_info);
+ info = (struct sunos_dynamic_info *) bfd_zalloc (abfd, amt);
if (!info)
return false;
info->valid = false;
@@ -174,7 +180,8 @@ sunos_read_dynamic_info (abfd)
if ((abfd->flags & DYNAMIC) == 0)
return true;
if (! bfd_get_section_contents (abfd, obj_datasec (abfd), (PTR) &dyninfo,
- (file_ptr) 0, sizeof dyninfo))
+ (file_ptr) 0,
+ (bfd_size_type) sizeof dyninfo))
return true;
dynver = GET_WORD (abfd, dyninfo.ld_version);
@@ -195,7 +202,8 @@ sunos_read_dynamic_info (abfd)
/* This executable appears to be dynamically linked in a way that we
can understand. */
- if (! bfd_get_section_contents (abfd, dynsec, (PTR) &linkinfo, dynoff,
+ if (! bfd_get_section_contents (abfd, dynsec, (PTR) &linkinfo,
+ (file_ptr) dynoff,
(bfd_size_type) sizeof linkinfo))
return true;
@@ -277,6 +285,7 @@ sunos_slurp_dynamic_symtab (abfd)
bfd *abfd;
{
struct sunos_dynamic_info *info;
+ bfd_size_type amt;
/* Get the general dynamic information. */
if (obj_aout_dynamic_info (abfd) == NULL)
@@ -295,16 +304,12 @@ sunos_slurp_dynamic_symtab (abfd)
/* Get the dynamic nlist structures. */
if (info->dynsym == (struct external_nlist *) NULL)
{
- info->dynsym = ((struct external_nlist *)
- bfd_alloc (abfd,
- (info->dynsym_count
- * EXTERNAL_NLIST_SIZE)));
+ amt = (bfd_size_type) info->dynsym_count * EXTERNAL_NLIST_SIZE;
+ info->dynsym = (struct external_nlist *) bfd_alloc (abfd, amt);
if (info->dynsym == NULL && info->dynsym_count != 0)
return false;
- if (bfd_seek (abfd, info->dyninfo.ld_stab, SEEK_SET) != 0
- || (bfd_read ((PTR) info->dynsym, info->dynsym_count,
- EXTERNAL_NLIST_SIZE, abfd)
- != info->dynsym_count * EXTERNAL_NLIST_SIZE))
+ if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_stab, SEEK_SET) != 0
+ || bfd_bread ((PTR) info->dynsym, amt, abfd) != amt)
{
if (info->dynsym != NULL)
{
@@ -318,13 +323,12 @@ sunos_slurp_dynamic_symtab (abfd)
/* Get the dynamic strings. */
if (info->dynstr == (char *) NULL)
{
- info->dynstr = (char *) bfd_alloc (abfd, info->dyninfo.ld_symb_size);
+ amt = info->dyninfo.ld_symb_size;
+ info->dynstr = (char *) bfd_alloc (abfd, amt);
if (info->dynstr == NULL && info->dyninfo.ld_symb_size != 0)
return false;
- if (bfd_seek (abfd, info->dyninfo.ld_symbols, SEEK_SET) != 0
- || (bfd_read ((PTR) info->dynstr, 1, info->dyninfo.ld_symb_size,
- abfd)
- != info->dyninfo.ld_symb_size))
+ if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_symbols, SEEK_SET) != 0
+ || bfd_bread ((PTR) info->dynstr, amt, abfd) != amt)
{
if (info->dynstr != NULL)
{
@@ -367,8 +371,8 @@ sunos_canonicalize_dynamic_symtab (abfd, storage)
table = (bfd_byte *) bfd_malloc (table_size);
if (table == NULL && table_size != 0)
abort ();
- if (bfd_seek (abfd, info->dyninfo.ld_hash, SEEK_SET) != 0
- || bfd_read ((PTR) table, 1, table_size, abfd) != table_size)
+ if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_hash, SEEK_SET) != 0
+ || bfd_bread ((PTR) table, table_size, abfd) != table_size)
abort ();
for (i = 0; i < info->dynsym_count; i++)
{
@@ -398,18 +402,18 @@ sunos_canonicalize_dynamic_symtab (abfd, storage)
structures. */
if (info->canonical_dynsym == (aout_symbol_type *) NULL)
{
- info->canonical_dynsym = ((aout_symbol_type *)
- bfd_alloc (abfd,
- (info->dynsym_count
- * sizeof (aout_symbol_type))));
+ bfd_size_type size;
+ bfd_size_type strsize = info->dyninfo.ld_symb_size;
+
+ size = (bfd_size_type) info->dynsym_count * sizeof (aout_symbol_type);
+ info->canonical_dynsym = (aout_symbol_type *) bfd_alloc (abfd, size);
if (info->canonical_dynsym == NULL && info->dynsym_count != 0)
return -1;
if (! aout_32_translate_symbol_table (abfd, info->canonical_dynsym,
- info->dynsym, info->dynsym_count,
- info->dynstr,
- info->dyninfo.ld_symb_size,
- true))
+ info->dynsym,
+ (bfd_size_type) info->dynsym_count,
+ info->dynstr, strsize, true))
{
if (info->canonical_dynsym != NULL)
{
@@ -459,6 +463,7 @@ sunos_canonicalize_dynamic_reloc (abfd, storage, syms)
{
struct sunos_dynamic_info *info;
unsigned long i;
+ bfd_size_type size;
/* Get the general dynamic information. */
if (obj_aout_dynamic_info (abfd) == (PTR) NULL)
@@ -477,15 +482,12 @@ sunos_canonicalize_dynamic_reloc (abfd, storage, syms)
/* Get the dynamic reloc information. */
if (info->dynrel == NULL)
{
- info->dynrel = (PTR) bfd_alloc (abfd,
- (info->dynrel_count
- * obj_reloc_entry_size (abfd)));
- if (info->dynrel == NULL && info->dynrel_count != 0)
+ size = (bfd_size_type) info->dynrel_count * obj_reloc_entry_size (abfd);
+ info->dynrel = (PTR) bfd_alloc (abfd, size);
+ if (info->dynrel == NULL && size != 0)
return -1;
- if (bfd_seek (abfd, info->dyninfo.ld_rel, SEEK_SET) != 0
- || (bfd_read ((PTR) info->dynrel, info->dynrel_count,
- obj_reloc_entry_size (abfd), abfd)
- != info->dynrel_count * obj_reloc_entry_size (abfd)))
+ if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_rel, SEEK_SET) != 0
+ || bfd_bread ((PTR) info->dynrel, size, abfd) != size)
{
if (info->dynrel != NULL)
{
@@ -502,10 +504,8 @@ sunos_canonicalize_dynamic_reloc (abfd, storage, syms)
{
arelent *to;
- info->canonical_dynrel = ((arelent *)
- bfd_alloc (abfd,
- (info->dynrel_count
- * sizeof (arelent))));
+ size = (bfd_size_type) info->dynrel_count * sizeof (arelent);
+ info->canonical_dynrel = (arelent *) bfd_alloc (abfd, size);
if (info->canonical_dynrel == NULL && info->dynrel_count != 0)
return -1;
@@ -520,7 +520,7 @@ sunos_canonicalize_dynamic_reloc (abfd, storage, syms)
pend = p + info->dynrel_count;
for (; p < pend; p++, to++)
NAME(aout,swap_ext_reloc_in) (abfd, p, to, syms,
- info->dynsym_count);
+ (bfd_size_type) info->dynsym_count);
}
else
{
@@ -531,7 +531,7 @@ sunos_canonicalize_dynamic_reloc (abfd, storage, syms)
pend = p + info->dynrel_count;
for (; p < pend; p++, to++)
NAME(aout,swap_std_reloc_in) (abfd, p, to, syms,
- info->dynsym_count);
+ (bfd_size_type) info->dynsym_count);
}
}
@@ -564,21 +564,21 @@ static const bfd_byte sparc_plt_first_entry[SPARC_PLT_ENTRY_SIZE] =
};
/* save %sp, -96, %sp */
-#define SPARC_PLT_ENTRY_WORD0 0x9de3bfa0
+#define SPARC_PLT_ENTRY_WORD0 ((bfd_vma) 0x9de3bfa0)
/* call; address filled in later. */
-#define SPARC_PLT_ENTRY_WORD1 0x40000000
+#define SPARC_PLT_ENTRY_WORD1 ((bfd_vma) 0x40000000)
/* sethi; reloc index filled in later. */
-#define SPARC_PLT_ENTRY_WORD2 0x01000000
+#define SPARC_PLT_ENTRY_WORD2 ((bfd_vma) 0x01000000)
/* This sequence is used when for the jump table entry to a defined
symbol in a complete executable. It is used when linking PIC
compiled code which is not being put into a shared library. */
/* sethi <address to be filled in later>, %g1 */
-#define SPARC_PLT_PIC_WORD0 0x03000000
+#define SPARC_PLT_PIC_WORD0 ((bfd_vma) 0x03000000)
/* jmp %g1 + <address to be filled in later> */
-#define SPARC_PLT_PIC_WORD1 0x81c06000
+#define SPARC_PLT_PIC_WORD1 ((bfd_vma) 0x81c06000)
/* nop */
-#define SPARC_PLT_PIC_WORD2 0x01000000
+#define SPARC_PLT_PIC_WORD2 ((bfd_vma) 0x01000000)
/* An m68k procedure linkage table entry is 8 bytes. The first entry
in the table is a jump which is filled in the by the runtime
@@ -598,7 +598,7 @@ static const bfd_byte m68k_plt_first_entry[M68K_PLT_ENTRY_SIZE] =
};
/* bsrl */
-#define M68K_PLT_ENTRY_WORD0 (0x61ff)
+#define M68K_PLT_ENTRY_WORD0 ((bfd_vma) 0x61ff)
/* Remaining words filled in later. */
/* An entry in the SunOS linker hash table. */
@@ -715,9 +715,9 @@ sunos_link_hash_table_create (abfd)
bfd *abfd;
{
struct sunos_link_hash_table *ret;
+ bfd_size_type amt = sizeof (struct sunos_link_hash_table);
- ret = ((struct sunos_link_hash_table *)
- bfd_alloc (abfd, sizeof (struct sunos_link_hash_table)));
+ ret = (struct sunos_link_hash_table *) bfd_alloc (abfd, amt);
if (ret == (struct sunos_link_hash_table *) NULL)
return (struct bfd_link_hash_table *) NULL;
if (! NAME(aout,link_hash_table_init) (&ret->root, abfd,
@@ -875,10 +875,10 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
bfd_size_type *sym_countp;
char **stringsp;
{
- asection *s;
bfd *dynobj;
struct sunos_dynamic_info *dinfo;
unsigned long need;
+ asection **ps;
/* Make sure we have all the required sections. */
if (info->hash->creator == abfd->xvec)
@@ -904,17 +904,12 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
want, because that one still implies that the section takes up
space in the output file. If this is the first object we have
seen, we must preserve the dynamic sections we just created. */
- if (abfd != dynobj)
- abfd->sections = NULL;
- else
+ for (ps = &abfd->sections; *ps != NULL; )
{
- asection *s;
-
- for (s = abfd->sections;
- (s->flags & SEC_LINKER_CREATED) == 0;
- s = s->next)
- ;
- abfd->sections = s;
+ if (abfd != dynobj || ((*ps)->flags & SEC_LINKER_CREATED) == 0)
+ bfd_section_list_remove (abfd, ps);
+ else
+ ps = &(*ps)->next;
}
/* The native linker seems to just ignore dynamic objects when -r is
@@ -938,7 +933,7 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
/* The .need section holds the list of names of shared objets
which must be included at runtime. The address of this
section is put in the ld_need field. */
- s = bfd_make_section (dynobj, ".need");
+ asection *s = bfd_make_section (dynobj, ".need");
if (s == NULL
|| ! bfd_set_section_flags (dynobj, s,
(SEC_ALLOC
@@ -955,7 +950,7 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
/* The .rules section holds the path to search for shared
objects. The address of this section is put in the ld_rules
field. */
- s = bfd_make_section (dynobj, ".rules");
+ asection *s = bfd_make_section (dynobj, ".rules");
if (s == NULL
|| ! bfd_set_section_flags (dynobj, s,
(SEC_ALLOC
@@ -985,12 +980,12 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
unsigned short major_vno, minor_vno;
struct bfd_link_needed_list *needed, **pp;
char *namebuf, *p;
- size_t alc;
+ bfd_size_type alc;
bfd_byte b;
char *namecopy;
- if (bfd_seek (abfd, need, SEEK_SET) != 0
- || bfd_read (buf, 1, 16, abfd) != 16)
+ if (bfd_seek (abfd, (file_ptr) need, SEEK_SET) != 0
+ || bfd_bread (buf, (bfd_size_type) 16, abfd) != 16)
return false;
/* For the format of an ld_need entry, see aout/sun4.h. We
@@ -998,12 +993,12 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
name = bfd_get_32 (abfd, buf);
flags = bfd_get_32 (abfd, buf + 4);
- major_vno = (unsigned short)bfd_get_16 (abfd, buf + 8);
- minor_vno = (unsigned short)bfd_get_16 (abfd, buf + 10);
+ major_vno = (unsigned short) bfd_get_16 (abfd, buf + 8);
+ minor_vno = (unsigned short) bfd_get_16 (abfd, buf + 10);
need = bfd_get_32 (abfd, buf + 12);
- needed = ((struct bfd_link_needed_list *)
- bfd_alloc (abfd, sizeof (struct bfd_link_needed_list)));
+ alc = sizeof (struct bfd_link_needed_list);
+ needed = (struct bfd_link_needed_list *) bfd_alloc (abfd, alc);
if (needed == NULL)
return false;
needed->by = abfd;
@@ -1020,7 +1015,7 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
*p++ = '-';
*p++ = 'l';
}
- if (bfd_seek (abfd, name, SEEK_SET) != 0)
+ if (bfd_seek (abfd, (file_ptr) name, SEEK_SET) != 0)
{
free (namebuf);
return false;
@@ -1028,13 +1023,13 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
do
{
- if (bfd_read (&b, 1, 1, abfd) != 1)
+ if (bfd_bread (&b, (bfd_size_type) 1, abfd) != 1)
{
free (namebuf);
return false;
}
- if ((size_t) (p - namebuf) >= alc)
+ if ((bfd_size_type) (p - namebuf) >= alc)
{
char *n;
@@ -1085,7 +1080,7 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp)
strcat (p, minbuf);
}
- namecopy = bfd_alloc (abfd, strlen (namebuf) + 1);
+ namecopy = bfd_alloc (abfd, (bfd_size_type) strlen (namebuf) + 1);
if (namecopy == NULL)
{
free (namebuf);
@@ -1322,11 +1317,11 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
asection **srulesptr;
{
bfd *dynobj;
- size_t dynsymcount;
+ bfd_size_type dynsymcount;
struct sunos_link_hash_entry *h;
asection *s;
size_t bucketcount;
- size_t hashalloc;
+ bfd_size_type hashalloc;
size_t i;
bfd *sub;
@@ -1442,7 +1437,7 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
s->contents = (bfd_byte *) bfd_alloc (dynobj, hashalloc);
if (s->contents == NULL && dynsymcount > 0)
return false;
- memset (s->contents, 0, hashalloc);
+ memset (s->contents, 0, (size_t) hashalloc);
for (i = 0; i < bucketcount; i++)
PUT_WORD (output_bfd, (bfd_vma) -1, s->contents + i * HASH_ENTRY_SIZE);
s->_raw_size = bucketcount * HASH_ENTRY_SIZE;
@@ -1470,7 +1465,7 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr,
add = 8 - (s->_raw_size & 7);
contents = (bfd_byte *) bfd_realloc (s->contents,
- (size_t) (s->_raw_size + add));
+ s->_raw_size + add);
if (contents == NULL)
return false;
memset (contents + s->_raw_size, 0, (size_t) add);
@@ -1544,19 +1539,19 @@ sunos_scan_relocs (info, abfd, sec, rel_size)
return true;
if (! info->keep_memory)
- relocs = free_relocs = bfd_malloc ((size_t) rel_size);
+ relocs = free_relocs = bfd_malloc (rel_size);
else
{
struct aout_section_data_struct *n;
+ bfd_size_type amt = sizeof (struct aout_section_data_struct);
- n = ((struct aout_section_data_struct *)
- bfd_alloc (abfd, sizeof (struct aout_section_data_struct)));
+ n = (struct aout_section_data_struct *) bfd_alloc (abfd, amt);
if (n == NULL)
relocs = NULL;
else
{
set_aout_section_data (sec, n);
- relocs = bfd_malloc ((size_t) rel_size);
+ relocs = bfd_malloc (rel_size);
aout_section_data (sec)->relocs = relocs;
}
}
@@ -1564,7 +1559,7 @@ sunos_scan_relocs (info, abfd, sec, rel_size)
return false;
if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0
- || bfd_read (relocs, 1, rel_size, abfd) != rel_size)
+ || bfd_bread (relocs, rel_size, abfd) != rel_size)
goto error_return;
if (obj_reloc_entry_size (abfd) == RELOC_STD_SIZE)
@@ -1777,6 +1772,7 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
asection *splt = NULL;
asection *sgot = NULL;
asection *srel = NULL;
+ bfd_size_type amt;
/* We only know how to handle SPARC plt entries. */
if (bfd_get_arch (abfd) != bfd_arch_sparc)
@@ -1868,10 +1864,10 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size)
if (adata (abfd).local_got_offsets == NULL)
{
+ amt = bfd_get_symcount (abfd);
+ amt *= sizeof (bfd_vma);
adata (abfd).local_got_offsets =
- (bfd_vma *) bfd_zalloc (abfd,
- (bfd_get_symcount (abfd)
- * sizeof (bfd_vma)));
+ (bfd_vma *) bfd_zalloc (abfd, amt);
if (adata (abfd).local_got_offsets == NULL)
return false;
}
@@ -2201,7 +2197,6 @@ sunos_write_dynamic_symbol (output_bfd, info, harg)
bfd *dynobj;
asection *splt;
bfd_byte *p;
- asection *s;
bfd_vma r_address;
dynobj = sunos_hash_table (info)->dynobj;
@@ -2230,8 +2225,6 @@ sunos_write_dynamic_symbol (output_bfd, info, harg)
}
else
{
- bfd_vma val;
-
val = (h->root.root.u.def.section->output_section->vma
+ h->root.root.u.def.section->output_offset
+ h->root.root.u.def.value);
@@ -2250,7 +2243,7 @@ sunos_write_dynamic_symbol (output_bfd, info, harg)
abort ();
bfd_put_16 (output_bfd, M68K_PLT_ENTRY_WORD0, p);
bfd_put_32 (output_bfd, (- (h->plt_offset + 2)), p + 2);
- bfd_put_16 (output_bfd, s->reloc_count, p + 6);
+ bfd_put_16 (output_bfd, (bfd_vma) s->reloc_count, p + 6);
r_address += 2;
break;
@@ -2399,13 +2392,13 @@ sunos_write_dynamic_symbol (output_bfd, info, harg)
outsym = ((struct external_nlist *)
(s->contents + h->dynindx * EXTERNAL_NLIST_SIZE));
- bfd_h_put_8 (output_bfd, type, outsym->e_type);
- bfd_h_put_8 (output_bfd, 0, outsym->e_other);
+ H_PUT_8 (output_bfd, type, outsym->e_type);
+ H_PUT_8 (output_bfd, 0, outsym->e_other);
/* FIXME: The native linker doesn't use 0 for desc. It seems to use
one less than the desc value in the shared library, although that
seems unlikely. */
- bfd_h_put_16 (output_bfd, 0, outsym->e_desc);
+ H_PUT_16 (output_bfd, 0, outsym->e_desc);
PUT_WORD (output_bfd, h->dynstr_index, outsym->e_strx);
PUT_WORD (output_bfd, val, outsym->e_value);
@@ -2668,7 +2661,7 @@ sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc,
}
*relocationp = (sgot->vma
- + (*got_offsetp &~ 1)
+ + (*got_offsetp &~ (bfd_vma) 1)
- sunos_hash_table (info)->got_base);
/* There is nothing else to do for a base relative reloc. */
@@ -2845,7 +2838,8 @@ sunos_finish_dynamic_link (abfd, info)
BFD_ASSERT (o->output_section != NULL
&& o->output_section->owner == abfd);
if (! bfd_set_section_contents (abfd, o->output_section,
- o->contents, o->output_offset,
+ o->contents,
+ (file_ptr) o->output_offset,
o->_raw_size))
return false;
}
@@ -2855,6 +2849,7 @@ sunos_finish_dynamic_link (abfd, info)
{
struct external_sun4_dynamic esd;
struct external_sun4_dynamic_link esdl;
+ file_ptr pos;
/* Finish up the dynamic link information. */
PUT_WORD (dynobj, (bfd_vma) 3, esd.ld_version);
@@ -2869,7 +2864,8 @@ sunos_finish_dynamic_link (abfd, info)
esd.ld);
if (! bfd_set_section_contents (abfd, sdyn->output_section, &esd,
- sdyn->output_offset, sizeof esd))
+ (file_ptr) sdyn->output_offset,
+ (bfd_size_type) sizeof esd))
return false;
PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_loaded);
@@ -2934,11 +2930,10 @@ sunos_finish_dynamic_link (abfd, info)
BFD_ALIGN (obj_textsec (abfd)->_raw_size, 0x2000),
esdl.ld_text);
+ pos = sdyn->output_offset;
+ pos += sizeof esd + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE;
if (! bfd_set_section_contents (abfd, sdyn->output_section, &esdl,
- (sdyn->output_offset
- + sizeof esd
- + EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE),
- sizeof esdl))
+ pos, (bfd_size_type) sizeof esdl))
return false;
abfd->flags |= DYNAMIC;
diff --git a/contrib/binutils/bfd/syms.c b/contrib/binutils/bfd/syms.c
index 34169ec..9ec9dd8 100644
--- a/contrib/binutils/bfd/syms.c
+++ b/contrib/binutils/bfd/syms.c
@@ -1,6 +1,6 @@
/* Generic symbol-table support for the BFD library.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000
+ 2000, 2001
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -197,7 +197,7 @@ CODE_FRAGMENT
.
. {* The text of the symbol. The name is left alone, and not copied; the
. application may not alter it. *}
-. CONST char *name;
+. const char *name;
.
. {* The value of the symbol. This really should be a union of a
. numeric value with a pointer, since some flags indicate that
@@ -308,10 +308,12 @@ CODE_FRAGMENT
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
+#include "safe-ctype.h"
#include "bfdlink.h"
#include "aout/stab_gnu.h"
static char coff_section_type PARAMS ((const char *));
+static int cmpindexentry PARAMS ((const PTR, const PTR));
/*
DOCDD
@@ -353,7 +355,10 @@ bfd_is_local_label (abfd, sym)
bfd *abfd;
asymbol *sym;
{
- if ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0)
+ /* The BSF_SECTION_SYM check is needed for IA-64, where every label that
+ starts with '.' is local. This would accidentally catch section names
+ if we didn't reject them here. */
+ if ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_SECTION_SYM)) != 0)
return false;
if (sym->name == NULL)
return false;
@@ -429,14 +434,15 @@ FUNCTION
bfd_print_symbol_vandf
SYNOPSIS
- void bfd_print_symbol_vandf(PTR file, asymbol *symbol);
+ void bfd_print_symbol_vandf(bfd *abfd, PTR file, asymbol *symbol);
DESCRIPTION
Print the value and flags of the @var{symbol} supplied to the
stream @var{file}.
*/
void
-bfd_print_symbol_vandf (arg, symbol)
+bfd_print_symbol_vandf (abfd, arg, symbol)
+ bfd *abfd;
PTR arg;
asymbol *symbol;
{
@@ -444,11 +450,12 @@ bfd_print_symbol_vandf (arg, symbol)
flagword type = symbol->flags;
if (symbol->section != (asection *) NULL)
{
- fprintf_vma (file, symbol->value + symbol->section->vma);
+ bfd_fprintf_vma (abfd, file,
+ symbol->value + symbol->section->vma);
}
else
{
- fprintf_vma (file, symbol->value);
+ bfd_fprintf_vma (abfd, file, symbol->value);
}
/* This presumes that a symbol can not be both BSF_DEBUGGING and
@@ -489,6 +496,31 @@ DESCRIPTION
/*
FUNCTION
+ _bfd_generic_make_empty_symbol
+
+SYNOPSIS
+ asymbol *_bfd_generic_make_empty_symbol (bfd *);
+
+DESCRIPTION
+ Create a new <<asymbol>> structure for the BFD @var{abfd}
+ and return a pointer to it. Used by core file routines,
+ binary back-end and anywhere else where no private info
+ is needed.
+*/
+
+asymbol *
+_bfd_generic_make_empty_symbol (abfd)
+ bfd *abfd;
+{
+ bfd_size_type amt = sizeof (asymbol);
+ asymbol *new = (asymbol *) bfd_zalloc (abfd, amt);
+ if (new)
+ new->the_bfd = abfd;
+ return new;
+}
+
+/*
+FUNCTION
bfd_make_debug_symbol
DESCRIPTION
@@ -502,14 +534,14 @@ DESCRIPTION
struct section_to_type
{
- CONST char *section;
+ const char *section;
char type;
};
/* Map section names to POSIX/BSD single-character symbol types.
This table is probably incomplete. It is sorted for convenience of
adding entries. Since it is so short, a linear search is used. */
-static CONST struct section_to_type stt[] =
+static const struct section_to_type stt[] =
{
{"*DEBUG*", 'N'},
{".bss", 'b'},
@@ -541,7 +573,7 @@ static char
coff_section_type (s)
const char *s;
{
- CONST struct section_to_type *t;
+ const struct section_to_type *t;
for (t = &stt[0]; t->section; t++)
if (!strncmp (s, t->section, strlen (t->section)))
@@ -550,13 +582,6 @@ coff_section_type (s)
return '?';
}
-#ifndef islower
-#define islower(c) ((c) >= 'a' && (c) <= 'z')
-#endif
-#ifndef toupper
-#define toupper(c) (islower(c) ? ((c) & ~0x20) : (c))
-#endif
-
/*
FUNCTION
bfd_decode_symclass
@@ -611,7 +636,7 @@ bfd_decode_symclass (symbol)
else
return '?';
if (symbol->flags & BSF_GLOBAL)
- c = toupper (c);
+ c = TOUPPER (c);
return c;
/* We don't have to handle these cases just yet, but we will soon:
@@ -718,7 +743,7 @@ _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep)
if (storage == 0)
return 0;
- syms = (asymbol **) bfd_malloc ((size_t) storage);
+ syms = (asymbol **) bfd_malloc ((bfd_size_type) storage);
if (syms == NULL)
goto error_return;
@@ -848,7 +873,8 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
bfd_byte *last_stab = NULL;
bfd_size_type stroff;
struct indexentry *indexentry;
- char *directory_name, *file_name;
+ char *file_name;
+ char *directory_name;
int saw_fun;
*pfound = false;
@@ -894,11 +920,10 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
arelent **reloc_vector;
int i;
char *name;
- char *file_name;
- char *directory_name;
char *function_name;
+ bfd_size_type amt = sizeof *info;
- info = (struct stab_find_info *) bfd_zalloc (abfd, sizeof *info);
+ info = (struct stab_find_info *) bfd_zalloc (abfd, amt);
if (info == NULL)
return false;
@@ -925,10 +950,10 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
if (info->stabs == NULL || info->strs == NULL)
return false;
- if (! bfd_get_section_contents (abfd, info->stabsec, info->stabs, 0,
- stabsize)
- || ! bfd_get_section_contents (abfd, info->strsec, info->strs, 0,
- strsize))
+ if (! bfd_get_section_contents (abfd, info->stabsec, info->stabs,
+ (bfd_vma) 0, stabsize)
+ || ! bfd_get_section_contents (abfd, info->strsec, info->strs,
+ (bfd_vma) 0, strsize))
return false;
/* If this is a relocateable object file, we have to relocate
@@ -938,7 +963,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
reloc_size = bfd_get_reloc_upper_bound (abfd, info->stabsec);
if (reloc_size < 0)
return false;
- reloc_vector = (arelent **) bfd_malloc (reloc_size);
+ reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
if (reloc_vector == NULL && reloc_size != 0)
return false;
reloc_count = bfd_canonicalize_reloc (abfd, info->stabsec, reloc_vector,
@@ -979,7 +1004,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
val &= r->howto->src_mask;
sym = *r->sym_ptr_ptr;
val += sym->value + sym->section->vma + r->addend;
- bfd_put_32 (abfd, val, info->stabs + r->address);
+ bfd_put_32 (abfd, (bfd_vma) val, info->stabs + r->address);
}
}
@@ -1029,10 +1054,9 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
return true;
++info->indextablesize;
- info->indextable = ((struct indexentry *)
- bfd_alloc (abfd,
- (sizeof (struct indexentry)
- * info->indextablesize)));
+ amt = info->indextablesize;
+ amt *= sizeof (struct indexentry);
+ info->indextable = (struct indexentry *) bfd_alloc (abfd, amt);
if (info->indextable == NULL)
return false;
@@ -1150,7 +1174,8 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
++i;
info->indextablesize = i;
- qsort (info->indextable, i, sizeof (struct indexentry), cmpindexentry);
+ qsort (info->indextable, (size_t) i, sizeof (struct indexentry),
+ cmpindexentry);
*pinfo = (PTR) info;
}
@@ -1272,9 +1297,8 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
{
if (info->filename != NULL)
free (info->filename);
- info->filename = (char *) bfd_malloc (dirlen +
- strlen (file_name)
- + 1);
+ info->filename = (char *) bfd_malloc ((bfd_size_type) dirlen
+ + strlen (file_name) + 1);
if (info->filename == NULL)
return false;
strcpy (info->filename, directory_name);
diff --git a/contrib/binutils/bfd/sysdep.h b/contrib/binutils/bfd/sysdep.h
index bab1c51..1338d6b 100644
--- a/contrib/binutils/bfd/sysdep.h
+++ b/contrib/binutils/bfd/sysdep.h
@@ -125,6 +125,12 @@ extern void free ();
extern char *getenv ();
#endif
+/* Define offsetof for those systems which lack it */
+
+#ifndef offsetof
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
+
#ifdef ENABLE_NLS
#include <libintl.h>
/* Note the use of dgetext() and PACKAGE here, rather than gettext().
diff --git a/contrib/binutils/bfd/targets.c b/contrib/binutils/bfd/targets.c
index cfbe6ad..352571a 100644
--- a/contrib/binutils/bfd/targets.c
+++ b/contrib/binutils/bfd/targets.c
@@ -1,6 +1,6 @@
/* Generic target-file-type support for the BFD library.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001
+ 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -153,7 +153,8 @@ DESCRIPTION
. bfd_target_versados_flavour,
. bfd_target_msdos_flavour,
. bfd_target_ovax_flavour,
-. bfd_target_evax_flavour
+. bfd_target_evax_flavour,
+. bfd_target_mmo_flavour
.};
.
.enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
@@ -208,27 +209,27 @@ Entries for byte swapping for data. These are different from the other
entry points, since they don't take a BFD asthe first argument.
Certain other handlers could do the same.
-. bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *));
+. bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *));
. bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
-. void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
-. bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *));
+. void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
+. bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *));
. bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *));
-. void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
-. bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *));
+. void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
+. bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *));
. bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *));
-. void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
+. void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
Byte swapping for the headers
-. bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *));
+. bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *));
. bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *));
-. void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
-. bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *));
+. void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
+. bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *));
. bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *));
-. void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
-. bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *));
+. void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
+. bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *));
. bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *));
-. void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
+. void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
Format dependent routines: these are vectors of entry points
within the target vector structure, one for each format to check.
@@ -239,225 +240,223 @@ Check the format of a file being read. Return a <<bfd_target *>> or zero.
Set the format of a file being written.
-. boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
+. boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
Write cached information into a file being written, at <<bfd_close>>.
-. boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
+. boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
The general target vector. These vectors are initialized using the
BFD_JUMP_TABLE macros.
.
. {* Generic entry points. *}
-.#define BFD_JUMP_TABLE_GENERIC(NAME)\
-.CAT(NAME,_close_and_cleanup),\
-.CAT(NAME,_bfd_free_cached_info),\
-.CAT(NAME,_new_section_hook),\
-.CAT(NAME,_get_section_contents),\
-.CAT(NAME,_get_section_contents_in_window)
+Do not "beautify" the CONCAT* macro args. Traditional C will not
+remove whitespace added here, and thus will fail to concatenate
+the tokens.
+.#define BFD_JUMP_TABLE_GENERIC(NAME) \
+.CONCAT2 (NAME,_close_and_cleanup), \
+.CONCAT2 (NAME,_bfd_free_cached_info), \
+.CONCAT2 (NAME,_new_section_hook), \
+.CONCAT2 (NAME,_get_section_contents), \
+.CONCAT2 (NAME,_get_section_contents_in_window)
.
. {* Called when the BFD is being closed to do any necessary cleanup. *}
-. boolean (*_close_and_cleanup) PARAMS ((bfd *));
+. boolean (*_close_and_cleanup) PARAMS ((bfd *));
. {* Ask the BFD to free all cached information. *}
-. boolean (*_bfd_free_cached_info) PARAMS ((bfd *));
+. boolean (*_bfd_free_cached_info) PARAMS ((bfd *));
. {* Called when a new section is created. *}
-. boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
+. boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
. {* Read the contents of a section. *}
-. boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
-. file_ptr, bfd_size_type));
-. boolean (*_bfd_get_section_contents_in_window)
-. PARAMS ((bfd *, sec_ptr, bfd_window *,
-. file_ptr, bfd_size_type));
+. boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
+. file_ptr, bfd_size_type));
+. boolean (*_bfd_get_section_contents_in_window)
+. PARAMS ((bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type));
.
. {* Entry points to copy private data. *}
-.#define BFD_JUMP_TABLE_COPY(NAME)\
-.CAT(NAME,_bfd_copy_private_bfd_data),\
-.CAT(NAME,_bfd_merge_private_bfd_data),\
-.CAT(NAME,_bfd_copy_private_section_data),\
-.CAT(NAME,_bfd_copy_private_symbol_data),\
-.CAT(NAME,_bfd_set_private_flags),\
-.CAT(NAME,_bfd_print_private_bfd_data)\
+.#define BFD_JUMP_TABLE_COPY(NAME) \
+.CONCAT2 (NAME,_bfd_copy_private_bfd_data), \
+.CONCAT2 (NAME,_bfd_merge_private_bfd_data), \
+.CONCAT2 (NAME,_bfd_copy_private_section_data), \
+.CONCAT2 (NAME,_bfd_copy_private_symbol_data), \
+.CONCAT2 (NAME,_bfd_set_private_flags), \
+.CONCAT2 (NAME,_bfd_print_private_bfd_data) \
. {* Called to copy BFD general private data from one object file
. to another. *}
-. boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
+. boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
. {* Called to merge BFD general private data from one object file
. to a common output file when linking. *}
-. boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
+. boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
. {* Called to copy BFD private section data from one object file
. to another. *}
-. boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
-. bfd *, sec_ptr));
+. boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
+. bfd *, sec_ptr));
. {* Called to copy BFD private symbol data from one symbol
. to another. *}
-. boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
-. bfd *, asymbol *));
+. boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
+. bfd *, asymbol *));
. {* Called to set private backend flags *}
-. boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
+. boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
.
. {* Called to print private BFD data *}
-. boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
+. boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
.
. {* Core file entry points. *}
-.#define BFD_JUMP_TABLE_CORE(NAME)\
-.CAT(NAME,_core_file_failing_command),\
-.CAT(NAME,_core_file_failing_signal),\
-.CAT(NAME,_core_file_matches_executable_p)
+.#define BFD_JUMP_TABLE_CORE(NAME) \
+.CONCAT2 (NAME,_core_file_failing_command), \
+.CONCAT2 (NAME,_core_file_failing_signal), \
+.CONCAT2 (NAME,_core_file_matches_executable_p)
. char * (*_core_file_failing_command) PARAMS ((bfd *));
. int (*_core_file_failing_signal) PARAMS ((bfd *));
. boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
.
. {* Archive entry points. *}
-.#define BFD_JUMP_TABLE_ARCHIVE(NAME)\
-.CAT(NAME,_slurp_armap),\
-.CAT(NAME,_slurp_extended_name_table),\
-.CAT(NAME,_construct_extended_name_table),\
-.CAT(NAME,_truncate_arname),\
-.CAT(NAME,_write_armap),\
-.CAT(NAME,_read_ar_hdr),\
-.CAT(NAME,_openr_next_archived_file),\
-.CAT(NAME,_get_elt_at_index),\
-.CAT(NAME,_generic_stat_arch_elt),\
-.CAT(NAME,_update_armap_timestamp)
+.#define BFD_JUMP_TABLE_ARCHIVE(NAME) \
+.CONCAT2 (NAME,_slurp_armap), \
+.CONCAT2 (NAME,_slurp_extended_name_table), \
+.CONCAT2 (NAME,_construct_extended_name_table), \
+.CONCAT2 (NAME,_truncate_arname), \
+.CONCAT2 (NAME,_write_armap), \
+.CONCAT2 (NAME,_read_ar_hdr), \
+.CONCAT2 (NAME,_openr_next_archived_file), \
+.CONCAT2 (NAME,_get_elt_at_index), \
+.CONCAT2 (NAME,_generic_stat_arch_elt), \
+.CONCAT2 (NAME,_update_armap_timestamp)
. boolean (*_bfd_slurp_armap) PARAMS ((bfd *));
. boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
. boolean (*_bfd_construct_extended_name_table)
-. PARAMS ((bfd *, char **, bfd_size_type *, const char **));
-. void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *));
-. boolean (*write_armap) PARAMS ((bfd *arch,
-. unsigned int elength,
-. struct orl *map,
-. unsigned int orl_count,
-. int stridx));
-. PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
-. bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
+. PARAMS ((bfd *, char **, bfd_size_type *, const char **));
+. void (*_bfd_truncate_arname) PARAMS ((bfd *, const char *, char *));
+. boolean (*write_armap)
+. PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
+. PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
+. bfd * (*openr_next_archived_file) PARAMS ((bfd *, bfd *));
.#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i))
. bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex));
. int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
. boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
.
. {* Entry points used for symbols. *}
-.#define BFD_JUMP_TABLE_SYMBOLS(NAME)\
-.CAT(NAME,_get_symtab_upper_bound),\
-.CAT(NAME,_get_symtab),\
-.CAT(NAME,_make_empty_symbol),\
-.CAT(NAME,_print_symbol),\
-.CAT(NAME,_get_symbol_info),\
-.CAT(NAME,_bfd_is_local_label_name),\
-.CAT(NAME,_get_lineno),\
-.CAT(NAME,_find_nearest_line),\
-.CAT(NAME,_bfd_make_debug_symbol),\
-.CAT(NAME,_read_minisymbols),\
-.CAT(NAME,_minisymbol_to_symbol)
-. long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
-. long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
-. struct symbol_cache_entry **));
-. struct symbol_cache_entry *
-. (*_bfd_make_empty_symbol) PARAMS ((bfd *));
-. void (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
-. struct symbol_cache_entry *,
-. bfd_print_symbol_type));
+.#define BFD_JUMP_TABLE_SYMBOLS(NAME) \
+.CONCAT2 (NAME,_get_symtab_upper_bound), \
+.CONCAT2 (NAME,_get_symtab), \
+.CONCAT2 (NAME,_make_empty_symbol), \
+.CONCAT2 (NAME,_print_symbol), \
+.CONCAT2 (NAME,_get_symbol_info), \
+.CONCAT2 (NAME,_bfd_is_local_label_name), \
+.CONCAT2 (NAME,_get_lineno), \
+.CONCAT2 (NAME,_find_nearest_line), \
+.CONCAT2 (NAME,_bfd_make_debug_symbol), \
+.CONCAT2 (NAME,_read_minisymbols), \
+.CONCAT2 (NAME,_minisymbol_to_symbol)
+. long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
+. long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
+. struct symbol_cache_entry **));
+. struct symbol_cache_entry *
+. (*_bfd_make_empty_symbol) PARAMS ((bfd *));
+. void (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
+. struct symbol_cache_entry *,
+. bfd_print_symbol_type));
.#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))
-. void (*_bfd_get_symbol_info) PARAMS ((bfd *,
-. struct symbol_cache_entry *,
-. symbol_info *));
+. void (*_bfd_get_symbol_info) PARAMS ((bfd *,
+. struct symbol_cache_entry *,
+. symbol_info *));
.#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e))
-. boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *));
+. boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *));
.
-. alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
-. boolean (*_bfd_find_nearest_line) PARAMS ((bfd *abfd,
-. struct sec *section, struct symbol_cache_entry **symbols,
-. bfd_vma offset, CONST char **file, CONST char **func,
-. unsigned int *line));
+. alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
+. boolean (*_bfd_find_nearest_line)
+. PARAMS ((bfd *, struct sec *, struct symbol_cache_entry **, bfd_vma,
+. const char **, const char **, unsigned int *));
. {* Back-door to allow format-aware applications to create debug symbols
. while using BFD for everything else. Currently used by the assembler
. when creating COFF files. *}
-. asymbol * (*_bfd_make_debug_symbol) PARAMS ((
-. bfd *abfd,
-. void *ptr,
-. unsigned long size));
+. asymbol *(*_bfd_make_debug_symbol) PARAMS ((bfd *, void *,
+. unsigned long size));
.#define bfd_read_minisymbols(b, d, m, s) \
. BFD_SEND (b, _read_minisymbols, (b, d, m, s))
-. long (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *,
-. unsigned int *));
+. long (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *,
+. unsigned int *));
.#define bfd_minisymbol_to_symbol(b, d, m, f) \
. BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
. asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
. asymbol *));
.
. {* Routines for relocs. *}
-.#define BFD_JUMP_TABLE_RELOCS(NAME)\
-.CAT(NAME,_get_reloc_upper_bound),\
-.CAT(NAME,_canonicalize_reloc),\
-.CAT(NAME,_bfd_reloc_type_lookup)
-. long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
-. long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
-. struct symbol_cache_entry **));
+.#define BFD_JUMP_TABLE_RELOCS(NAME) \
+.CONCAT2 (NAME,_get_reloc_upper_bound), \
+.CONCAT2 (NAME,_canonicalize_reloc), \
+.CONCAT2 (NAME,_bfd_reloc_type_lookup)
+. long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
+. long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
+. struct symbol_cache_entry **));
. {* See documentation on reloc types. *}
. reloc_howto_type *
-. (*reloc_type_lookup) PARAMS ((bfd *abfd,
-. bfd_reloc_code_real_type code));
+. (*reloc_type_lookup) PARAMS ((bfd *, bfd_reloc_code_real_type));
.
. {* Routines used when writing an object file. *}
-.#define BFD_JUMP_TABLE_WRITE(NAME)\
-.CAT(NAME,_set_arch_mach),\
-.CAT(NAME,_set_section_contents)
-. boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,
-. unsigned long));
-. boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
-. file_ptr, bfd_size_type));
+.#define BFD_JUMP_TABLE_WRITE(NAME) \
+.CONCAT2 (NAME,_set_arch_mach), \
+.CONCAT2 (NAME,_set_section_contents)
+. boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,
+. unsigned long));
+. boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
+. file_ptr, bfd_size_type));
.
. {* Routines used by the linker. *}
-.#define BFD_JUMP_TABLE_LINK(NAME)\
-.CAT(NAME,_sizeof_headers),\
-.CAT(NAME,_bfd_get_relocated_section_contents),\
-.CAT(NAME,_bfd_relax_section),\
-.CAT(NAME,_bfd_link_hash_table_create),\
-.CAT(NAME,_bfd_link_add_symbols),\
-.CAT(NAME,_bfd_final_link),\
-.CAT(NAME,_bfd_link_split_section),\
-.CAT(NAME,_bfd_gc_sections)
-. int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
-. bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *,
-. struct bfd_link_info *, struct bfd_link_order *,
-. bfd_byte *data, boolean relocateable,
-. struct symbol_cache_entry **));
+.#define BFD_JUMP_TABLE_LINK(NAME) \
+.CONCAT2 (NAME,_sizeof_headers), \
+.CONCAT2 (NAME,_bfd_get_relocated_section_contents), \
+.CONCAT2 (NAME,_bfd_relax_section), \
+.CONCAT2 (NAME,_bfd_link_hash_table_create), \
+.CONCAT2 (NAME,_bfd_link_add_symbols), \
+.CONCAT2 (NAME,_bfd_final_link), \
+.CONCAT2 (NAME,_bfd_link_split_section), \
+.CONCAT2 (NAME,_bfd_gc_sections), \
+.CONCAT2 (NAME,_bfd_merge_sections)
+. int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
+. bfd_byte *(*_bfd_get_relocated_section_contents)
+. PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
+. bfd_byte *, boolean, struct symbol_cache_entry **));
.
-. boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *,
-. struct bfd_link_info *, boolean *again));
+. boolean (*_bfd_relax_section)
+. PARAMS ((bfd *, struct sec *, struct bfd_link_info *, boolean *));
.
. {* Create a hash table for the linker. Different backends store
. different information in this table. *}
. struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));
.
. {* Add symbols from this object file into the hash table. *}
-. boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
+. boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
.
. {* Do a link based on the link_order structures attached to each
. section of the BFD. *}
-. boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
+. boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
.
. {* Should this section be split up into smaller pieces during linking. *}
-. boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
+. boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
.
. {* Remove sections that are not referenced from the output. *}
-. boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));
+. boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));
+.
+. {* Attempt to merge SEC_MERGE sections. *}
+. boolean (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *));
.
. {* Routines to handle dynamic symbols and relocs. *}
-.#define BFD_JUMP_TABLE_DYNAMIC(NAME)\
-.CAT(NAME,_get_dynamic_symtab_upper_bound),\
-.CAT(NAME,_canonicalize_dynamic_symtab),\
-.CAT(NAME,_get_dynamic_reloc_upper_bound),\
-.CAT(NAME,_canonicalize_dynamic_reloc)
+.#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
+.CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \
+.CONCAT2 (NAME,_canonicalize_dynamic_symtab), \
+.CONCAT2 (NAME,_get_dynamic_reloc_upper_bound), \
+.CONCAT2 (NAME,_canonicalize_dynamic_reloc)
. {* Get the amount of memory required to hold the dynamic symbols. *}
-. long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *));
+. long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *));
. {* Read in the dynamic symbols. *}
-. long (*_bfd_canonicalize_dynamic_symtab)
+. long (*_bfd_canonicalize_dynamic_symtab)
. PARAMS ((bfd *, struct symbol_cache_entry **));
. {* Get the amount of memory required to hold the dynamic relocs. *}
-. long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *));
+. long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *));
. {* Read in the dynamic relocs. *}
-. long (*_bfd_canonicalize_dynamic_reloc)
+. long (*_bfd_canonicalize_dynamic_reloc)
. PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
.
@@ -517,6 +516,7 @@ extern const bfd_target bfd_elf32_cris_vec;
extern const bfd_target bfd_elf32_d10v_vec;
extern const bfd_target bfd_elf32_d30v_vec;
extern const bfd_target bfd_elf32_fr30_vec;
+extern const bfd_target bfd_elf32_h8300_vec;
extern const bfd_target bfd_elf32_hppa_linux_vec;
extern const bfd_target bfd_elf32_hppa_vec;
extern const bfd_target bfd_elf32_i370_vec;
@@ -525,6 +525,7 @@ extern const bfd_target bfd_elf32_i860_little_vec;
extern const bfd_target bfd_elf32_i860_vec;
extern const bfd_target bfd_elf32_i960_vec;
extern const bfd_target bfd_elf32_ia64_big_vec;
+extern const bfd_target bfd_elf32_ia64_hpux_big_vec;
extern const bfd_target bfd_elf32_little_generic_vec;
extern const bfd_target bfd_elf32_littlearc_vec;
extern const bfd_target bfd_elf32_littlearm_oabi_vec;
@@ -539,32 +540,45 @@ extern const bfd_target bfd_elf32_mcore_big_vec;
extern const bfd_target bfd_elf32_mcore_little_vec;
extern const bfd_target bfd_elf32_mn10200_vec;
extern const bfd_target bfd_elf32_mn10300_vec;
+extern const bfd_target bfd_elf32_openrisc_vec;
extern const bfd_target bfd_elf32_pj_vec;
extern const bfd_target bfd_elf32_pjl_vec;
extern const bfd_target bfd_elf32_powerpc_vec;
extern const bfd_target bfd_elf32_powerpcle_vec;
+extern const bfd_target bfd_elf32_s390_vec;
extern const bfd_target bfd_elf32_sh_vec;
extern const bfd_target bfd_elf32_shblin_vec;
extern const bfd_target bfd_elf32_shl_vec;
extern const bfd_target bfd_elf32_shlin_vec;
+extern const bfd_target bfd_elf32_shlnbsd_vec;
+extern const bfd_target bfd_elf32_shnbsd_vec;
extern const bfd_target bfd_elf32_sparc_vec;
extern const bfd_target bfd_elf32_tradbigmips_vec;
extern const bfd_target bfd_elf32_tradlittlemips_vec;
extern const bfd_target bfd_elf32_us_cris_vec;
extern const bfd_target bfd_elf32_v850_vec;
+extern const bfd_target bfd_elf32_xstormy16_vec;
extern const bfd_target bfd_elf64_alpha_vec;
extern const bfd_target bfd_elf64_big_generic_vec;
extern const bfd_target bfd_elf64_bigmips_vec;
extern const bfd_target bfd_elf64_hppa_linux_vec;
extern const bfd_target bfd_elf64_hppa_vec;
+extern const bfd_target bfd_elf64_ia64_aix_big_vec;
+extern const bfd_target bfd_elf64_ia64_aix_little_vec;
extern const bfd_target bfd_elf64_ia64_big_vec;
+extern const bfd_target bfd_elf64_ia64_hpux_big_vec;
extern const bfd_target bfd_elf64_ia64_little_vec;
extern const bfd_target bfd_elf64_little_generic_vec;
extern const bfd_target bfd_elf64_littlemips_vec;
+extern const bfd_target bfd_elf64_mmix_vec;
+extern const bfd_target bfd_elf64_powerpc_vec;
+extern const bfd_target bfd_elf64_powerpcle_vec;
+extern const bfd_target bfd_elf64_s390_vec;
+extern const bfd_target bfd_elf64_sparc_vec;
extern const bfd_target bfd_elf64_tradbigmips_vec;
extern const bfd_target bfd_elf64_tradlittlemips_vec;
-extern const bfd_target bfd_elf64_sparc_vec;
extern const bfd_target bfd_elf64_x86_64_vec;
+extern const bfd_target bfd_mmo_vec;
extern const bfd_target bfd_powerpc_pe_vec;
extern const bfd_target bfd_powerpc_pei_vec;
extern const bfd_target bfd_powerpcle_pe_vec;
@@ -625,6 +639,7 @@ extern const bfd_target nlm32_sparc_vec;
extern const bfd_target oasys_vec;
extern const bfd_target pc532machaout_vec;
extern const bfd_target pc532netbsd_vec;
+extern const bfd_target pdp11_aout_vec;
extern const bfd_target pmac_xcoff_vec;
extern const bfd_target ppcboot_vec;
extern const bfd_target riscix_vec;
@@ -644,7 +659,6 @@ extern const bfd_target sparclynx_aout_vec;
extern const bfd_target sparclynx_coff_vec;
extern const bfd_target sparcnetbsd_vec;
extern const bfd_target sunos_big_vec;
-extern const bfd_target tekhex_vec;
extern const bfd_target tic30_aout_vec;
extern const bfd_target tic30_coff_vec;
extern const bfd_target tic54x_coff0_beh_vec;
@@ -662,28 +676,25 @@ extern const bfd_target w65_vec;
extern const bfd_target we32kcoff_vec;
extern const bfd_target z8kcoff_vec;
-/* srec is always included. */
+/* These are always included. */
extern const bfd_target srec_vec;
extern const bfd_target symbolsrec_vec;
-
-/* binary is always included. */
+extern const bfd_target tekhex_vec;
extern const bfd_target binary_vec;
-
-/* ihex is always included. */
extern const bfd_target ihex_vec;
/* All of the xvecs for core files. */
extern const bfd_target aix386_core_vec;
extern const bfd_target cisco_core_big_vec;
extern const bfd_target cisco_core_little_vec;
-extern const bfd_target hpux_core_vec;
extern const bfd_target hppabsd_core_vec;
+extern const bfd_target hpux_core_vec;
extern const bfd_target irix_core_vec;
extern const bfd_target netbsd_core_vec;
extern const bfd_target osf_core_vec;
+extern const bfd_target ptrace_core_vec;
extern const bfd_target sco5_core_vec;
extern const bfd_target trad_core_vec;
-extern const bfd_target ptrace_core_vec;
static const bfd_target * const _bfd_target_vector[] = {
@@ -704,127 +715,152 @@ static const bfd_target * const _bfd_target_vector[] = {
it wasn't omitted by mistake. */
&a29kcoff_big_vec,
&a_out_adobe_vec,
-#if 0 /* No one seems to use this. */
+ &aout0_big_vec,
+#if 0
+ /* We have no way of distinguishing these from other a.out variants */
+ &aout_arm_big_vec,
+ &aout_arm_little_vec,
+ /* No one seems to use this. */
&aout_mips_big_vec,
#endif
&aout_mips_little_vec,
+#if 0
+ &apollocoff_vec,
+#endif
+ &arm_epoc_pe_big_vec,
+ &arm_epoc_pe_little_vec,
+ &arm_epoc_pei_big_vec,
+ &arm_epoc_pei_little_vec,
+ &armcoff_big_vec,
+ &armcoff_little_vec,
+ &armnetbsd_vec,
+ &armpe_big_vec,
+ &armpe_little_vec,
+ &armpei_big_vec,
+ &armpei_little_vec,
&b_out_vec_big_host,
&b_out_vec_little_host,
-
&bfd_efi_app_ia32_vec,
#ifdef BFD64
&bfd_efi_app_ia64_vec,
#endif
+ &bfd_elf32_avr_vec,
/* This, and other vectors, may not be used in any *.mt configuration.
But that does not mean they are unnecessary. If configured with
--enable-targets=all, objdump or gdb should be able to examine
the file even if we don't recognize the machine type. */
&bfd_elf32_big_generic_vec,
-#ifdef BFD64
- &bfd_elf64_alpha_vec,
- &bfd_elf64_hppa_vec,
- &bfd_elf64_hppa_linux_vec,
- &bfd_elf64_ia64_little_vec,
- &bfd_elf64_ia64_big_vec,
-#endif
- &bfd_elf32_avr_vec,
&bfd_elf32_bigarc_vec,
- &bfd_elf32_bigarm_vec,
- &bfd_elf32_bigarm_oabi_vec,
+ &bfd_elf32_bigarm_oabi_vec,
+ &bfd_elf32_bigarm_vec,
&bfd_elf32_bigmips_vec,
-#ifdef BFD64
- &bfd_elf64_bigmips_vec,
-#endif
&bfd_elf32_cris_vec,
- &bfd_elf32_us_cris_vec,
&bfd_elf32_d10v_vec,
&bfd_elf32_d30v_vec,
- &bfd_elf32_hppa_vec,
+ &bfd_elf32_fr30_vec,
+ &bfd_elf32_h8300_vec,
&bfd_elf32_hppa_linux_vec,
+ &bfd_elf32_hppa_vec,
&bfd_elf32_i370_vec,
&bfd_elf32_i386_vec,
-#ifdef BFD64
- &bfd_elf64_x86_64_vec,
-#endif
- &bfd_elf32_i860_vec,
&bfd_elf32_i860_little_vec,
+ &bfd_elf32_i860_vec,
&bfd_elf32_i960_vec,
+#if 0
+ &bfd_elf32_ia64_big_vec,
+#endif
+ &bfd_elf32_ia64_hpux_big_vec,
&bfd_elf32_little_generic_vec,
&bfd_elf32_littlearc_vec,
- &bfd_elf32_littlearm_vec,
- &bfd_elf32_littlearm_oabi_vec,
+ &bfd_elf32_littlearm_oabi_vec,
+ &bfd_elf32_littlearm_vec,
&bfd_elf32_littlemips_vec,
-#ifdef BFD64
- &bfd_elf64_littlemips_vec,
-#endif
&bfd_elf32_m32r_vec,
- &bfd_elf32_mn10200_vec,
- &bfd_elf32_mn10300_vec,
&bfd_elf32_m68hc11_vec,
&bfd_elf32_m68hc12_vec,
&bfd_elf32_m68k_vec,
&bfd_elf32_m88k_vec,
+ &bfd_elf32_mcore_big_vec,
+ &bfd_elf32_mcore_little_vec,
+ &bfd_elf32_mn10200_vec,
+ &bfd_elf32_mn10300_vec,
+ &bfd_elf32_openrisc_vec,
&bfd_elf32_pj_vec,
&bfd_elf32_pjl_vec,
&bfd_elf32_powerpc_vec,
&bfd_elf32_powerpcle_vec,
+ &bfd_elf32_s390_vec,
+ &bfd_elf32_sh_vec,
+ &bfd_elf32_shblin_vec,
+ &bfd_elf32_shl_vec,
+ &bfd_elf32_shlin_vec,
+ &bfd_elf32_shlnbsd_vec,
+ &bfd_elf32_shnbsd_vec,
&bfd_elf32_sparc_vec,
- &bfd_elf32_v850_vec,
- &bfd_elf32_fr30_vec,
- &bfd_elf32_mcore_big_vec,
- &bfd_elf32_mcore_little_vec,
&bfd_elf32_tradbigmips_vec,
&bfd_elf32_tradlittlemips_vec,
+ &bfd_elf32_us_cris_vec,
+ &bfd_elf32_v850_vec,
+ &bfd_elf32_xstormy16_vec,
#ifdef BFD64
- &bfd_elf64_tradbigmips_vec,
- &bfd_elf64_tradlittlemips_vec,
- /* No one seems to use this. */
+ &bfd_elf64_alpha_vec,
&bfd_elf64_big_generic_vec,
+ &bfd_elf64_bigmips_vec,
+ &bfd_elf64_hppa_linux_vec,
+ &bfd_elf64_hppa_vec,
+ &bfd_elf64_ia64_aix_big_vec,
+ &bfd_elf64_ia64_aix_little_vec,
+ &bfd_elf64_ia64_big_vec,
+ &bfd_elf64_ia64_hpux_big_vec,
+ &bfd_elf64_ia64_little_vec,
&bfd_elf64_little_generic_vec,
-#endif
+ &bfd_elf64_littlemips_vec,
+ &bfd_elf64_mmix_vec,
+ &bfd_elf64_powerpc_vec,
+ &bfd_elf64_powerpcle_vec,
+ &bfd_elf64_s390_vec,
#if 0
&bfd_elf64_sparc_vec,
#endif
- /* We don't include cisco_core_*_vec. Although it has a magic number,
- the magic number isn't at the beginning of the file, and thus
- might spuriously match other kinds of files. */
-
- &cris_aout_vec,
+ &bfd_elf64_tradbigmips_vec,
+ &bfd_elf64_tradlittlemips_vec,
+ &bfd_elf64_x86_64_vec,
+ &bfd_mmo_vec,
+#endif
+ &bfd_powerpc_pe_vec,
+ &bfd_powerpc_pei_vec,
+ &bfd_powerpcle_pe_vec,
+ &bfd_powerpcle_pei_vec,
+ &cris_aout_vec,
#ifdef BFD64
&demo_64_vec, /* Only compiled if host has long-long support */
#endif
&ecoff_big_vec,
- &ecoff_little_vec,
&ecoff_biglittle_vec,
+ &ecoff_little_vec,
#ifdef BFD64
&ecoffalpha_little_vec,
#endif
+ &go32coff_vec,
+ &go32stubbedcoff_vec,
&h8300coff_vec,
&h8500coff_vec,
#if 0
/* Since a.out files lack decent magic numbers, no way to recognize
which kind of a.out file it is. */
&host_aout_vec,
-#endif
-#if 0 /* Clashes with sunos_big_vec magic no. */
+ /* Clashes with sunos_big_vec magic no. */
&hp300bsd_vec,
#endif
&hp300hpux_vec,
-#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF)
- &som_vec,
-#endif
&i386aout_vec,
&i386bsd_vec,
&i386coff_vec,
+#if 0
+ &i386dynix_vec,
+#endif
&i386freebsd_vec,
- &i860coff_vec,
- &bfd_powerpc_pe_vec,
- &bfd_powerpcle_pe_vec,
- &bfd_powerpc_pei_vec,
- &bfd_powerpcle_pei_vec,
- &go32coff_vec,
- &go32stubbedcoff_vec,
#if 0
/* Since a.out files lack decent magic numbers, no way to recognize
which kind of a.out file it is. */
@@ -841,20 +877,14 @@ static const bfd_target * const _bfd_target_vector[] = {
&i386os9k_vec,
&i386pe_vec,
&i386pei_vec,
- &armcoff_little_vec,
- &armcoff_big_vec,
- &armnetbsd_vec,
- &armpe_little_vec,
- &armpe_big_vec,
- &armpei_little_vec,
- &armpei_big_vec,
- &arm_epoc_pe_little_vec,
- &arm_epoc_pe_big_vec,
- &arm_epoc_pei_little_vec,
- &arm_epoc_pei_big_vec,
+ &i860coff_vec,
&icoff_big_vec,
&icoff_little_vec,
&ieee_vec,
+#if 0
+ &m68k4knetbsd_vec,
+ &m68kaux_coff_vec,
+#endif
&m68kcoff_vec,
&m68kcoffun_vec,
#if 0
@@ -872,13 +902,15 @@ static const bfd_target * const _bfd_target_vector[] = {
&mcore_pe_little_vec,
&mcore_pei_big_vec,
&mcore_pei_little_vec,
+ &mipslpe_vec,
+ &mipslpei_vec,
&newsos3_vec,
- &nlm32_i386_vec,
- &nlm32_sparc_vec,
#ifdef BFD64
&nlm32_alpha_vec,
#endif
- &pc532netbsd_vec,
+ &nlm32_i386_vec,
+ &nlm32_powerpc_vec,
+ &nlm32_sparc_vec,
#if 0
/* We have no oasys tools anymore, so we can't test any of this
anymore. If you want to test the stuff yourself, go ahead...
@@ -888,40 +920,45 @@ static const bfd_target * const _bfd_target_vector[] = {
&oasys_vec,
#endif
&pc532machaout_vec,
-#if 0
- /* We have no way of distinguishing these from other a.out variants */
- &aout_arm_big_vec,
- &aout_arm_little_vec,
- &riscix_vec,
-#endif
+ &pc532netbsd_vec,
+ &pdp11_aout_vec,
#if 0
/* This has the same magic number as RS/6000. */
&pmac_xcoff_vec,
#endif
- &rs6000coff_vec,
+ &ppcboot_vec,
+#if 0
+ /* We have no way of distinguishing these from other a.out variants */
+ &riscix_vec,
+#endif
#ifdef BFD64
&rs6000coff64_vec,
#endif
- &ppcboot_vec,
- &shcoff_vec,
- &shlcoff_vec,
+ &rs6000coff_vec,
&shcoff_small_vec,
+ &shcoff_vec,
&shlcoff_small_vec,
+ &shlcoff_vec,
+ &shlpe_vec,
+ &shlpei_vec,
+#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF)
+ &som_vec,
+#endif
+ &sparccoff_vec,
&sparcle_aout_vec,
&sparclinux_vec,
&sparclynx_aout_vec,
&sparclynx_coff_vec,
&sparcnetbsd_vec,
&sunos_big_vec,
- &aout0_big_vec,
&tic30_aout_vec,
&tic30_coff_vec,
- &tic54x_coff0_vec,
&tic54x_coff0_beh_vec,
- &tic54x_coff1_vec,
+ &tic54x_coff0_vec,
&tic54x_coff1_beh_vec,
- &tic54x_coff2_vec,
+ &tic54x_coff1_vec,
&tic54x_coff2_beh_vec,
+ &tic54x_coff2_vec,
&tic80coff_vec,
&vaxnetbsd_vec,
&versados_vec,
@@ -929,9 +966,9 @@ static const bfd_target * const _bfd_target_vector[] = {
&vms_alpha_vec,
#endif
&vms_vax_vec,
+ &w65_vec,
&we32kcoff_vec,
&z8kcoff_vec,
-
#endif /* not SELECT_VECS */
/* Always support S-records, for convenience. */
@@ -949,12 +986,19 @@ static const bfd_target * const _bfd_target_vector[] = {
#ifdef AIX386_CORE
&aix386_core_vec,
#endif
-#ifdef HPUX_CORE
- &hpux_core_vec,
+#if 0
+ /* We don't include cisco_core_*_vec. Although it has a magic number,
+ the magic number isn't at the beginning of the file, and thus
+ might spuriously match other kinds of files. */
+ &cisco_core_big_vec,
+ &cisco_core_little_vec,
#endif
#ifdef HPPABSD_CORE
&hppabsd_core_vec,
#endif
+#ifdef HPUX_CORE
+ &hpux_core_vec,
+#endif
#ifdef IRIX_CORE
&irix_core_vec,
#endif
@@ -964,17 +1008,16 @@ static const bfd_target * const _bfd_target_vector[] = {
#ifdef OSF_CORE
&osf_core_vec,
#endif
+#ifdef PTRACE_CORE
+ &ptrace_core_vec,
+#endif
#ifdef SCO5_CORE
&sco5_core_vec,
#endif
-#ifdef TRAD_CORE
+#ifdef TRAD_CORE
&trad_core_vec,
#endif
-#ifdef PTRACE_CORE
- &ptrace_core_vec,
-#endif
-
NULL /* end of list marker */
};
const bfd_target * const *bfd_target_vector = _bfd_target_vector;
@@ -1081,7 +1124,7 @@ FUNCTION
bfd_find_target
SYNOPSIS
- const bfd_target *bfd_find_target(CONST char *target_name, bfd *abfd);
+ const bfd_target *bfd_find_target(const char *target_name, bfd *abfd);
DESCRIPTION
Return a pointer to the transfer vector for the object target
@@ -1147,19 +1190,20 @@ const char **
bfd_target_list ()
{
int vec_length= 0;
+ bfd_size_type amt;
#if defined (HOST_HPPAHPUX) && ! defined (__STDC__)
/* The native compiler on the HP9000/700 has a bug which causes it
to loop endlessly when compiling this file. This avoids it. */
volatile
#endif
- const bfd_target * const *target;
- CONST char **name_list, **name_ptr;
+ const bfd_target * const *target;
+ const char **name_list, **name_ptr;
for (target = &bfd_target_vector[0]; *target != NULL; target++)
vec_length++;
- name_ptr = name_list = (CONST char **)
- bfd_zmalloc ((vec_length + 1) * sizeof (char **));
+ amt = (vec_length + 1) * sizeof (char **);
+ name_ptr = name_list = (const char **) bfd_zmalloc (amt);
if (name_list == NULL)
return NULL;
diff --git a/contrib/binutils/bfd/targmatch.sed b/contrib/binutils/bfd/targmatch.sed
index 2f40e72..2716876 100644
--- a/contrib/binutils/bfd/targmatch.sed
+++ b/contrib/binutils/bfd/targmatch.sed
@@ -1,5 +1,6 @@
1,/START OF targmatch.h/ d
/END OF targmatch.h/,$ d
+/^[ ]*case/,/^[ ]*esac/ d
s/^#if/KEEP #if/
s/^#endif/KEEP #endif/
s/^[ ]*#.*$//
diff --git a/contrib/binutils/bfd/tekhex.c b/contrib/binutils/bfd/tekhex.c
index ccfe7d8..f5d5160 100644
--- a/contrib/binutils/bfd/tekhex.c
+++ b/contrib/binutils/bfd/tekhex.c
@@ -1,5 +1,5 @@
/* BFD backend for Extended Tektronix Hex Format objects.
- Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000
+ Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
@@ -107,7 +107,7 @@ static asymbol *tekhex_make_empty_symbol PARAMS ((bfd *));
static int tekhex_sizeof_headers PARAMS ((bfd *, boolean));
static boolean tekhex_write_object_contents PARAMS ((bfd *));
static void out PARAMS ((bfd *, int, char *, char *));
-static void writesym PARAMS ((char **, CONST char *));
+static void writesym PARAMS ((char **, const char *));
static void writevalue PARAMS ((char **, bfd_vma));
static boolean tekhex_set_section_contents
PARAMS ((bfd*, sec_ptr, PTR, file_ptr, bfd_size_type));
@@ -354,11 +354,11 @@ find_chunk (abfd, vma)
}
if (!d)
{
- char *sname = bfd_alloc (abfd, 12);
+ char *sname = bfd_alloc (abfd, (bfd_size_type) 12);
/* No chunk for this address, so make one up */
- d = (struct data_struct *)
- bfd_alloc (abfd, sizeof (struct data_struct));
+ d = ((struct data_struct *)
+ bfd_alloc (abfd, (bfd_size_type) sizeof (struct data_struct)));
if (!sname || !d)
return NULL;
@@ -394,7 +394,7 @@ first_phase (abfd, type, src)
char *src;
{
asection *section = bfd_abs_section_ptr;
- int len;
+ unsigned int len;
char sym[17]; /* A symbol can only be 16chars long */
switch (type)
@@ -419,7 +419,7 @@ first_phase (abfd, type, src)
section = bfd_get_section_by_name (abfd, sym);
if (section == (asection *) NULL)
{
- char *n = bfd_alloc (abfd, len + 1);
+ char *n = bfd_alloc (abfd, (bfd_size_type) len + 1);
if (!n)
abort (); /* FIXME */
@@ -445,10 +445,10 @@ first_phase (abfd, type, src)
case '8':
/* Symbols, add to section */
{
+ bfd_size_type amt = sizeof (tekhex_symbol_type);
tekhex_symbol_type *new =
- (tekhex_symbol_type *) bfd_alloc (abfd,
- sizeof (tekhex_symbol_type));
- char type = (*src);
+ (tekhex_symbol_type *) bfd_alloc (abfd, amt);
+ char stype = (*src);
if (!new)
abort (); /* FIXME */
@@ -459,12 +459,12 @@ first_phase (abfd, type, src)
new->prev = abfd->tdata.tekhex_data->symbols;
abfd->tdata.tekhex_data->symbols = new;
len = getsym (sym, &src);
- new->symbol.name = bfd_alloc (abfd, len + 1);
+ new->symbol.name = bfd_alloc (abfd, (bfd_size_type) len + 1);
if (!new->symbol.name)
abort (); /* FIXME */
memcpy ((char *) (new->symbol.name), sym, len + 1);
new->symbol.section = section;
- if (type <= '4')
+ if (stype <= '4')
new->symbol.flags = (BSF_GLOBAL | BSF_EXPORT);
else
new->symbol.flags = BSF_LOCAL;
@@ -496,17 +496,17 @@ pass_over (abfd, func)
char type;
/* Find first '%' */
- eof = (boolean) (bfd_read (src, 1, 1, abfd) != 1);
+ eof = (boolean) (bfd_bread (src, (bfd_size_type) 1, abfd) != 1);
while (*src != '%' && !eof)
{
- eof = (boolean) (bfd_read (src, 1, 1, abfd) != 1);
+ eof = (boolean) (bfd_bread (src, (bfd_size_type) 1, abfd) != 1);
}
if (eof)
break;
src++;
/* Fetch the type and the length and the checksum */
- if (bfd_read (src, 1, 5, abfd) != 5)
+ if (bfd_bread (src, (bfd_size_type) 5, abfd) != 5)
abort (); /* FIXME */
type = src[2];
@@ -516,7 +516,7 @@ pass_over (abfd, func)
chars_on_line = HEX (src) - 5; /* Already read five char */
- if (bfd_read (src, 1, chars_on_line, abfd) != chars_on_line)
+ if (bfd_bread (src, (bfd_size_type) chars_on_line, abfd) != chars_on_line)
abort (); /* FIXME */
src[chars_on_line] = 0; /* put a null at the end */
@@ -555,8 +555,9 @@ static boolean
tekhex_mkobject (abfd)
bfd *abfd;
{
- tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type));
+ tdata_type *tdata;
+ tdata = (tdata_type *) bfd_alloc (abfd, (bfd_size_type) sizeof (tdata_type));
if (!tdata)
return false;
abfd->tdata.tekhex_data = tdata;
@@ -580,7 +581,7 @@ tekhex_object_p (abfd)
tekhex_init ();
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_read (b, 1, 4, abfd) != 4)
+ || bfd_bread (b, (bfd_size_type) 4, abfd) != 4)
return NULL;
if (b[0] != '%' || !ISHEX (b[1]) || !ISHEX (b[2]) || !ISHEX (b[3]))
@@ -597,7 +598,7 @@ move_section_contents (abfd, section, locationp, offset, count, get)
bfd *abfd;
asection *section;
PTR locationp;
- file_ptr offset ATTRIBUTE_UNUSED;
+ file_ptr offset;
bfd_size_type count;
boolean get;
{
@@ -606,10 +607,11 @@ move_section_contents (abfd, section, locationp, offset, count, get)
bfd_vma prev_number = 1; /* Nothing can have this as a high bit*/
struct data_struct *d = (struct data_struct *) NULL;
+ BFD_ASSERT (offset == 0);
for (addr = section->vma; count != 0; count--, addr++)
{
-
- bfd_vma chunk_number = addr & ~CHUNK_MASK; /* Get high bits of address */
+ /* Get high bits of address. */
+ bfd_vma chunk_number = addr & ~(bfd_vma) CHUNK_MASK;
bfd_vma low_bits = addr & CHUNK_MASK;
if (chunk_number != prev_number)
@@ -689,7 +691,7 @@ tekhex_set_section_contents (abfd, section, locationp, offset, bytes_to_do)
{
if (s->flags & SEC_LOAD)
{
- for (vma = s->vma & ~CHUNK_MASK;
+ for (vma = s->vma & ~(bfd_vma) CHUNK_MASK;
vma < s->vma + s->_raw_size;
vma += CHUNK_MASK)
find_chunk (abfd, vma);
@@ -699,7 +701,8 @@ tekhex_set_section_contents (abfd, section, locationp, offset, bytes_to_do)
}
if (section->flags & (SEC_LOAD | SEC_ALLOC))
{
- move_section_contents (abfd, section, locationp, offset, bytes_to_do, false);
+ move_section_contents (abfd, section, locationp, offset, bytes_to_do,
+ false);
return true;
}
else
@@ -740,7 +743,7 @@ writevalue (dst, value)
static void
writesym (dst, sym)
char **dst;
- CONST char *sym;
+ const char *sym;
{
char *p = *dst;
int len = (sym ? strlen (sym) : 0);
@@ -797,11 +800,11 @@ out (abfd, type, start, end)
sum += sum_block[(unsigned char) front[2]];
sum += sum_block[(unsigned char) front[3]]; /* type */
TOHEX (front + 4, sum);
- if (bfd_write (front, 1, 6, abfd) != 6)
+ if (bfd_bwrite (front, (bfd_size_type) 6, abfd) != 6)
abort ();
end[0] = '\n';
wrlen = end - start + 1;
- if (bfd_write (start, 1, wrlen, abfd) != wrlen)
+ if (bfd_bwrite (start, wrlen, abfd) != wrlen)
abort ();
}
@@ -826,7 +829,7 @@ tekhex_write_object_contents (abfd)
{
int low;
- CONST int span = 32;
+ const int span = 32;
int addr;
/* Write it in blocks of 32 bytes */
@@ -876,10 +879,10 @@ tekhex_write_object_contents (abfd)
if (section_code != '?')
{ /* do not include debug symbols */
- asymbol *s = *p;
+ asymbol *sym = *p;
char *dst = buffer;
- writesym (&dst, s->section->name);
+ writesym (&dst, sym->section->name);
switch (section_code)
{
@@ -911,15 +914,15 @@ tekhex_write_object_contents (abfd)
return false;
}
- writesym (&dst, s->name);
- writevalue (&dst, s->value + s->section->vma);
+ writesym (&dst, sym->name);
+ writevalue (&dst, sym->value + sym->section->vma);
out (abfd, '3', buffer, dst);
}
}
}
/* And the terminator */
- if (bfd_write ("%0781010\n", 1, 9, abfd) != 9)
+ if (bfd_bwrite ("%0781010\n", (bfd_size_type) 9, abfd) != 9)
abort ();
return true;
}
@@ -937,8 +940,8 @@ static asymbol *
tekhex_make_empty_symbol (abfd)
bfd *abfd;
{
- tekhex_symbol_type *new =
- (tekhex_symbol_type *) bfd_zalloc (abfd, sizeof (struct tekhex_symbol_struct));
+ bfd_size_type amt = sizeof (struct tekhex_symbol_struct);
+ tekhex_symbol_type *new = (tekhex_symbol_type *) bfd_zalloc (abfd, amt);
if (!new)
return NULL;
@@ -957,8 +960,8 @@ tekhex_get_symbol_info (ignore_abfd, symbol, ret)
}
static void
-tekhex_print_symbol (ignore_abfd, filep, symbol, how)
- bfd *ignore_abfd ATTRIBUTE_UNUSED;
+tekhex_print_symbol (abfd, filep, symbol, how)
+ bfd *abfd;
PTR filep;
asymbol *symbol;
bfd_print_symbol_type how;
@@ -975,9 +978,9 @@ tekhex_print_symbol (ignore_abfd, filep, symbol, how)
case bfd_print_symbol_all:
{
- CONST char *section_name = symbol->section->name;
+ const char *section_name = symbol->section->name;
- bfd_print_symbol_vandf ((PTR) file, symbol);
+ bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
fprintf (file, " %-5s %s",
section_name,
@@ -1001,6 +1004,7 @@ tekhex_print_symbol (ignore_abfd, filep, symbol, how)
bfd_generic_get_relocated_section_contents
#define tekhex_bfd_relax_section bfd_generic_relax_section
#define tekhex_bfd_gc_sections bfd_generic_gc_sections
+#define tekhex_bfd_merge_sections bfd_generic_merge_sections
#define tekhex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define tekhex_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define tekhex_bfd_final_link _bfd_generic_final_link
diff --git a/contrib/binutils/bfd/trad-core.c b/contrib/binutils/bfd/trad-core.c
index 872ad54..aed0b50 100644
--- a/contrib/binutils/bfd/trad-core.c
+++ b/contrib/binutils/bfd/trad-core.c
@@ -1,6 +1,6 @@
/* BFD back end for traditional Unix core files (U-area and raw sections)
Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
- 2000
+ 2000, 2001, 2002
Free Software Foundation, Inc.
Written by John Gilmore of Cygnus Support.
@@ -80,14 +80,15 @@ trad_unix_core_file_p (abfd)
int val;
struct user u;
struct trad_core_struct *rawptr;
+ bfd_size_type amt;
#ifdef TRAD_CORE_USER_OFFSET
/* If defined, this macro is the file position of the user struct. */
- if (bfd_seek (abfd, TRAD_CORE_USER_OFFSET, SEEK_SET) != 0)
+ if (bfd_seek (abfd, (file_ptr) TRAD_CORE_USER_OFFSET, SEEK_SET) != 0)
return 0;
#endif
- val = bfd_read ((void *)&u, 1, sizeof u, abfd);
+ val = bfd_bread ((void *) &u, (bfd_size_type) sizeof u, abfd);
if (val != sizeof u)
{
/* Too small to be a core file */
@@ -149,8 +150,8 @@ trad_unix_core_file_p (abfd)
/* Allocate both the upage and the struct core_data at once, so
a single free() will free them both. */
- rawptr = (struct trad_core_struct *)
- bfd_zmalloc (sizeof (struct trad_core_struct));
+ amt = sizeof (struct trad_core_struct);
+ rawptr = (struct trad_core_struct *) bfd_zmalloc (amt);
if (rawptr == NULL)
return 0;
@@ -158,22 +159,17 @@ trad_unix_core_file_p (abfd)
rawptr->u = u; /*Copy the uarea into the tdata part of the bfd */
- /* Create the sections. This is raunchy, but bfd_close wants to free
- them separately. */
+ /* Create the sections. */
- core_stacksec(abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
+ core_stacksec(abfd) = bfd_make_section_anyway (abfd, ".stack");
if (core_stacksec (abfd) == NULL)
- return NULL;
- core_datasec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
+ goto fail;
+ core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data");
if (core_datasec (abfd) == NULL)
- return NULL;
- core_regsec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
+ goto fail;
+ core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
if (core_regsec (abfd) == NULL)
- return NULL;
-
- core_stacksec (abfd)->name = ".stack";
- core_datasec (abfd)->name = ".data";
- core_regsec (abfd)->name = ".reg";
+ goto fail;
core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
@@ -230,12 +226,13 @@ trad_unix_core_file_p (abfd)
core_datasec (abfd)->alignment_power = 2;
core_regsec (abfd)->alignment_power = 2;
- abfd->sections = core_stacksec (abfd);
- core_stacksec (abfd)->next = core_datasec (abfd);
- core_datasec (abfd)->next = core_regsec (abfd);
- abfd->section_count = 3;
-
return abfd->xvec;
+
+ fail:
+ bfd_release (abfd, abfd->tdata.any);
+ abfd->tdata.any = NULL;
+ bfd_section_list_clear (abfd);
+ return NULL;
}
char *
diff --git a/contrib/binutils/bfd/version.h b/contrib/binutils/bfd/version.h
new file mode 100644
index 0000000..55d8900
--- /dev/null
+++ b/contrib/binutils/bfd/version.h
@@ -0,0 +1 @@
+#define BFD_VERSION_DATE 20020127
OpenPOWER on IntegriCloud