Add support for x86_64-*-linux-gnu* target

This commit is contained in:
Nick Clifton 2000-11-30 19:16:54 +00:00
parent abf1d184bd
commit 8d88c4ca53
20 changed files with 5666 additions and 927 deletions

View File

@ -1,3 +1,20 @@
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.
@ -306,7 +323,7 @@
if a relocation for an undefined symbol also results in an
overflow.
Mon Nov 6 13:35:07 2000 Christopher Faylor <cgf@cygnus.com>
2000-11-06 Christopher Faylor <cgf@cygnus.com>
* config.bfd: Add support for Sun Chorus.
@ -762,7 +779,7 @@ Mon Nov 6 13:35:07 2000 Christopher Faylor <cgf@cygnus.com>
* elf32-mips.c (_bfd_mips_elf_final_write_processing): Return
E_MIPS_ARCH_2 for bfd_mach_mips4K.
Wed Sep 13 19:31:39 2000 Marco Franzen <marcof@thyron.com>
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.
@ -1062,7 +1079,7 @@ Wed Sep 13 19:31:39 2000 Marco Franzen <marcof@thyron.com>
* elf32-i386.c (elf_i386_finish_dynamic_symbol): Revert 2000-08-27
change.
Thu Aug 31 22:49:30 2000 J"orn Rennecke <amylaar@cygnus.co.uk>
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.
@ -1450,7 +1467,7 @@ Thu Aug 31 22:49:30 2000 J"orn Rennecke <amylaar@cygnus.co.uk>
DT_PLTPAD, DT_MOVETAB, DT_SYMINFO, DT_RELACOUNT, DT_RELCOUNT,
DT_FLAGS_1, DT_USED and DT_CHECKSUM.
Tue Jul 18 13:11:54 2000 Andrew Cagney <cagney@b1.cygnus.com>
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...
@ -1518,14 +1535,14 @@ Tue Jul 18 13:11:54 2000 Andrew Cagney <cagney@b1.cygnus.com>
* elf64-hppa.c (elf64_hppa_check_relocs): Fix some warnings.
(elf64_hppa_modify_segment_map): Likewise.
Tue Jul 11 17:21:52 2000 Andrew Cagney <cagney@b1.cygnus.com>
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.
Tue Jul 11 16:25:52 2000 Andrew Cagney <cagney@b1.cygnus.com>
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.
@ -1535,7 +1552,7 @@ Tue Jul 11 16:25:52 2000 Andrew Cagney <cagney@b1.cygnus.com>
* elf64-mips.c (ECOFF_SIGNED_64): Define instead of ECOFF_64.
* elf32-mips.c (ECOFF_SIGNED_32): Define instead of ECOFF_32.
Tue Jul 11 16:03:04 2000 Andrew Cagney <cagney@b1.cygnus.com>
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.
@ -2045,7 +2062,7 @@ Tue Jul 11 16:03:04 2000 Andrew Cagney <cagney@b1.cygnus.com>
* configure: Regenerate.
Tue Jun 13 01:28:57 2000 J"orn Rennecke <amylaar@cygnus.co.uk>
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.
@ -2098,7 +2115,7 @@ Tue Jun 13 01:28:57 2000 J"orn Rennecke <amylaar@cygnus.co.uk>
(i[3456]86-*-netbsd*): Add bfd_elf32_i386_vec to targ_selvecs.
(i[3456]86-*-openbsd*): Likewise.
Tue May 30 15:39:04 2000 Andrew Cagney <cagney@b1.cygnus.com>
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.
@ -2271,7 +2288,7 @@ Tue May 30 15:39:04 2000 Andrew Cagney <cagney@b1.cygnus.com>
* elflink.h (elf_bfd_final_link, elf_link_input_bfd): When emiting
relocs for an executable, ensure that they are virtual addresses.
Thu May 18 10:55:47 2000 Jeffrey A Law (law@cygnus.com)
2000-05-18 Jeffrey A Law (law@cygnus.com)
* config.bfd (hppa*64*-*-hpux11*): New target triplet.
@ -2295,7 +2312,7 @@ Thu May 18 10:55:47 2000 Jeffrey A Law (law@cygnus.com)
read idata section only from dataoff.
(pe_print_edata): Correctly check for valid eat_member.
Tue May 16 00:04:11 2000 J"orn Rennecke <amylaar@cygnus.co.uk>
2000-05-16 J"orn Rennecke <amylaar@cygnus.co.uk>
* elf32-sh.c (sh_elf_relax_delete_bytes): Handle R_SH_SWITCH8.
@ -2349,7 +2366,7 @@ Tue May 16 00:04:11 2000 J"orn Rennecke <amylaar@cygnus.co.uk>
(_bfd_pe_print_private_bfd_data_common): Print Reserved1 field as
Win32Version.
Fri May 5 20:44:40 2000 Clinton Popetz <cpopetz@cygnus.com>
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
@ -2358,7 +2375,7 @@ Fri May 5 20:44:40 2000 Clinton Popetz <cpopetz@cygnus.com>
* coff-pmac.c: Ditto.
* Makefile.in: Regenerate.
Fri May 5 16:51:03 2000 Clinton Popetz <cpopetz@cygnus.com>
2000-05-05 Clinton Popetz <cpopetz@cygnus.com>
* coffcode.h (coff_set_arch_mach_hook, coff_set_flags):
Change U802TOC64MAGIC to U803XTOCMAGIC.
@ -2401,7 +2418,7 @@ Fri May 5 16:51:03 2000 Clinton Popetz <cpopetz@cygnus.com>
dependencies.
* Makefile.in: Regenerate.
Mon May 1 16:56:47 2000 Jim Wilson <wilson@cygnus.com>
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.
@ -2492,7 +2509,7 @@ Mon May 1 16:56:47 2000 Jim Wilson <wilson@cygnus.com>
* coff-sh.c (bfd_coff_small_swap_table): Fix Fri Apr 28 change.
* vms.c (vms_openr_next_archived_file): Return NULL.
Fri Apr 28 21:34:44 2000 Clinton Popetz <cpopetz@cygnus.com>
2000-04-28 Clinton Popetz <cpopetz@cygnus.com>
* coffcode.h Copy changes mistakenly done to libcoff.h in
4/24/2000 patch.
@ -2505,7 +2522,7 @@ Fri Apr 28 21:34:44 2000 Clinton Popetz <cpopetz@cygnus.com>
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
Fri Apr 28 14:58:37 2000 Clinton Popetz <cpopetz@cygnus.com>
2000-04-28 Clinton Popetz <cpopetz@cygnus.com>
* Makefile.am (BFD64_BACKENDS, BFD64_BACKENDS_CFILES): Add
coffdu-rs6000.{lo,c}.
@ -2518,14 +2535,14 @@ Fri Apr 28 14:58:37 2000 Clinton Popetz <cpopetz@cygnus.com>
common to the xcoff backends into xcoff.h
* coff64-rs6000.c: Ditto,
Fri Apr 28 08:35:21 2000 Clinton Popetz <cpopetz@cygnus.com>
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.
Fri Apr 28 08:05:12 2000 Clinton Popetz <cpopetz@cygnus.com>
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
@ -2552,11 +2569,11 @@ Fri Apr 28 08:05:12 2000 Clinton Popetz <cpopetz@cygnus.com>
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.
Wed Apr 26 16:31:28 2000 Clinton Popetz <cpopetz@cygnus.com>
2000-04-26 Clinton Popetz <cpopetz@cygnus.com>
* config.bfd: Remove extraneous bfd_powerpc_64_arch.
Mon Apr 24 15:20:35 2000 Clinton Popetz <cpopetz@cygnus.com>
2000-04-24 Clinton Popetz <cpopetz@cygnus.com>
* Makefile.am (coff64-rs6000.lo): New rule.
* Makefile.in: Regenerate.
@ -2616,7 +2633,7 @@ Mon Apr 24 15:20:35 2000 Clinton Popetz <cpopetz@cygnus.com>
* configure.in: Add rs6000coff64_vec case.
* cpu-powerpc.c: New bfd_arch_info_type.
Mon Apr 24 02:17:31 2000 Jeffrey A Law (law@cygnus.com)
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
@ -2634,12 +2651,12 @@ Mon Apr 24 02:17:31 2000 Jeffrey A Law (law@cygnus.com)
* elf64-hppa.c, elf64-hppa.h: New files with PA64 support.
Mon Apr 24 02:14:29 2000 Jason Eckhardt <jle@cygnus.com>
2000-04-24 Jason Eckhardt <jle@cygnus.com>
* libhppa.h (dis_assemble_16): New function.
(pa_arch): Added pa20w element.
Mon Apr 24 01:49:03 2000 Ulrich Drepper <drepper@cygnus.com>
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

