aboutsummaryrefslogtreecommitdiff
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
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.
-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
-rw-r--r--gas/ChangeLog9
-rw-r--r--gas/config/tc-i386.c4
-rw-r--r--gas/config/tc-i386.h7
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/emulparams/elf_x86_64_fbsd.sh1
11 files changed, 75 insertions, 7 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
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 937a60f..593d5f8 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,12 @@
+2006-08-02 Petr Salinger <Petr.Salinger@seznam.cz>
+
+ PR binutils/2983
+ * 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.
+ * config/tc-i386.h (ELF_TARGET_FORMAT64): Define.
+
2006-08-02 Nick Clifton <nickc@redhat.com>
PR gas/2991
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 1060510..f85aed3 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -5819,7 +5819,7 @@ md_parse_option (int c, char *arg)
list = bfd_target_list ();
for (l = list; *l != NULL; l++)
- if (strcmp (*l, "elf64-x86-64") == 0)
+ if (strncmp (*l, "elf64-x86-64", 12) == 0)
{
default_arch = "x86_64";
break;
@@ -5975,7 +5975,7 @@ i386_target_format ()
object_64bit = 1;
use_rela_relocations = 1;
}
- return flag_code == CODE_64BIT ? "elf64-x86-64" : ELF_TARGET_FORMAT;
+ return flag_code == CODE_64BIT ? ELF_TARGET_FORMAT64 : ELF_TARGET_FORMAT;
}
#endif
default:
diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h
index 4519132..43d6df9 100644
--- a/gas/config/tc-i386.h
+++ b/gas/config/tc-i386.h
@@ -1,6 +1,6 @@
/* tc-i386.h -- Header file for tc-i386.c
Copyright 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005
+ 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -55,6 +55,7 @@ extern unsigned long i386_mach (void);
#ifdef TE_FreeBSD
#define ELF_TARGET_FORMAT "elf32-i386-freebsd"
+#define ELF_TARGET_FORMAT64 "elf64-x86-64-freebsd"
#elif defined (TE_VXWORKS)
#define ELF_TARGET_FORMAT "elf32-i386-vxworks"
#endif
@@ -63,6 +64,10 @@ extern unsigned long i386_mach (void);
#define ELF_TARGET_FORMAT "elf32-i386"
#endif
+#ifndef ELF_TARGET_FORMAT64
+#define ELF_TARGET_FORMAT64 "elf64-x86-64"
+#endif
+
#if ((defined (OBJ_MAYBE_COFF) && defined (OBJ_MAYBE_AOUT)) \
|| defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF))
extern const char *i386_target_format PARAMS ((void));
diff --git a/ld/ChangeLog b/ld/ChangeLog
index f874f5d..e3e78d4 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2006-08-02 Petr Salinger <Petr.Salinger@seznam.cz>
+
+ PR binutils/2983
+ * emulparams/elf_x86_64_fbsd.sh (OUTPUT_FORMAT): Define as
+ elf64-x86-64-freebsd.
+
2006-08-01 H.J. Lu <hongjiu.lu@intel.com>
* ldlang.c (init_os): Add flags. Replace bfd_make_section with
diff --git a/ld/emulparams/elf_x86_64_fbsd.sh b/ld/emulparams/elf_x86_64_fbsd.sh
index 34258cb..35b6a62 100644
--- a/ld/emulparams/elf_x86_64_fbsd.sh
+++ b/ld/emulparams/elf_x86_64_fbsd.sh
@@ -1,2 +1,3 @@
. ${srcdir}/emulparams/elf_x86_64.sh
. ${srcdir}/emulparams/elf_fbsd.sh
+OUTPUT_FORMAT="elf64-x86-64-freebsd"