[lld] r327260 - [ELF] - Change consume()->expect() in INSERT AFTER parsing.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 12 05:34:43 PDT 2018
Author: grimar
Date: Mon Mar 12 05:34:43 2018
New Revision: 327260
URL: http://llvm.org/viewvc/llvm-project?rev=327260&view=rev
Log:
[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.
Added:
lld/trunk/test/ELF/linkerscript/insert-broken.test
Modified:
lld/trunk/ELF/ScriptParser.cpp
Modified: lld/trunk/ELF/ScriptParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ScriptParser.cpp?rev=327260&r1=327259&r2=327260&view=diff
==============================================================================
--- lld/trunk/ELF/ScriptParser.cpp (original)
+++ lld/trunk/ELF/ScriptParser.cpp Mon Mar 12 05:34:43 2018
@@ -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;
Added: lld/trunk/test/ELF/linkerscript/insert-broken.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/insert-broken.test?rev=327260&view=auto
==============================================================================
--- lld/trunk/test/ELF/linkerscript/insert-broken.test (added)
+++ lld/trunk/test/ELF/linkerscript/insert-broken.test Mon Mar 12 05:34:43 2018
@@ -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
More information about the llvm-commits
mailing list