[ELF] Support symbol names with space in linker script expressions

Fix PR51961

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D110490
This commit is contained in:
Fangrui Song
2021-09-27 09:50:41 -07:00
parent 59540b29f8
commit 2bf06d9345
2 changed files with 8 additions and 5 deletions

View File

@@ -1429,8 +1429,9 @@ Expr ScriptParser::readPrimary() {
return [=] { return *val; };
// Tok is a symbol name.
tok = unquote(tok);
if (!isValidSymbolName(tok))
if (tok.startswith("\""))
tok = unquote(tok);
else if (!isValidSymbolName(tok))
setError("malformed number: " + tok);
script->referencedSymbols.push_back(tok);
return [=] { return script->getSymbolValue(tok, location); };