[PATCH] D24604: [ELF] - Implemented --sort-section cmd line option and SORT_NONE script command.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 16 11:06:41 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/LinkerScript.cpp:130-134
@@ -131,5 +129,7 @@
+getComparator(SortSectionPolicy K) {
+  if (K == SortSectionPolicy::Priority)
     return comparePriority;
-  if (K == SortByName)
+  if (K == SortSectionPolicy::Name)
     return compareName;
   return compareAlignment;
 }
----------------
Convert this to a switch with a default statement with llvm_unreacahble, so that it reports an error if SortSectionPolicy is not one of Priority, Name nor Alignment.

================
Comment at: ELF/LinkerScript.cpp:988
@@ +987,3 @@
+
+static void selectSortKind(InputSectionDescription *Cmd) {
+  if (Cmd->SortOuter == SortSectionPolicy::IgnoreConfig) {
----------------
It's hard to figure out the final output of this function. Can you describe it for me? I think it's hard to understand because you update `Cmd` and then fix its members in the second pass using this function. Why don't you set the proper values in the first place in one shot?


https://reviews.llvm.org/D24604





More information about the llvm-commits mailing list