libtool
[Top][All Lists]
Advanced

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

libtool doesn't pass LDFLAGS to linker - Solaris 64 bit


From: Jaimon Jose
Subject: libtool doesn't pass LDFLAGS to linker - Solaris 64 bit
Date: Sat, 14 Jan 2006 23:55:34 +0530
User-agent: Thunderbird 1.5 (X11/20051201)

The linker remains a 32bit application in Solaris. 32 bit output file is generated if the linker is presented with a collection of ELF32 object files and 64 bit output file is generated if the linker is presented with a collection of 64bit object files. Linker requires explicit flags to be provided if the required output format can not be determined from the first object file. These are transparent to the user since the linker is invoked indirectly through the compiler driver. The problem starts here. Compiler flag -xarch=v9 or -xarch=generic64 ( sunstudio 8 onwards ) is used to build 64 bit object files. The same flag needs to be provided to the linker driver, so that the compiler driver picks up the correct runtime libraries before calling the linker. However, libtool is not passing the LDFLAGS before invoking the linker driver. I'm building it on Solaris 8 with both SunForte U2 and SunStudio 11. Libtool used is 1.5.18.

Is there any reason why LIBTOOL ignores the LDFLAGS ( -xarch=v9 ) before calling the linker ( $CXX ). Though linker identifies the output required from the inputs, the compiler driver pass the correct libraries only if this flag is passed.

Here are some logs from my build environment.
------------------------------------
Here is how linker is invoked through libtool. LDFLAGS is set to "-xarch=generic64". Expanded output is how to explain how linker is invoked. We can see that runtime libraries passed to linker are /usr/SUNWspro/prod/lib/crti.o /usr/SUNWspro/prod/lib/CCrti.o which are 32 bit libraries. This is because libtool is not passing the -xarch=v9 while invoking the compiler driver.

everest(jjaimon)::/home1/jjaimon/builds/sal-64bit/unix/src >/bin/bash ../../libtool --tag=CXX --mode=link CC -g -DSAL_UNIX64 -D_REENTRANT= -DDEBUG -DPRECHECKIN=1 -xarch=generic64 -DSUNWORKSHOP64 -D_LARGEFILE_SOURCE -_FILE_OFFSET_BITS=64 -DSAL_DEBUG -xarch=generic64 -o libsal.la -rpath /home1/jaimon/builds/install-rosalind64/opt/novell//lib -version-info 1:0:0 -export-smbols /net/nds-ldap-mp1/home/jjaimon/svn_wa/sal-test/unix/src/libsal.symbols sa_atom.lo sal_cv.lo -lpthread -lposix4 -lnsl -ldl -lsocket -nsl

CC -v -G -nolib -Qoption ld -M -Qoption ld .libs/libsal.so.1.0.0.exp -hlibsal.so.1 -o .libs/libsal.so.1.0.0 .libs/sal_atom.o .libs/sal_cv.o -lpthread -lposix4 -ldl -lsocket -lnsl
###     command line files and options (expanded):
### -v -G -xnolib -Qoption ld -M -Qoption ld .libs/libsal.so.1.0.0.exp -hlibsal.so.1 -o .libs/libsal.so.1.0.0 .libs/sal_atom.o .libs/sal_cv.o -lpthread -lposix4 -ldl -lsocket -lnsl -xcode=pic13 ### CC: Note: NLSPATH = /usr/SUNWspro/prod/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:/usr/SUNWspro/prod/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat
### CC: Note: LD_LIBRARY_PATH = (null)
### CC: Note: LD_RUN_PATH     = (null)
### CC: Note: LD_OPTIONS = (null)
ln -s /usr/SUNWspro/prod/lib /tmp/lib_link.05759
ln -s /usr/SUNWspro/prod/lib /tmp/lib_base_link.05759
/usr/ccs/bin/ld -zld32=-S/tmp/lib_base_link.05759/libCCexcept.so.1 -zld64=-S/tmp/lib_link.05759/v9/libCCexcept.so.1 -zld32=-S/tmp/lib_base_link.05759/libldstab_ws.so -zld64=-S/tmp/lib_link.05759/v9/libldstab_ws.so -dy -G -M .libs/libsal.so.1.0.0.exp -hlibsal.so.1 -R/usr/SUNWspro/lib/rw7:/usr/SUNWspro/lib/v8plus:/usr/SUNWspro/lib:/opt/SUNWspro/lib/v8plus:/opt/SUNWspro/lib:/usr/ccs/lib:/lib:/usr/lib -o .libs/libsal.so.1.0.0 /usr/SUNWspro/prod/lib/crti.o /usr/SUNWspro/prod/lib/CCrti.o .libs/sal_atom.o .libs/sal_cv.o -lpthread -lposix4 -ldl -lsocket -lnsl -Y P,/usr/SUNWspro/lib/rw7:/usr/SUNWspro/lib/v8plus:/usr/SUNWspro/prod/lib/rw7:/usr/SUNWspro/prod/lib/v8plus:/usr/SUNWspro/lib:/usr/SUNWspro/prod/lib:/usr/ccs/lib:/lib:/usr/lib /usr/SUNWspro/prod/lib/CCrtn.o /usr/SUNWspro/prod/lib/crtn.o >&/tmp/ld.05759.0.err /usr/SUNWspro/prod/bin/c++filt -filt=no%stdlib </tmp/ld.05759.0.err >/tmp/c++filt.05759.1.err
rm /tmp/ld.05759.0.err
/usr/SUNWspro/prod/bin/stdlibfilt -stderr </tmp/c++filt.05759.1.err
ld: fatal: file .libs/sal_atom.o: wrong ELF class: ELFCLASS64
ld: fatal: File processing errors. No output written to .libs/libsal.so.1.0.0
rm /tmp/c++filt.05759.1.err
rm /tmp/lib_link.05759
rm /tmp/lib_base_link.05759
------------------------------------------------------------------------------------
If -xarch=v9 flag is passed to the compiler driver, we see that correct 64 bit runtime libraries are passed. /usr/SUNWspro/prod/lib/v9/crti.o /usr/SUNWspro/prod/lib/v9/CCrti.o are passed in the following log.

