aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2017-05-18 15:07:59 +0100
committerNick Clifton <nickc@redhat.com>2017-05-18 15:07:59 +0100
commit3aa2d05a728216bbb99dbb5718be9bb36429cf41 (patch)
tree634ea00884160b88e1c0c55154b963ab3652e077 /ld/ldlang.c
parent59cc050d893d1e8c75547de950a35e809588f12f (diff)
downloadgdb-3aa2d05a728216bbb99dbb5718be9bb36429cf41.zip
gdb-3aa2d05a728216bbb99dbb5718be9bb36429cf41.tar.gz
gdb-3aa2d05a728216bbb99dbb5718be9bb36429cf41.tar.bz2
Treat a prefix of "$SYSROOT" in the same way as "=" when parsing linker search paths.
PR ld/21251 * ldfile.c (ldfile_add_library_path): If the path starts with $SYSROOT then use the sysroot as the real prefix. * ldlang.c (lang_add_input_file): Treat $SYSROOT in the same way as =. * ldlex.l: Add $SYSROOT as allow prefix for a filename. * ld.texinfo (-L): Document that $SYSROOT acts like = when prefixing a library search path. (INPUT): Likewise. * testsuite/ld-scripts/sysroot-prefix.exp: Add $SYSROOT prefix tests.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 266c099..ed7e552 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -1138,11 +1138,14 @@ lang_add_input_file (const char *name,
lang_input_file_enum_type file_type,
const char *target)
{
- if (name != NULL && *name == '=')
+ if (name != NULL
+ && (*name == '=' || CONST_STRNEQ (name, "$SYSROOT")))
{
lang_input_statement_type *ret;
char *sysrooted_name
- = concat (ld_sysroot, name + 1, (const char *) NULL);
+ = concat (ld_sysroot,
+ name + (*name == '=' ? 1 : strlen ("$SYSROOT")),
+ (const char *) NULL);
/* We've now forcibly prepended the sysroot, making the input
file independent of the context. Therefore, temporarily