aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-x86-64.c
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/elf64-x86-64.c
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/elf64-x86-64.c')
-rw-r--r--bfd/elf64-x86-64.c31
1 files changed, 31 insertions, 0 deletions
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"