[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fwd: libtool munges '-(' linker options.]
From: |
Scott James Remnant |
Subject: |
[Fwd: libtool munges '-(' linker options.] |
Date: |
15 Dec 2002 16:42:42 +0000 |
Hi there, I'm the new Debian maintainer for libtool :)
I'm currently going through the bug list trying to cut it down a
little. A couple of them have patches, so I'm going to send them here
for comments about whether you agree it's a bug or not.
----8<--------8<--------8<--------8<--------8<--------8<--------8<----
Subject: libtool munges '-(' linker options.
From: "C. Scott Ananian" <address@hidden>
To: "Debian Bug Tracking System" <address@hidden>
Date: Thu, 05 Sep 2002 14:04:07 -0400
Package: libtool
Version: 1.4.2-7
Severity: important
Certain applications require the linker flags --start-group
and --end-group (abbreviated "-(" and "-)" ) in order to
resolve circular references between libraries. However,
libtool "sorts" these flags and places them at the beginning
of the command-line, destroying their utility. At the end
of this report is a uuencoded archive containing three
source files and a Makefile demonstrating the problem.
We end up with an archive A.a which uses symbols defined in B.a
and an archive B.a which uses symbols defined in A.a --- a
circular dependency. The command:
gcc -o foo c.o -Wl,"-(" A.a B.a -Wl,"-)"
correctly builds these archives into an executable by telling
ld that it should iterate over A.a and B.a to resolve all
circular references, instead of ld's usual search-once strategy.
However:
libtool gcc -o foo c.o -Wl,"-(" A.a B.a -Wl,"-)"
yields:
$ libtool gcc -o foo c.o -Wl,"-(" A.a B.a -Wl,"-)"
gcc -o foo c.o -Wl,"-(" -Wl,"-)" A.a B.a
B.a(b.o): In function `b':
b.o(.text+0x1b): undefined reference to `a'
collect2: ld returned 1 exit status
As you can see, libtool re-orders the -( and -) flags, destroying
their function. This is a bug in libtool (and it's making my
life quite difficult at the moment).
--scott
begin 644 libtool-bug.tgz
M'XL(`%R9=ST``^V476O;,!2&?6O]BH/)0.YJ5W*L&AP"[6"#P7JS7>QF%&3%
M#J:*'6P'LH[MMU?.QS#)address@hidden:UAL[#\B2CJ2C(Q^]TGG2E*7VDL7TS'HA&`N#
M2`A3,QX)UJVW6"P20Q'Q4`Q#B_%A&`06B)<*J,NB;F0%8"E9R"*7Q:%Y#XW_
MH^A._J_D39KE.CWV'HPS=AZ&!_,?[>5?,&'RSXX=R)_XS_/_X>address@hidden)>^
MI-(O77AG&DG;4'Y)I-8Q--5WWGX"HG0JBYC8`_KYRH43OS1%PLDODLE<\Q@&
M=.7.)?94*?!*R,JR]=-Z;QV3N:SK^^9Y7_6IXU%GNV!C<)W5#D%WY>;BPCT[
M/6;^X1W))*^;V%Z=&3HR\9OI+=GIQ[#5#DA?06**\A6Q9S>3O#)!)+)."SE+
M87!A0E%S&%SO6,^(W=Y#=9N9WO[8^H][5;;K[+GY[^K?A'Z,*[7'0_KG_'SW
M_8^B"/7_&N1%`PEMOTMW1-I:;address@hidden&=#E>,Q<J-)F417`1L::ZCK=&OC;
MA"X];A;_),^^C<AKT]5_TIO^!>J_)[J*7^L_>:K^Y6_]]WT8Y,ET]:_ZTC]#
M_??%8?V/R*H[DWE!UX_!O#*&C#IO)M\*Y]1,Y,Q%W2,(@B`(@B`(@B`(@B`(
address@hidden(W\<address@hidden
`
end
-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux skiffserv 2.4.17 #1 Fri Feb 8 14:08:32 EST 2002 i686
Locale: LANG=C, LC_CTYPE=
Versions of packages libtool depends on:
ii autotools-dev 20020621.1 Update infrastructure for config.{
ii cpp 2:2.95.4-16 The GNU C preprocessor.
ii file 3.39-1 Determines file type using "magic"
ii gcc [c-compiler] 2:2.95.4-16 The GNU C compiler.
ii gcc-2.95 [c-compiler] 1:2.95.4-11 The GNU C compiler.
ii gcc-3.0 [c-compiler] 1:3.0.4-12 The GNU C compiler.
ii gcc-3.1 [c-compiler] 1:3.1.1-2 The GNU C compiler.
ii gcc-3.2 [c-compiler] 1:3.2.1-0pre1 The GNU C compiler.
ii libc6-dev [libc-dev] 2.2.5-14 GNU C Library: Development Librari
-- no debconf information
---->8-------->8-------->8-------->8-------->8-------->8-------->8----
----8<--------8<--------8<--------8<--------8<--------8<--------8<----
Date: Thu, 5 Sep 2002 16:11:34 -0400 (EDT)
From: "C. Scott Ananian" <address@hidden>
To: address@hidden
Subject: Patch.
Here's a quick & dirty patch to fix the problem:
diff -ruHp libtool-1.4.2.orig/ltmain.sh libtool-1.4.2/ltmain.sh
--- libtool-1.4.2.orig/ltmain.sh 2002-09-05 16:03:23.000000000 -0400
+++ libtool-1.4.2/ltmain.sh 2002-09-05 16:04:07.000000000 -0400
@@ -934,9 +934,17 @@ compiler."
continue
;;
xlinker)
+ prev=
+ if test "$qarg" = "\"-(\"" -o "$qarg" = "--start-group" ; then
+ deplibs="$deplibs --start-group"
+ continue
+ fi
+ if test "$qarg" = "\"-)\"" -o "$qarg" = "--end-group" ; then
+ deplibs="$deplibs --end-group"
+ continue
+ fi
linker_flags="$linker_flags $qarg"
compiler_flags="$compiler_flags $wl$qarg"
- prev=
compile_command="$compile_command $wl$qarg"
finalize_command="$finalize_command $wl$qarg"
continue
@@ -1177,6 +1185,14 @@ compiler."
save_ifs="$IFS"; IFS=','
for flag in $args; do
IFS="$save_ifs"
+ if test "$flag" = "-(" -o "$flag" = "--start-group" ; then
+ deplibs="$deplibs --start-group"
+ continue;
+ fi
+ if test "$flag" = "-)" -o "$flag" = "--end-group" ; then
+ deplibs="$deplibs --end-group"
+ continue
+ fi
case $flag in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
flag="\"$flag\""
@@ -1464,6 +1480,12 @@ compiler."
deplibs="$deplib $deplibs"
continue
;;
+ --start-group|--end-group)
+ deplibs="$deplib $deplibs"
+ compile_deplibs="$wl$deplib $compile_deplibs"
+ finalize_deplibs="$wl$deplib $finalize_deplibs"
+ continue
+ ;;
*.la) lib="$deplib" ;;
*.$libext)
if test $pass = conv; then
---->8-------->8-------->8-------->8-------->8-------->8-------->8----
Scott
--
Scott James Remnant Have you ever, ever felt like this? Had strange
http://netsplit.com/ things happen? Are you going round the twist?
signature.asc
Description: This is a digitally signed message part
- [Fwd: libtool munges '-(' linker options.],
Scott James Remnant <=