Subject: Re: -export-symbols-regex

Re: -export-symbols-regex

From: Gregor Jasny <jasny_at_vidsoft.de>
Date: Tue, 09 Jun 2009 15:52:16 +0200

Yang Tse wrote:
> 2009/6/9, Gregor Jasny wrote:
>
>> Yang Tse wrote:
>>> The -export-symbols-regex libtool option was introduced in libtool in
>>> 1999, now ten years later it certainly still misbehaves on solaris
>>> systems using the solaris linker creating unusable shared libraries.
>> Do you have some pointers to e.g. bug reports?
>
> Nope. i've not bothered to do any bug report archeology related with
> this. But if I wanted to search for something i would look for libtool
> problems related with -export-symbols-regex and/or libtool erroneously
> assuming that the gnu linker is the one being used when actually its
> another one.
>
> The problem has been verified using libcurl autobuilds. When using
> -export-symbols-regex with a sparc-sun-solaris2.10 host building
> shared and static versions of c-ares library, the libraries seemed to
> build successfully but as soon as the shared c-ares library was linked
> with libcurl and curl the result was the following output:
>
> Undefined -- first referenced
> symbol ----- in file
> ares_gethostbyname ../lib/.libs/libcurl.so
> ares_strerror ../lib/.libs/libcurl.so
> ares_process_fd ../lib/.libs/libcurl.so
> ares_cancel ../lib/.libs/libcurl.so
> ares_library_cleanup ../lib/.libs/libcurl.so
> ares_version ../lib/.libs/libcurl.so
> ares_getsock ../lib/.libs/libcurl.so
> ares_destroy ../lib/.libs/libcurl.so
> ares_timeout ../lib/.libs/libcurl.so
> ares_init ../lib/.libs/libcurl.so
> ares_library_init ../lib/.libs/libcurl.so
> ld: fatal: Symbol referencing errors. No output written to .libs/curl
>
> As soon as -export-symbols-regex was commented out from Makefile.am
> the build suceeded without above errors and all curl test suite pass
> ok.
>
> I have no access to this box, so it would be plain wrong for me
> attempting to report this bug, for which I can give no further details
> nor make further tests, to the libtool team.
>
>>> My opinion is to remove now the -export-symbols-regex libtool option
>>> introduced in Makefile.am nearly one month ago and never released.
>>>
>>> And if someone wants to reduce the number of exported sysmbols provide
>>> a patch based on the 'visibility' attribute for GNUC and __global for
>>> Sun compilers, taking in account also Windows DLLs.
>>>
>> How about enabling it conditionally for gnu systems until a visibility patch
>> is available?
>
> Or even better, introduce now a configure script option which enabled
> building with 'hidden-symbols'. When given, this option would now use
> the -export-symbols-regex libtool option if using a gnu linker, and in
> the future would use the 'visibility patch'.
>
> What we can not do is force the -export-symbols-regex libtool option
> on all systems as the default setting.

As I suck at doing m4/autoconf I'll prepare a visibility patch within
the next days for the GCC compiler.

Gregor
Received on 2009-06-09