libtool-patches
[Top][All Lists]
Advanced

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

[PATCH] Use pic_object as fallback for non_pic_object in ltmain.in


From: David Edelsohn
Subject: [PATCH] Use pic_object as fallback for non_pic_object in ltmain.in
Date: Thu, 19 Aug 2004 22:18:26 -0400

        If one invokes

libtool --mode=link -static ...

and non-pic objects have not been compiled, libtool silently will fail and
create an empty archive.  This situation happens when building the GCC
libgfortranbegin.a library on AIX where all objects are PIC and libtool is
configured with enable_shared=yes and enable_static=no.

        The following patch updates ltmain.in to use $pic_object for
static linking if $non_pic_object=none.  If $pic_object=none as well,
libtool will fail with a visible error trying to link "none" instead of
silently producing an incorrect result.

Thanks, David


        * ltmain.in: Use $pic_object as $non_pic_object if
        $non_pic_object=none.

Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/config/ltmain.in,v
retrieving revision 1.2
diff -c -p -r1.2 ltmain.in
*** ltmain.in   3 Aug 2004 14:54:34 -0000       1.2
--- ltmain.in   20 Aug 2004 01:55:17 -0000
*************** EOF
*** 1518,1523 ****
--- 1518,1528 ----
                  if test -z "$pic_object" || test "$pic_object" = none ; then
                    arg="$non_pic_object"
                  fi
+               else
+                 # If the PIC object exists, use it instead.
+                 # $xdir was prepended to $pic_object above.
+                 non_pic_object="$pic_object"
+                 non_pic_objects="$non_pic_objects $non_pic_object"
                fi
              else
                # Only an error if not doing a dry-run.
*************** EOF
*** 2027,2032 ****
--- 2032,2042 ----
            if test -z "$pic_object" || test "$pic_object" = none ; then
              arg="$non_pic_object"
            fi
+         else
+           # If the PIC object exists, use it instead.
+           # $xdir was prepended to $pic_object above.
+           non_pic_object="$pic_object"
+           non_pic_objects="$non_pic_objects $non_pic_object"
          fi
        else
          # Only an error if not doing a dry-run.




reply via email to

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