In r253839 the default behaviour of ld(1) was changed such that all
libraries that need to be linked into an executable or library have to be listed on the command line explicitly. This commit fixes a bug in ld(1) where it would scan dependencies of the libraries on the command line and link them if needed if they were also found in ld.so.cache. The important bit of the patch is the initialisation of needed.by such that libraries found by scanning dependencies are marked as such and not used in the link. The patch is a backport of binutils git commit d5c8b1f8561426b41aa5330ed60f578178fe6be2 The author gave permission to use it under GPLv2 terms. PR: 192062 Exp-run by: antoine MFC after: 1 week
This commit is contained in:
parent
3a41cafaa4
commit
f71e540b0a
@ -541,7 +541,8 @@ EOF
|
||||
#endif
|
||||
|
||||
static bfd_boolean
|
||||
gld${EMULATION_NAME}_check_ld_elf_hints (const char *name, int force)
|
||||
gld${EMULATION_NAME}_check_ld_elf_hints (const struct bfd_link_needed_list *l,
|
||||
int force)
|
||||
{
|
||||
static bfd_boolean initialized;
|
||||
static char *ld_elf_hints;
|
||||
@ -584,10 +585,9 @@ gld${EMULATION_NAME}_check_ld_elf_hints (const char *name, int force)
|
||||
if (ld_elf_hints == NULL)
|
||||
return FALSE;
|
||||
|
||||
needed.by = NULL;
|
||||
needed.name = name;
|
||||
return gld${EMULATION_NAME}_search_needed (ld_elf_hints, & needed,
|
||||
force);
|
||||
needed.by = l->by;
|
||||
needed.name = l->name;
|
||||
return gld${EMULATION_NAME}_search_needed (ld_elf_hints, &needed, force);
|
||||
}
|
||||
EOF
|
||||
# FreeBSD
|
||||
@ -759,7 +759,8 @@ gld${EMULATION_NAME}_parse_ld_so_conf
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
gld${EMULATION_NAME}_check_ld_so_conf (const char *name, int force)
|
||||
gld${EMULATION_NAME}_check_ld_so_conf (const struct bfd_link_needed_list *l,
|
||||
int force)
|
||||
{
|
||||
static bfd_boolean initialized;
|
||||
static char *ld_so_conf;
|
||||
@ -794,8 +795,8 @@ gld${EMULATION_NAME}_check_ld_so_conf (const char *name, int force)
|
||||
return FALSE;
|
||||
|
||||
|
||||
needed.by = NULL;
|
||||
needed.name = name;
|
||||
needed.by = l->by;
|
||||
needed.name = l->name;
|
||||
return gld${EMULATION_NAME}_search_needed (ld_so_conf, &needed, force);
|
||||
}
|
||||
|
||||
@ -1037,7 +1038,7 @@ if [ "x${USE_LIBPATH}" = xyes ] ; then
|
||||
case ${target} in
|
||||
*-*-freebsd* | *-*-dragonfly*)
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
if (gld${EMULATION_NAME}_check_ld_elf_hints (l->name, force))
|
||||
if (gld${EMULATION_NAME}_check_ld_elf_hints (l, force))
|
||||
break;
|
||||
EOF
|
||||
# FreeBSD
|
||||
@ -1046,7 +1047,7 @@ EOF
|
||||
*-*-linux-* | *-*-k*bsd*-*)
|
||||
# Linux
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
|
||||
if (gld${EMULATION_NAME}_check_ld_so_conf (l, force))
|
||||
break;
|
||||
|
||||
EOF
|
||||
|
Loading…
Reference in New Issue
Block a user