From 8fa719e81dba828d3e22cd59f825fac456c20809 Mon Sep 17 00:00:00 2001 From: Michael Haubenwallner Date: Sat, 29 Nov 2014 15:05:05 +0000 Subject: libtool: optional filename-based shlib versioning on aix. Support filename-based shared library versioning on AIX with the lib.so library filename extension, which is used with runtime linking only. Runtime linking is enabled by the -brtl linker flag for executables and the -G linker flag for Shared Objects. The behaviour is similar to Linux/SVR4 DT_SONAME, hence the name "aix-soname=svr4". * Makefile.am (TESTS_ENVIRONMENT): Pass with_aix_soname value via lt_cv_with_aix_soname into testsuite. * configure.ac: AC_SUBST with_aix_soname for testsuite. * libltdl/loaders/dlopen.c (vm_open): Use RTLD_MEMBER flag for dlopen when the filename does specify an archive member between "()". Otherways, retry with appending LT_SHARED_LIB_MEMBER when loading fails without but archive file seems to exist. * m4/libtool.m4 (dynamic_linker): Describe configured shared library versioning variant according to with_aix_soname and runtime linking. (soname_spec, library_names_spec, shlibpath_overrides_runpath) (postinstall_cmds, postuninstall_cmds, hardcode_direct) (hardcode_direct_absolute, no_undefined_flag) (allow_undefined_flag): Set according to with_aix_soname and runtime linking configuration. (export_symbols_cmds): Decorate symbols with the weak keyword. (archive_expsym_cmds): Create both shared libraries according to with_aix_soname and runtime linking configuration. Filter -brtl linker flag from compiler_flags for shared libraries due to its side effects. (enable_static): Respect with_aix_soname for disabling as well. * m4/ltdl.m4 (LT_SHARED_LIB_MEMBER): Define, set based on the value of the shared_archive_member_spec libtool variable. * m4/ltoptions.m4 (_LT_WITH_AIX_SONAME): New. Provides commandline option --with-aix-soname=aix|svr4|both. Declares $shared_archive_member_spec as libtool variable. (_LT_SET_OPTIONS): Define LT_INIT options "aix-soname=aix", "aix-soname=svr4", "aix-soname=both". Default is "aix-soname=aix". * doc/libtool.texi (LT_INIT): Document new options. * tests/deplibs-ident.at: To define whether this test should XFAIL, use hardcode_action, hardcode_direct, hardcode_direct_absolute configuration settings instead of platforms aix, bitrig, hppa-hpux, interix or openbsd. * tests/versioning.at: When shared_archive_member_spec is defined and LDFLAGS contain -brtl, we can run the versioning check. * NEWS: Update. Signed-off-by: Gary V. Vaughan --- tests/deplibs-ident.at | 11 +++++++---- tests/versioning.at | 14 ++++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/deplibs-ident.at b/tests/deplibs-ident.at index 9c5e823d..172885f4 100644 --- a/tests/deplibs-ident.at +++ b/tests/deplibs-ident.at @@ -67,10 +67,13 @@ int main() { return a1() + a2() + a3() + c(); } AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o b$EXEEXT b.$OBJEXT ../liba1.la ../liba2.la ../liba3.la ../../c/libcee.la -rpath /nowhere], [0],[stdout],[ignore]) AT_CHECK([$EGREP 'cee.*cee' stdout], 1, [ignore], [ignore]) - AT_XFAIL_IF([case $host in - *-*-aix*|*-*-bitrig*|hppa*-*-hpux*|*-*-interix*|*-*-openbsd*) false;; - *):;; - esac]) + AT_XFAIL_IF([dnl + eval `$LIBTOOL --config | $EGREP '^hardcode_(direct|direct_absolute|action)='` + case $hardcode_action,$hardcode_direct,$hardcode_direct_absolute in + relink,yes,no) :;; + *,no,*) :;; + *) false;; + esac]) dnl This is currently broken in libtool ) diff --git a/tests/versioning.at b/tests/versioning.at index dac032ca..629cb7f4 100644 --- a/tests/versioning.at +++ b/tests/versioning.at @@ -24,7 +24,7 @@ AT_SETUP([versioning]) AT_KEYWORDS([libtool]) -eval "`$LIBTOOL --config | $EGREP '^(objdir|host_os)='`" +eval "`$LIBTOOL --config | $EGREP '^(objdir|host_os|shared_archive_member_spec)='`" # Setup some library and program sources: # a library (a1), a new revision (a2), a compatible update (a3), @@ -228,9 +228,15 @@ AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba4.lo ]dnl AT_CHECK([$LIBTOOL --mode=install cp liba.la $libdir], [], [ignore], [ignore]) AT_CHECK([$LIBTOOL --mode=clean rm -f liba.la], [], [ignore], [ignore]) -# This test does not work on AIX, not even with runtimelinking, because -# the linker always records the unversioned name as dependency. -AT_CHECK([:; case $host_os in aix*) exit 77;; esac]) +# On AIX, this test only works when the 'aix-soname' feature is enabled and +# active, which is reflected in shared_archive_member_spec being set and LDFLAGS +# containing -brtl. Otherwise, even with runtime linking, the linker always +# records the unversioned name as dependency. +AT_CHECK([:; case $host_os,$shared_archive_member_spec,$LDFLAGS in +aix*,,*) exit 77 ;; +aix*,*,*-brtl*) ;; +aix*,*) exit 77 ;; +esac]) test_installed -- cgit v1.2.1