summaryrefslogtreecommitdiff
path: root/bfd/elf64-sparc.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-10-18 23:58:52 +0000
committerMike Frysinger <vapier@gentoo.org>2006-10-18 23:58:52 +0000
commit71a75f6f15bcaf99d98bb50ddd57ec8e8d1bbc9d (patch)
treed011cc97e090b899771347dc709397573fd767de /bfd/elf64-sparc.c
parent981c7f5a30140027e173d12ba33b8b650f850447 (diff)
downloadbinutils-gdb-71a75f6f15bcaf99d98bb50ddd57ec8e8d1bbc9d.tar.gz
2006-10-18 Roy Marples <uberlord@gentoo.org>
* bfd/elf64-sparc.c: Add FreeBSD support. (elf64_sparc_fbsd_post_process_headers): New function. * bfd/targets.c (_bfd_target_vector): Add bfd_elf64_sparc_freebsd_vec. * bfd/config.bfd (sparc64-*-freebsd*): Set targ_defvec to bfd_elf64_sparc_freebsd_vec. * bfd/configure.in: Add entry for bfd_elf64_sparc_freebsd_vec. * bfd/configure: Regenerate. * gas/config/tc-sparc.c (md_parse_option): Treat any target starting with elf32-sparc as a viable target for the -32 switch and any target starting with elf64-sparc as a viable target for the -64 switch. (sparc_target_format): For 64-bit ELF flavoured output use ELF_TARGET_FORMAT64 while for 32-bit ELF flavoured output use ELF_TARGET_FORMAT. * gas/config/tc-sparc.h (ELF_TARGET_FORMAT, ELF_TARGET_FORMAT64): Define. * ld/emulparams/elf64_sparc_fbsd.sh (OUTPUT_FORMAT): Define as elf64-sparc-freebsd.
Diffstat (limited to 'bfd/elf64-sparc.c')
-rw-r--r--bfd/elf64-sparc.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index 11855537054..0eefc95c125 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -904,3 +904,33 @@ const struct elf_size_info elf64_sparc_size_info =
#define elf_backend_plt_alignment 8
#include "elf64-target.h"
+
+/* FreeBSD support */
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elf64_sparc_freebsd_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elf64-sparc-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_sparc_fbsd_post_process_headers (bfd *abfd,
+ struct bfd_link_info *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_sparc_fbsd_post_process_headers
+#undef elf64_bed
+#define elf64_bed elf64_sparc_fbsd_bed
+
+#include "elf64-target.h"
+