diff options
author | Alexander Shaposhnikov <shal1t712@gmail.com> | 2018-04-26 18:28:17 +0000 |
---|---|---|
committer | Alexander Shaposhnikov <shal1t712@gmail.com> | 2018-04-26 18:28:17 +0000 |
commit | 40e9bdf9af45e8693239f2781703d65ed31f0d9f (patch) | |
tree | e385db418e4c429b95497fad6ee316455f97bb94 /llvm/tools/llvm-objcopy/Object.cpp | |
parent | 15c0515a2171bd2be2506e18e292731ef9fb10b6 (diff) | |
download | bcm5719-llvm-40e9bdf9af45e8693239f2781703d65ed31f0d9f.tar.gz bcm5719-llvm-40e9bdf9af45e8693239f2781703d65ed31f0d9f.zip |
[llvm-objcopy] Implement --redefine-sym option
This diff implements --redefine-sym option
for changing the name of a symbol.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D46029
llvm-svn: 330973
Diffstat (limited to 'llvm/tools/llvm-objcopy/Object.cpp')
-rw-r--r-- | llvm/tools/llvm-objcopy/Object.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/llvm/tools/llvm-objcopy/Object.cpp b/llvm/tools/llvm-objcopy/Object.cpp index c7ce2309ffb..07b60367b9e 100644 --- a/llvm/tools/llvm-objcopy/Object.cpp +++ b/llvm/tools/llvm-objcopy/Object.cpp @@ -202,15 +202,9 @@ void SymbolTableSection::removeSectionReferences(const SectionBase *Sec) { assignIndices(); } -void SymbolTableSection::localize( - std::function<bool(const Symbol &)> ToLocalize) { - for (const auto &Sym : Symbols) { - if (ToLocalize(*Sym)) - 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. +void SymbolTableSection::updateSymbols(function_ref<void(Symbol &)> Callable) { + for (auto &Sym : Symbols) + Callable(*Sym); std::stable_partition( std::begin(Symbols), std::end(Symbols), [](const SymPtr &Sym) { return Sym->Binding == STB_LOCAL; }); |