View File

@ -411,6 +411,7 @@ BFD64_BACKENDS = \
coff64-rs6000.lo \
demo64.lo \
efi-app-ia64.lo \
elf64-x86-64.lo \
elf64-alpha.lo \
elf64-hppa.lo \
elf64-ia64.lo \
@ -427,6 +428,7 @@ BFD64_BACKENDS_CFILES = \
coff64-rs6000.c \
demo64.c \
efi-app-ia64.c \
elf64-x86-64.c \
elf64-alpha.c \
elf64-hppa.c \
elf64-ia64.c \
@ -1254,6 +1256,10 @@ elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \
$(INCDIR)/elf/reloc-macros.h elf64-target.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)/opcode/i386.h $(INCDIR)/elf/x86-64.h \
$(INCDIR)/elf/reloc-macros.h elf64-target.h
elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h elf64-target.h

View File

@ -536,6 +536,7 @@ BFD64_BACKENDS = \
coff64-rs6000.lo \
demo64.lo \
efi-app-ia64.lo \
elf64-x86-64.lo \
elf64-alpha.lo \
elf64-hppa.lo \
elf64-ia64.lo \
@ -553,6 +554,7 @@ BFD64_BACKENDS_CFILES = \
coff64-rs6000.c \
demo64.c \
efi-app-ia64.c \
elf64-x86-64.c \
elf64-alpha.c \
elf64-hppa.c \
elf64-ia64.c \
@ -1794,6 +1796,10 @@ elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \
$(INCDIR)/elf/reloc-macros.h elf64-target.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)/opcode/i386.h $(INCDIR)/elf/x86-64.h \
$(INCDIR)/elf/reloc-macros.h elf64-target.h
elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
$(INCDIR)/bfdlink.h elf64-target.h

