[PATCH] D23019: [ELF] - Linkerscript: support all kinds of sorting (including nested).
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 1 13:26:50 PDT 2016
ruiu added inline comments.
================
Comment at: ELF/LinkerScript.cpp:742
@@ +741,3 @@
+ bool Keep, int Level) {
+ StringRef Type = peek();
+ bool SortByName = Type == "SORT" || Type == "SORT_BY_NAME";
----------------
Because we have limited number of patterns, we probably should handle all pattern as a grammar rather than a computed result. I think more straightforward code is something like this.
if (skip("SORT") || skip("SORT_BY_NAME)) {
expect("(");
if (skip("SORT_by_alignment") {
InCmd->Sort = NameAlign;
expect("(");
readInputFilePattern(InCmd, Keep);
expect(")");
} else {
InCmd->Sort = Name;
readInputFilePattern(InCmd, Keep);
}
expect(")");
return;
}
if (skip("SORT_BY_ALIGNMENT")) {
expect("(");
if (skip("SORT") || skip("SORT_BY_NAME")) {
InCmd->Sort = AlignName;
expect("(");
readInputFilePattern(InCmd, Keep);
expect(")");
} else {
InCmd->Sort = Align;
readInputFilePattern(InCmd, Keep);
}
expect(")");
return;
}
readInputFilePattern(InCmd, Keep);
https://reviews.llvm.org/D23019
More information about the llvm-commits
mailing list