This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: i386-pc-nto-qnx patch
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Graeme Peterson <gp at qnx dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Thu, 18 Apr 2002 12:48:34 +0930
- Subject: Re: i386-pc-nto-qnx patch
- References: <200204172005.QAA1212454@gp2>
I'll review the rest later, just addressing this particular point here.
On Wed, Apr 17, 2002 at 04:05:10PM -0400, Graeme Peterson wrote:
> - ld/emultempl/elf32.em
> I have a #if 0 with a comment. This is so you can see
> why I think the code should be removed in the general case
> for everyone, and then we can comment on the correctness
> or lack thereof.
> + #if 0
> + /* This was removed to allow the linker to search in library
> + paths supplied at the command-line when looking for libs that
> + are in DT_NEEDED sections of shared libraries.
> + GP March 25, 2002 */
> +
> if (search->cmdline)
> continue;
> + #endif
Did you read the following comment?
/* We need to find this file and include the symbol table. We
want to search for the file in the same way that the dynamic
linker will search. That means that we want to use
rpath_link, rpath, then the environment variable
LD_LIBRARY_PATH (native only), then the DT_RPATH/DT_RUNPATH
entries (native only), then the linker script LIB_SEARCH_DIRS.
We do not search using the -L arguments.
We search twice. The first time, we skip objects which may
introduce version mismatches. The second time, we force
their use. See gld${EMULATION_NAME}_vercheck comment. */
Particularly the phrase "same way that the dynamic linker will search".
That's why -L shouldn't change the search path for shared libraries.
If you really want to do something weird with shared lib search paths,
you should be using -rpath-link (which affects just the linker), or
-rpath (which affects linker and dynamic linker).
--
Alan Modra
IBM OzLabs - Linux Technology Centre