elfos.h (ASM_DECLARE_OBJECT_NAME): Use gnu_unique_object type if available.

* config/elfos.h (ASM_DECLARE_OBJECT_NAME): Use gnu_unique_object
	type if available.
	* configure.ac: Test for it.
	* configure, config.in: Regenerate.
	* doc/install.texi: Document --enable-gnu-unique-object.

From-SVN: r150882
This commit is contained in:
Jason Merrill 2009-08-18 13:01:36 -04:00 committed by Jason Merrill
parent 8fd962e39c
commit e31bcd1b96
6 changed files with 172 additions and 45 deletions

View File

@ -1,3 +1,11 @@
2009-08-18 Jason Merrill <jason@redhat.com>
* config/elfos.h (ASM_DECLARE_OBJECT_NAME): Use gnu_unique_object
type if available.
* configure.ac: Test for it.
* configure, config.in: Regenerate.
* doc/install.texi: Document --enable-gnu-unique-object.
2009-08-18 Richard Guenther <rguenther@suse.de>
PR middle-end/41094

View File

@ -321,6 +321,12 @@
#endif
/* Define if your assembler supports LWSYNC instructions. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_LWSYNC
#endif
/* Define if your assembler supports mfcr field. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_MFCRF
@ -351,22 +357,17 @@
#endif
/* Define if your assembler supports popcntb instruction. */
/* Define if your assembler supports popcntb field. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_POPCNTB
#endif
/* Define if your assembler supports popcntd instruction. */
/* Define if your assembler supports POPCNTD instructions. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_POPCNTD
#endif
/* Define if your assembler supports lwsync instruction. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_LWSYNC
#endif
/* Define if your assembler supports .register. */
#ifndef USED_FOR_TARGET
@ -886,6 +887,12 @@
#endif
/* Define if your assembler supports @gnu_unique_object. */
#ifndef USED_FOR_TARGET
#undef HAVE_GAS_GNU_UNIQUE_OBJECT
#endif
/* Define if your assembler and linker support .hidden. */
#undef HAVE_GAS_HIDDEN

View File

