diff options
author | tijl <tijl@FreeBSD.org> | 2014-09-04 16:05:12 +0000 |
---|---|---|
committer | tijl <tijl@FreeBSD.org> | 2014-09-04 16:05:12 +0000 |
commit | 1e988094dcb9c82d09ef73ca891800b734cab2c1 (patch) | |
tree | 4209659de766f77bcd7531836b3d8d62056b4da3 | |
parent | 3d900a4d5b39028a3e10ae2db96ba5b9eaff1f80 (diff) | |
download | FreeBSD-src-1e988094dcb9c82d09ef73ca891800b734cab2c1.zip FreeBSD-src-1e988094dcb9c82d09ef73ca891800b734cab2c1.tar.gz |
MFC r270757:
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
-rw-r--r-- | contrib/binutils/ld/emultempl/elf32.em | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/contrib/binutils/ld/emultempl/elf32.em b/contrib/binutils/ld/emultempl/elf32.em index d9f6fbb..4f707ff 100644 --- a/contrib/binutils/ld/emultempl/elf32.em +++ b/contrib/binutils/ld/emultempl/elf32.em @@ -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 |