From 2ca48caa2c83ba7ba516a227788b2e86f8ca74ec Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Thu, 19 May 2011 14:29:05 +0000 Subject: 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/config/sparc/sol2.h | 13 ++++++++++--- gcc/config/sparc/sparc.c | 8 ++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'gcc/config/sparc') diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h index 73355ca..a53b82a 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 e2443d7..10b35f2 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. -- cgit v1.1