18
bfd/aclocal.m4 vendored
View File

@ -136,6 +136,24 @@ AC_DEFUN([CY_WITH_NLS],)
AC_SUBST(INTLLIBS)
])
#serial 1
# This test replaces the one in autoconf.
# Currently this macro should have the same name as the autoconf macro
# because gettext's gettext.m4 (distributed in the automake package)
# still uses it. Otherwise, the use in gettext.m4 makes autoheader
# give these diagnostics:
# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
undefine([AC_ISC_POSIX])
AC_DEFUN(AC_ISC_POSIX,
[
dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
]
)
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.

View File

@ -136,6 +136,8 @@ DESCRIPTION
.#define bfd_mach_i386_i386 0
.#define bfd_mach_i386_i8086 1
.#define bfd_mach_i386_i386_intel_syntax 2
.#define bfd_mach_x86_64 3
.#define bfd_mach_x86_64_intel_syntax 4
. bfd_arch_we32k, {* AT&T WE32xxx *}
. bfd_arch_tahoe, {* CCI/Harris Tahoe *}
. bfd_arch_i860, {* Intel 860 *}

File diff suppressed because it is too large Load Diff

View File

@ -36,6 +36,7 @@ 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 ;;
m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch" ;;
@ -351,6 +352,12 @@ case "${targ}" in
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
;;
#ifdef BFD64
x86_64-*-linux-gnu*)
targ_defvec=bfd_elf64_x86_64_vec
targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec"
;;
#endif
i[3456]86-*-lynxos*)
targ_defvec=i386lynx_coff_vec
targ_selvecs=i386lynx_aout_vec

