[PATCH] D61636: [llvm-objcopy] - Fix for "Bug 41775 - SymbolTableSection::addSymbol - shadow variable names"
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 7 03:40:18 PDT 2019
grimar created this revision.
grimar added reviewers: rupprecht, jhenderson, jakehehrlich.
Herald added subscribers: MaskRay, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: alexshap.
This is a fix for https://bugs.llvm.org/show_bug.cgi?id=41775,
I checked that we do not actually need this line,
since we always call `removeSectionReferences` which calls `removeSymbols` which
updates the Size:
Error SymbolTableSection::removeSymbols(
function_ref<bool(const Symbol &)> ToRemove) {
Symbols.erase(
std::remove_if(std::begin(Symbols) + 1, std::end(Symbols),
[ToRemove](const SymPtr &Sym) { return ToRemove(*Sym); }),
std::end(Symbols));
Size = Symbols.size() * EntrySize;
assignIndices();
return Error::success();
}
But I think it worth to fix this assignment instead of removing it,
that allows to relax the dependencies.
https://reviews.llvm.org/D61636
Files:
tools/llvm-objcopy/ELF/Object.cpp
Index: tools/llvm-objcopy/ELF/Object.cpp
===================================================================
--- tools/llvm-objcopy/ELF/Object.cpp
+++ tools/llvm-objcopy/ELF/Object.cpp
@@ -421,7 +421,7 @@
Sym.Size = Size;
Sym.Index = Symbols.size();
Symbols.emplace_back(llvm::make_unique<Symbol>(Sym));
- Size += this->EntrySize;
+ this->Size += this->EntrySize;
}
Error SymbolTableSection::removeSectionReferences(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61636.198425.patch
Type: text/x-patch
Size: 440 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190507/8bc9f23e/attachment.bin>
More information about the llvm-commits
mailing list