Commit 11176d2a by Julian Brown Committed by Julian Brown

configure.ac: Set ld_vers_major, ld_vers_minor and ld_vers_patch for GNU linker.

        * configure.ac: Set ld_vers_major, ld_vers_minor and ld_vers_patch for
        GNU linker. Support linker version x.x.x.x.x. Require GNU linker
        20050308/2.16.0 or newer for comdat group.
        * configure: Regenerated.
        * config.in: Regenerated.
        * varasm.c (default_function_rodata_section): Put .rodata section in
        COMDAT group when necessary.
        (default_elf_asm_named_section): Rename HAVE_GAS_COMDAT_GROUP to
        HAVE_COMDAT_GROUP.
        (default_unique_section_1): Don't use .gnu.linkonce when COMDAT is
        available.

Co-Authored-By: H.J. Lu <hongjiu.lu@intel.com>
Co-Authored-By: Paul Brook <paul@codesourcery.com>

From-SVN: r99395
parent 357877ed
2005-05-08 Julian Brown <julian@codesourcery.com>
H.J. Lu <hongjiu.lu@intel.com>
Paul Brook <paul@codesourcery.com>
* configure.ac: Set ld_vers_major, ld_vers_minor and ld_vers_patch for
GNU linker. Support linker version x.x.x.x.x. Require GNU linker
20050308/2.16.0 or newer for comdat group.
* configure: Regenerated.
* config.in: Regenerated.
* varasm.c (default_function_rodata_section): Put .rodata section in
COMDAT group when necessary.
(default_elf_asm_named_section): Rename HAVE_GAS_COMDAT_GROUP to
HAVE_COMDAT_GROUP.
(default_unique_section_1): Don't use .gnu.linkonce when COMDAT is
available.
2005-05-08 Kazu Hirata <kazu@cs.umass.edu>
* tree-dfa.c (referenced_vars, add_referenced_var): Use VEC
......
......@@ -216,7 +216,10 @@
/* Define if your assembler supports popcntb field. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_POPCNTB
#endif
/* Define if your assembler supports .register. */
#ifndef USED_FOR_TARGET
......@@ -280,6 +283,12 @@
#endif
/* Define 0/1 if your assembler and linker support COMDAT groups. */
#ifndef USED_FOR_TARGET
#undef HAVE_COMDAT_GROUP
#endif
/* Define to 1 if we found a declaration for 'abort', otherwise define to 0.
*/
#ifndef USED_FOR_TARGET
......@@ -666,12 +675,6 @@
#endif
/* Define 0/1 if your assembler supports COMDAT group. */
#ifndef USED_FOR_TARGET
#undef HAVE_GAS_COMDAT_GROUP
#endif
/* Define if your assembler uses the new HImode fild and fist notation. */
#ifndef USED_FOR_TARGET
#undef HAVE_GAS_FILDS_FISTS
......
......@@ -2104,8 +2104,12 @@ changequote(,)dnl
-e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
-e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p' \
-e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p' \
-e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p'`
-e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p' \
-e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p'`
ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'`
ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
if test 0"$ld_date" -lt 20020404; then
if test -n "$ld_date"; then
# If there was date string, but was earlier than 2002-04-04, fail
......@@ -2114,9 +2118,6 @@ changequote(,)dnl
# If there was no date string nor ld version number, something is wrong
gcc_cv_ld_hidden=no
else
ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
test -z "$ld_vers_patch" && ld_vers_patch=0
if test "$ld_vers_major" -lt 2; then
gcc_cv_ld_hidden=no
......@@ -2258,18 +2259,35 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE,
[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,
[elf,2,15,91], [--fatal-warnings],
[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
else
gcc_GAS_CHECK_FEATURE(COMDAT group support, gcc_cv_as_comdat_group_percent,
[elf,2,15,91], [--fatal-warnings],
[elf,2,16,0], [--fatal-warnings],
[.section .text,"axG",%progbits,.foo,comdat])
fi
AC_DEFINE_UNQUOTED(HAVE_GAS_COMDAT_GROUP,
if test $in_tree_ld != yes && test x"$ld_vers" != x; then
comdat_group=yes
if test 0"$ld_date" -lt 20050308; then
if test -n "$ld_date"; then
# If there was date string, but was earlier than 2005-03-08, fail
comdat_group=no
elif test "$ld_vers_major" -lt 2; then
comdat_group=no
elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then
comdat_group=no
fi
fi
if test $comdat_group = no; then
gcc_cv_as_comdat_group=no
gcc_cv_as_comdat_group_percent=no
fi
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`],
[Define 0/1 if your assembler supports COMDAT group.])
[Define 0/1 if your assembler and linker support COMDAT groups.])
# Thread-local storage - the check is heavily parametrized.
conftest_s=
......
......@@ -618,8 +618,19 @@ default_function_rodata_section (tree decl)
{
const char *name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
if (DECL_ONE_ONLY (decl) && HAVE_COMDAT_GROUP)
{
size_t len = strlen (name) + 3;
char* rname = alloca (len);
strcpy (rname, ".rodata");
strcat (rname, name + 5);
named_section_real (rname, SECTION_LINKONCE, decl);
return;
}
/* For .gnu.linkonce.t.foo we want to use .gnu.linkonce.r.foo. */
if (DECL_ONE_ONLY (decl) && strncmp (name, ".gnu.linkonce.t.", 16) == 0)
else if (DECL_ONE_ONLY (decl)
&& strncmp (name, ".gnu.linkonce.t.", 16) == 0)
{
size_t len = strlen (name) + 1;
char *rname = alloca (len);
......@@ -4880,7 +4891,7 @@ default_elf_asm_named_section (const char *name, unsigned int flags,
abbreviated form to switch back to it -- unless this section is
part of a COMDAT groups, in which case GAS requires the full
declaration every time. */
if (!(HAVE_GAS_COMDAT_GROUP && (flags & SECTION_LINKONCE))
if (!(HAVE_COMDAT_GROUP && (flags & SECTION_LINKONCE))
&& ! named_section_first_declaration (name))
{
fprintf (asm_out_file, "\t.section\t%s\n", name);
......@@ -4901,7 +4912,7 @@ default_elf_asm_named_section (const char *name, unsigned int flags,
*f++ = 'S';
if (flags & SECTION_TLS)
*f++ = 'T';
if (HAVE_GAS_COMDAT_GROUP && (flags & SECTION_LINKONCE))
if (HAVE_COMDAT_GROUP && (flags & SECTION_LINKONCE))
*f++ = 'G';
*f = '\0';
......@@ -4928,7 +4939,7 @@ default_elf_asm_named_section (const char *name, unsigned int flags,
if (flags & SECTION_ENTSIZE)
fprintf (asm_out_file, ",%d", flags & SECTION_ENTSIZE);
if (HAVE_GAS_COMDAT_GROUP && (flags & SECTION_LINKONCE))
if (HAVE_COMDAT_GROUP && (flags & SECTION_LINKONCE))
fprintf (asm_out_file, ",%s,comdat",
lang_hooks.decls.comdat_group (decl));
}
......@@ -5240,7 +5251,8 @@ default_unique_section (tree decl, int reloc)
void
default_unique_section_1 (tree decl, int reloc, int shlib)
{
bool one_only = DECL_ONE_ONLY (decl);
/* We only need to use .gnu.linkonce if we don't have COMDAT groups. */
bool one_only = DECL_ONE_ONLY (decl) && !HAVE_COMDAT_GROUP;
const char *prefix, *name;
size_t nlen, plen;
char *string;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment