[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
12-gary-solaris-no-undefined.patch [Was Re: 5-gary-solaris-no-undefined.
From: |
Gary V. Vaughan |
Subject: |
12-gary-solaris-no-undefined.patch [Was Re: 5-gary-solaris-no-undefined.patch] |
Date: |
Mon, 10 Sep 2001 00:35:46 +0100 |
User-agent: |
Mutt/1.3.21i |
On Sun, Sep 09, 2001 at 01:39:34PM -0500, address@hidden wrote:
> On Sun, Sep 09, 2001 at 12:41:48PM -0500, address@hidden wrote:
> > My results:
> > 1. GCC 2.95.3 without binutils on Solaris 8/SPARC fails (1.4.1)
> > 2. GCC 3.0.1 without binutils on Solaris 8/SPARC succeeds (1.4.1)
> >
> > 3. GCC 2.95.3 with binutils on Solaris 2.6/SPARC succeeds (1.4.1)
> >
> > 4. GCC 2.95.3 without binutils on Solaris 8/SPARC succeeds (1.3.5)
> >
> > Because of #4, I say we reject the patch and find out why 1.3.5
> > succeeded.
>
> Further research:
> (from gcc/libgcc2.c in GCC 2.95.3)
> /* This is used by the `assert' macro. */
> extern void __eprintf (const char *, const char *, unsigned int, const
> char *)
> __attribute__ ((__noreturn__));
>
> (from gcc/libgcc2.c in GCC 3.0)
> /* __eprintf used to be used by GCC's private version of <assert.h>.
> We no longer provide that header, but this routine remains in libgcc.a
> for binary backward compatibility. Note that it is not included in
> the shared version of libgcc. */
>
> I looked at libltdl/ltdl.c in 1.3.5 and it makes *no* calls to assert.
> However, the libltdl/ltdl.c in 1.4.1 does. Remove the assert calls in
> 1.4.1 and we don't have problems :)
>
> Even if an assert() is added to ltdl.c from 1.3.5, you'll never get an
> error because "-z defs" is not used the build the shared library. I
> inserted an assert() in 1.3.5 and had the same error as with 1.4.1.
> So, it seems the "ugly hack" is needed only when GCC < 3.0 is used and
> GCC has been compiled *without* binutils. Can you incorporate this
> into your patch so the ugliness is localized?
>
> BTW, have you tried using GCC to created the shared library? I did a
> quick test with 2.95.3 for 1.4.1:
> $ gcc -shared -Wl,-h,libltdl.so.3 -o .libs/libltdl.so.3.0.0 ltdl.lo -ldl -lc
> $ nm .libs/libltdl.so.3.0.0 | grep eprintf
> [242] | 27140| 72|FUNC |GLOB |0 |10 |__eprintf
> If gcc creating the shared library works, I say use it instead of
> Solaris ld (barring any problem).
According to comments in libtool.m4:
# $CC -shared without GNU ld will not create a library from C++
# object files and a static libstdc++, better avoid it by now
I'm proposing the following patch (pending tests), which takes a
slightly different tack. I'll test it tomorrow, and release it as
part of 1.4.2 if it works.
Cheers,
Gary.
Index: ChangeLog
from Gary V. Vaughan <address@hidden>, Albert Chin <address@hidden>, Tim Van
Holder <address@hidden>
* libtool.m4 (no_undefined_flag) [solaris*}: Set this flag to
unsupported for GCC < 3.0 without binutils.
Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.166.2.23
diff -u -p -u -r1.166.2.23 libtool.m4
--- libtool.m4 2001/09/09 17:20:33 1.166.2.23
+++ libtool.m4 2001/09/09 23:26:29
@@ -1707,7 +1707,33 @@ else
;;
solaris*)
- no_undefined_flag=' -z text'
+ # gcc --version < 3.0 without binutils cannot create self contained
+ # shared libraries reliably, requiring libgcc.a to resolve some of
+ # the object symbols generated in some cases. Libraries that use
+ # assert need libgcc.a to resolve __eprintf, for example. Linking
+ # a copy of libgcc.a into every shared library to guarantee resolving
+ # such symbols causes other problems: According to Tim Van Holder
+ # <address@hidden>, C++ libraries end up with a separate
+ # exception stack for one thing.
+ if test "$GCC" = yes; then
+ case `$CC --version 2>/dev/null` in
+ [12].*)
+ no_undefined_flag=unsupported
+ cat <<EOF 1>&2
+
+*** Warning: Releases of GCC earlier than version 3.0 cannot reliably
+*** create self contained shared libraries on Solaris systems. Therefore,
+*** libtool is disabling the -no-undefined support. We urge you to upgrade
+*** to a newer version of GCC. Another option is to rebuild your current
+*** GCC to use the GNU linker from GNU binutils 2.9.1 or newer.
+
+EOF
+ ;;
+ *)
+ no_undefined_flag=' -z defs'
+ ;;
+ esac
+ fi
# $CC -shared without GNU ld will not create a library from C++
# object files and a static libstdc++, better avoid it by now
archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs
$deplibs $linker_flags'
--
())_. Gary V. Vaughan gary@(oranda.demon.co.uk|gnu.org)
( '/ Research Scientist http://www.oranda.demon.co.uk ,_())____
/ )= GNU Hacker http://www.gnu.org/software/libtool \' `&
`(_~)_ Tech' Author http://sources.redhat.com/autobook =`---d__/