[PATCH] D50381: [llvm-objcopy] Add --prefix-symbols option
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 9 08:11:30 PDT 2018
jhenderson added inline comments.
================
Comment at: test/tools/llvm-objcopy/prefix-symbols.test:33
+
+# CHECK: Symbols [
+# CHECK-NEXT: Symbol {
----------------
You can avoid having two near-identical blocks by using multiple check-prefixes:
```
# RUN: llvm-readobj -symbols %t2 | FileCheck %s --check-prefixes=COMMON,BASIC
...
# RUN: llvm-readobj -symbols %t3 | FileCheck %s --check-prefixes=COMMON,REDEF
...
# COMMON: Symbols [
# COMMON-NEXT: Symbol {
# ...
# COMMON-NEXT: Symbol {
# BASIC-NEXT: Name: prefixbar
# REDEF-NEXT: Name: prefixbaz
# COMMON-NEXT: Value: 0x0
...
```
================
Comment at: tools/llvm-objcopy/llvm-objcopy.cpp:369
+ if (!Config.SymbolsPrefix.empty() && Sym.Type != STT_SECTION)
+ Sym.Name = Config.SymbolsPrefix.str() + Sym.Name;
});
----------------
Nit: Use `.str()` on the result of this expression, so as to do the concatenation as a Twine:
```
Sym.Name = (Config.SymbolsPrefix + Sym.Name).str();
```
Repository:
rL LLVM
https://reviews.llvm.org/D50381
More information about the llvm-commits
mailing list