[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Possible flaw in `libtool's argument shuffle ?? --
From: |
Paul Townsend |
Subject: |
Possible flaw in `libtool's argument shuffle ?? -- |
Date: |
Fri, 4 Feb 2005 04:01:29 -0500 (EST) |
=====
The Solaris link editor options, "-Bstatic" and "-Bdynamic", are
position dependent in the command line. I modified the "wget" configure
file so that the command line substring "-Bstatic -lssl -lcrypto
-Bdynamic" should have been used. `libtool', however, shuffled the
options such that the effective substring "-Bstatic -Bdynamic -lssl
-lcrypto" was used. I upgraded the "libtool.m4" and "ltmain.sh" to the
latest revision I could find.
FWIW, the "-Bstatic" option doesn't necessarily cause the Solaris link
editor to build a static image. The "-dn" option should probably be
used instead.
=-=-=-=-=-=-=-=-=-=-=
>./libtool --version
ltmain.sh (GNU libtool) 1.5.8 (1.1220.2.117 2004/08/04 14:12:05)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
=-=-=-=-=-=-=-=-=-=-=
>From "wget"s build log using the old `libtool' - note repositioning of
"-B..." arguments:
cd src && gmake CC='cc' CPPFLAGS='' DEFS='-DHAVE_CONFIG_H
-DSYSTEM_WGETRC=\"/home/aab/u54/aab/etc/wgetrc\"
-DLOCALEDIR=\"/home/aab/u54/aab/share/locale\"' CFLAGS='-xO5 -xarch=v8plusa
-xdepend' LDFLAGS='-L/opt/openssl/lib -R/opt/openssl/lib ' LIBS='-lintl -lmd5
-Bstatic -lssl -lcrypto -Bdynamic -ldl -lsocket -lnsl -lrt '
prefix='/home/aab/u54/aab' exec_prefix='/home/aab/u54/aab'
bindir='/home/aab/u54/aab/bin' infodir='/home/aab/u54/aab/info'
mandir='/home/aab/u54/aab/man' manext='1'
/bin/sh ../libtool --mode=link cc -xO5 -xarch=v8plusa -xdepend
-L/opt/openssl/lib -R/opt/openssl/lib -o wget cmpt.o connect.o convert.o
cookies.o ftp.o ftp-basic.o ftp-ls.o ftp-opie.o getopt.o hash.o host.o
html-parse.o html-url.o http.o init.o log.o main.o gen-md5.o netrc.o progress.o
recur.o res.o retr.o safe-ctype.o snprintf.o gen_sslfunc.o url.o utils.o
version.o xmalloc.o -lintl -lmd5 -Bstatic -lssl -lcrypto -Bdynamic -ldl
-lsocket -lnsl -lrt
cc -xO5 -xarch=v8plusa -xdepend -o wget cmpt.o connect.o convert.o cookies.o
ftp.o ftp-basic.o ftp-ls.o ftp-opie.o getopt.o hash.o host.o html-parse.o
html-url.o http.o init.o log.o main.o gen-md5.o netrc.o progress.o recur.o
res.o retr.o safe-ctype.o snprintf.o gen_sslfunc.o url.o utils.o version.o
xmalloc.o -Bstatic -Bdynamic -L/opt/openssl/lib -lintl -lmd5 -lssl -lcrypto
-ldl -lsocket -lnsl -lrt -R/opt/openssl/lib
=-=-=-=-=-=-=-=-=-=-=
>From the Sun Studio 8 (formerly Forte) "cc" man page. The "ld" man page
says something similar but this is clearer:
-B [static|dynamic]
Specifies whether bindings of libraries for linking are static or
dynamic, indicating whether libraries are non-shared or shared,
respectively. -B dynamic causes the link editor to look for files
named libx.so and then for files named libx.a when given the -lx
option. -B static causes the link editor to look only for files
named libx.a. This option may be specified multiple times on the
command line as a toggle. This option and its argument are passed
to ld.
=-=-=-=-=-=-=-=-=-=-=
Crude patch for the generated `libtool' that corrects the problem.
Sorry, didn't have time to play with "libtool.m4"/"ltmain.sh". The
patch also contains a replacement of "$host" for "$host_os" as
"$host_os" is not defined within `libtool'. It should be noted that
the additional code attempts to restrict itself the "Forte" compiler.
I suppose "-Wl,-Bstatic", etc., could be used instead.
--- libtool 2005-02-04 02:58:36.010570000 -0500
+++ libtool.mine 2005-02-04 03:08:01.412095000 -0500
@@ -1109,7 +1109,7 @@
trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
# On Cygwin there's no "real" PIC flag so we must build both object types
- case $host_os in
+ case $host in
cygwin* | mingw* | pw32* | os2*)
pic_mode=default
;;
@@ -1795,6 +1795,16 @@
esac
continue
;;
+ -Bstatic|-Bdynamic)
+ case "$host" in
+ *solaris*)
+ if test "X$link_static_flag" = "X-Bstatic"; then
+ deplibs="$deplibs $arg"
+ continue
+ fi
+ ;;
+ esac
+ ;;
-l*)
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
@@ -2321,6 +2331,15 @@
fi
continue
;;
+ -Bstatic|-Bdynamic)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ fi
+ continue
+ ;;
-l*)
if test "$linkmode" != lib && test "$linkmode" != prog; then
$echo "$modename: warning: \`-l' is ignored for archives/objects"
1>&2
=-=-=-=-=-=-=-=-=-=-=
>From "wget"s build log using the modified `libtool':
cd src && gmake CC='cc' CPPFLAGS='' DEFS='-DHAVE_CONFIG_H
-DSYSTEM_WGETRC=\"/home/aab/u54/aab/etc/wgetrc\"
-DLOCALEDIR=\"/home/aab/u54/aab/share/locale\"' CFLAGS='-xO5 -xarch=v8plusa
-xdepend' LDFLAGS='-L/opt/openssl/lib -R/opt/openssl/lib ' LIBS='-lintl -lmd5
-Bstatic -lssl -lcrypto -Bdynamic -ldl -lsocket -lnsl -lrt '
prefix='/home/aab/u54/aab' exec_prefix='/home/aab/u54/aab'
bindir='/home/aab/u54/aab/bin' infodir='/home/aab/u54/aab/info'
mandir='/home/aab/u54/aab/man' manext='1'
/bin/sh ../libtool --mode=link cc -xO5 -xarch=v8plusa -xdepend
-L/opt/openssl/lib -R/opt/openssl/lib -o wget cmpt.o connect.o convert.o
cookies.o ftp.o ftp-basic.o ftp-ls.o ftp-opie.o getopt.o hash.o host.o
html-parse.o html-url.o http.o init.o log.o main.o gen-md5.o netrc.o progress.o
recur.o res.o retr.o safe-ctype.o snprintf.o gen_sslfunc.o url.o utils.o
version.o xmalloc.o -lintl -lmd5 -Bstatic -lssl -lcrypto -Bdynamic -ldl
-lsocket -lnsl -lrt
cc -xO5 -xarch=v8plusa -xdepend -o wget cmpt.o connect.o convert.o cookies.o
ftp.o ftp-basic.o ftp-ls.o ftp-opie.o getopt.o hash.o host.o html-parse.o
html-url.o http.o init.o log.o main.o gen-md5.o netrc.o progress.o recur.o
res.o retr.o safe-ctype.o snprintf.o gen_sslfunc.o url.o utils.o version.o
xmalloc.o -L/opt/openssl/lib -lintl -lmd5 -Bstatic -lssl -lcrypto -Bdynamic
-ldl -lsocket -lnsl -lrt -R/opt/openssl/lib
-- Thanks for reading this far,
-- Paul Townsend (alpha alpha beta at purdue dot edu)
- Possible flaw in `libtool's argument shuffle ?? --,
Paul Townsend <=