View File

@ -25,9 +25,6 @@
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
@ -223,6 +220,9 @@
/* Define if <sys/procfs.h> has pstatus_t. */
#undef HAVE_PSTATUS_T
/* Define if <sys/procfs.h> has pxstatus_t. */
#undef HAVE_PXSTATUS_T
/* Define if <sys/procfs.h> has pstatus32_t. */
#undef HAVE_PSTATUS32_T
@ -241,6 +241,9 @@
/* Define if <sys/procfs.h> has lwpstatus_t. */
#undef HAVE_LWPSTATUS_T
/* Define if <sys/procfs.h> has lwpxstatus_t. */
#undef HAVE_LWPXSTATUS_T
/* Define if <sys/procfs.h> has lwpstatus_t.pr_context. */
#undef HAVE_LWPSTATUS_T_PR_CONTEXT

994
bfd/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -507,6 +507,7 @@ do
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" ;;
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_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;;

View File

@ -36,6 +36,21 @@ const bfd_arch_info_type bfd_i386_arch_intel_syntax =
bfd_default_scan ,
0,
};
const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
{
64, /* 64 bits in a word */
64, /* 64 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_i386,
bfd_mach_x86_64_intel_syntax,
"x86_64:intel",
"x86_64:intel",
3,
true,
bfd_default_compatible,
bfd_default_scan ,
&bfd_i386_arch_intel_syntax,
};
static const bfd_arch_info_type i8086_arch =
{
32, /* 32 bits in a word */
@ -49,7 +64,23 @@ static const bfd_arch_info_type i8086_arch =
false,
bfd_default_compatible,
bfd_default_scan ,
&bfd_i386_arch_intel_syntax,
&bfd_x86_64_arch_intel_syntax,
};
const bfd_arch_info_type bfd_x86_64_arch =
{
64, /* 32 bits in a word */
64, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_i386,
bfd_mach_x86_64,
"x86_64",
"x86_64",
3,
true,
bfd_default_compatible,
bfd_default_scan ,
&i8086_arch,
};
const bfd_arch_info_type bfd_i386_arch =
@ -65,6 +96,6 @@ const bfd_arch_info_type bfd_i386_arch =
true,
bfd_default_compatible,
bfd_default_scan ,
&i8086_arch,
&bfd_x86_64_arch
};

View File

@ -3306,6 +3306,9 @@ prep_headers (abfd)
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:

4201
bfd/elf64-ia64.c Normal file

File diff suppressed because it is too large Load Diff

353
bfd/elf64-x86-64.c Normal file
View File