everest(jjaimon)::/home1/jjaimon/builds/sal-64bit/unix/src >CC -v -xarch=v9 -Gnolib -Qoption ld -M -Qoption ld .libs/libsal.so.1.0.0.exp -hlibsal.so.1 -o .lis/libsal.so.1.0.0 .libs/sal_atom.o .libs/sal_cv.o -lpthread -lposix4 -ldl -lsocket -lnsl
###     command line files and options (expanded):
### -v -xarch=v9 -G -xnolib -Qoption ld -M -Qoption ld .libs/libsal.so.1.0.0.ex -hlibsal.so.1 -o .libs/libsal.so.1.0.0 .libs/sal_atom.o .libs/sal_cv.o -lpthread -lposix4 -ldl -lsocket -lnsl -xcode=pic13 ### CC: Note: NLSPATH = /usr/SUNWspro/prod/bin/../lib/locale/%L/LC_MESSAGES/%N.at:/usr/SUNWspro/prod/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat
### CC: Note: LD_LIBRARY_PATH = (null)
### CC: Note: LD_LIBRARY_PATH_64 = (null)
### CC: Note: LD_RUN_PATH     = (null)
### CC: Note: LD_OPTIONS = (null)
ln -s /usr/SUNWspro/prod/lib /tmp/lib_link.06041
ln -s /usr/SUNWspro/prod/lib /tmp/lib_base_link.06041
/usr/ccs/bin/ld -zld32=-S/tmp/lib_base_link.06041/libCCexcept.so.1 -zld64=-S/tm/lib_link.06041/v9/libCCexcept.so.1 -zld32=-S/tmp/lib_base_link.06041/libldstabws.so -zld64=-S/tmp/lib_link.06041/v9/libldstab_ws.so -dy -G -M .libs/libsal.so1.0.0.exp -hlibsal.so.1 -R/usr/SUNWspro/lib/rw7/v9:/usr/SUNWspro/lib/v9:/opt/SUWspro/lib/v9:/usr/ccs/lib/sparcv9:/lib/sparcv9:/usr/lib/sparcv9 -o .libs/libsalso.1.0.0 /usr/SUNWspro/prod/lib/v9/crti.o /usr/SUNWspro/prod/lib/v9/CCrti.o .libs/sal_atom.o .libs/sal_cv.o -lpthread -lposix4 -ldl -lsocket -lnsl -Y P,/usr/SUNWspro/lib/rw7/v9:/usr/SUNWspro/lib/v9:/usr/SUNWspro/prod/lib/rw7/v9:/usr/SUNWspro/prod/lib/v9:/usr/ccs/lib/sparcv9:/lib/sparcv9:/usr/lib/sparcv9 /usr/SUNWspro/prod/lib/v9/CCrt.o /usr/SUNWspro/prod/lib/v9/crtn.o >&/tmp/ld.06041.0.err
rm /tmp/lib_link.06041
rm /tmp/lib_base_link.06041
rm /tmp/ld.06041.0.err

Is this already reported? Is there any workaround - I don't want to maintain a project specific libtool.

Thanks
--jaimon







reply via email to

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