From ebcb8d85eca4ac1e52082b471d5b88dad9f12992 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 18 Oct 2006 23:58:52 +0000 Subject: 2006-10-18 Roy Marples * 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. --- bfd/ChangeLog | 9 +++++++++ bfd/config.bfd | 6 +++++- bfd/configure | 1 + bfd/configure.in | 1 + bfd/elf64-sparc.c | 30 ++++++++++++++++++++++++++++++ bfd/targets.c | 2 ++ 6 files changed, 48 insertions(+), 1 deletion(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 961e65e04c..c558facd7a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2006-10-18 Roy Marples + + * 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 * elf32-arm.c (elf32_arm_final_link_relocate): Add support for diff --git a/bfd/config.bfd b/bfd/config.bfd index 6f6a7b9168..31dbf0e9fa 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 0f878f04d9..fa61beedff 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 339af936af..0532434833 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 1185553705..0eefc95c12 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 117e7c6e33..96fab096f9 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, -- cgit v1.2.1