diff options
author | Fangrui Song <i@maskray.me> | 2021-12-25 23:59:27 -0800 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2021-12-25 23:59:27 -0800 |
commit | aabe901d57d6df4cd2786163359a7b2a7aae8c32 (patch) | |
tree | 3da4dfa4bb12be9e9356525b5c15016c322294bb /lld/ELF/SyntheticSections.cpp | |
parent | 20b4704da315f569d417a55313c61b792e568a07 (diff) | |
download | llvm-aabe901d57d6df4cd2786163359a7b2a7aae8c32.zip llvm-aabe901d57d6df4cd2786163359a7b2a7aae8c32.tar.gz llvm-aabe901d57d6df4cd2786163359a7b2a7aae8c32.tar.bz2 |
[ELF] Remove one redundant computeBinding
This does resolve the redundancy in includeInDynsym().
Diffstat (limited to 'lld/ELF/SyntheticSections.cpp')
-rw-r--r-- | lld/ELF/SyntheticSections.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index b877509..86b2f33 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -2116,9 +2116,8 @@ void SymbolTableBaseSection::finalizeContents() { void SymbolTableBaseSection::sortSymTabSymbols() { // Move all local symbols before global symbols. auto e = std::stable_partition( - symbols.begin(), symbols.end(), [](const SymbolTableEntry &s) { - return s.sym->isLocal() || s.sym->computeBinding() == STB_LOCAL; - }); + symbols.begin(), symbols.end(), + [](const SymbolTableEntry &s) { return s.sym->isLocal(); }); size_t numLocals = e - symbols.begin(); getParent()->info = numLocals + 1; @@ -2208,12 +2207,8 @@ template <class ELFT> void SymbolTableSection<ELFT>::writeTo(uint8_t *buf) { // Set st_info and st_other. eSym->st_other = 0; - if (sym->isLocal()) { - eSym->setBindingAndType(STB_LOCAL, sym->type); - } else { - eSym->setBindingAndType(sym->computeBinding(), sym->type); - eSym->setVisibility(sym->visibility); - } + eSym->setBindingAndType(sym->binding, sym->type); + eSym->setVisibility(sym->visibility); // The 3 most significant bits of st_other are used by OpenPOWER ABI. // See getPPC64GlobalEntryToLocalEntryOffset() for more details. |