[PATCH] D23019: [ELF] - Linkerscript: support all kinds of sorting (including nested).

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 2 02:37:35 PDT 2016


grimar 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";
----------------
ruiu wrote:
> 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);
> 
Ok.


https://reviews.llvm.org/D23019





More information about the llvm-commits mailing list