From 6a9c5260e107891b2f847e453f405d5198206f2e Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 5 Apr 2000 07:34:36 +0000 Subject: [PATCH] acconfig.h: Add HAVE_GAS_HIDDEN. * acconfig.h: Add HAVE_GAS_HIDDEN. * config.h: Regenerated. * configure.in: Add test for .hidden pseudo-op in gas. * configure: Regenerated. * crtstuff.c: Include auto-host.h. Emit additional .hidden pseudo-op for __dso_handle if the assembler knows about it. From-SVN: r32925 --- gcc/acconfig.h | 3 +++ gcc/config.in | 3 +++ gcc/configure | 26 ++++++++++++++++++++++---- gcc/configure.in | 14 ++++++++++++++ gcc/crtstuff.c | 13 ++++++++++++- 5 files changed, 54 insertions(+), 5 deletions(-) diff --git a/gcc/acconfig.h b/gcc/acconfig.h index b0a44d00aca..2d0457b6c8b 100644 --- a/gcc/acconfig.h +++ b/gcc/acconfig.h @@ -72,6 +72,9 @@ /* Define if your assembler supports .weak. */ #undef HAVE_GAS_WEAK +/* Define if your assembler supports .hidden. */ +#undef HAVE_GAS_HIDDEN + /* Define if your assembler uses the old HImode fild and fist notation. */ #undef HAVE_GAS_FILDS_FISTS diff --git a/gcc/config.in b/gcc/config.in index 879360b882f..600e76bc86b 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -73,6 +73,9 @@ /* Define if your assembler supports .weak. */ #undef HAVE_GAS_WEAK +/* Define if your assembler supports .hidden. */ +#undef HAVE_GAS_HIDDEN + /* Define if your assembler uses the old HImode fild and fist notation. */ #undef HAVE_GAS_FILDS_FISTS diff --git a/gcc/configure b/gcc/configure index 0a9d6d28480..bdbf29af864 100755 --- a/gcc/configure +++ b/gcc/configure @@ -8834,10 +8834,28 @@ EOF fi echo "$ac_t""$gcc_cv_as_weak" 1>&6 +echo $ac_n "checking assembler hidden support""... $ac_c" 1>&6 +echo "configure:8839: checking assembler hidden support" >&5 +gcc_cv_as_hidden= +if test x$gcc_cv_as != x; then + # Check if we have .hidden + echo " .hidden foobar" > conftest.s + echo "foobar:" >> conftest.s + if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then + cat >> confdefs.h <<\EOF +#define HAVE_GAS_HIDDEN 1 +EOF + + gcc_cv_as_hidden="yes" + fi + rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 +fi +echo "$ac_t""$gcc_cv_as_hidden" 1>&6 + case "$target" in sparc*-*-*) echo $ac_n "checking assembler .register pseudo-op support""... $ac_c" 1>&6 -echo "configure:8841: checking assembler .register pseudo-op support" >&5 +echo "configure:8859: checking assembler .register pseudo-op support" >&5 if eval "test \"`echo '$''{'gcc_cv_as_register_pseudo_op'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8867,7 +8885,7 @@ EOF case "$tm_file" in *64*) echo $ac_n "checking for 64 bit support in assembler ($gcc_cv_as)""... $ac_c" 1>&6 -echo "configure:8871: checking for 64 bit support in assembler ($gcc_cv_as)" >&5 +echo "configure:8889: checking for 64 bit support in assembler ($gcc_cv_as)" >&5 if eval "test \"`echo '$''{'gcc_cv_as_flags64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8912,7 +8930,7 @@ EOF if test "x$gcc_cv_as_flags64" != xno; then echo $ac_n "checking for assembler offsetable %lo() support""... $ac_c" 1>&6 -echo "configure:8916: checking for assembler offsetable %lo() support" >&5 +echo "configure:8934: checking for assembler offsetable %lo() support" >&5 if eval "test \"`echo '$''{'gcc_cv_as_offsetable_lo10'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8951,7 +8969,7 @@ EOF i[34567]86-*-*) echo $ac_n "checking assembler instructions""... $ac_c" 1>&6 -echo "configure:8955: checking assembler instructions" >&5 +echo "configure:8973: checking assembler instructions" >&5 gcc_cv_as_instructions= if test x$gcc_cv_as != x; then set "filds fists" "filds mem; fists mem" diff --git a/gcc/configure.in b/gcc/configure.in index 3005071abe2..734f4cae22e 100644 --- a/gcc/configure.in +++ b/gcc/configure.in @@ -4382,6 +4382,20 @@ if test x$gcc_cv_as != x; then fi AC_MSG_RESULT($gcc_cv_as_weak) +AC_MSG_CHECKING(assembler hidden support) +gcc_cv_as_hidden= +if test x$gcc_cv_as != x; then + # Check if we have .hidden + echo " .hidden foobar" > conftest.s + echo "foobar:" >> conftest.s + if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then + AC_DEFINE(HAVE_GAS_HIDDEN) + gcc_cv_as_hidden="yes" + fi + rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 +fi +AC_MSG_RESULT($gcc_cv_as_hidden) + case "$target" in sparc*-*-*) AC_CACHE_CHECK([assembler .register pseudo-op support], diff --git a/gcc/crtstuff.c b/gcc/crtstuff.c index 1619e65d55c..c4a437a28ef 100644 --- a/gcc/crtstuff.c +++ b/gcc/crtstuff.c @@ -52,6 +52,7 @@ Boston, MA 02111-1307, USA. */ compiled for the target, and hence definitions concerning only the host do not apply. */ +#include "auto-host.h" #include "tm.h" #include "tsystem.h" @@ -132,7 +133,17 @@ typedef void (*func_ptr) (void); #ifdef OBJECT_FORMAT_ELF /* Declare the __dso_handle variable. It should have a unique value - in every shared-object; in a main program its value is zero. */ + in every shared-object; in a main program its value is zero. The + object should in any case be protected. This means the instance + in one DSO or the main program is not used in another object. The + dynamic linker takes care of this. */ + +/* XXX Ideally the following should be implemented using + __attribute__ ((__visibility__ ("hidden"))) + but the __attribute__ support is not yet there. */ +#ifdef HAVE_GAS_HIDDEN +asm (".hidden\t__dso_handle"); +#endif #ifdef CRTSTUFFS_O void *__dso_handle = &__dso_handle;