diff options
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
-rw-r--r-- | lld/ELF/LinkerScript.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 7101c7fa433..a0bffce6383 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -1072,30 +1072,24 @@ SortSectionPolicy ScriptParser::readSortKind() { // * 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 * |