[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: libtool update - the "duplicate _init and _fini" problem
From: |
Alexandre Oliva |
Subject: |
Re: libtool update - the "duplicate _init and _fini" problem |
Date: |
25 Jun 2003 17:54:33 -0300 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
On Jun 25, 2003, Fernando Nasser <address@hidden> wrote:
> This version of libtool includes the (host) crti.o file which usually
> lives in /usr/lib (or /usr/lib64 on 64 bit machines).
> But cross compilers use the target machine crt file, which lives in
> the multilib directory inside the gcc installation itself, like:
> /usr/lib/gcc-lib/x86_64-redhat-linux/3.3/crtbeginS.o
The problem is caused by an occurrence of "$LD" in libtool.m4, in teh
macro AC_PROG_LD_GNU. The patchlet that fixes it is:
[AC_REQUIRE([AC_PROG_EGREP])dnl
AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
-case `"$LD" -v 2>&1 </dev/null` in
+case `$LD -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
lt_cv_prog_gnu_ld=yes
;;
The reason for this problem is that, on AMD64, LD is set to the
pathname of LD followed by -m elf_x86_64, and "/usr/bin/ld -m
elf_x86_64" does not exist as a filename, so libtool's configure
machinery concludes the linker used by g++ is not GNU ld, so, instead
of using:
_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects
$libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o
$lib'
it ends up using the generic link command:
_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs
$deplibs $postdep_objects $compiler_flags -o $lib'
Note the absence of -nostdlib. This is likely another bug, that can
be fixed in libtool.m4 with the following patchlet:
# linker, instead of GNU ld. If possible, this setting should
# overridden to take advantage of the native linker features on
# the platform it is being used on.
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs
$deplibs $postdep_objects $compiler_flags -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects
$libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
fi
# Commands to make compiler produce verbose output that lists
I'd like to thank Tim Waugh for having gone through this with me. It
was a painful debugging session.
While at that, I also fixed some incorrect uses of the term `path',
per RMS's request.
Ok to install in the libtool CVS tree?
Index: ChangeLog
from Alexandre Oliva <address@hidden>, Tim Waugh <address@hidden>
* libtool.m4: Replace mis-uses of path with pathname.
(AC_PROG_LD_GNU): Don't quote $LD when running it.
(_LT_AC_LANG_CXX_CONFIG): Use -nostdlib also when linking with g++
and non-GNU ld.
Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.324
diff -u -p -r1.324 libtool.m4
--- libtool.m4 11 Jun 2003 16:33:49 -0000 1.324
+++ libtool.m4 25 Jun 2003 20:51:05 -0000
@@ -1942,7 +1942,7 @@ fi
# AC_PROG_LD
# ----------
-# find the path to the GNU or non-GNU linker
+# find the pathname to the GNU or non-GNU linker
AC_DEFUN([AC_PROG_LD],
[AC_ARG_WITH([gnu-ld],
[AC_HELP_STRING([--with-gnu-ld],
@@ -1968,7 +1968,7 @@ if test "$GCC" = yes; then
# Accept absolute paths.
[[\\/]]* | ?:[[\\/]]*)
re_direlt='/[[^/]][[^/]]*/\.\./'
- # Canonicalize the path of ld
+ # Canonicalize the pathname of ld
ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
@@ -2031,7 +2031,7 @@ AC_DEFUN([AC_PROG_LD_GNU],
[AC_REQUIRE([AC_PROG_EGREP])dnl
AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
-case `"$LD" -v 2>&1 </dev/null` in
+case `$LD -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
lt_cv_prog_gnu_ld=yes
;;
@@ -2269,7 +2269,7 @@ test -z "$deplibs_check_method" && depli
# AC_PROG_NM
# ----------
-# find the path to a BSD-compatible name lister
+# find the pathname to a BSD-compatible name lister
AC_DEFUN([AC_PROG_NM],
[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
[if test -n "$NM"; then
@@ -2710,7 +2710,7 @@ if test "$GXX" = yes; then
# linker, instead of GNU ld. If possible, this setting should
# overridden to take advantage of the native linker features on
# the platform it is being used on.
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs
$deplibs $postdep_objects $compiler_flags -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects
$libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
fi
# Commands to make compiler produce verbose output that lists
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer address@hidden, gcc.gnu.org}
CS PhD student at IC-Unicamp address@hidden, gnu.org}
Free Software Evangelist Professional serial bug killer
- Re: libtool update - the "duplicate _init and _fini" problem,
Alexandre Oliva <=