From: Ralf Wildenhues Date: Mon, 7 Sep 2009 19:27:08 +0000 (+0200) Subject: Allow dlopen self test to work with gcc's -fvisibility=hidden. X-Git-Tag: v2.2.7b~60 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b03736353b6d478a68bfc19c017605eb21a3edce;p=thirdparty%2Flibtool.git Allow dlopen self test to work with gcc's -fvisibility=hidden. * libltdl/m4/libtool.m4 (_LT_TRY_DLOPEN_SELF): Declare default visibility for the symbol we are going to test dlopen (NULL) when a GCC version is used that understands the visibility attribute, under the assumption that if -fvisibility=hidden will be used, the user code will be sufficiently annotated for visibility of needed symbols from the main executable. * THANKS: Update. Report by Josh Hursey against OpenMPI. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index 26afae704..d3e924fee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2009-09-07 Ralf Wildenhues + Allow dlopen self test to work with gcc's -fvisibility=hidden. + * libltdl/m4/libtool.m4 (_LT_TRY_DLOPEN_SELF): Declare default + visibility for the symbol we are going to test dlopen (NULL) + when a GCC version is used that understands the visibility + attribute, under the assumption that if -fvisibility=hidden + will be used, the user code will be sufficiently annotated + for visibility of needed symbols from the main executable. + * THANKS: Update. + Report by Josh Hursey against OpenMPI. + Fix and split recent testsuite addition for compile/link flags. * tests/flags.at (passing flags through libtool): Split into ... (passing CC flags through libtool) diff --git a/THANKS b/THANKS index 935388598..8baf7f412 100644 --- a/THANKS +++ b/THANKS @@ -110,6 +110,7 @@ John Bowler jbowler@acm.org John R. Cary cary@txcorp.com John Wolfe jlw@sco.com + Josh Hursey jjhursey@open-mpi.org Joseph Beckenbach III jrb3@best.com Lennart Poettering lennart@poettering.net Karl Berry karl@freefriends.org diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index bb1097f2e..662a88b12 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -1651,7 +1651,13 @@ else # endif #endif -void fnord() { int i=42;} +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +void fnord () __attribute__((visibility("default"))); +#endif + +void fnord () { int i=42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); @@ -1660,7 +1666,11 @@ int main () if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } /* dlclose (self); */ } else