mirror of
https://github.com/intel/llvm.git
synced 2026-01-25 01:07:04 +08:00
[LLD][ELF] - Do not crash when parsing the -defsym option from a error state.
When we are in a error state, script parser will not parse the -defsym
expression and hence will not tokenize it. Then ScriptLexer::Pos will be 0
and LLD will assert and crash here:
MemoryBufferRef ScriptLexer::getCurrentMB() {
assert(!MBs.empty() && Pos > 0); // Bang !
Solution - stop parsing the defsym in a error state. That is consistent
with the regular case (when we parse the linker script).
llvm-svn: 347549
This commit is contained in:
@@ -271,6 +271,8 @@ void ScriptParser::readLinkerScript() {
|
||||
}
|
||||
|
||||
void ScriptParser::readDefsym(StringRef Name) {
|
||||
if (errorCount())
|
||||
return;
|
||||
Expr E = readExpr();
|
||||
if (!atEOF())
|
||||
setError("EOF expected, but got " + next());
|
||||
|
||||
Reference in New Issue
Block a user