mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 10:58:11 +08:00
[ELF] - Linkerscript: reimplement readSectionExcludes()
It is not only a bit more straightforward now, but also next 2 issues are solved:
* It just crashed on ".foo : { *(EXCLUDE_FILE (*file1.o)) }" before.
* It accepted multiple EXCLUDE_FILEs in a row.
Differential revision: https://reviews.llvm.org/D24726
llvm-svn: 282060
This commit is contained in:
@@ -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 *
|
||||
|
||||
Reference in New Issue
Block a user