diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 7b11e96..93a9be5 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -515,6 +515,27 @@ func_ltwrapper_p () func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } +# func_dlname_to_filename dlname +# Extracts the real filename out of dlname. +# This is necessary for AIX, where dlname might be 'filename(soname)'. +func_dlname_to_filename () +{ + if test -n "$dlname_spec" ; then + save_ifs=$IFS; IFS='()'; set dummy $1; shift; IFS=$save_ifs + fi + func_dlname_to_filename_result=$1 +} + +# func_dlname_to_soname dlname +# Extracts the soname out of 'dlname', see func_dlname_to_filename(). +func_dlname_to_soname () +{ + if test -n "$dlname_spec" ; then + save_ifs=$IFS; IFS='()'; set dummy $1; shift; IFS=$save_ifs + test "$#" -lt 1 || shift + fi + func_dlname_to_soname_result=$1 +} # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. @@ -1250,11 +1271,12 @@ func_mode_execute () func_dirname "$file" "" "." dir="$func_dirname_result" - if test -f "$dir/$objdir/$dlname"; then + func_dlname_to_filename "$dlname" + if test -f "$dir/$objdir/$func_dlname_to_filename_result"; then dir="$dir/$objdir" else - if test ! -f "$dir/$dlname"; then - func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" + if test ! -f "$dir/$func_dlname_to_filename_result"; then + func_fatal_error "cannot find \`$func_dlname_to_filename_result' in \`$dir' or \`$dir/$objdir'" fi fi ;; @@ -3823,8 +3845,10 @@ func_mode_link () fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static + prefer_static_libs=all + else + prefer_static_libs=yes fi - prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then @@ -5150,7 +5174,8 @@ func_mode_link () dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" + func_dlname_to_filename "$dlname" + newdlprefiles="$newdlprefiles $dir/$func_dlname_to_filename_result" else newdlprefiles="$newdlprefiles $dir/$linklib" fi @@ -5325,7 +5350,8 @@ func_mode_link () libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then - soname="$dlname" + func_dlname_to_soname "$dlname" + soname="$func_dlname_to_soname_result" elif test -n "$soname_spec"; then # bleh windows case $host in @@ -5447,7 +5473,17 @@ func_mode_link () fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + # AIX can link 'shared objects' statically: + test "$use_static_libs" != no && + test "$use_static_libs" != all && + test -n "$link_shared_as_static_flag" && + eval compile_deplibs=\"$link_shared_as_static_flag \$compile_deplibs\" test -n "$add" && compile_deplibs="$add $compile_deplibs" + # switch back to link 'shared objects' dynamically: + test "$use_static_libs" != no && + test "$use_static_libs" != all && + test -n "$link_shared_as_shared_flag" && + eval compile_deplibs=\"$link_shared_as_shared_flag \$compile_deplibs\" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" @@ -5502,10 +5538,30 @@ func_mode_link () if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + # AIX can link 'shared objects' statically: + test "$use_static_libs" != no && + test "$use_static_libs" != all && + test -n "$link_shared_as_static_flag" && + eval finalize_deplibs=\"$link_shared_as_static_flag \$finalize_deplibs\" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + # switch back to link 'shared objects' dynamically: + test "$use_static_libs" != no && + test "$use_static_libs" != all && + test -n "$link_shared_as_shared_flag" && + eval finalize_deplibs=\"$link_shared_as_shared_flag \$finalize_deplibs\" else test -n "$add_dir" && deplibs="$add_dir $deplibs" + # AIX can link 'shared objects' statically: + test "$use_static_libs" != no && + test "$use_static_libs" != all && + test -n "$link_shared_as_static_flag" && + eval deplibs=\"$link_shared_as_static_flag \$deplibs\" test -n "$add" && deplibs="$add $deplibs" + # switch back to link 'shared objects' dynamically: + test "$use_static_libs" != no && + test "$use_static_libs" != all && + test -n "$link_shared_as_shared_flag" && + eval deplibs=\"$link_shared_as_shared_flag \$deplibs\" fi fi elif test "$linkmode" = prog; then @@ -5561,6 +5617,7 @@ func_mode_link () if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || + test -n "$link_shared_as_static_flag" || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= @@ -6151,7 +6208,8 @@ func_mode_link () *) finalize_rpath="$finalize_rpath $libdir" ;; esac done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || + test -n "$link_shared_as_static_flag"; then dependency_libs="$temp_xrpath $dependency_libs" fi fi @@ -6655,7 +6713,11 @@ EOF soname="$realname" fi if test -z "$dlname"; then - dlname=$soname + if test -n "$dlname_spec"; then + eval dlname=\"$dlname_spec\" + else + dlname=$soname + fi fi lib="$output_objdir/$realname" @@ -7077,8 +7139,11 @@ EOF # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" + if test -n "$dlname_spec"; then + eval dlname=\"$dlname_spec\" + else + dlname=$soname + fi fi fi ;; @@ -7954,10 +8019,11 @@ func_mode_uninstall () case "$mode" in clean) + func_dlname_to_filename "$dlname" case " $library_names " in # " " in the beginning catches empty $dlname - *" $dlname "*) ;; - *) rmfiles="$rmfiles $objdir/$dlname" ;; + *" $func_dlname_to_filename_result "*) ;; + *) rmfiles="$rmfiles $objdir/$func_dlname_to_filename_result" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; diff --git a/libltdl/loaders/dlopen.c b/libltdl/loaders/dlopen.c index 1d052b4..2f25442 100644 --- a/libltdl/loaders/dlopen.c +++ b/libltdl/loaders/dlopen.c @@ -169,6 +169,11 @@ vm_open (lt_user_data LT__UNUSED loader_data, const char *filename, int module_flags = LT_LAZY_OR_NOW; lt_module module; +#ifdef RTLD_MEMBER + if (filename && strchr(filename, '(') && strchr(filename, ')')) + module_flags |= RTLD_MEMBER; +#endif + if (advise) { #ifdef RTLD_GLOBAL diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index 35d7d5c..cdc8c93 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -196,6 +196,54 @@ aix3*) export COLLECT_NAMES fi ;; +aix[[4-9]]*) + if test "$host_cpu" != ia64; then + # The libtool default is to use runtime linking, which is available + # since AIX 4.2, but disabled by default on Power*. + # We need to add '-brtl' to LDFLAGS early for correct link-check results + # if we are allowed to and user did not do herself. + AC_MSG_CHECKING([how to enable AIX runtime linking]) + case $host_os in + aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + # The last one found in LDFLAGS fires and overrides libtool-default. + aix_use_runtimelinking=yes + aix_runtimelinking_flag_set=no + as_save_IFS=$IFS + IFS=' ,' + for ld_flag in $LDFLAGS; do + IFS=$as_save_IFS + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + aix_runtimelinking_flag_set=yes + ;; + *-bnortl*) + aix_use_runtimelinking=no + aix_runtimelinking_flag_set=yes + ;; + esac + done + IFS=$as_save_IFS + case "$aix_use_runtimelinking:$aix_runtimelinking_flag_set" in + yes:no) + LDFLAGS="-Wl,-brtl ${LDFLAGS}" + export LDFLAGS + AC_MSG_RESULT([adding -Wl,-brtl to LDFLAGS]) + ;; + yes:yes) + AC_MSG_RESULT([present]) + ;; + no:*) + AC_MSG_RESULT([not wanted]) + ;; + esac + ;; + *) + aix_use_runtimelinking=no + AC_MSG_RESULT([not available]) + ;; + esac + fi esac # Global variables: @@ -2066,20 +2114,24 @@ aix[[4-9]]*) fi ;; esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi + # Although standalone shared objects (libname.so) are supported since + # AIX4.2, the only way to get some 'soname' support (on Power*) is to + # store the shared object into an archive library. + # By default, we create 'libname.so' as an archive library if we need + # 'soname', or keep 'libname.so' as standalone shared object if not. + # Additionally, 'libname.a' archive is created with static objects only. + # When we have '-no-undefined' symbols, either from cmdline or because + # of runtime-linking disabled (with '${wl}-bnortl' in LDFLAGS), we create + # 'libname.a' archive library containing the shared object only, even + # with no 'soname' versioning, and omit 'libname.so', as 'no-undefined' + # shared objects also work when linked with runtime-linking disabled. + # This ensures to not find a shared object with potentially undefined + # symbols in subsequent link steps when they disable runtime-linking. + # Also, libltdl knows how to load shared archive members now: by using + # RTLD_MEMBER flag and 'libname.a(libname.so.1)' as filename with dlopen(). + library_names_spec='`test "x$allow_undefined" = "xyes" && echo "${libname}${release}.so ${libname}.so" || echo "${libname}${release}.a ${libname}.a"`' + soname_spec='${libname}${release}.so${major}' + dlname_spec='`case "${soname}:${allow_undefined}" in "${libname}${release}.so:yes") echo "${soname}";; *":yes") echo "${libname}${release}.so(${soname})";; *) echo "${libname}${release}.a(${soname})";; esac`' shlibpath_var=LIBPATH fi ;; @@ -2628,6 +2680,8 @@ _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) +_LT_DECL([], [dlname_spec], [1], + [[The loadable name of the library, if different from the soname, as on AIX]]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], @@ -3459,6 +3513,8 @@ m4_defun([_LT_COMPILER_PIC], _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= +_LT_TAGVAR(lt_prog_compiler_shared_as_static, $1)= +_LT_TAGVAR(lt_prog_compiler_shared_as_shared, $1)= AC_MSG_CHECKING([for $compiler option to produce PIC]) m4_if([$1], [CXX], [ @@ -3473,6 +3529,9 @@ m4_if([$1], [CXX], [ if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_shared_as_static, $1)='${wl}-bstatic' + _LT_TAGVAR(lt_prog_compiler_shared_as_shared, $1)='${wl}-bdynamic' fi ;; @@ -3550,6 +3609,8 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + _LT_TAGVAR(lt_prog_compiler_shared_as_static, $1)='-bstatic' + _LT_TAGVAR(lt_prog_compiler_shared_as_shared, $1)='-bdynamic' fi ;; chorus*) @@ -3779,6 +3840,9 @@ m4_if([$1], [CXX], [ if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_shared_as_static, $1)='${wl}-bstatic' + _LT_TAGVAR(lt_prog_compiler_shared_as_shared, $1)='${wl}-bdynamic' fi ;; @@ -3868,6 +3932,8 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + _LT_TAGVAR(lt_prog_compiler_shared_as_static, $1)='-bstatic' + _LT_TAGVAR(lt_prog_compiler_shared_as_shared, $1)='-bdynamic' fi ;; @@ -4072,6 +4138,10 @@ _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) +_LT_TAGDECL([link_shared_as_static_flag], [lt_prog_compiler_shared_as_static], [1], + [Compiler flag to link subsequent shared objects statically - AIX can do that]) +_LT_TAGDECL([link_shared_as_shared_flag], [lt_prog_compiler_shared_as_shared], [1], + [Compiler flag to link subsequent shared objects dynamically]) ])# _LT_COMPILER_PIC @@ -4457,7 +4527,6 @@ _LT_EOF if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. - aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else @@ -4468,20 +4537,19 @@ _LT_EOF else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac + + if test "$aix_use_runtimelinking" = no; then + # In case we do not have runtime-linking, we cannot allow undefined + # symbols with '-berok', as this would produce broken shared objects. + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + else + # In case we have runtime-linking enabled, we create shared objects + # with '-G', which enables both '-brtl' and '-berok' among others. + # Any executable linking against any shared object with undefined + # symbols needs to be linked with '-brtl', to allow them being + # resolved at runtime. + _LT_TAGVAR(prelink_cmds, $1)='func_append compile_command " ${wl}-brtl"~func_append finalize_command " ${wl}-brtl"' + fi exp_sym_flag='-bexport' no_entry_flag='-bnoentry' @@ -4545,35 +4613,88 @@ _LT_EOF # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # REMEMBER1: libtool's default is to enable runtime-linking. + # REMEMBER2: libtool's default is to allow undefined symbols. + # We could create 'libname.so' as 'standalone import file' containing + # the loadable name along the list of exported symbols to enforce + # autoloading of this shared object, either as standalone shared object + # or as shared archive member - which seems like the easiest way to + # implement the 'soname' feature on AIX. + # But then we are unable to inform the linker of undefined symbols + # in that shared object any more. + # + # So we put the shared object into an archive library - libltdl can + # dynamically load that now too - to get the 'soname' support. + # This is similar to how AIX traditionally builds its shared libraries. + # + # See also comments around 'dlname_spec' definition for AIX. + # + # To have runtime-linking enabled in subsequent link steps with libtool, + # '-brtl' is added to the 'inherited_linker_flags' libtool variable. + # + # A shared object as part of an archive library is recorded into the + # resulting executable as to-be-loaded _only_ when there are direct + # symbol references from statically linked objects, as long as the + # referencing symbols are not garbage-collected too. + # With runtime-linking, only standalone shared objects are recorded + # into the executable as to-be-loaded, even when not referenced. + # This breaks situations where one shared object has undefined + # symbols which are defined in other shared objects being an archive + # member and not referenced otherways - this IMO is an AIX linker bug + # (seen on AIX 5.3, can't say for others). + # So we tell the linker to prevent all undefined symbols in + # this shared object from being garbage-collected, using + # 'inherited_linker_flags' libtool variable again. + # + # Create the shared object with 'soname' as filename: + # We add -bnortllib after $compiler_flags, because we might have + # inherited -brtl from $LDFLAGS or $inherited_linker_flags, which + # re-enables rtllib, even when disabled within -G before. + # We don't put -G at the end, because the user might want to + # override -bnosymbolic or -bnoautoexp. + # From ld(1) man page: + # The -G flag is equivalent to specifying the erok, rtl, nortllib, + # nosymbolic, noautoexp, and M:SRE options with the -b flag. + # Subsequent options can override these options. + # + cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bnortllib ${wl}-bE:${export_symbols}${allow_undefined_flag}' + # + # In case of undefined symbols, enforce '-brtl' for subsequent linking: + # + cmds="${cmds}"'~test "x${allow_undefined}" = "xno" || func_append new_inherited_linker_flags " \${wl}-brtl"' + # + # Explicitly inform subsequent link steps of undefined symbols: + # + cmds="${cmds}"'~test "x${allow_undefined}" = "xno" || undefs=`dump -Tv ${output_objdir}/${soname} | $SED -n '"'"'s/.* EXTref *\.\. *\([[^ ]]*\) *$/ \${wl}-u\1/p'"'"' | \$NL2SP`' + cmds="${cmds}"'~test -z "${undefs}" || func_append new_inherited_linker_flags "`echo '"' '"'${undefs}`"' + # + # Reuse the decision from 'dlname_spec': + # whether to keep 'libname.so' as standalone shared object, + # or to create 'libname.so' as archive library, + # or to create 'libname.a' as archive library. + # + cmds="${cmds}"'~func_dlname_to_filename "${dlname}"' + cmds="${cmds}"'~test "x${func_dlname_to_filename_result}" = "x${soname}" || $AR $AR_FLAGS ${output_objdir}/${func_dlname_to_filename_result} ${output_objdir}/${soname}' + cmds="${cmds}"'~test "x${func_dlname_to_filename_result}" = "x${soname}" || $RM ${output_objdir}/${soname}' + # + # When creating/keeping 'libname.so', still create the old 'libname.a': + # + cmds="${cmds}"'~case "${func_dlname_to_filename_result}" in *".a") ;; *) build_old_libs=yes; func_append oldlibs " $output_objdir/$libname.a";; esac' + _LT_TAGVAR(archive_expsym_cmds, $1)=${cmds} fi ;; @@ -5221,7 +5342,7 @@ if test -n "$compiler"; then ;; aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + if test "$host_cpu" != ia64 ; then test "$enable_shared" = yes && enable_static=no fi ;; @@ -5414,26 +5535,21 @@ if test "$_lt_caught_CXX_error" != yes; then if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. - aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - ;; - esac + if test "$aix_use_runtimelinking" = no; then + # In case we do not have runtime-linking, we cannot allow undefined + # symbols with '-berok', as this would produce broken shared objects. + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + else + # In case we have runtime-linking enabled, we create shared objects + # with '-G', which enables both '-brtl' and '-berok' among others. + # Any executable linking against any shared object with undefined + # symbols needs to be linked with '-brtl', to allow them being + # resolved at runtime. + _LT_TAGVAR(prelink_cmds, $1)='func_append compile_command " ${wl}-brtl"~func_append finalize_command " ${wl}-brtl"' + fi exp_sym_flag='-bexport' no_entry_flag='-bnoentry' @@ -5497,38 +5613,20 @@ if test "$_lt_caught_CXX_error" != yes; then # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty - # executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared - # libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi + + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + _LT_SYS_MODULE_PATH_AIX + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # same for CXX as for CC, even when mixing gcc/xlC or xlc/g++ + _LT_TAGVAR(archive_expsym_cmds, $1)=${archive_expsym_cmds} + fi ;; beos*) @@ -6593,7 +6691,7 @@ if test "$_lt_disable_F77" != yes; then fi ;; aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + if test "$host_cpu" != ia64 ; then test "$enable_shared" = yes && enable_static=no fi ;; @@ -6738,7 +6836,7 @@ if test "$_lt_disable_FC" != yes; then fi ;; aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + if test "$host_cpu" != ia64 ; then test "$enable_shared" = yes && enable_static=no fi ;; diff --git a/tests/lt_dladvise.at b/tests/lt_dladvise.at index b76746c..51d86b9 100644 --- a/tests/lt_dladvise.at +++ b/tests/lt_dladvise.at @@ -318,8 +318,9 @@ dlpreloadable='preload' # are reporting not able to accept the global hint to lt_dlopenadvise(). # # ------------------------------------------------------------------------- # -case $host_os in -cygwin* | mingw* | cegcc*) +eval `$LIBTOOL --config | grep '^allow_undefined_flag=` +case $host_os:$allow_undefined_flag in +cygwin* | mingw* | cegcc* | *:unsupported) # These hosts do not support linking without -no-undefined CPPFLAGS="$CPPFLAGS -DHAVE_UNDEFINED_SYMBOLS=0" ;;