]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* ltmain.in (piecewise linking): Make sure we link at least one
authorAlexandre Oliva <oliva@lsd.ic.unicamp.br>
Tue, 20 Mar 2001 05:47:28 +0000 (05:47 +0000)
committerAlexandre Oliva <aoliva@redhat.com>
Tue, 20 Mar 2001 05:47:28 +0000 (05:47 +0000)
object file at a time into a new reloadable object file.
[whole_archive_flag_spec]: Don't link convenience archives
piecewise.
(piecewise archiving): Clear RANLIB except for the last run.

ChangeLog
ltmain.in

index c8abbf8e3e6872b1fd588493dfbd85f912ff2859..6d637a393854b4ef3ea479d34100fef9fd7c0e20 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-03-20  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
+
+       * ltmain.in (piecewise linking): Make sure we link at least one
+       object file at a time into a new reloadable object file.
+       [whole_archive_flag_spec]: Don't link convenience archives
+       piecewise.
+       (piecewise archiving): Clear RANLIB except for the last run.
+
 2001-03-20  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
 
        * configure.in (file_magic_cmd, reload_flag): Duplicate `$'s
index aa2a9afc9956bb155bc725874406bf0c1c129f7d..a8c744151f384d2a41863d818b5a592816a51467 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -3081,6 +3081,7 @@ EOF
 
        if test -n "$convenience"; then
          if test -n "$whole_archive_flag_spec"; then
+           save_libobjs=$libobjs
            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
          else
            gentop="$output_objdir/${outputname}x"
@@ -3141,10 +3142,22 @@ EOF
         else
          # The command line is too long to link in one step, link piecewise.
           $echo "creating reloadable object files..."
-         # Save the value of $output and $libobjs because we want to use them later.
-          save_libobjs=$libobjs
+
+         # Save the value of $output and $libobjs because we want to
+         # use them later.  If we have whole_archive_flag_spec, we
+         # want to use save_libobjs as it was before
+         # whole_archive_flag_spec was expanded, because we can't
+         # assume the linker understands whole_archive_flag_spec.
+         # This may have to be revisited, in case too many
+         # convenience libraries get linked in and end up exceeding
+         # the spec.
+         if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+           save_libobjs=$libobjs
+         fi
           save_output=$output
-         # Clear the reloadable object creation command queue and initialize k to one.
+
+         # Clear the reloadable object creation command queue and
+         # initialize k to one.
           test_cmds=
           concat_cmds=
           objlist=
@@ -3156,16 +3169,19 @@ EOF
           for obj in $save_libobjs
           do
             eval test_cmds=\"$reload_cmds $objlist $last_robj\"
-            if len=`expr "X$test_cmds" : ".*"` &&
-                  test $len -le $max_cmd_len; then
+            if test "X$objlist" = X ||
+              { len=`expr "X$test_cmds" : ".*"` &&
+                 test $len -le $max_cmd_len; }; then
               objlist="$objlist $obj"
             else
-             # The command $test_cmds is almost too long, add a command to the queue.
+             # The command $test_cmds is almost too long, add a
+             # command to the queue.
               if test $k -eq 1 ; then
                # The first file doesn't have a previous command to add.
                 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
               else
-               # All subsequent reloadable object files will link in the last one created.
+               # All subsequent reloadable object files will link in
+               # the last one created.
                 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
               fi
               last_robj=$output_objdir/$save_output-${k}.$objext
@@ -3175,11 +3191,14 @@ EOF
               len=1
             fi
           done
-         # Handle the remaining objects by creating one last reloadable object file.
-         # All subsequent reloadable object files will link in the last one created.
-          eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
-
-         # Set up a command to remove the reloadale object files after they are used.
+         # Handle the remaining objects by creating one last
+         # reloadable object file.  All subsequent reloadable object
+         # files will link in the last one created.
+         test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+
+         # Set up a command to remove the reloadale object files
+         # after they are used.
           i=0
           while test $i -lt $k
           do
@@ -3202,14 +3221,21 @@ EOF
          # Restore the value of output.
           output=$save_output
 
-         # Expand the library linking commands again to reset the value of $libobjs for piecewise linking.
+         if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+           eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+         fi
+         # Expand the library linking commands again to reset the
+         # value of $libobjs for piecewise linking.
+
          # Do each of the archive commands.
           if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
             eval cmds=\"$archive_expsym_cmds\"
           else
             eval cmds=\"$archive_cmds\"
           fi
-         # Append the command to remove the reloadable object files to the just-reset $cmds.
+
+         # Append the command to remove the reloadable object files
+         # to the just-reset $cmds.
           eval cmds=\"\$cmds~$rm $delfiles\"
         fi
         IFS="${IFS=    }"; save_ifs="$IFS"; IFS='~'
@@ -4126,6 +4152,8 @@ fi\
         else
           # the command line is too long to link in one step, link in parts
           $echo "using piecewise archive linking..."
+         save_RANLIB=$RANLIB
+         RANLIB=:
           objlist=
           concat_cmds=
           save_oldobjs=$oldobjs
@@ -4140,13 +4168,14 @@ fi\
             else
               # the above command should be used before it gets too long
               oldobjs=$objlist
-              eval concat_cmds=\"\$old_archive_cmds~$concat_cmds\"
+             test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
               objlist=
             fi
           done
+         RANLIB=$save_RANLIB
           oldobjs=$objlist
-          eval concat_cmds=\"\$old_archive_cmds~$concat_cmds\"
-          eval cmds=\"$concat_cmds\"
+          eval cmds=\"\$concat_cmds~$old_archive_cmds\"
         fi
       fi
       IFS="${IFS=      }"; save_ifs="$IFS"; IFS='~'