@ -0,0 +1,353 @@
/* X86-64 specific support for 64-bit ELF
Copyright 2000 Free Software Foundation, Inc.
Contributed by Jan Hubicka <jh@suse.cz>.
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/x86-64.h"
/* We use only the RELA entries. */
#define USE_RELA
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */
#define MINUS_ONE (~ (bfd_vma) 0)
/* The relocation "howto" table. Order of fields:
type, size, bitsize, pc_relative, complain_on_overflow, special_function,
name, partial_inplace, src_mask, dst_pack, pcrel_offset */
static reloc_howto_type x86_64_elf_howto_table[] =
{
HOWTO(R_X86_64_NONE, 0,0, 0,false,0,complain_overflow_dont, 0, "R_X86_64_NONE", false,0x00000000,0x00000000,false),
HOWTO(R_X86_64_64, 0,4,64,false,0,complain_overflow_bitfield,0, "R_X86_64_64", false,MINUS_ONE ,MINUS_ONE ,false),
HOWTO(R_X86_64_PC32, 0,4,32,true ,0,complain_overflow_signed ,0, "R_X86_64_PC32", false,0xffffffff,0xffffffff,true),
HOWTO(R_X86_64_GOT32, 0,4,32,false,0,complain_overflow_signed ,0, "R_X86_64_GOT32", false,0xffffffff,0xffffffff,false),
HOWTO(R_X86_64_PLT32, 0,4,32,true ,0,complain_overflow_signed ,0, "R_X86_64_PLT32", false,0xffffffff,0xffffffff,true),
HOWTO(R_X86_64_COPY, 0,4,32,false,0,complain_overflow_bitfield,0, "R_X86_64_COPY", false,0xffffffff,0xffffffff,false),
HOWTO(R_X86_64_GLOB_DAT, 0,4,64,false,0,complain_overflow_bitfield,0,"R_X86_64_GLOB_DAT",false,MINUS_ONE ,MINUS_ONE ,false),
HOWTO(R_X86_64_RELATIVE ,0,4,64,false,0,complain_overflow_bitfield,0,"R_X86_64_RELATIVE",false,MINUS_ONE ,MINUS_ONE ,false),
HOWTO(R_X86_64_JUMP_SLOT,0,4,64,false,0,complain_overflow_bitfield,0,"R_X86_64_JUMP_SLOT",false,MINUS_ONE,MINUS_ONE ,false),
HOWTO(R_X86_64_GOTPCREL, 0,4,32,true, 0,complain_overflow_signed ,0, "R_X86_64_PCREL", false,0xffffffff,0xffffffff,true),
HOWTO(R_X86_64_32, 0,4,32,false,0,complain_overflow_unsigned,0, "R_X86_64_32", false,0xffffffff,0xffffffff,false),
HOWTO(R_X86_64_32S, 0,4,32,false,0,complain_overflow_signed, 0, "R_X86_64_32S", false,0xffffffff,0xffffffff,false),
HOWTO(R_X86_64_16, 0,1,16,false,0,complain_overflow_bitfield,0, "R_X86_64_16", false,0xffff ,0xffff, false),
HOWTO(R_X86_64_PC16, 0,1,16,true ,0,complain_overflow_bitfield,0, "R_X86_64_PC16", false,0xffff ,0xffff, true),
HOWTO(R_X86_64_8, 0,0, 8,false,0,complain_overflow_signed ,0, "R_X86_64_8", false,0xff ,0xff, false),
HOWTO(R_X86_64_PC8, 0,0, 8,true ,0,complain_overflow_signed ,0, "R_X86_64_PC8", false,0xff ,0xff, true),
};
/* Map BFD relocs to the x86_64 elf relocs. */
struct elf_reloc_map {
bfd_reloc_code_real_type bfd_reloc_val;
unsigned char elf_reloc_val;
};
static CONST struct elf_reloc_map x86_64_reloc_map[] =
{
{ BFD_RELOC_NONE, R_X86_64_NONE, },
{ BFD_RELOC_64, R_X86_64_64, },
{ BFD_RELOC_32_PCREL, R_X86_64_PC32, },
{ BFD_RELOC_X86_64_GOT32, R_X86_64_GOT32,},
{ BFD_RELOC_X86_64_PLT32, R_X86_64_PLT32,},
{ BFD_RELOC_X86_64_COPY, R_X86_64_COPY, },
{ BFD_RELOC_X86_64_GLOB_DAT, R_X86_64_GLOB_DAT, },
{ BFD_RELOC_X86_64_JUMP_SLOT, R_X86_64_JUMP_SLOT, },
{ BFD_RELOC_X86_64_RELATIVE, R_X86_64_RELATIVE, },
{ BFD_RELOC_X86_64_GOTPCREL, R_X86_64_GOTPCREL, },
{ BFD_RELOC_32, R_X86_64_32, },
{ BFD_RELOC_X86_64_32S, R_X86_64_32S, },
{ BFD_RELOC_16, R_X86_64_16, },
{ BFD_RELOC_16_PCREL, R_X86_64_PC16, },
{ BFD_RELOC_8, R_X86_64_8, },
{ BFD_RELOC_8_PCREL, R_X86_64_PC8, },
};
static reloc_howto_type *elf64_x86_64_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
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_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
/* Given a BFD reloc type, return a HOWTO structure. */
static reloc_howto_type *
elf64_x86_64_reloc_type_lookup (abfd, code)
bfd *abfd ATTRIBUTE_UNUSED;
bfd_reloc_code_real_type code;
{
unsigned int i;
for (i = 0; i < sizeof (x86_64_reloc_map) / sizeof (struct elf_reloc_map);
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 0;
}
/* Given an x86_64 ELF reloc type, fill in an arelent structure. */
static void
elf64_x86_64_info_to_howto (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
Elf64_Internal_Rela *dst;
{
unsigned r_type;
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];
BFD_ASSERT (r_type == cache_ptr->howto->type);
}
/* Hash table functions - these will be used by dynamic linking code and
right now they are needed to keep ld happy. */
/* x86_64 ELF linker hash table. */
struct elf64_x86_64_link_hash_table
{
struct elf_link_hash_table root;
};
/* Get the X86-64 ELF linker hash table from a link_info structure. */
#define elf64_x86_64_hash_table(p) \
((struct elf64_x86_64_link_hash_table *) ((p)->hash))
/* Create an X86-64 ELF linker hash table. */
static struct bfd_link_hash_table *
elf64_x86_64_link_hash_table_create (abfd)
bfd *abfd;
{
struct elf64_x86_64_link_hash_table *ret;
ret = ((struct elf64_x86_64_link_hash_table *)
bfd_alloc (abfd, sizeof (struct elf64_x86_64_link_hash_table)));
if (ret == (struct elf64_x86_64_link_hash_table *) NULL)
return NULL;
if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
_bfd_elf_link_hash_newfunc))
{
bfd_release (abfd, ret);
return NULL;
}
return &ret->root.root;
}
boolean
elf64_x86_64_elf_object_p (abfd)
bfd *abfd;
{
/* Set the right machine number for an x86-64 elf64 file. */
bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_x86_64);
return true;
}
/* Relocate an x86_64 ELF section. */
static boolean
elf64_x86_64_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;
{
bfd *dynobj;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
bfd_vma *local_got_offsets;
asection *sreloc;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
dynobj = elf_hash_table (info)->dynobj;
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;
if (dynobj != NULL)
abort ();
rel = relocs;
relend = relocs + input_section->reloc_count;
for (; rel < relend; rel++)
{
int r_type;
reloc_howto_type *howto;
unsigned long r_symndx;
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
asection *sec;
bfd_vma relocation;
bfd_reloc_status_type r;
unsigned int indx;
r_type = ELF64_R_TYPE (rel->r_info);
if ((indx = (unsigned) r_type) >= R_X86_64_max)
{
bfd_set_error (bfd_error_bad_value);
return false;
}
howto = x86_64_elf_howto_table + indx;
r_symndx = ELF64_R_SYM (rel->r_info);
if (info->relocateable)
{
/* This is a relocateable 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 (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. */
h = NULL;
sym = NULL;
sec = NULL;
if (r_symndx < symtab_hdr->sh_info)
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
relocation = (sec->output_section->vma
+ sec->output_offset
+ sym->st_value);
}
else
{
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;
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)
{
(*_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;
}
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->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd,
input_section, rel->r_offset,
(!info->shared || info->no_undefined
|| ELF_ST_VISIBILITY (h->other)))))
return false;
relocation = 0;
}
}
/* This function should support shared objects, but don't. */
if (info->shared)
abort();
r = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, rel->r_offset,
relocation, rel->r_addend);
if (r != bfd_reloc_ok)
{
switch (r)
{
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;
}
}
}
return true;
}
#define TARGET_LITTLE_SYM bfd_elf64_x86_64_vec
#define TARGET_LITTLE_NAME "elf64-x86-64"
#define ELF_ARCH bfd_arch_i386
#define ELF_MACHINE_CODE EM_X86_64
#define ELF_MAXPAGESIZE 0x100000
#define elf_info_to_howto elf64_x86_64_info_to_howto
#define bfd_elf64_bfd_reloc_type_lookup elf64_x86_64_reloc_type_lookup
#define elf_backend_object_p elf64_x86_64_elf_object_p
#define elf_backend_relocate_section elf64_x86_64_relocate_section
#define bfd_elf64_bfd_link_hash_table_create elf64_x86_64_link_hash_table_create
#include "elf64-target.h"

