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

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 01:23:24 PST 2024


================
@@ -0,0 +1,115 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objcopy --remove-prefix-symbols __pf_ %t %t2
+# RUN: llvm-readobj --symbols %t2 | FileCheck %s
+
+## Show that an empty string is permitted as the argument to
+## --remove-prefix-symbols.
+# RUN: llvm-objcopy --remove-prefix-symbols= %t2 %t3
+# RUN: cmp %t2 %t3
+
+## When both options are present, llvm-objcopy should remove
+## prefixes first, before adding prefixes.
+# RUN: llvm-objcopy --prefix-symbols=AAA --remove-prefix-symbols=AAA %t %t4
+# RUN: llvm-objcopy --prefix-symbols=AAA %t %t5
+# RUN: cmp %t4 %t5
----------------
jh7370 wrote:

- [ ] I think I'd prefer to see a functional rename using this, i.e. where you remove one prefix and add a different one. For example, you could remove `foo` from `foobar` and add `baz` and then check the llvm-readelf output to see what the final result looks like (it should be `bazbar`).

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


More information about the llvm-commits mailing list