Hi!

The MSVC linker can't do relinking (-r -o), and this patch avoids
a usage of that in libtool when it digs for symbols in large
numbers of object files. With the patch I get identical behavior
inside "Run tests with low max_cmd_len" as I do outside, without
the patch lots of stuff go belly-up with low max_cmd_len. I found
no regressions on neither cygwin/gcc nor debian/gcc (admittedly
both with "recent" binutils nm, supporting @FILE).

The failures without the patch are variations of this:
/cwrapper.at:91: $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -no-undefined -o 
liba.la -rpath /foo liba.lo
stderr:
stdout:
libtool: link: link -r -o .libs/liba.la-1.obj .libs/liba.obj
Microsoft (R) Incremental Linker Version 8.00.50727.762
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : warning LNK4044: unrecognized option '/r'; ignored
LINK : warning LNK4044: unrecognized option '/o'; ignored
LINK : fatal error LNK1181: cannot open input file '.libs/liba.la-1.obj'


The attached patch is basically:
Support for response files with $NM.
902120b3d9ff0e756b0598f06f5ac79164938d2b

plus the relevant part of:
Fix _LT_TAGVAR errors, hide error output.
6f9c4a15717a896a7da7904d433f0a8e1842bc04

augmented by:
Enable response file support for GNU nm; reorder.
1b36758e54020910c96877608e421ea16acd6ccc

and finished off with the relevant part of:
patch msvc-documentation.patch
06cfce005204bb8ca212aadab38b38c0202ea04e

Further, the ChangeLog change has been collapsed into one
entry and I have updated the code to use the new func_append
function.

Previous discussion:
http://lists.gnu.org/archive/html/libtool-patches/2008-08/msg00012.html
(and following "Next by thread" links)
http://lists.gnu.org/archive/html/libtool-patches/2008-08/msg00046.html

Ok to push?

Cheers,
Peter

2010-07-01  Ralf Wildenhues  <ralf.wildenh...@gmx.de>
            Peter Rosin  <p...@lysator.liu.se>

        Support for response files with $NM.
        * libltdl/m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS)
        <nm_file_list_spec>: New tag variable. Set it to '@' if input
        files can be passed to $NM in a file named with the '@' option.
        * libltdl/config/ltmain.m4sh (func_mode_link): When
        nm_file_list_spec is nonempty, use it to avoid skipped_export.
        * doc/libtool.texi (libtool script contents): Document
        new variable.


commit aaeb6c3d0c51b61d75a23d6875b60549c43d2f73
Author: Peter Rosin <peda@lysator.liu.se>
Date:   Thu Jul 1 11:36:05 2010 +0200

    Support for response files with $NM.
    
    * libltdl/m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS)
    <nm_file_list_spec>: New tag variable. Set it to '@' if input
    files can be passed to $NM in a file named with the '@' option.
    * libltdl/config/ltmain.m4sh (func_mode_link): When
    nm_file_list_spec is nonempty, use it to avoid skipped_export.
    * doc/libtool.texi (libtool script contents): Document
    new variable.

diff --git a/ChangeLog b/ChangeLog
index 4064851..32cdbc4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-07-01  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+	    Peter Rosin  <peda@lysator.liu.se>
+
+	Support for response files with $NM.
+	* libltdl/m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS)
+	<nm_file_list_spec>: New tag variable. Set it to '@' if input
+	files can be passed to $NM in a file named with the '@' option.
+	* libltdl/config/ltmain.m4sh (func_mode_link): When
+	nm_file_list_spec is nonempty, use it to avoid skipped_export.
+	* doc/libtool.texi (libtool script contents): Document
+	new variable.
+
 2010-07-02  Peter Rosin  <peda@lysator.liu.se>
 
 	Don't trigger file name expansion when embedding manifests.
diff --git a/doc/libtool.texi b/doc/libtool.texi
index af6e13d..914bd1d 100644
--- a/doc/libtool.texi
+++ b/doc/libtool.texi
@@ -6171,6 +6171,10 @@ Whether files must be locked to prevent conflicts when compiling
 simultaneously.  Set to @samp{yes} or @samp{no}.
 @end defvar
 
+@defvar nm_file_list_spec
+Specify filename containing input files for @code{NM}.
+@end defvar
+
 @defvar no_builtin_flag
 Compiler flag to disable builtin functions that conflict with declaring
 external global symbols as @code{char}.
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index e5b68af..c6fe560 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -6719,14 +6719,30 @@ EOF
 	    $opt_dry_run || $RM $export_symbols
 	    cmds=$export_symbols_cmds
 	    save_ifs="$IFS"; IFS='~'
-	    for cmd in $cmds; do
+	    for cmd1 in $cmds; do
 	      IFS="$save_ifs"
-	      eval cmd=\"$cmd\"
+	      eval cmd=\"$cmd1\"
 	      func_len " $cmd"
 	      len=$func_len_result
 	      if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 		func_show_eval "$cmd" 'exit $?'
 		skipped_export=false
+	      elif test -n "$nm_file_list_spec"; then
+		output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
+		save_libobjs=$libobjs
+		save_output=$output
+		output=${output_objdir}/${output_la}.nm
+		libobjs=$nm_file_list_spec$output
+		func_append delfiles " $output"
+		func_verbose "creating $NM input file list: $output"
+		for obj in $save_libobjs; do
+		  $ECHO "$obj"
+		done > "$output"
+		eval cmd=\"$cmd1\"
+		func_show_eval "$cmd" 'exit $?'
+		output=$save_output
+		libobjs=$save_libobjs
+		skipped_export=false
 	      else
 		# The command line is too long to execute in one step.
 		func_verbose "using reloadable object file for export list..."
diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index 8475d4b..bb6957e 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -3615,6 +3615,13 @@ else
   AC_MSG_RESULT(ok)
 fi
 
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
 _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
     [Take the output of nm and produce a listing of raw symbols and C names])
 _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
@@ -3625,6 +3632,8 @@ _LT_DECL([global_symbol_to_c_name_address],
 _LT_DECL([global_symbol_to_c_name_address_lib_prefix],
     [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
     [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([], [nm_file_list_spec], [1],
+    [Specify filename containing input files for $NM])
 ]) # _LT_CMD_GLOBAL_SYMBOLS
 
 

Reply via email to