2006-10-18 Roy Marples <uberlord@gentoo.org>
[external/binutils.git] / bfd / elf64-sparc.c
index 1185553..0eefc95 100644 (file)
@@ -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"
+