This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
specs file problem with *link and -Wl,-rpath
- From: "Sal Paradise" <mr94rnp02 at sneakemail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: 11 Jan 2006 01:51:36 -0000
- Subject: specs file problem with *link and -Wl,-rpath
- Encoding: 8bit
Hello,
I am building gcc 3.3.5 from source on my system (x86 Linux). I am attempting to modify the specs file in order to give gcc a default rpath on my system. However, I do not want gcc to insert this default rpath if the user specifies -Wl,-rpath,/whatever on the command line.
I attempted to do this in the specs file:
*link:
%{!static:--eh-frame-hdr} -m elf_i386 %{shared:-shared} %{!shared: %{!ibcs: %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /mylib/ld-linux.so.2} %{!Wl,-rpath*:-rpath /mylib}} %{static:-static}}}
Unfortunately, strace -f reveals that the "-rpath /mylib" is always passed to ld (regardless of the presence of the -Wl,-rpath argument on the gcc command line). This is bad because this default rpath gets precedence over the one the user specifies (the user's choice gets concatenated after the default by ld).
Am I missing something here? Is the this option treated specially in the specs file language? For what it is worth, the conditionality of the dynamic linker option also seems broken (and that part is from the stock file; not my modification). It gets passed to ld even when users specify -Wl,--dynamic-linker (but it ends up working inadvertently because ld takes the second one which is the one from the command line).
Please cc: me on the reply (I am not subscribed to this list).
Thanks