libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Libtool needs -input-file option


From: Robert Boehne
Subject: Re: Libtool needs -input-file option
Date: Fri, 23 Feb 2001 17:07:54 -0600

Alexandre Oliva wrote:
> 
> On Feb 20, 2001, Robert Boehne <address@hidden> wrote:
> 
> > I don't think I can assign the objects to the argument list $0 $1 $2 etc
> > because that would exceed the same limit as the shell.(?)
> 
> I think it's ok to do it.  IIUC, the command-line length limit only
> applies to the exec() system call, when it has to set up argc, argv
> and envvars for the new process in a static memory region.
> 
> So, we could run a first pass over command-line arguments looking for
> -lt-input-file filename and expanding them.  Bonus points if you can
> fold this pass into the current argument-list handling loops :-)
> 

I've compiled this list of similar arguments from the systems I have
handy.  The option that my prototype most resembles is -objectlist
a la IRIX, it is simple, and if we use -objectlist, IRIX users will
already recognize it.

hp11
  -c filename  Arguments to ld
Linux
  -c filename  All arguments to ld (everything else on the command line
is ignored)
Tru64
  -input filename  Arguments to ld (all are allowed), + nesting up to 20
levels (!)
aix 4.3
  -fFileID list of object files, allows wildcards
irix 6.5
  -objectlist object_list_file  list of object files, ignores wildcards
Sun
  no such option


Now, although I'd love to have the "Bonus points" ;) I have taken
the easy way out in my current patch.  It reads command line options
just like normal (with one addition), and then parses the *.lo
objects with a copy of the code that does it with command
line arguments.  It isn't the most elagant solution, BUT
it is "safer" than altering the mature tested code,
and we will probably turn that section into a C function
soon enough.  That doesn't mean I wouldn't rewrite it though...
Here's the patch, as promised.


-- 
Robert Boehne             Software Engineer
Ricardo Software   Chicago Technical Center
TEL: (630)789-0003 x. 238
FAX: (630)789-0127
email:  address@hidden
ChangeLog entry:
2001-02-23  Robert Boehne  <address@hidden>

        * ltmain.in: Add support for the -objectlist option in
        link mode.  The option behaves identically to the IRIX
        6.5 linker option of the same name.  Added a description
        of the -objectlist option to the output of
        libtool --mode=link --help
        * doc/libtool.texi (Link mode): Added documentation for
        the -objectlist option in libtool link mode.


Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.200.2.45
diff -u -r1.200.2.45 ltmain.in
--- ltmain.in   2001/02/23 20:11:56     1.200.2.45
+++ ltmain.in   2001/02/23 23:01:04
@@ -950,6 +950,113 @@
          prev=
          continue
          ;;
+       objectlist)
+         if test -f "$arg"; then
+            save_arg=$arg
+           moreargs=
+           for fil in `cat $save_arg`
+           do
+#            moreargs="$moreargs $fil"
+              arg=$fil
+              # A libtool-controlled object.
+
+             # Check to see that this really is a libtool object.
+             if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") 
>/dev/null 2>&1; then
+                pic_object=
+                non_pic_object=
+
+                # Read the .lo file
+                # If there is no directory component, then add one.
+                case "$arg" in
+                */* | *\\*) . $arg ;;
+                *) . ./$arg ;;
+                esac
+
+                if test -z "$pic_object" || \
+                   test -z "$non_pic_object" ||
+                   test "$pic_object" = none && \
+                   test "$non_pic_object" = none; then
+                  $echo "$modename: cannot find name of object for \`$arg'" 
1>&2
+                  exit 1
+                fi
+
+               # Extract subdirectory from the argument.
+               xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+               if test "X$xdir" = "X$arg"; then
+                 xdir=
+               else
+                 xdir="$xdir/"
+               fi
+
+                if test "$pic_object" != none; then
+                  # Prepend the subdirectory the object is found in.
+                 pic_object="$xdir$pic_object"
+
+                 if test "$prev" = dlfiles; then
+                   if test "$build_libtool_libs" = yes && test 
"$dlopen_support" = yes; then
+                     dlfiles="$dlfiles $pic_object"
+                     prev=
+                     continue
+                   else
+                     # If libtool objects are unsupported, then we need to 
preload.
+                     prev=dlprefiles
+                   fi
+                 fi
+
+                 # CHECK ME:  I think I busted this.  -Ossama
+                  if test "$prev" = dlprefiles; then
+                   # Preload the old-style object.
+                   dlprefiles="$dlprefiles $pic_object"
+                   prev=
+                  fi
+
+                  # A PIC object.
+                 libobjs="$libobjs $pic_object"
+                 arg="$pic_object"
+                fi
+
+                # Non-PIC object.
+                if test "$non_pic_object" != none; then
+                  # Prepend the subdirectory the object is found in.
+                 non_pic_object="$xdir$non_pic_object"
+
+                  # A standard non-PIC object
+                  non_pic_objects="$non_pic_objects $non_pic_object"
+                  if test -z "$pic_object" || test "$pic_object" = none ; then
+                    arg="$non_pic_object"
+                  fi
+                fi
+              else
+                # Only an error if not doing a dry-run.
+                if test -z "$run"; then
+                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+                  exit 1
+                else
+                  # Dry-run case.
+
+                 # Extract subdirectory from the argument.
+                 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+                 if test "X$xdir" = "X$arg"; then
+                   xdir=
+                 else
+                   xdir="$xdir/"
+                 fi
+
+                  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e 
"$lo2o"`
+                  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+                 libobjs="$libobjs $pic_object"
+                  non_pic_objects="$non_pic_objects $non_pic_object"
+                fi
+             fi
+           done
+         else
+           $echo "$modename: link input file \`$save_arg' does not exist"
+           exit 1
+         fi
+          arg=$save_arg
+         prev=
+         continue
+         ;;
        rpath | xrpath)
          # We need an absolute path.
          case "$arg" in
@@ -1153,6 +1260,11 @@
        continue
        ;;
 
+      -objectlist)
+       prev=objectlist
+       continue
+       ;;
+
       -o) prev=output ;;
 
       -release)
@@ -5072,6 +5184,7 @@
   -no-install       link a not-installable executable
   -no-undefined     declare that a library does not refer to external symbols
   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -objectlist FILE  Use a list of object files found in FILE to specify objects
   -release RELEASE  specify package release information
   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
Index: doc/libtool.texi
===================================================================
RCS file: /cvsroot/libtool/libtool/doc/libtool.texi,v
retrieving revision 1.86.2.17
diff -u -r1.86.2.17 libtool.texi
--- doc/libtool.texi    2001/02/23 20:12:00     1.86.2.17
+++ doc/libtool.texi    2001/02/23 23:01:05
@@ -1237,6 +1237,17 @@
 the regular expression @var{regex} are exported.
 By default all symbols are exported.
 
address@hidden -objectlist @var{input-file}
+Tells libtool to read a text file to determine the object files
+to be linked.  The @var{input-file} is a text file containing a list
+of libtool objects (@samp{.lo} files), one per line.  This option is
+used to build arbitrarily large libraries when the libtool command
+becomes too large for the system to execute.  Creating this file can
+be automated with a command like the following:
address@hidden
address@hidden ./ -name \*.lo -print | sed 's/.\///g' > inputfile.txt}
address@hidden example
+
 @item address@hidden
 Search @var{libdir} for required libraries that have already been
 installed.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]