[PATCH] D70212: [llvm-objcopy][MachO] Implement --redefine-sym and --redefine-syms

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 02:06:08 PST 2019


jhenderson added inline comments.


================
Comment at: llvm/test/tools/llvm-objcopy/MachO/redefine-symbol.s:3
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %s -o %t
+
----------------
Any reason you're not using yaml2obj for this?


================
Comment at: llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp:53-57
+  for (SymbolEntry &Sym : Obj.SymTable) {
+    auto I = Config.SymbolsToRename.find(Sym.Name);
+    if (I != Config.SymbolsToRename.end())
+      Sym.Name = I->getValue();
+  }
----------------
It looks like there's currently no way to remove individual symbols by name in llvm-objcopy for Mach-O, but I wanted to make sure that this is the right order, i.e. symbols are renamed before they are checked for removal, to make sure things don't break in the future.

For example does `objcopy --redefine-sym foo=bar -N foo test.o` leave a symbol called bar?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70212/new/

https://reviews.llvm.org/D70212





More information about the llvm-commits mailing list