bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/6753] -L order is not respected when searching for -l<libname>,


From: funtoos at yahoo dot com
Subject: [Bug ld/6753] -L order is not respected when searching for -l<libname>, but -T fixes it
Date: 23 Jul 2008 20:38:07 -0000

------- Additional Comments From funtoos at yahoo dot com  2008-07-23 20:38 
-------
OK, I thought it would be that easy and messed up confusing -rpath-link with -L.

But I sidetracked from the original bug, which is about a prefix install and -T
fixing it. Assuming, you have installed binutils with --prefix=$PREFIX, do this:

cd /tmp/mydir
gcc -shared -o libmylib.so mysymbol.o
mv libmylib.so $PREFIX/usr/lib/libmylib.so
cp /usr/lib/libcwait.so /usr/lib/libmylib.so
gcc -o mymain mymain.o -L$PREFIX/usr/lib -L/usr/lib -lmylib

It won't honor the -L$PREFIX/usr/lib but pick libmylib.so up from /usr/lib. But
when you get the command line for ld using gcc -c followed by collect2 -v, and
use -T option to specify the linker script, it will work. Linker script used in
both cases (internal or external with -T) is same as can be seen from --verbose
output.

In my case, it was:

/scratch/devsk/usr/bin/ld -v -T
/scratch/devsk/usr/lib/binutils/i686-pc-linux-gnu/2.18.50.0.7/ldscripts/elf_i386.xc
--eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o mymain
/usr/lib/crt1.o /usr/lib/crti.o
/scratch/devsk/usr/lib/gcc/i686-pc-linux-gnu/4.2.4/crtbegin.o
-L/scratch/devsk/usr/lib -L/usr/lib
-L/scratch/devsk/usr/lib/gcc/i686-pc-linux-gnu/4.2.4
-L/scratch/devsk/usr/lib/gcc/i686-pc-linux-gnu/4.2.4/../../../../i686-pc-linux-gnu/lib
-L/scratch/devsk/usr/lib/gcc/i686-pc-linux-gnu/4.2.4/../../.. mymain.o  -lmylib
-lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s
--no-as-needed /scratch/devsk/usr/lib/gcc/i686-pc-linux-gnu/4.2.4/crtend.o
/usr/lib/crtn.o



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW


http://sourceware.org/bugzilla/show_bug.cgi?id=6753

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

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