From 2ca48caa2c83ba7ba516a227788b2e86f8ca74ec Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Thu, 19 May 2011 14:29:05 +0000 Subject: [PATCH] re PR target/40483 (gcc 4.x needs to utilize better COMDAT mechanism under Solaris) PR target/40483 * configure.ac (gcc_cv_as_comdat_group_group): Check for Sun as COMDAT group syntax, both SPARC and x86 variants. (HAVE_COMDAT_GROUP): Also define if gcc_cv_as_comdat_group_group. * configure: Regenerate. * config/sol2.h (TARGET_SOLARIS): Define. (PUSHSECTION_FORMAT): Remove. (SECTION_NAME_FORMAT): Define. * config/sol2.c: Include hashtab.h. (solaris_output_init_fini): Replace PUSHSECTION_FORMAT by its expansion, using SECTION_NAME_FORMAT. (solaris_comdat_htab): New variable. (struct comdat_entry): Define. (comdat_hash): New function. (comdat_eq): New function. (solaris_elf_asm_comdat_section): New function. (solaris_define_comdat_signature): New function. (solaris_code_end): New function. * config/sol2-protos.h (solaris_elf_asm_comdat_section): Declare. (solaris_code_end): Declare. * config/t-sol2 (sol2.o): Add $HASHTAB_H dependency. * config/i386/i386.c (ix86_code_end) [TARGET_SOLARIS]: Call solaris_code_end. (i386_solaris_elf_named_section): Wrap in TARGET_SOLARIS. Remove ATTRIBUTE_UNUSED. [!USE_GAS]: Call solaris_elf_asm_comdat_section for SECTION_LINKONCE sections if HAVE_COMDAT_GROUP. * config/sparc/sparc.c (sparc_solaris_elf_asm_named_section): Likewise. * config/i386/sol2-10.h (TARGET_ASM_NAMED_SECTION): Moved ... * config/i386/sol2.h (TARGET_ASM_NAMED_SECTION): ... here. * config/sparc/sol2.h (TARGET_ASM_CODE_END): Redefine. (PUSHSECTION_FORMAT): Remove. (SECTION_NAME_FORMAT): Redefine. From-SVN: r173913 --- gcc/ChangeLog | 37 +++++++++++ gcc/config/i386/i386.c | 17 ++++- gcc/config/i386/sol2-10.h | 3 - gcc/config/i386/sol2.h | 3 + gcc/config/sol2-protos.h | 2 + gcc/config/sol2.c | 131 +++++++++++++++++++++++++++++++++++++- gcc/config/sol2.h | 8 ++- gcc/config/sparc/sol2.h | 13 +++- gcc/config/sparc/sparc.c | 8 +++ gcc/configure | 80 ++++++++++++++++++++--- gcc/configure.ac | 55 +++++++++++++--- 11 files changed, 327 insertions(+), 30 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3da31e700b4..9b70e154111 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,40 @@ +2011-05-19 Rainer Orth + + PR target/40483 + * configure.ac (gcc_cv_as_comdat_group_group): Check for Sun as + COMDAT group syntax, both SPARC and x86 variants. + (HAVE_COMDAT_GROUP): Also define if gcc_cv_as_comdat_group_group. + * configure: Regenerate. + * config/sol2.h (TARGET_SOLARIS): Define. + (PUSHSECTION_FORMAT): Remove. + (SECTION_NAME_FORMAT): Define. + * config/sol2.c: Include hashtab.h. + (solaris_output_init_fini): Replace PUSHSECTION_FORMAT by its + expansion, using SECTION_NAME_FORMAT. + (solaris_comdat_htab): New variable. + (struct comdat_entry): Define. + (comdat_hash): New function. + (comdat_eq): New function. + (solaris_elf_asm_comdat_section): New function. + (solaris_define_comdat_signature): New function. + (solaris_code_end): New function. + * config/sol2-protos.h (solaris_elf_asm_comdat_section): Declare. + (solaris_code_end): Declare. + * config/t-sol2 (sol2.o): Add $HASHTAB_H dependency. + * config/i386/i386.c (ix86_code_end) [TARGET_SOLARIS]: Call + solaris_code_end. + (i386_solaris_elf_named_section): Wrap in TARGET_SOLARIS. + Remove ATTRIBUTE_UNUSED. + [!USE_GAS]: Call solaris_elf_asm_comdat_section for + SECTION_LINKONCE sections if HAVE_COMDAT_GROUP. + * config/sparc/sparc.c (sparc_solaris_elf_asm_named_section): + Likewise. + * config/i386/sol2-10.h (TARGET_ASM_NAMED_SECTION): Moved ... + * config/i386/sol2.h (TARGET_ASM_NAMED_SECTION): ... here. + * config/sparc/sol2.h (TARGET_ASM_CODE_END): Redefine. + (PUSHSECTION_FORMAT): Remove. + (SECTION_NAME_FORMAT): Redefine. + 2011-05-19 Kai Tietz * tree-cfg.c (verify_gimple_assign_binary): Barf on diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 87d5650405f..15dde25a9ca 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -8768,6 +8768,10 @@ ix86_code_end (void) rtx xops[2]; int regno; +#ifdef TARGET_SOLARIS + solaris_code_end (); +#endif + for (regno = AX_REG; regno <= SP_REG; regno++) { char name[32]; @@ -32148,9 +32152,10 @@ void ix86_emit_swsqrtsf (rtx res, rtx a, enum machine_mode mode, gen_rtx_MULT (mode, e2, e3))); } +#ifdef TARGET_SOLARIS /* Solaris implementation of TARGET_ASM_NAMED_SECTION. */ -static void ATTRIBUTE_UNUSED +static void i386_solaris_elf_named_section (const char *name, unsigned int flags, tree decl) { @@ -32164,8 +32169,18 @@ i386_solaris_elf_named_section (const char *name, unsigned int flags, flags & SECTION_WRITE ? "aw" : "a"); return; } + +#ifndef USE_GAS + if (HAVE_COMDAT_GROUP && flags & SECTION_LINKONCE) + { + solaris_elf_asm_comdat_section (name, flags, decl); + return; + } +#endif + default_elf_asm_named_section (name, flags, decl); } +#endif /* TARGET_SOLARIS */ /* Return the mangling of TYPE if it is an extended fundamental type. */ diff --git a/gcc/config/i386/sol2-10.h b/gcc/config/i386/sol2-10.h index c3decd2ef24..04a7132dc6c 100644 --- a/gcc/config/i386/sol2-10.h +++ b/gcc/config/i386/sol2-10.h @@ -133,6 +133,3 @@ along with GCC; see the file COPYING3. If not see /* We do not need to search a special directory for startup files. */ #undef MD_STARTFILE_PREFIX - -#undef TARGET_ASM_NAMED_SECTION -#define TARGET_ASM_NAMED_SECTION i386_solaris_elf_named_section diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h index baddbb0b929..36ca62f904c 100644 --- a/gcc/config/i386/sol2.h +++ b/gcc/config/i386/sol2.h @@ -154,6 +154,9 @@ along with GCC; see the file COPYING3. If not see } \ while (0) +#undef TARGET_ASM_NAMED_SECTION +#define TARGET_ASM_NAMED_SECTION i386_solaris_elf_named_section + /* We do not need NT_VERSION notes. */ #undef X86_FILE_START_VERSION_DIRECTIVE #define X86_FILE_START_VERSION_DIRECTIVE false diff --git a/gcc/config/sol2-protos.h b/gcc/config/sol2-protos.h index 800629aaba1..25753ff610e 100644 --- a/gcc/config/sol2-protos.h +++ b/gcc/config/sol2-protos.h @@ -22,3 +22,5 @@ extern void solaris_insert_attributes (tree, tree *); extern void solaris_register_pragmas (void); extern void solaris_output_init_fini (FILE *, tree); extern void solaris_assemble_visibility (tree, int); +extern void solaris_elf_asm_comdat_section (const char *, unsigned int, tree); +extern void solaris_code_end (void); diff --git a/gcc/config/sol2.c b/gcc/config/sol2.c index decde2fea29..7fed184e14d 100644 --- a/gcc/config/sol2.c +++ b/gcc/config/sol2.c @@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see #include "tm_p.h" #include "diagnostic-core.h" #include "ggc.h" +#include "hashtab.h" tree solaris_pending_aligns, solaris_pending_inits, solaris_pending_finis; @@ -106,14 +107,14 @@ solaris_output_init_fini (FILE *file, tree decl) { if (lookup_attribute ("init", DECL_ATTRIBUTES (decl))) { - fprintf (file, PUSHSECTION_FORMAT, ".init"); + fprintf (file, "\t.pushsection\t" SECTION_NAME_FORMAT "\n", ".init"); ASM_OUTPUT_CALL (file, decl); fprintf (file, "\t.popsection\n"); } if (lookup_attribute ("fini", DECL_ATTRIBUTES (decl))) { - fprintf (file, PUSHSECTION_FORMAT, ".fini"); + fprintf (file, "\t.pushsection\t" SECTION_NAME_FORMAT "\n", ".fini"); ASM_OUTPUT_CALL (file, decl); fprintf (file, "\t.popsection\n"); } @@ -155,3 +156,129 @@ solaris_assemble_visibility (tree decl ATTRIBUTE_UNUSED, "in this configuration; ignored"); #endif } + +/* Hash table of group signature symbols. */ + +static htab_t solaris_comdat_htab; + +/* Group section information entry stored in solaris_comdat_htab. */ + +typedef struct comdat_entry +{ + const char *name; + unsigned int flags; + tree decl; + const char *sig; +} comdat_entry; + +/* Helper routines for maintaining solaris_comdat_htab. */ + +static hashval_t +comdat_hash (const void *p) +{ + const comdat_entry *entry = (const comdat_entry *) p; + + return htab_hash_string (entry->sig); +} + +static int +comdat_eq (const void *p1, const void *p2) +{ + const comdat_entry *entry1 = (const comdat_entry *) p1; + const comdat_entry *entry2 = (const comdat_entry *) p2; + + return strcmp (entry1->sig, entry2->sig) == 0; +} + +/* Output assembly to switch to COMDAT group section NAME with attributes + FLAGS and group signature symbol DECL, using Sun as syntax. */ + +void +solaris_elf_asm_comdat_section (const char *name, unsigned int flags, tree decl) +{ + const char *signature; + char *section; + comdat_entry entry, **slot; + + if (TREE_CODE (decl) == IDENTIFIER_NODE) + signature = IDENTIFIER_POINTER (decl); + else + signature = IDENTIFIER_POINTER (DECL_COMDAT_GROUP (decl)); + + /* Sun as requires group sections to be fragmented, i.e. to have names of + the form
%. Strictly speaking this is only + necessary to support cc -xF, but is enforced globally in violation of + the ELF gABI. We keep the section names generated by GCC (generally + of the form .text.) and append % to pacify as, + despite the redundancy. */ + section = concat (name, "%", signature, NULL); + + /* Clear SECTION_LINKONCE flag so targetm.asm_out.named_section only + emits this as a regular section. Emit section before .group + directive since Sun as treats undeclared sections as @progbits, + which conflicts with .bss* sections which are @nobits. */ + targetm.asm_out.named_section (section, flags & ~SECTION_LINKONCE, decl); + + /* Sun as separates declaration of a group section and of the group + itself, using the .group directive and the #comdat flag. */ + fprintf (asm_out_file, "\t.group\t%s," SECTION_NAME_FORMAT ",#comdat\n", + signature, section); + + /* Unlike GNU as, group signature symbols need to be defined explicitly + for Sun as. With a few exceptions, this is already the case. To + identify the missing ones without changing the affected frontents, + remember the signature symbols and emit those not marked + TREE_SYMBOL_REFERENCED in solaris_code_end. */ + if (solaris_comdat_htab == NULL) + solaris_comdat_htab = htab_create_alloc (37, comdat_hash, comdat_eq, NULL, + xcalloc, free); + + entry.sig = signature; + slot = (comdat_entry **) htab_find_slot (solaris_comdat_htab, &entry, INSERT); + + if (*slot == NULL) + { + *slot = XCNEW (comdat_entry); + /* Remember fragmented section name. */ + (*slot)->name = section; + /* Emit as regular section, .group declaration has already been done. */ + (*slot)->flags = flags & ~SECTION_LINKONCE; + (*slot)->decl = decl; + (*slot)->sig = signature; + } +} + +/* Define unreferenced COMDAT group signature symbol corresponding to SLOT. */ + +static int +solaris_define_comdat_signature (void **slot, void *aux ATTRIBUTE_UNUSED) +{ + comdat_entry *entry = *(comdat_entry **) slot; + tree decl = entry->decl; + + if (TREE_CODE (decl) != IDENTIFIER_NODE) + decl = DECL_COMDAT_GROUP (decl); + + if (!TREE_SYMBOL_REFERENCED (decl)) + { + /* Switch to group section, otherwise Sun as complains + `Group Id symbol defined outside of group'. */ + switch_to_section (get_section (entry->name, entry->flags, entry->decl)); + + ASM_OUTPUT_LABEL (asm_out_file, entry->sig); + } + + /* Continue with scan. */ + return 1; +} + +/* Emit unreferenced COMDAT group signature symbols for Sun as. */ + +void +solaris_code_end (void) +{ + if (solaris_comdat_htab == NULL) + return; + + htab_traverse (solaris_comdat_htab, solaris_define_comdat_signature, NULL); +} diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h index 7e42ddb6a4b..f3394fda74d 100644 --- a/gcc/config/sol2.h +++ b/gcc/config/sol2.h @@ -19,6 +19,9 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see . */ +/* We are compiling for Solaris 2 now. */ +#define TARGET_SOLARIS 1 + /* We use stabs-in-elf for debugging, because that is what the native toolchain uses. */ #undef PREFERRED_DEBUGGING_TYPE @@ -257,9 +260,8 @@ __enable_execute_stack (void *addr) \ { "init", 0, 0, true, false, false, NULL, false }, \ { "fini", 0, 0, true, false, false, NULL, false } -/* Solaris/x86 as and gas support the common ELF .section/.pushsection - syntax. */ -#define PUSHSECTION_FORMAT "\t.pushsection\t%s\n" +/* Solaris/x86 as and gas support unquoted section names. */ +#define SECTION_NAME_FORMAT "%s" /* This is how to declare the size of a function. For Solaris, we output any .init or .fini entries here. */ diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h index 73355ca8c45..a53b82a8e95 100644 --- a/gcc/config/sparc/sol2.h +++ b/gcc/config/sparc/sol2.h @@ -188,9 +188,16 @@ along with GCC; see the file COPYING3. If not see #undef TARGET_ASM_NAMED_SECTION #define TARGET_ASM_NAMED_SECTION sparc_solaris_elf_asm_named_section -/* And SPARC non-standard pushsection syntax. */ -#undef PUSHSECTION_FORMAT -#define PUSHSECTION_FORMAT "\t.pushsection\t\"%s\"\n" +/* Emit COMDAT group signature symbols for Sun as. */ +#undef TARGET_ASM_CODE_END +#define TARGET_ASM_CODE_END solaris_code_end + +/* Solaris/SPARC as requires doublequoted section names. While gas + supports that, too, we prefer the standard variant. */ +#ifndef USE_GAS +#undef SECTION_NAME_FORMAT +#define SECTION_NAME_FORMAT "\"%s\"" +#endif /* Static stack checking is supported by means of probes. */ #define STACK_CHECK_STATIC_BUILTIN 1 diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index e2443d7c4ed..10b35f250e9 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -8537,12 +8537,19 @@ sparc_profile_hook (int labelno) } } +#ifdef TARGET_SOLARIS /* Solaris implementation of TARGET_ASM_NAMED_SECTION. */ static void sparc_solaris_elf_asm_named_section (const char *name, unsigned int flags, tree decl ATTRIBUTE_UNUSED) { + if (HAVE_COMDAT_GROUP && flags & SECTION_LINKONCE) + { + solaris_elf_asm_comdat_section (name, flags, decl); + return; + } + fprintf (asm_out_file, "\t.section\t\"%s\"", name); if (!(flags & SECTION_DEBUG)) @@ -8558,6 +8565,7 @@ sparc_solaris_elf_asm_named_section (const char *name, unsigned int flags, fputc ('\n', asm_out_file); } +#endif /* TARGET_SOLARIS */ /* We do not allow indirect calls to be optimized into sibling calls. diff --git a/gcc/configure b/gcc/configure index b0bde294bfc..a054764333a 100755 --- a/gcc/configure +++ b/gcc/configure @@ -22328,8 +22328,8 @@ cat >>confdefs.h <<_ACEOF _ACEOF -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for COMDAT group support" >&5 -$as_echo_n "checking assembler for COMDAT group support... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for COMDAT group support (GNU as)" >&5 +$as_echo_n "checking assembler for COMDAT group support (GNU as)... " >&6; } if test "${gcc_cv_as_comdat_group+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -22361,9 +22361,10 @@ $as_echo "$gcc_cv_as_comdat_group" >&6; } if test $gcc_cv_as_comdat_group = yes; then gcc_cv_as_comdat_group_percent=no + gcc_cv_as_comdat_group_group=no else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for COMDAT group support" >&5 -$as_echo_n "checking assembler for COMDAT group support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for COMDAT group support (GNU as, %type)" >&5 +$as_echo_n "checking assembler for COMDAT group support (GNU as, %type)... " >&6; } if test "${gcc_cv_as_comdat_group_percent+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -22393,6 +22394,59 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_comdat_group_percent" >&5 $as_echo "$gcc_cv_as_comdat_group_percent" >&6; } + if test $gcc_cv_as_comdat_group_percent = yes; then + gcc_cv_as_comdat_group_group=no + else + case "${target}" in + # Sun as uses a completely different syntax. + *-*-solaris2*) + case "${target}" in + sparc*-*-solaris2*) + conftest_s=' + .group foo,".text%foo",#comdat + .section ".text%foo", #alloc,#execinstr,#progbits + .globl foo + foo: + ' + ;; + i?86-*-solaris2*) + conftest_s=' + .group foo,.text%foo,#comdat + .section .text%foo, "ax", @progbits + .globl foo + foo: + ' + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for COMDAT group support (Sun as, .group)" >&5 +$as_echo_n "checking assembler for COMDAT group support (Sun as, .group)... " >&6; } +if test "${gcc_cv_as_comdat_group_group+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + gcc_cv_as_comdat_group_group=no + if test x$gcc_cv_as != x; then + echo "$conftest_s" > conftest.s + if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + gcc_cv_as_comdat_group_group=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_comdat_group_group" >&5 +$as_echo "$gcc_cv_as_comdat_group_group" >&6; } + + ;; + esac + fi fi if test x"$ld_is_gold" = xyes; then comdat_group=yes @@ -22417,16 +22471,19 @@ elif echo "$ld_ver" | grep GNU > /dev/null; then else case "${target}" in *-*-solaris2.1[1-9]*) + comdat_group=no # Sun ld has COMDAT group support since Solaris 9, but it doesn't # interoperate with GNU as until Solaris 11 build 130, i.e. ld # version 1.688. # - # FIXME: Maybe need to refine later when COMDAT group support with - # Sun as is implemented. - if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 1688; then + # If using Sun as for COMDAT group as emitted by GCC, one needs at + # least ld version 1.2267. + if test "$ld_vers_major" -gt 1; then comdat_group=yes - else - comdat_group=no + elif test "x$gas_flag" = xyes && test "$ld_vers_minor" -ge 1688; then + comdat_group=yes + elif test "$ld_vers_minor" -ge 2267; then + comdat_group=yes fi ;; *) @@ -22444,10 +22501,13 @@ fi if test $comdat_group = no; then gcc_cv_as_comdat_group=no gcc_cv_as_comdat_group_percent=no + gcc_cv_as_comdat_group_group=no fi cat >>confdefs.h <<_ACEOF -#define HAVE_COMDAT_GROUP `if test $gcc_cv_as_comdat_group = yes || test $gcc_cv_as_comdat_group_percent = yes; then echo 1; else echo 0; fi` +#define HAVE_COMDAT_GROUP `if test $gcc_cv_as_comdat_group = yes \ + || test $gcc_cv_as_comdat_group_percent = yes \ + || test $gcc_cv_as_comdat_group_group = yes; then echo 1; else echo 0; fi` _ACEOF diff --git a/gcc/configure.ac b/gcc/configure.ac index 87b712045a7..ff6d5e90157 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2589,15 +2589,48 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE, [`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`], [Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.]) -gcc_GAS_CHECK_FEATURE(COMDAT group support, gcc_cv_as_comdat_group, +gcc_GAS_CHECK_FEATURE([COMDAT group support (GNU as)], + gcc_cv_as_comdat_group, [elf,2,16,0], [--fatal-warnings], [.section .text,"axG",@progbits,.foo,comdat]) if test $gcc_cv_as_comdat_group = yes; then gcc_cv_as_comdat_group_percent=no + gcc_cv_as_comdat_group_group=no else - gcc_GAS_CHECK_FEATURE(COMDAT group support, gcc_cv_as_comdat_group_percent, + gcc_GAS_CHECK_FEATURE([COMDAT group support (GNU as, %type)], + gcc_cv_as_comdat_group_percent, [elf,2,16,0], [--fatal-warnings], [.section .text,"axG",%progbits,.foo,comdat]) + if test $gcc_cv_as_comdat_group_percent = yes; then + gcc_cv_as_comdat_group_group=no + else + case "${target}" in + # Sun as uses a completely different syntax. + *-*-solaris2*) + case "${target}" in + sparc*-*-solaris2*) + conftest_s=' + .group foo,".text%foo",#comdat + .section ".text%foo", #alloc,#execinstr,#progbits + .globl foo + foo: + ' + ;; + i?86-*-solaris2*) + conftest_s=' + .group foo,.text%foo,#comdat + .section .text%foo, "ax", @progbits + .globl foo + foo: + ' + ;; + esac + gcc_GAS_CHECK_FEATURE([COMDAT group support (Sun as, .group)], + gcc_cv_as_comdat_group_group, + ,, [$conftest_s]) + ;; + esac + fi fi if test x"$ld_is_gold" = xyes; then comdat_group=yes @@ -2623,16 +2656,19 @@ else changequote(,)dnl case "${target}" in *-*-solaris2.1[1-9]*) + comdat_group=no # Sun ld has COMDAT group support since Solaris 9, but it doesn't # interoperate with GNU as until Solaris 11 build 130, i.e. ld # version 1.688. # - # FIXME: Maybe need to refine later when COMDAT group support with - # Sun as is implemented. - if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 1688; then + # If using Sun as for COMDAT group as emitted by GCC, one needs at + # least ld version 1.2267. + if test "$ld_vers_major" -gt 1; then comdat_group=yes - else - comdat_group=no + elif test "x$gas_flag" = xyes && test "$ld_vers_minor" -ge 1688; then + comdat_group=yes + elif test "$ld_vers_minor" -ge 2267; then + comdat_group=yes fi ;; *) @@ -2649,9 +2685,12 @@ AC_ARG_ENABLE(comdat, if test $comdat_group = no; then gcc_cv_as_comdat_group=no gcc_cv_as_comdat_group_percent=no + gcc_cv_as_comdat_group_group=no fi AC_DEFINE_UNQUOTED(HAVE_COMDAT_GROUP, - [`if test $gcc_cv_as_comdat_group = yes || test $gcc_cv_as_comdat_group_percent = yes; then echo 1; else echo 0; fi`], + [`if test $gcc_cv_as_comdat_group = yes \ + || test $gcc_cv_as_comdat_group_percent = yes \ + || test $gcc_cv_as_comdat_group_group = yes; then echo 1; else echo 0; fi`], [Define 0/1 if your assembler and linker support COMDAT groups.]) gcc_GAS_CHECK_FEATURE([line table discriminator support], -- 2.30.2