libtool-patches
[Top][All Lists]
Advanced

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

ltmain.in broken code when duplicate object names in .a files


From: Albert Chin
Subject: ltmain.in broken code when duplicate object names in .a files
Date: Sat, 11 Dec 2004 18:37:49 -0600
User-agent: Mutt/1.5.6i

ltmain.in makes use of a binutils-specific feature of GNU ar ("$AR xN
#"). The patch below retools this to something more portable. Patch
against branch-1-5.

-- 
albert chin (address@hidden)

-- snip snip
2004-12-11  Albert Chin-A-Young  <address@hidden>

        * ltmain.in: When a convenience library is merged into
        another library and the result contains duplicate object
        names, use a more portable method than the GNU ar-specific
        "$AR xN 1" to rename the duplicate object files. We extract
        the object files one at a time but, after the first
        extraction, move the object file to the end of the archive
        so the duplicate object files are fetched on subsequent
        "$AR x" invocations.

Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/ltmain.in,v
retrieving revision 1.334.2.42
diff -u -3 -p -r1.334.2.42 ltmain.in
--- ltmain.in   9 Dec 2004 18:00:47 -0000       1.334.2.42
+++ ltmain.in   12 Dec 2004 00:32:28 -0000
@@ -331,8 +331,13 @@ func_extract_archives () {
        else
          $echo "$modename: warning: object name conflicts; renaming object 
files" 1>&2
          $echo "$modename: warning: to ensure that they will not overwrite" 
1>&2
-         $AR t "$my_xabs" | sort | uniq -cd | while read -r count name
+         $show "(cp $my_xabs $my_xdir)"
+         $run eval "(cp \$my_xabs \$my_xdir)"
+         $AR t "$my_xdir/$my_xlib" | sort | uniq -c | \
+           while read -r count name
          do
+           test "$count" -eq 1 && continue
+
            i=1
            while test "$i" -le "$count"
            do
@@ -343,11 +348,15 @@ func_extract_archives () {
              do
                name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
              done
-             $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' 
'$name_to')"
-             $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv 
'$name' '$name_to')" || exit $?
+             $show "(cd $my_xdir && $AR x $my_xlib '$name' && $mv '$name' 
'$name_to')"
+             $run eval "(cd \$my_xdir && $AR x \$my_xlib '$name' && $mv 
'$name' '$name_to')" || exit $?
+             $show "(cd $my_xdir && $AR m $my_xlib '$name')"
+             $run eval "(cd \$my_xdir && $AR m \$my_xlib '$name')" || exit $?
              i=`expr $i + 1`
            done
          done
+         $show "(rm $my_xdir/$my_xlib)"
+         $run eval "(rm \$my_xdir/\$my_xlib)"
        fi
        ;;
       esac




reply via email to

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