This is the mail archive of the
mailing list for the binutils project.
gnu ld searchpath
- From: Vinitha Vijayan <vinitha dot vijayann at gmail dot com>
- To: binutils at sourceware dot org
- Date: Thu, 28 May 2015 17:23:18 +0530
- Subject: gnu ld searchpath
- Authentication-results: sourceware.org; auth=none
Sorry if I am posting to a wrong mailing list.
As per the gnu ld documentation,
" The linker uses the following search paths to locate required shared
1. Any directories specified by -rpath-link options.
2. Any directories specified by -rpath options. The difference between
-rpath and -rpath-link is that directories specified by -rpath options
are included in the executable and used at runtime, whereas the
-rpath-link option is only effective at link time. Searching -rpath in
this way is only supported by native linkers and cross linkers which
have been configured with the --with-sysroot option.
3. On an ELF system, for native linkers, if the -rpath and -rpath-link
options were not used, search the contents of the environment variable
4. On SunOS, if the -rpath option was not used, search any directories
specified using -L options.
5. For a native linker, search the contents of the environment
6. For a native ELF linker, the directories in DT_RUNPATH or DT_RPATH
of a shared library are searched for shared libraries needed by it.
The DT_RPATH entries are ignored if DT_RUNPATH entries exist.
7. The default directories, normally /lib and /usr/lib.
8. For a native linker on an ELF system, if the file /etc/ld.so.conf
exists, the list of directories found in that file.
I have doubt regarding the last point i.e, "8. For a native linker on
an ELF system, if the file /etc/ld.so.conf exists, the list of
directories found in that file."
Does this mean, if I have placed a local shared lib " libfoo.so" in a
local path e.g, /usr/local/foo/lib and add this path in
/etc/ld.so.conf or /etc/ld.so.conf.d/libfoo.conf, the following will
gcc main.c -lfoo
The above doesn't seems to work in with a native linker in a native
armhf environment, unless I pass -L/usr/local/foo/lib in the command
Is this the expected behavior for gnu ld ? And ld.so.conf file entries
only affect runtime linker (ld-linux*.so) searchpaths ?