Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ld/ld.texi
Original file line number Diff line number Diff line change
Expand Up @@ -2355,7 +2355,9 @@ For a linker for a Linux system, if the file @file{/etc/ld.so.conf}
exists, the list of directories found in that file. Note: the path
to this file is prefixed with the @code{sysroot} value, if that is
defined, and then any @code{prefix} string if the linker was
configured with the @command{--prefix=<path>} option.
configured with the @command{--prefix=<path>} option. This has feature has
been disabled on Gentoo Linux to make it consistent with the other
linkers, which do not do this.
@item
For a native linker on a FreeBSD system, any directories specified by
the @code{_PATH_ELF_HINTS} macro defined in the @file{elf-hints.h}
Expand Down
14 changes: 3 additions & 11 deletions ld/ldelf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1090,8 +1090,8 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab,
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.
entries (native only), then the linker script LIB_SEARCH_DIRS,
then the -L arguments.

We search twice. The first time, we skip objects which may
introduce version mismatches. The second time, we force
Expand Down Expand Up @@ -1156,20 +1156,12 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab,
if (is_freebsd
&& ldelf_check_ld_elf_hints (l, force, elfsize))
break;

if (is_linux
&& ldelf_check_ld_so_conf (l, force, elfsize, prefix))
break;
}

len = strlen (l->name);
for (search = search_head; search != NULL; search = search->next)
{
char *filename;

if (search->cmdline)
continue;
filename = (char *) xmalloc (strlen (search->name) + len + 2);
char *filename = (char *) xmalloc (strlen (search->name) + len + 2);
sprintf (filename, "%s/%s", search->name, l->name);
nn.name = filename;
if (ldelf_try_needed (&nn, force, is_linux))
Expand Down