From 1360ba7676d14e2c69958ac09f9ac23d58f38d54 Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Fri, 22 Oct 2010 12:08:32 +0000 Subject: [PATCH] ld: * emulparams/elf32_sparc_sol2.sh (OUTPUT_FORMAT): Set to elf32-sparc-sol2. * emulparams/elf64_sparc_sol2.sh (OUTPUT_FORMAT): Set to elf64-sparc-sol2. gas: * config/tc-sparc.h [TE_SOLARIS] (ELF_TARGET_FORMAT): Define as elf32-sparc-sol2. (ELF64_TARGET_FORMAT): Define as elf64-sparc-sol2. bfd: * elfxx-sparc.c (tpoff): Define bed, static_tls_size. Consider static_tls_alignment. * elf32-sparc.c (TARGET_BIG_SYM): Redefine to bfd_elf32_sparc_sol2_vec. (TARGET_BIG_NAME): Redefine to elf32-sparc-sol2. (elf32_bed): Redefine to elf32_sparc_sol2_bed. (elf_backend_static_tls_alignment): Redefine to 8. Include elf32-target.h. (elf_backend_static_tls_alignment): Undef again for VxWorks. * elf64-sparc.c (TARGET_BIG_SYM): Redefine to bfd_elf64_sparc_sol2_vec. (TARGET_BIG_NAME): Redefine to elf64-sparc-sol2. (ELF_OSABI): Undef. (elf64_bed): Redefine to elf64_sparc_sol2_bed. (elf_backend_static_tls_alignment): Redefine to 16. Include elf64-target.h. * config.bfd (sparc-*-solaris2.[0-6]): Split from sparc-*-elf*. Set targ_defvec to bfd_elf32_sparc_sol2_vec. [BFD64] (sparc-*-solaris2*): Set targ_defvec to bfd_elf32_sparc_sol2_vec. Replace bfd_elf64_sparc_vec by bfd_elf64_sparc_sol2_vec in targ_selvecs. * configure.in: Handle bfd_elf32_sparc_sol2_vec, bfd_elf64_sparc_sol2_vec. * configure: Regenerate. * targets.c (bfd_elf32_sparc_sol2_vec): Declare. (bfd_elf64_sparc_sol2_vec): Declare. (_bfd_target_vector): Add bfd_elf32_sparc_sol2_vec, bfd_elf64_sparc_sol2_vec. --- bfd/ChangeLog | 37 +++++++++++++++++++++++++++++++ bfd/config.bfd | 10 ++++++--- bfd/configure | 2 ++ bfd/configure.in | 2 ++ bfd/elf32-sparc.c | 20 ++++++++++++++++- bfd/elf64-sparc.c | 22 +++++++++++++++++- bfd/elfxx-sparc.c | 7 +++++- bfd/targets.c | 4 ++++ gas/ChangeLog | 6 +++++ gas/config/tc-sparc.h | 7 +++++- ld/ChangeLog | 7 ++++++ ld/emulparams/elf32_sparc_sol2.sh | 1 + ld/emulparams/elf64_sparc_sol2.sh | 1 + 13 files changed, 119 insertions(+), 7 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 7722ff8fec..f5749a9ace 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,40 @@ +2010-10-22 Rainer Orth + + * elfxx-sparc.c (tpoff): Define bed, static_tls_size. + Consider static_tls_alignment. + + * elf32-sparc.c (TARGET_BIG_SYM): Redefine to + bfd_elf32_sparc_sol2_vec. + (TARGET_BIG_NAME): Redefine to elf32-sparc-sol2. + (elf32_bed): Redefine to elf32_sparc_sol2_bed. + (elf_backend_static_tls_alignment): Redefine to 8. + Include elf32-target.h. + (elf_backend_static_tls_alignment): Undef again for VxWorks. + + * elf64-sparc.c (TARGET_BIG_SYM): Redefine to + bfd_elf64_sparc_sol2_vec. + (TARGET_BIG_NAME): Redefine to elf64-sparc-sol2. + (ELF_OSABI): Undef. + (elf64_bed): Redefine to elf64_sparc_sol2_bed. + (elf_backend_static_tls_alignment): Redefine to 16. + Include elf64-target.h. + + * config.bfd (sparc-*-solaris2.[0-6]): Split from sparc-*-elf*. + Set targ_defvec to bfd_elf32_sparc_sol2_vec. + [BFD64] (sparc-*-solaris2*): Set targ_defvec to + bfd_elf32_sparc_sol2_vec. + Replace bfd_elf64_sparc_vec by bfd_elf64_sparc_sol2_vec in + targ_selvecs. + + * configure.in: Handle bfd_elf32_sparc_sol2_vec, + bfd_elf64_sparc_sol2_vec. + * configure: Regenerate. + + * targets.c (bfd_elf32_sparc_sol2_vec): Declare. + (bfd_elf64_sparc_sol2_vec): Declare. + (_bfd_target_vector): Add bfd_elf32_sparc_sol2_vec, + bfd_elf64_sparc_sol2_vec. + 2010-10-21 Joseph Myers * elf32-tic6x.c (elf32_tic6x_merge_arch_attributes): Update for diff --git a/bfd/config.bfd b/bfd/config.bfd index e42535f91a..f0a03e3914 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -1395,14 +1395,18 @@ case "${targ}" in targ_defvec=bfd_elf32_sparc_vec targ_selvecs=sparcnetbsd_vec ;; - sparc-*-elf* | sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*) + sparc-*-elf*) targ_defvec=bfd_elf32_sparc_vec targ_selvecs=sunos_big_vec ;; + sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*) + targ_defvec=bfd_elf32_sparc_sol2_vec + targ_selvecs=sunos_big_vec + ;; #ifdef BFD64 sparc-*-solaris2* | sparcv9-*-solaris2* | sparc64-*-solaris2*) - targ_defvec=bfd_elf32_sparc_vec - targ_selvecs="bfd_elf64_sparc_vec sunos_big_vec" + targ_defvec=bfd_elf32_sparc_sol2_vec + targ_selvecs="bfd_elf64_sparc_sol2_vec sunos_big_vec" want64=true ;; #endif diff --git a/bfd/configure b/bfd/configure index 980711aa26..41009f2505 100755 --- a/bfd/configure +++ b/bfd/configure @@ -15148,6 +15148,7 @@ do bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_shvxworks_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;; bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;; + bfd_elf32_sparc_sol2_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;; bfd_elf32_sparc_vxworks_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;; bfd_elf32_spu_vec) tb="$tb elf32-spu.lo elf32.lo $elf" ;; bfd_elf32_tic6x_be_vec) tb="$tb elf32-tic6x.lo elf32.lo $elf" ;; @@ -15185,6 +15186,7 @@ do 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_sparc_sol2_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 elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; diff --git a/bfd/configure.in b/bfd/configure.in index 13fb66f4bc..2a876bf52e 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -783,6 +783,7 @@ do bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_shvxworks_vec) tb="$tb elf32-sh.lo elf-vxworks.lo elf32.lo $elf coff-sh.lo" ;; bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;; + bfd_elf32_sparc_sol2_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;; bfd_elf32_sparc_vxworks_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;; bfd_elf32_spu_vec) tb="$tb elf32-spu.lo elf32.lo $elf" ;; bfd_elf32_tic6x_be_vec) tb="$tb elf32-tic6x.lo elf32.lo $elf" ;; @@ -820,6 +821,7 @@ do 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_sparc_sol2_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 elf-ifunc.lo elf64.lo $elf"; target_size=64 ;; diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index adfe924718..187d46698d 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -1,6 +1,6 @@ /* SPARC-specific support for 32-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006, 2007, 2010 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -246,6 +246,23 @@ elf32_sparc_add_symbol_hook (bfd * abfd, #include "elf32-target.h" +/* Solaris 2. */ + +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf32_sparc_sol2_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf32-sparc-sol2" + +#undef elf32_bed +#define elf32_bed elf32_sparc_sol2_bed + +/* The 32-bit static TLS arena size is rounded to the nearest 8-byte + boundary. */ +#undef elf_backend_static_tls_alignment +#define elf_backend_static_tls_alignment 8 + +#include "elf32-target.h" + /* A wrapper around _bfd_sparc_elf_link_hash_table_create that identifies the target system as VxWorks. */ @@ -305,6 +322,7 @@ elf32_sparc_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker) #undef elf_backend_final_write_processing #define elf_backend_final_write_processing \ elf32_sparc_vxworks_final_write_processing +#undef elf_backend_static_tls_alignment #undef elf32_bed #define elf32_bed sparc_elf_vxworks_bed diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 1ad0c14e09..9f05b85fa5 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -1,6 +1,6 @@ /* SPARC-specific support for 64-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -934,3 +934,23 @@ const struct elf_size_info elf64_sparc_size_info = #include "elf64-target.h" +/* Solaris 2. */ + +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf64_sparc_sol2_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf64-sparc-sol2" + +/* Restore default: we cannot use ELFOSABI_SOLARIS, otherwise ELFOSABI_NONE + objects won't be recognized. */ +#undef ELF_OSABI + +#undef elf64_bed +#define elf64_bed elf64_sparc_sol2_bed + +/* The 64-bit static TLS arena size is rounded to the nearest 16-byte + boundary. */ +#undef elf_backend_static_tls_alignment +#define elf_backend_static_tls_alignment 16 + +#include "elf64-target.h" diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index 979505a79c..ebe040f0ff 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -2819,11 +2819,16 @@ static bfd_vma tpoff (struct bfd_link_info *info, bfd_vma address) { struct elf_link_hash_table *htab = elf_hash_table (info); + const struct elf_backend_data *bed = get_elf_backend_data (info->output_bfd); + bfd_vma static_tls_size; /* If tls_sec is NULL, we should have signalled an error already. */ if (htab->tls_sec == NULL) return 0; - return address - htab->tls_size - htab->tls_sec->vma; + + /* Consider special static TLS alignment requirements. */ + static_tls_size = BFD_ALIGN (htab->tls_size, bed->static_tls_alignment); + return address - static_tls_size - htab->tls_sec->vma; } /* Return the relocation value for a %gdop relocation. */ diff --git a/bfd/targets.c b/bfd/targets.c index aaf7e99c64..3e99754272 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -676,6 +676,7 @@ extern const bfd_target bfd_elf32_shlvxworks_vec; extern const bfd_target bfd_elf32_shnbsd_vec; extern const bfd_target bfd_elf32_shvxworks_vec; extern const bfd_target bfd_elf32_sparc_vec; +extern const bfd_target bfd_elf32_sparc_sol2_vec; extern const bfd_target bfd_elf32_sparc_vxworks_vec; extern const bfd_target bfd_elf32_spu_vec; extern const bfd_target bfd_elf32_tic6x_be_vec; @@ -713,6 +714,7 @@ 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_sparc_sol2_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; @@ -1025,6 +1027,7 @@ static const bfd_target * const _bfd_target_vector[] = &bfd_elf32_sh64blin_vec, #endif &bfd_elf32_sparc_vec, + &bfd_elf32_sparc_sol2_vec, &bfd_elf32_sparc_vxworks_vec, &bfd_elf32_spu_vec, &bfd_elf32_tic6x_be_vec, @@ -1063,6 +1066,7 @@ static const bfd_target * const _bfd_target_vector[] = &bfd_elf64_sh64blin_vec, &bfd_elf64_sparc_vec, &bfd_elf64_sparc_freebsd_vec, + &bfd_elf64_sparc_sol2_vec, &bfd_elf64_tradbigmips_vec, &bfd_elf64_tradlittlemips_vec, &bfd_elf64_x86_64_freebsd_vec, diff --git a/gas/ChangeLog b/gas/ChangeLog index 70213c4cc0..817adc447a 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2010-10-22 Rainer Orth + + * config/tc-sparc.h [TE_SOLARIS] (ELF_TARGET_FORMAT): Define as + elf32-sparc-sol2. + (ELF64_TARGET_FORMAT): Define as elf64-sparc-sol2. + 2010-10-21 Joseph Myers * config/tc-tic6x.c (tic6x_arch_attribute, tic6x_arches, diff --git a/gas/config/tc-sparc.h b/gas/config/tc-sparc.h index 9054b471b8..3d4636d5ee 100644 --- a/gas/config/tc-sparc.h +++ b/gas/config/tc-sparc.h @@ -1,6 +1,6 @@ /* tc-sparc.h - Macros and type defines for the sparc. Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008 + 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2010 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -37,6 +37,11 @@ struct frag; #define ELF64_TARGET_FORMAT "elf64-sparc-freebsd" #endif +#ifdef TE_SOLARIS +#define ELF_TARGET_FORMAT "elf32-sparc-sol2" +#define ELF64_TARGET_FORMAT "elf64-sparc-sol2" +#endif + #ifndef ELF_TARGET_FORMAT #define ELF_TARGET_FORMAT "elf32-sparc" #endif diff --git a/ld/ChangeLog b/ld/ChangeLog index 09a1f71940..0b0e607393 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2010-10-22 Rainer Orth + + * emulparams/elf32_sparc_sol2.sh (OUTPUT_FORMAT): Set to + elf32-sparc-sol2. + * emulparams/elf64_sparc_sol2.sh (OUTPUT_FORMAT): Set to + elf64-sparc-sol2. + 2010-10-22 Alan Modra * ldwrite.c (build_link_order ): Don't diff --git a/ld/emulparams/elf32_sparc_sol2.sh b/ld/emulparams/elf32_sparc_sol2.sh index 8fab990d54..46ca284914 100644 --- a/ld/emulparams/elf32_sparc_sol2.sh +++ b/ld/emulparams/elf32_sparc_sol2.sh @@ -1,3 +1,4 @@ . ${srcdir}/emulparams/elf32_sparc.sh . ${srcdir}/emulparams/solaris2.sh EXTRA_EM_FILE=solaris2 +OUTPUT_FORMAT="elf32-sparc-sol2" diff --git a/ld/emulparams/elf64_sparc_sol2.sh b/ld/emulparams/elf64_sparc_sol2.sh index 3bf09f68a9..2fad634eee 100644 --- a/ld/emulparams/elf64_sparc_sol2.sh +++ b/ld/emulparams/elf64_sparc_sol2.sh @@ -1,3 +1,4 @@ . ${srcdir}/emulparams/elf64_sparc.sh . ${srcdir}/emulparams/solaris2.sh EXTRA_EM_FILE=solaris2 +OUTPUT_FORMAT="elf64-sparc-sol2" -- 2.34.1