[llvm] Add functionality to llvm-objcopy to remove prefixes (PR #79415)

Yi Kong via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 04:12:02 PST 2024


================
@@ -203,6 +203,11 @@ defm dump_section
 defm prefix_symbols
     : Eq<"prefix-symbols", "Add <prefix> to the start of every symbol name">,
       MetaVarName<"prefix">;
+defm prefix_symbols_remove
+    : Eq<"prefix-symbols-remove",
----------------
kongy wrote:

> What's the motivation behind being able to remove prefixes from symbol names?

One of our projects prefixes its symbols with llvm-objcopy using `--prefix-symbols`. When we deploy sampling pgo, we need to undo that and get the original symbol names.

> Note that removing prefixes could lead to various issues, e.g. multiple symbols with the same name in the same file, resulting in the linker not knowing the right symbol to pick, so adding this option needs to be done carefully.

Since our goal is to undo the `--prefix-symbols` action, it is guarenteed that the output symbol names will not duplicate.

https://github.com/llvm/llvm-project/pull/79415


More information about the llvm-commits mailing list