__dso_handle (Ignore last patch)
Ulrich Drepper
drepper@redhat.com
Tue Apr 4 16:18:00 GMT 2000
Almost everything from the last mail is OK, but the patch isn't. I
was just educated that the visibility rules for symbols are a bit
different than I thought and so using .hidden instead of .protected is
the better solution.
--
---------------. drepper at gnu.org ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2000-04-04 Ulrich Drepper <drepper@cygnus.com>
* acconfig.h: Add HAVE_GAS_HIDDEN.
* config.h: Regenerated.
* configure.in: Add test for .hidden pseudo-op in gas.
* crtstuff.c: Include auto-host.h.
Emit additional .hidden pseudo-op for __dso_handle if the
assembler knows about it.
Index: acconfig.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/acconfig.h,v
retrieving revision 1.43
diff -u -u -r1.43 acconfig.h
--- acconfig.h 2000/03/16 01:58:12 1.43
+++ acconfig.h 2000/04/04 23:12:58
@@ -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
Index: config.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config.in,v
retrieving revision 1.62
diff -u -u -r1.62 config.in
--- config.in 2000/03/16 01:58:13 1.62
+++ config.in 2000/04/04 23:13:00
@@ -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
Index: configure.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/configure.in,v
retrieving revision 1.349
diff -u -u -r1.349 configure.in
--- configure.in 2000/03/30 22:31:36 1.349
+++ configure.in 2000/04/04 23:13:36
@@ -4414,6 +4414,20 @@
fi
AC_MSG_RESULT($gcc_cv_as_weak)
+AC_MSG_CHECKING(assembler hidden support)
+gcc_cv_as_protected=
+if test x$gcc_cv_as != x; then
+ # Check if we have .hidden
+ echo " .hidden symbol" > conftest.s
+ echo "symbol:" >> 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],
Index: crtstuff.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/crtstuff.c,v
retrieving revision 1.26
diff -u -u -r1.26 crtstuff.c
--- crtstuff.c 2000/02/26 05:59:31 1.26
+++ crtstuff.c 2000/04/04 23:13:38
@@ -52,6 +52,7 @@
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 @@
#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_PROTECTED
+asm (".hidden\t__dso_handle");
+#endif
#ifdef CRTSTUFFS_O
void *__dso_handle = &__dso_handle;
More information about the Gcc-patches
mailing list