From: Ralf Wildenhues Date: Fri, 23 Feb 2007 21:11:25 +0000 (+0000) Subject: * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS) X-Git-Tag: release-2-1b~179 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3709c2f9df4a53e0811fd156e00d40d6ee6e091;p=thirdparty%2Flibtool.git * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS) : New tag variable. Default to `no'. (_LT_LINKER_SHLIBS) [ linux ]: Set it to yes for Sun C 5.9. (_LT_LANG_CXX_CONFIG): Also default it to `no'. [ linux ]: Set it to `yes' for Sun C++ 5.9. * libltdl/config/ltmain.m4sh (func_mode_link): If we link no objects but only convenience archives into a library, force expansion if `compiler_needs_object' is yes. For creating a linker input filelist due to long cmdline, extract the first object if `compiler_needs_object' is yes. * doc/libtool.texi (libtool script contents): Document it. Fixes test failures of Sun compilers on GNU/Linux. Report by Terry D. Dontje. --- diff --git a/ChangeLog b/ChangeLog index 5d00c6233..a59d1cb5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2007-02-23 Ralf Wildenhues + * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS) + : New tag variable. Default to `no'. + (_LT_LINKER_SHLIBS) [ linux ]: Set it to yes for Sun C 5.9. + (_LT_LANG_CXX_CONFIG): Also default it to `no'. + [ linux ]: Set it to `yes' for Sun C++ 5.9. + * libltdl/config/ltmain.m4sh (func_mode_link): If we link + no objects but only convenience archives into a library, + force expansion if `compiler_needs_object' is yes. + For creating a linker input filelist due to long cmdline, + extract the first object if `compiler_needs_object' is yes. + * doc/libtool.texi (libtool script contents): Document it. + Fixes test failures of Sun compilers on GNU/Linux. + Report by Terry D. Dontje. + * libltdl/config/ltmain.m4sh (func_mode_link): Avoid setting `$libobjs' to a single space; set it to empty in that case. diff --git a/doc/libtool.texi b/doc/libtool.texi index 6d317d02d..0e78f4b49 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -5259,6 +5259,13 @@ Whether the compiler supports the @option{-c} and @option{-o} options simultaneously. Set to @samp{yes} or @samp{no}. @end defvar +@defvar compiler_needs_object +Whether the compiler has to see an object listed on the command line in +order to successfully invoke the linker. If @samp{no}, then a set of +convenience archives or a set of object file names can be passed via +linker-specific options or linker scripts. +@end defvar + @defvar dlopen_support Whether @code{dlopen} is supported on the platform. Set to @samp{yes} or @samp{no}. diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 74ac159b1..e44f965d3 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -5182,6 +5182,13 @@ EOF deplibs="$tmp_deplibs" if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test "$compiler_needs_object" = yes && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" @@ -5270,12 +5277,19 @@ EOF output=${output_objdir}/${output_la}.lnk func_echo "creating linker input file list: $output" : > $output - for obj in $save_libobjs + set x $save_libobjs + shift + firstobj= + if test "$compiler_needs_object" = yes; then + firstobj="$1 " + shift + fi + for obj do $ECHO "$obj" >> $output done delfiles="$delfiles $output" - output=\"$file_list_spec$output\" + output=$firstobj\"$file_list_spec$output\" else func_echo "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index 9644c4f41..2cc55cd37 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -4003,6 +4003,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= + _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' @@ -4195,6 +4196,7 @@ _LT_EOF case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; @@ -4994,6 +4996,8 @@ _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) +_LT_TAGDECL([], [compiler_needs_object], [1], + [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], @@ -5183,6 +5187,7 @@ _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no @@ -5851,6 +5856,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1