View File

@ -562,7 +562,7 @@ extern bfd *bfd_last_cache;
#define bfd_cache_lookup(x) \
((x)==bfd_last_cache? \
(FILE*)(bfd_last_cache->iostream): \
(FILE*) (bfd_last_cache->iostream): \
bfd_cache_lookup_worker(x))
boolean
bfd_cache_init PARAMS ((bfd *abfd));
@ -714,6 +714,14 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_386_RELATIVE",
"BFD_RELOC_386_GOTOFF",
"BFD_RELOC_386_GOTPC",
"BFD_RELOC_X86_64_GOT32",
"BFD_RELOC_X86_64_PLT32",
"BFD_RELOC_X86_64_COPY",
"BFD_RELOC_X86_64_GLOB_DAT",
"BFD_RELOC_X86_64_JUMP_SLOT",
"BFD_RELOC_X86_64_RELATIVE",
"BFD_RELOC_X86_64_GOTPCREL",
"BFD_RELOC_X86_64_32S",
"BFD_RELOC_NS32K_IMM_8",
"BFD_RELOC_NS32K_IMM_16",
"BFD_RELOC_NS32K_IMM_32",

View File

@ -823,12 +823,12 @@ typedef struct
struct bfd_link_info *info,
bfd *abfd,
const char *name,
flagword flags,
flagword flags,
asection *section,
bfd_vma value,
const char *string,
boolean copy,
boolean collect,
boolean collect,
struct bfd_link_hash_entry **hashp));
boolean (*_bfd_coff_link_output_has_begun) PARAMS ((

View File

@ -139,6 +139,7 @@ elf64-hppa.h
elf64-ia64.c
elf64-mips.c
elf64-sparc.c
elf64-x86-64.c
elfarm-nabi.c
elfarm-oabi.c
elf-bfd.h

File diff suppressed because it is too large Load Diff

View File

@ -2077,6 +2077,25 @@ ENUMX
ENUMDOC
i386/elf relocations
ENUM
BFD_RELOC_X86_64_GOT32
ENUMX
BFD_RELOC_X86_64_PLT32
ENUMX
BFD_RELOC_X86_64_COPY
ENUMX
BFD_RELOC_X86_64_GLOB_DAT
ENUMX
BFD_RELOC_X86_64_JUMP_SLOT
ENUMX
BFD_RELOC_X86_64_RELATIVE
ENUMX
BFD_RELOC_X86_64_GOTPCREL
ENUMX
BFD_RELOC_X86_64_32S
ENUMDOC
x86-64/elf relocations
ENUM
BFD_RELOC_NS32K_IMM_8
ENUMX

View File

@ -552,6 +552,7 @@ extern const bfd_target bfd_elf32_shl_vec;
extern const bfd_target bfd_elf32_shlin_vec;
extern const bfd_target bfd_elf32_shblin_vec;
extern const bfd_target bfd_elf32_sparc_vec;
extern const bfd_target bfd_elf64_x86_64_vec;
extern const bfd_target bfd_elf32_tradbigmips_vec;
extern const bfd_target bfd_elf32_tradlittlemips_vec;
extern const bfd_target bfd_elf32_v850_vec;
@ -738,6 +739,9 @@ const bfd_target * const bfd_target_vector[] = {
&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_i960_vec,