[PATCH] D24726: [ELF] - Linkerscript: reimplement readSectionExcludes()
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 21 02:02:04 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL282060: [ELF] - Linkerscript: reimplement readSectionExcludes() (authored by grimar).
Changed prior to commit:
https://reviews.llvm.org/D24726?vs=71909&id=72015#toc
Repository:
rL LLVM
https://reviews.llvm.org/D24726
Files:
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/test/ELF/linkerscript/exclude-multiple.s
Index: lld/trunk/ELF/LinkerScript.cpp
===================================================================
--- lld/trunk/ELF/LinkerScript.cpp
+++ lld/trunk/ELF/LinkerScript.cpp
@@ -1072,30 +1072,24 @@
// * Include .foo.2 from every file but a.o
// * Include .foo.3 from every file but b.o
void ScriptParser::readSectionExcludes(InputSectionDescription *Cmd) {
- Regex ExcludeFileRe;
- std::vector<StringRef> V;
-
- while (!Error) {
- if (skip(")")) {
- Cmd->SectionPatterns.push_back(
- {std::move(ExcludeFileRe), compileGlobPatterns(V)});
- return;
- }
-
+ while (!Error && peek() != ")") {
+ Regex ExcludeFileRe;
if (skip("EXCLUDE_FILE")) {
- if (!V.empty()) {
- Cmd->SectionPatterns.push_back(
- {std::move(ExcludeFileRe), compileGlobPatterns(V)});
- V.clear();
- }
-
expect("(");
ExcludeFileRe = readFilePatterns();
- continue;
}
- V.push_back(next());
+ std::vector<StringRef> V;
+ while (!Error && peek() != ")" && peek() != "EXCLUDE_FILE")
+ V.push_back(next());
+
+ if (!V.empty())
+ Cmd->SectionPatterns.push_back(
+ {std::move(ExcludeFileRe), compileGlobPatterns(V)});
+ else
+ setError("section pattern is expected");
}
+ expect(")");
}
InputSectionDescription *
Index: lld/trunk/test/ELF/linkerscript/exclude-multiple.s
===================================================================
--- lld/trunk/test/ELF/linkerscript/exclude-multiple.s
+++ lld/trunk/test/ELF/linkerscript/exclude-multiple.s
@@ -18,6 +18,15 @@
# CHECK-NEXT: Contents of section .foo.3:
# CHECK-NEXT: 06000000 00000000
+# RUN: echo "SECTIONS { .foo : { *(EXCLUDE_FILE (*file1.o) EXCLUDE_FILE (*file2.o) .foo.3) } }" > %t2.script
+# RUN: not ld.lld -script %t2.script %tfile1.o %tfile2.o %tfile3.o -o %t2.o 2>&1 | \
+# RUN: FileCheck %s --check-prefix=ERR
+# ERR: section pattern is expected
+
+# RUN: echo "SECTIONS { .foo : { *(EXCLUDE_FILE (*file1.o)) } }" > %t3.script
+# RUN: not ld.lld -script %t3.script %tfile1.o %tfile2.o %tfile3.o -o %t2.o 2>&1 | \
+# RUN: FileCheck %s --check-prefix=ERR
+
.section .foo.1,"a"
.quad 1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24726.72015.patch
Type: text/x-patch
Size: 2173 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160921/da0ee2e8/attachment.bin>
More information about the llvm-commits
mailing list