[ELF] - Change consume()->expect() in INSERT AFTER parsing.

AFTER keyword is mandatory and consume() was 
used by mistake here. We accepted broken script before
this patch, testcase shows the issue.

llvm-svn: 327260
This commit is contained in:
George Rimar
2018-03-12 12:34:43 +00:00
parent 6618e2a09c
commit e3f198d58a
2 changed files with 7 additions and 1 deletions

View File

@@ -450,7 +450,7 @@ void ScriptParser::readSections() {
}
if (!atEOF() && consume("INSERT")) {
consume("AFTER");
expect("AFTER");
std::vector<BaseCommand *> &Dest = Script->InsertAfterCommands[next()];
Dest.insert(Dest.end(), V.begin(), V.end());
return;

View File

@@ -0,0 +1,6 @@
SECTIONS {
.foo : { *(.bar) }
} INSERT .data;
# RUN: not ld.lld -o %t1 --script %s 2>&1 | FileCheck %s
# CHECK: {{.*}}:3: AFTER expected, but got .data