[PATCH] D13911: [ELF2] Determine the order of entries of symbol tables in the finalize() phase.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 20 12:58:28 PDT 2015


ruiu added inline comments.

================
Comment at: ELF/OutputSections.cpp:694-697
@@ +693,6 @@
+
+  std::stable_sort(Symbols.begin(), Symbols.end(), [](SymbolBody *L,
+                                                      SymbolBody *R) {
+    return getSymbolBinding(L) == STB_LOCAL && getSymbolBinding(R) != STB_LOCAL;
+  });
+  if (StrTabSec.isDynamic()) {
----------------
Do we have to sort them even if isDynamic() is false?

================
Comment at: ELF/OutputSections.cpp:698
@@ +697,3 @@
+  });
+  if (StrTabSec.isDynamic()) {
+    unsigned Index = 0;
----------------
Early return.

  if (!StrTabSec.isDynamic())
    return;

================
Comment at: ELF/Writer.cpp:512-514
@@ -512,4 +511,5 @@
 
-    if (isOutputDynamic() && includeInDynamicSymtab(*Body))
-      Out<ELFT>::HashTab->addSymbol(Body);
+    if (isOutputDynamic() && includeInDynamicSymtab(*Body)) {
+      Out<ELFT>::DynSymTab->addSymbol(Body);
+    }
   }
----------------
Remove {}.


http://reviews.llvm.org/D13911





More information about the llvm-commits mailing list