From 3aa2d05a728216bbb99dbb5718be9bb36429cf41 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 18 May 2017 15:07:59 +0100 Subject: 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. --- ld/ldlex.l | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ld/ldlex.l') diff --git a/ld/ldlex.l b/ld/ldlex.l index fa9b924..acba1a2 100644 --- a/ld/ldlex.l +++ b/ld/ldlex.l @@ -380,6 +380,11 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* yylval.name = xstrdup (yytext); return NAME; } +"$SYSROOT"{FILENAMECHAR1}{FILENAMECHAR}* { +/* Filename to be prefixed by --sysroot or when non-sysrooted, nothing. */ + yylval.name = xstrdup (yytext); + return NAME; + } "-l"{FILENAMECHAR}+ { yylval.name = xstrdup (yytext + 2); return LNAME; -- cgit v1.1