Adding to the *end* of the gnu ld library search paths

Bryce Schober bryce.schober@gmail.com
Thu Aug 25 13:32:00 GMT 2011


I know how to add to GNU ld's library search path using the -Ldir
option and use it extensively. But as far as I can tell from reading
the manuals of gcc and ld, there is no way to add to the end of the
list of library search paths.

The -L option adds to the beginning, after which it searches the
default system library paths. But I want to add a
look-here-if-you-can't-find-it-anywhwere-else path. Is there any way
to do that with ld?

I can imagine a hacky-crap solution that extracts all standard library
dirs (using -print-search-dirs) and adds them to the list of -L search
dirs in the order I desire, ahead of their implied duplicates as
default search paths...

But there must be a better way...

<><  <><  <><
Bryce Schober



More information about the Binutils mailing list