From: Alan Modra Date: Sat, 11 Mar 2017 12:27:29 +0000 (+1030) Subject: Rewrite add_sysroot X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=316a1245fe31e327223ca66797b789eaf9544c2c;p=binutils-gdb.git Rewrite add_sysroot Relative paths shouldn't have the sysroot prefix added. The patch also makes some attempt at supporting DOS paths, and tidies code using the new add_sysroot. * emultempl/elf32.em (gld${EMULATION_NAME}_add_sysroot): Rewrite. Only prefix absolute paths with sysroot. Handle DOS paths. (gld${EMULATION_NAME}_check_ld_elf_hints): Constify variable. (gld${EMULATION_NAME}_check_ld_so_conf): Likewise. (gld${EMULATION_NAME}_after_open): Short-circuit NULL path searches. Rename variable. Simplify get_runpath search. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index 47c07b9a5e1..f4baea87d82 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,12 @@ +2017-03-11 Alan Modra + + * emultempl/elf32.em (gld${EMULATION_NAME}_add_sysroot): Rewrite. + Only prefix absolute paths with sysroot. Handle DOS paths. + (gld${EMULATION_NAME}_check_ld_elf_hints): Constify variable. + (gld${EMULATION_NAME}_check_ld_so_conf): Likewise. + (gld${EMULATION_NAME}_after_open): Short-circuit NULL path + searches. Rename variable. Simplify get_runpath search. + 2017-03-11 Alan Modra * testsuite/ld-elf/shared.exp: Use -Wl,-export-dynamic rather diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 84adaef6dfe..16220d56d6f 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -691,41 +691,85 @@ EOF if [ "x${USE_LIBPATH}" = xyes ] ; then fragment <next) { - const char *tmpname = rp->name; - - if (IS_ABSOLUTE_PATH (tmpname)) - tmpname = gld${EMULATION_NAME}_add_sysroot (tmpname); + path = gld${EMULATION_NAME}_add_sysroot (rp->name); found = (rp->by == l->by - && gld${EMULATION_NAME}_search_needed (tmpname, - &n, + && gld${EMULATION_NAME}_search_needed (path, &n, force)); - if (tmpname != rp->name) - free ((char *) tmpname); + free ((char *) path); } if (found) break;