mirror of
https://github.com/intel/llvm.git
synced 2026-01-25 09:13:38 +08:00
[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:
@@ -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;
|
||||
|
||||
6
lld/test/ELF/linkerscript/insert-broken.test
Normal file
6
lld/test/ELF/linkerscript/insert-broken.test
Normal 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
|
||||
Reference in New Issue
Block a user