@ -289,24 +289,37 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
/* Write the extra assembler code needed to declare an object properly. */
#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
do \
{ \
HOST_WIDE_INT size; \
\
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
\
size_directive_output = 0; \
if (!flag_inhibit_size_directive \
&& (DECL) && DECL_SIZE (DECL)) \
{ \
size_directive_output = 1; \
size = int_size_in_bytes (TREE_TYPE (DECL)); \
ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
} \
\
ASM_OUTPUT_LABEL (FILE, NAME); \
} \
#ifdef HAVE_GAS_GNU_UNIQUE_OBJECT
#define USE_GNU_UNIQUE_OBJECT 1
#else
#define USE_GNU_UNIQUE_OBJECT 0
#endif
#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
do \
{ \
HOST_WIDE_INT size; \
\
/* For template static data member instantiations or \
inline fn local statics, use gnu_unique_object so that \
they will be combined even under RTLD_LOCAL. */ \
if (USE_GNU_UNIQUE_OBJECT \
&& !DECL_ARTIFICIAL (DECL) && DECL_ONE_ONLY (DECL)) \
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "gnu_unique_object"); \
else \
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
\
size_directive_output = 0; \
if (!flag_inhibit_size_directive \
&& (DECL) && DECL_SIZE (DECL)) \
{ \
size_directive_output = 1; \
size = int_size_in_bytes (TREE_TYPE (DECL)); \
ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
} \
\
ASM_OUTPUT_LABEL (FILE, NAME); \
} \
while (0)
/* Output the size directive for a decl in rest_of_decl_compilation

105
gcc/configure vendored
View File

@ -1091,6 +1091,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-gnu-unique-object enable the use of the @gnu_unique_object ELF extension on
glibc systems
--enable-linker-build-id
compiler will always pass --build-id to linker
--enable-maintainer-mode
@ -14903,13 +14905,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
(eval echo "\"\$as_me:14906: $ac_compile\"" >&5)
(eval echo "\"\$as_me:14908: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
(eval echo "\"\$as_me:14909: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval echo "\"\$as_me:14911: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
(eval echo "\"\$as_me:14912: output\"" >&5)
(eval echo "\"\$as_me:14914: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@ -16066,7 +16068,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 16069 "configure"' > conftest.$ac_ext
echo '#line 16071 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -17959,11 +17961,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:17962: $lt_compile\"" >&5)
(eval echo "\"\$as_me:17964: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:17966: \$? = $ac_status" >&5
echo "$as_me:17968: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -18298,11 +18300,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:18301: $lt_compile\"" >&5)
(eval echo "\"\$as_me:18303: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:18305: \$? = $ac_status" >&5
echo "$as_me:18307: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -18403,11 +18405,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:18406: $lt_compile\"" >&5)
(eval echo "\"\$as_me:18408: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:18410: \$? = $ac_status" >&5
echo "$as_me:18412: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -18458,11 +18460,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:18461: $lt_compile\"" >&5)
(eval echo "\"\$as_me:18463: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:18465: \$? = $ac_status" >&5
echo "$as_me:18467: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -21270,7 +21272,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 21273 "configure"
#line 21275 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -21366,7 +21368,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 21369 "configure"
#line 21371 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -23382,11 +23384,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:23385: $lt_compile\"" >&5)
(eval echo "\"\$as_me:23387: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:23389: \$? = $ac_status" >&5
echo "$as_me:23391: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -23481,11 +23483,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:23484: $lt_compile\"" >&5)
(eval echo "\"\$as_me:23486: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:23488: \$? = $ac_status" >&5
echo "$as_me:23490: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -23533,11 +23535,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:23536: $lt_compile\"" >&5)
(eval echo "\"\$as_me:23538: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:23540: \$? = $ac_status" >&5
echo "$as_me:23542: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -28096,6 +28098,69 @@ _ACEOF
fi
# Check whether --enable-gnu-unique-object or --disable-gnu-unique-object was given.
if test "${enable_gnu_unique_object+set}" = set; then
enableval="$enable_gnu_unique_object"
case $enable_gnu_unique_object in
yes | no) ;;
*) { { echo "$as_me:$LINENO: error: '$enable_gnu_unique_object' is an invalid value for --enable-gnu-unique-object.
Valid choices are 'yes' and 'no'." >&5
echo "$as_me: error: '$enable_gnu_unique_object' is an invalid value for --enable-gnu-unique-object.
Valid choices are 'yes' and 'no'." >&2;}
{ (exit 1); exit 1; }; } ;;
esac
else
echo "$as_me:$LINENO: checking assembler for gnu_unique_object" >&5
echo $ECHO_N "checking assembler for gnu_unique_object... $ECHO_C" >&6
if test "${gcc_cv_as_gnu_unique_object+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
gcc_cv_as_gnu_unique_object=no
if test $in_tree_gas = yes; then
if test $in_tree_gas_is_elf = yes \
&& test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 19 \) \* 1000 + 52`
then gcc_cv_as_gnu_unique_object=yes
fi
elif test x$gcc_cv_as != x; then
echo '.type foo, @gnu_unique_object' > conftest.s
if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }
then
# Also check for ld.so support, i.e. glibc 2.11 or higher.
if test x$host = x$build -a x$host = x$target &&
glibcver=`ldd --version 2>/dev/null`; then
glibcmajor=`expr "$glibcver" : "ldd (GNU libc) \([0-9]*\)"`
glibcminor=`expr "$glibcver" : "ldd (GNU libc) [0-9]*\.\([0-9]*\)"`
glibcnum=`expr $glibcmajor \* 1000 + $glibcminor`
if test "$glibcnum" -ge 2011 ; then
gcc_cv_as_gnu_unique_object=yes
fi
fi
else
echo "configure: failed program was" >&5
cat conftest.s >&5
fi
rm -f conftest.o conftest.s
fi
fi
echo "$as_me:$LINENO: result: $gcc_cv_as_gnu_unique_object" >&5
echo "${ECHO_T}$gcc_cv_as_gnu_unique_object" >&6
if test $gcc_cv_as_gnu_unique_object = yes; then
enable_gnu_unique_object=yes
fi
fi;
if test x$enable_gnu_unique_object = xyes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_GAS_GNU_UNIQUE_OBJECT 1
_ACEOF
fi
echo "$as_me:$LINENO: checking assembler for tolerance to line number 0" >&5
echo $ECHO_N "checking assembler for tolerance to line number 0... $ECHO_C" >&6
if test "${gcc_cv_as_line_zero+set}" = set; then

View File

@ -3379,6 +3379,33 @@ gcc_GAS_CHECK_FEATURE([.lcomm with alignment], gcc_cv_as_lcomm_with_alignment,
[AC_DEFINE(HAVE_GAS_LCOMM_WITH_ALIGNMENT, 1,
[Define if your assembler supports .lcomm with an alignment field.])])
AC_ARG_ENABLE(gnu-unique-object,
[ --enable-gnu-unique-object enable the use of the @gnu_unique_object ELF extension on
glibc systems],
[case $enable_gnu_unique_object in
yes | no) ;;
*) AC_MSG_ERROR(['$enable_gnu_unique_object' is an invalid value for --enable-gnu-unique-object.
Valid choices are 'yes' and 'no'.]) ;;
esac],
[gcc_GAS_CHECK_FEATURE([gnu_unique_object], gcc_cv_as_gnu_unique_object,
[elf,2,19,52],,
[.type foo, @gnu_unique_object],
# Also check for ld.so support, i.e. glibc 2.11 or higher.
[if test x$host = x$build -a x$host = x$target &&
glibcver=`ldd --version 2>/dev/null`; then
glibcmajor=`expr "$glibcver" : "ldd (GNU libc) \([[0-9]]*\)"`
glibcminor=`expr "$glibcver" : "ldd (GNU libc) [[0-9]]*\.\([[0-9]]*\)"`
glibcnum=`expr $glibcmajor \* 1000 + $glibcminor`
if test "$glibcnum" -ge 2011 ; then
gcc_cv_as_gnu_unique_object=yes
fi
fi],
[enable_gnu_unique_object=yes])])
if test x$enable_gnu_unique_object = xyes; then
AC_DEFINE(HAVE_GAS_GNU_UNIQUE_OBJECT, 1,
[Define if your assembler supports @gnu_unique_object.])
fi
AC_CACHE_CHECK([assembler for tolerance to line number 0],
[gcc_cv_as_line_zero],
[gcc_cv_as_line_zero=no

View File

@ -1595,6 +1595,13 @@ option), if the linker supports it. If you specify
support @option{--build-id} option, a warning is issued and the
@option{--enable-linker-build-id} option is ignored. The default is off.
@item --enable-gnu-unique-object
@itemx --disable-gnu-unique-object
Tells GCC to use the gnu_unique_object relocation for C++ template
static data members and inline function local statics. Enabled by
default for a native toolchain with an assembler that accepts it and
GLIBC 2.11 or above, otherwise disabled.
@end table
@subheading Cross-Compiler-Specific Options