This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC 3.0 and GLIBC don't work together
On Wed, Jun 13, 2001 at 10:08:47AM +0200, Paolo Carlini wrote:
> Hi again...
>
> a short follow-up to my previous message. Eventually I found that message by Drepper which
> is troubling me (in libc-hacker):
>
> http://sources.redhat.com/ml/libc-hacker/2001-03/msg00033.html
>
> The problem is still there or not????
It is.
You'd have patch gcc-2.95.3 to add __dso_handle and configure test for
HAVE_GAS_HIDDEN (plus the atexit patch).
Something like below (untested, plus you need to rebuild configure).
Alternatively, gcc-2.96-RH will build glibc just fine, so will gcc-3.0
snapshots before new unwind code was added, provided you build glibc with
-static-libgcc.
--- gcc-2.95.x/config/alpha/crtbegin.asm.jj Wed Dec 16 22:00:53 1998
+++ gcc-2.95.x/config/alpha/crtbegin.asm Wed Jun 13 12:41:28 2001
@@ -97,6 +97,31 @@ __EH_FRAME_BEGIN__:
# Support recursive calls to exit.
$ptr: .quad __DTOR_LIST__
+/* A globally unique widget for c++ local destructors to hang off.
+
+ This has a unique value in every dso; in the main program its
+ value is zero. The object should be protected. This means the
+ instance in any dso or the main program is not used in any other
+ dso. The dynamic linker takes care of this. */
+
+ .global __dso_handle
+ .type __dso_handle,@object
+ .size __dso_handle,8
+#ifdef SHARED
+.section .data
+ .align 3
+__dso_handle:
+ .quad __dso_handle
+#else
+.section .bss
+ .align 3
+__dso_handle:
+ .zero 8
+#endif
+#ifdef HAVE_GAS_HIDDEN
+ .hidden __dso_handle
+#endif
+
.text
.align 3
--- gcc-2.95.x/crtstuff.c.jj Tue Mar 23 01:43:51 1999
+++ gcc-2.95.x/crtstuff.c Wed Jun 13 12:39:14 2001
@@ -135,6 +135,25 @@ 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. 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;
+#else
+void *__dso_handle = 0;
+#endif
+
/* Run all the global destructors on exit from the program. */
/* Some systems place the number of pointers in the first word of the
--- gcc-2.95.x/configure.in.jj Wed Oct 13 09:58:02 1999
+++ gcc-2.95.x/configure.in Wed Jun 13 12:44:34 2001
@@ -4053,6 +4053,21 @@ EOF
fi
AC_MSG_RESULT($gcc_cv_as_subsections)
+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, 1,
+ [Define if your assembler supports .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)
+
AC_MSG_CHECKING(assembler instructions)
gcc_cv_as_instructions=
if test x$gcc_cv_as != x; then
--- gcc-2.95.x/config.in.jj Mon Oct 25 10:02:08 1999
+++ gcc-2.95.x/config.in Wed Jun 13 12:45:56 2001
@@ -34,6 +34,9 @@
emitting at the beginning of your section */
#undef HAVE_GAS_SUBSECTION_ORDERING
+/* 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
Jakub