From 199fa1b7089d7f7438b087fa30504ea5a590f561 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 11 Oct 2016 12:04:42 +0100 Subject: [PATCH] Add support to the static linker for the tokens accepted by the dynamic linker when resolving search paths. PR ld/20535 * emultempl/elf32.em (_search_needed): Add support for pseudo environment variables supported by ld.so. Namely $ORIGIN, $LIB and $PLATFORM. * configure.ac: Add getauxval to list AC_CHECK_FUNCS list. * config.in: Regenerate. * configure: Regenerate. --- ld/ChangeLog | 10 ++++ ld/config.in | 3 + ld/configure | 2 +- ld/configure.ac | 2 +- ld/emultempl/elf32.em | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 166 insertions(+), 2 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 1c71de1..4c296bf 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,13 @@ +2016-10-11 Nick Clifton + + PR ld/20535 + * emultempl/elf32.em (_search_needed): Add support for pseudo + environment variables supported by ld.so. Namely $ORIGIN, $LIB + and $PLATFORM. + * configure.ac: Add getauxval to list AC_CHECK_FUNCS list. + * config.in: Regenerate. + * configure: Regenerate. + 2016-10-11 Alan Modra * ldlang.c (lang_do_assignments_1): Descend into output section diff --git a/ld/config.in b/ld/config.in index 2c6d698..5c614ed 100644 --- a/ld/config.in +++ b/ld/config.in @@ -62,6 +62,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H +/* Define to 1 if you have the `getauxval' function. */ +#undef HAVE_GETAUXVAL + /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE diff --git a/ld/configure b/ld/configure index 3f82f35..2c55b28 100755 --- a/ld/configure +++ b/ld/configure @@ -16488,7 +16488,7 @@ _ACEOF fi done -for ac_func in open lseek close +for ac_func in getauxval open lseek close do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/ld/configure.ac b/ld/configure.ac index d17281f..4542845 100644 --- a/ld/configure.ac +++ b/ld/configure.ac @@ -216,7 +216,7 @@ AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h elf-hints.h limits.h local AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h sys/stat.h) ACX_HEADER_STRING AC_CHECK_FUNCS(glob mkstemp realpath sbrk setlocale waitpid) -AC_CHECK_FUNCS(open lseek close) +AC_CHECK_FUNCS(getauxval open lseek close) AC_HEADER_DIRENT dnl AC_CHECK_HEADERS(sys/mman.h) diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 2815a3e..06f02c6 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -472,6 +472,15 @@ fragment < +#endif +EOF +fi +fragment < token might be a legitimate component of + a path name in the target's file system. */ + info_msg (_("unrecognised token '%s' in search path\n"), var); + + if (end) + /* Restore the path separator. */ + * end = '/'; + } + + free (freeme); + } + needed.name = filename; if (gld${EMULATION_NAME}_try_needed (&needed, force)) return TRUE; -- 2.7.4