[PATCH] D46029: [llvm-objcopy] Implement --redefine-sym option

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 25 12:02:19 PDT 2018


jakehehrlich added inline comments.


================
Comment at: tools/llvm-objcopy/Object.cpp:208
+    Callable(*Sym);
+}
 
----------------
Can you add in the stable_partition + assignIndices code used in localize here. It's unfortunately more expensive but it means that forEachSymbol can be used with impunity and without thought.


================
Comment at: tools/llvm-objcopy/Object.cpp:210-231
+void SymbolTableSection::localizeHidden() {
+  forEachSymbol([](Symbol &Sym) {
+    if (Sym.Visibility == STV_HIDDEN || Sym.Visibility == STV_INTERNAL)
+      Sym.Binding = STB_LOCAL;
+  });
   // Now that the local symbols aren't grouped at the start we have to reorder
   // the symbols to respect this property.
----------------
Sorry, I didn't state some of my motivations. I wanted everything to happen in a single "pass" (in reality 3 passes are used) and for SymbolTable to have a minimal complete interface. So localizeHidden and renameSymbols can be implemented in terms of forEachSymbol in HandleArgs. The point is to accumulate symbol modifications and then to apply them in one "pass" like we do for section modifications. The single "pass" is also something James wants.


Repository:
  rL LLVM

https://reviews.llvm.org/D46029





More information about the llvm-commits mailing list