aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2006-08-02 16:25:14 +0000
committerNick Clifton <nickc@redhat.com>2006-08-02 16:25:14 +0000
commit9d7cbccda0d0b223261e33efb609a7a43401ec5e (patch)
tree89c15bea23a6a33149b4057f5f7add8d6910cdb6 /bfd
parentc973bc5cd4b6024ab430a41cae5b75c2c54fd55e (diff)
downloadgdb-9d7cbccda0d0b223261e33efb609a7a43401ec5e.zip
gdb-9d7cbccda0d0b223261e33efb609a7a43401ec5e.tar.gz
gdb-9d7cbccda0d0b223261e33efb609a7a43401ec5e.tar.bz2
PR binutils/2983
* bfd/elf64-x86-64.c: Add FreeBSD support. (elf64_x86_64_fbsd_post_process_headers): New function. * bfd/targets.c (_bfd_target_vector): Add bfd_elf64_x86_64_freebsd_vec. * bfd/config.bfd (x64_64-*-freebsd*): Add bfd_elf64_x86_64_freebsd_vec to the targ_selvecs. * bfd/configure.in: Add entry for bfd_elf64_x86_64_freebsd_vec. * bfd/configure: Regenerate. * gas/config/tc-i386.c (md_parse_option): Treat any target starting with elf64_x86_64 as a viable target for the -64 switch. (i386_target_format): For 64-bit ELF flavoured output use ELF_TARGET_FORMAT64. * gas/config/tc-i386.h (ELF_TARGET_FORMAT64): Define. * ld/emulparams/elf_x86_64_fbsd.sh (OUTPUT_FORMAT): Define as elf64-x86-64-freebsd.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog11
-rw-r--r--bfd/config.bfd4
-rwxr-xr-xbfd/configure6
-rw-r--r--bfd/configure.in1
-rw-r--r--bfd/elf64-x86-64.c31
-rw-r--r--bfd/targets.c2
6 files changed, 51 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 0b9613d..b1537bd 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,14 @@
+2006-08-02 Petr Salinger <Petr.Salinger@seznam.cz>
+
+ PR binutils/2983
+ * elf64-x86-64.c: Add FreeBSD support.
+ (elf64_x86_64_fbsd_post_process_headers): New function.
+ * targets.c (_bfd_target_vector): Add bfd_elf64_x86_64_freebsd_vec.
+ * config.bfd (x64_64-*-freebsd*): Add bfd_elf64_x86_64_freebsd_vec
+ to the targ_selvecs.
+ * configure.in: Add entry for bfd_elf64_x86_64_freebsd_vec.
+ * configure: Regenerate.
+
2006-07-26 Andreas Schwab <schwab@suse.de>
* elfxx-ia64.c (elfNN_ia64_choose_gp): Use rawsize if set.
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 0a8ed0f..dfe631e 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -564,8 +564,8 @@ case "${targ}" in
want64=true
;;
x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
- targ_defvec=bfd_elf64_x86_64_vec
- targ_selvecs="bfd_elf32_i386_vec i386coff_vec bfd_efi_app_ia32_vec"
+ targ_defvec=bfd_elf64_x86_64_freebsd_vec
+ targ_selvecs="bfd_elf32_i386_freebsd_vec i386coff_vec bfd_efi_app_ia32_vec bfd_elf32_i386_vec bfd_elf64_x86_64_vec"
want64=true
;;
x86_64-*-netbsd* | x86_64-*-openbsd*)
diff --git a/bfd/configure b/bfd/configure
index fa9307d..86b9492 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -5282,8 +5282,9 @@ INCINTL=
XGETTEXT=
GMSGFMT=
POSUB=
-if test -f ../intl/config.intl; then
- . ../intl/config.intl
+
+if test -f ../intl/config.intl; then
+ . ../intl/config.intl
fi
echo "$as_me:$LINENO: checking whether NLS is requested" >&5
echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6
@@ -10917,6 +10918,7 @@ do
bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf64_x86_64_freebsd_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; 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" ;;
diff --git a/bfd/configure.in b/bfd/configure.in
index 41d55f6..e206160 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -708,6 +708,7 @@ do
bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf64_x86_64_freebsd_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; 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" ;;
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 6ca622a..34fde96 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -3710,3 +3710,34 @@ static const struct bfd_elf_special_section
elf64_x86_64_hash_symbol
#include "elf64-target.h"
+
+/* FreeBSD support. */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf64_x86_64_freebsd_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf64-x86-64-freebsd"
+
+/* The kernel recognizes executables as valid only if they carry a
+ "FreeBSD" label in the ELF header. So we put this label on all
+ executables and (for simplicity) also all other object files. */
+
+static void
+elf64_x86_64_fbsd_post_process_headers (bfd * abfd,
+ struct bfd_link_info * link_info ATTRIBUTE_UNUSED)
+{
+ Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */
+
+ i_ehdrp = elf_elfheader (abfd);
+
+ /* Put an ABI label supported by FreeBSD >= 4.1. */
+ i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
+}
+
+#undef elf_backend_post_process_headers
+#define elf_backend_post_process_headers elf64_x86_64_fbsd_post_process_headers
+
+#undef elf64_bed
+#define elf64_bed elf64_x86_64_fbsd_bed
+
+#include "elf64-target.h"
diff --git a/bfd/targets.c b/bfd/targets.c
index 180ecd2..ce3e487 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -668,6 +668,7 @@ extern const bfd_target bfd_elf64_sh64nbsd_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_x86_64_freebsd_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;
@@ -984,6 +985,7 @@ static const bfd_target * const _bfd_target_vector[] = {
&bfd_elf64_sparc_vec,
&bfd_elf64_tradbigmips_vec,
&bfd_elf64_tradlittlemips_vec,
+ &bfd_elf64_x86_64_freebsd_vec,
&bfd_elf64_x86_64_vec,
&bfd_mmo_vec,
#endif