Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/gpl3/binutils/dist/ld/emultempl PR 47922: Properly ...
details: https://anonhg.NetBSD.org/src/rev/a3c3b79c2b38
branches: trunk
changeset: 787600:a3c3b79c2b38
user: joerg <joerg%NetBSD.org@localhost>
date: Tue Jun 25 19:38:54 2013 +0000
description:
PR 47922: Properly resolve DT_NEEDED entries under sysroot and don't
accidently try the installed system.
diffstat:
external/gpl3/binutils/dist/ld/emultempl/elf32.em | 39 +++++++++++++++-------
1 files changed, 27 insertions(+), 12 deletions(-)
diffs (108 lines):
diff -r bbe569a3c93a -r a3c3b79c2b38 external/gpl3/binutils/dist/ld/emultempl/elf32.em
--- a/external/gpl3/binutils/dist/ld/emultempl/elf32.em Tue Jun 25 17:38:38 2013 +0000
+++ b/external/gpl3/binutils/dist/ld/emultempl/elf32.em Tue Jun 25 19:38:54 2013 +0000
@@ -452,15 +452,25 @@
static bfd_boolean
gld${EMULATION_NAME}_search_needed (const char *path,
- struct dt_needed *n, int force)
+ struct dt_needed *n, int force, int prepend_sysroot)
{
const char *s;
const char *name = n->name;
size_t len;
struct dt_needed needed;
- if (name[0] == '/')
+ if (name[0] == '/') {
+ if (prepend_sysroot && ld_sysroot) {
+ bfd_boolean rv;
+ needed.by = n->by;
+ char *filename= concat(ld_sysroot, n->name, (const char *)NULL);
+ needed.name = filename;
+ rv = gld${EMULATION_NAME}_try_needed (&needed, force);
+ free(filename);
+ return rv;
+ }
return gld${EMULATION_NAME}_try_needed (n, force);
+ }
if (path == NULL || *path == '\0')
return FALSE;
@@ -499,6 +509,13 @@
}
strcpy (sset, name);
+ if (prepend_sysroot && filename[0] == '=')
+ abort();
+ if (filename[0] == '/' && prepend_sysroot && ld_sysroot) {
+ char *filename2 = concat(ld_sysroot, filename, (const char *)NULL);
+ free(filename);
+ filename = filename2;
+ }
needed.name = filename;
if (gld${EMULATION_NAME}_try_needed (&needed, force))
return TRUE;
@@ -613,7 +630,7 @@
needed.by = NULL;
needed.name = name;
return gld${EMULATION_NAME}_search_needed (ld_elf_hints, & needed,
- force);
+ force, 0);
}
EOF
# FreeBSD
@@ -824,7 +841,7 @@
needed.by = NULL;
needed.name = name;
- return gld${EMULATION_NAME}_search_needed (ld_so_conf, &needed, force);
+ return gld${EMULATION_NAME}_search_needed (ld_so_conf, &needed, force, 0);
}
EOF
@@ -1256,13 +1273,13 @@
fragment <<EOF
if (gld${EMULATION_NAME}_search_needed (command_line.rpath_link,
- &n, force))
+ &n, force, 0))
break;
EOF
if [ "x${USE_LIBPATH}" = xyes ] ; then
fragment <<EOF
if (gld${EMULATION_NAME}_search_needed (command_line.rpath,
- &n, force))
+ &n, force, 1))
break;
EOF
fi
@@ -1273,11 +1290,11 @@
{
lib_path = (const char *) getenv ("LD_RUN_PATH");
if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
- force))
+ force, 0))
break;
}
lib_path = (const char *) getenv ("LD_LIBRARY_PATH");
- if (gld${EMULATION_NAME}_search_needed (lib_path, &n, force))
+ if (gld${EMULATION_NAME}_search_needed (lib_path, &n, force, 0))
break;
EOF
fi
@@ -1287,12 +1304,10 @@
rp = bfd_elf_get_runpath_list (link_info.output_bfd, &link_info);
for (; !found && rp != NULL; rp = rp->next)
{
- char *tmpname = gld${EMULATION_NAME}_add_sysroot (rp->name);
found = (rp->by == l->by
- && gld${EMULATION_NAME}_search_needed (tmpname,
+ && gld${EMULATION_NAME}_search_needed (rp->name,
&n,
- force));
- free (tmpname);
+ force, 1));
}
if (found)
break;
Home |
Main Index |
Thread Index |
Old Index