aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/config.bfd6
-rwxr-xr-xbfd/configure1
-rw-r--r--bfd/configure.in1
-rw-r--r--bfd/elf64-sparc.c30
-rw-r--r--bfd/targets.c2
-rw-r--r--gas/ChangeLog9
-rw-r--r--gas/config/tc-sparc.c6
-rw-r--r--gas/config/tc-sparc.h13
-rw-r--r--ld/ChangeLog4
-rw-r--r--ld/emulparams/elf64_sparc_fbsd.sh2
11 files changed, 79 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 961e65e..c558fac 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+2006-10-18 Roy Marples <uberlord@gentoo.org>
+
+ * elf64-sparc.c: Add FreeBSD support.
+ (elf64_sparc_fbsd_post_process_headers): New function.
+ * targets.c (_bfd_target_vector): Add bfd_elf64_sparc_freebsd_vec.
+ * config.bfd (sparc64-*-freebsd*): Set targ_defvec to bfd_elf64_sparc_freebsd_vec.
+ * configure.in: Add entry for bfd_elf64_sparc_freebsd_vec.
+ * configure: Regenerate.
+
2006-10-17 Mark Shinwell <shinwell@codesourcery.com>
* elf32-arm.c (elf32_arm_final_link_relocate): Add support for
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 6f6a7b9..31dbf0e 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -182,7 +182,11 @@ case "${targ}" in
targ_selvecs="bfd_elf64_ia64_hpux_big_vec"
want64=true
;;
- sparc64-*-freebsd* | sparc64-*-netbsd* | sparc64-*-openbsd* | sparc64-*-kfreebsd*-gnu)
+ sparc64-*-freebsd* | sparc64-*-kfreebsd*-gnu)
+ targ_defvec=bfd_elf64_sparc_freebsd_vec
+ targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
+ ;;
+ sparc64-*-netbsd* | sparc64-*-openbsd*)
targ_defvec=bfd_elf64_sparc_vec
targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
want64=true
diff --git a/bfd/configure b/bfd/configure
index 0f878f0..fa61bee 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -10926,6 +10926,7 @@ do
bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_sparc_freebsd_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 ;;
diff --git a/bfd/configure.in b/bfd/configure.in
index 339af93..0532434 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -716,6 +716,7 @@ do
bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_sparc_freebsd_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 ;;
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index 1185553..0eefc95 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"
+
diff --git a/bfd/targets.c b/bfd/targets.c
index 117e7c6..96fab09 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -674,6 +674,7 @@ extern const bfd_target bfd_elf64_sh64blin_vec;
extern const bfd_target bfd_elf64_sh64lnbsd_vec;
extern const bfd_target bfd_elf64_sh64nbsd_vec;
extern const bfd_target bfd_elf64_sparc_vec;
+extern const bfd_target bfd_elf64_sparc_freebsd_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;
@@ -1002,6 +1003,7 @@ static const bfd_target * const _bfd_target_vector[] =
&bfd_elf64_sh64lin_vec,
&bfd_elf64_sh64blin_vec,
&bfd_elf64_sparc_vec,
+ &bfd_elf64_sparc_freebsd_vec,
&bfd_elf64_tradbigmips_vec,
&bfd_elf64_tradlittlemips_vec,
&bfd_elf64_x86_64_freebsd_vec,
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 38b93fb..22262e3 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,12 @@
+2006-10-18 Roy Marples <uberlord@gentoo.org>
+
+ * 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.
+ * config/tc-sparc.h (ELF_TARGET_FORMAT, ELF_TARGET_FORMAT64): Define.
+
2006-10-17 H.J. Lu <hongjiu.lu@intel.com>
* configure: Regenerated.
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index d84c273..d6a1a15 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -337,7 +337,7 @@ sparc_target_format ()
#endif
#ifdef OBJ_ELF
- return sparc_arch_size == 64 ? "elf64-sparc" : "elf32-sparc";
+ return sparc_arch_size == 64 ? ELF64_TARGET_FORMAT : ELF_TARGET_FORMAT;
#endif
abort ();
@@ -545,12 +545,12 @@ md_parse_option (c, arg)
{
if (sparc_arch_size == 32)
{
- if (strcmp (*l, "elf32-sparc") == 0)
+ if (CONST_STRNEQ (*l, "elf32-sparc"))
break;
}
else
{
- if (strcmp (*l, "elf64-sparc") == 0)
+ if (CONST_STRNEQ (*l, "elf64-sparc"))
break;
}
}
diff --git a/gas/config/tc-sparc.h b/gas/config/tc-sparc.h
index 3feac4f..3318ddd 100644
--- a/gas/config/tc-sparc.h
+++ b/gas/config/tc-sparc.h
@@ -31,6 +31,19 @@ struct frag;
#define TARGET_ARCH bfd_arch_sparc
+#ifdef TE_FreeBSD
+#define ELF_TARGET_FORMAT "elf32-sparc-freebsd"
+#define ELF64_TARGET_FORMAT "elf64-sparc-freebsd"
+#endif
+
+#ifndef ELF_TARGET_FORMAT
+#define ELF_TARGET_FORMAT "elf32-sparc"
+#endif
+
+#ifndef ELF64_TARGET_FORMAT
+#define ELF64_TARGET_FORMAT "elf64-sparc"
+#endif
+
extern const char *sparc_target_format PARAMS ((void));
#define TARGET_FORMAT sparc_target_format ()
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 674051e..33bbe3d 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,7 @@
+2006-10-18 Roy Marples <uberlord@gentoo.org>
+
+ * emulparams/elf64_sparc_fbsd.sh (OUTPUT_FORMAT): Define as elf64-sparc-freebsd.
+
2006-10-18 Joseph Myers <joseph@codesourcery.com>
* configure.tgt (i[3-7]86-*-linux-*): Also define
diff --git a/ld/emulparams/elf64_sparc_fbsd.sh b/ld/emulparams/elf64_sparc_fbsd.sh
index 232a321..21d13ab 100644
--- a/ld/emulparams/elf64_sparc_fbsd.sh
+++ b/ld/emulparams/elf64_sparc_fbsd.sh
@@ -1,2 +1,4 @@
. ${srcdir}/emulparams/elf64_sparc.sh
. ${srcdir}/emulparams/elf_fbsd.sh
+
+OUTPUT_FORMAT="elf64-sparc-freebsd"