summaryrefslogtreecommitdiffstats
path: root/lld/ELF/ScriptParser.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2018-11-26 12:29:56 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2018-11-26 12:29:56 +0000
commitc152281632b4079fbc27de3faca8865cb8440dbc (patch)
tree35aa9baebb88e7e2568efc5ea447775ef3e64634 /lld/ELF/ScriptParser.cpp
parent4fac50e72fb6d573e067c246b068433391dca3fe (diff)
downloadbcm5719-llvm-c152281632b4079fbc27de3faca8865cb8440dbc.tar.gz
bcm5719-llvm-c152281632b4079fbc27de3faca8865cb8440dbc.zip
[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
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r--lld/ELF/ScriptParser.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index 6aed439cf4f..008439f97b4 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -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());
OpenPOWER on IntegriCloud