What is the meaning/purpose of the “=” that sometimes appears in the SEARCH_DIR command in binutils' ldscripts?

Mike Frysinger vapier@gentoo.org
Tue Jul 7 15:48:00 GMT 2015


On 07 Jul 2015 07:50, Cary Coutant wrote:
> > What is the meaning/purpose of the “=” that sometimes appears in the SEARCH_DIR command in binutils' ldscripts?
> >
> > I've searched the documentation, but cannot find an answer.  I've posted the same question on StackOverflow (http://stackoverflow.com/questions/31237263/what-is-the-meaning-purpose-of-the-that-sometimes-appears-in-the-search-dir), but have not received any feedback.  Hopefully, someone here can help me.  Below is the full question I am asking:
> >
> > When I build binutils, the ldscripts folder contains several files that are used by ld to determine how to link objects for a particular platform. In the scripts I see lines like:
> >
> > SEARCH_DIR("/Volumes/CaseSensitive/Developer/XCF/x86_64-pc-linux-gnu/gcc47/x86_64-pc-linux-gnu/lib64");
> > SEARCH_DIR("=/usr/local/lib64"); SEARCH_DIR("=/lib64"); SEARCH_DIR("=/usr/lib64"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
> >
> > What is the meaning/purpose of the "=" that appears in the SEARCH_DIR command?
> 
> The '=' causes ld to add the sysroot to the path. I suspect this is
> undocumented because it's an internal implementation detail intended
> only for the linker-provided script templates.

the latest manual does document it.  the one referenced is from binutils-2.12 
which long predates this functionality.

-L searchdir
--library-path=searchdir
...
If searchdir begins with =, then the = will be replaced by the sysroot prefix, 
controlled by the `--sysroot' option, or specified when the linker is 
configured.
...
The paths can also be specified in a link script with the SEARCH_DIR command. 
Directories specified this way are searched at the point in which the linker 
script appears in the command line.

https://sourceware.org/binutils/docs/ld/Options.html
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://sourceware.org/pipermail/binutils/attachments/20150707/5e2c5eda/attachment.sig>


More information about the Binutils mailing list