[lld] c0fc09a - [ELF] Remove config->relocatable condition from Symbol::computeBinding
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 15 23:49:52 PST 2022
Author: Fangrui Song
Date: 2022-01-15T23:49:48-08:00
New Revision: c0fc09ab91f9e84f176822c7d7c9dc7221f4cd98
URL: https://github.com/llvm/llvm-project/commit/c0fc09ab91f9e84f176822c7d7c9dc7221f4cd98
DIFF: https://github.com/llvm/llvm-project/commit/c0fc09ab91f9e84f176822c7d7c9dc7221f4cd98.diff
LOG: [ELF] Remove config->relocatable condition from Symbol::computeBinding
Added:
Modified:
lld/ELF/Symbols.cpp
lld/ELF/Writer.cpp
Removed:
################################################################################
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index 5aa585d7bfe0..221a89ac4961 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -268,8 +268,6 @@ MemoryBufferRef LazyArchive::getMemberBuffer() {
}
uint8_t Symbol::computeBinding() const {
- if (config->relocatable)
- return binding;
if ((visibility != STV_DEFAULT && visibility != STV_PROTECTED) ||
(versionId == VER_NDX_LOCAL && !isLazy()))
return STB_LOCAL;
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index b87123a216bc..4ff3ec5849f1 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -1972,7 +1972,8 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
for (Symbol *sym : symtab->symbols()) {
if (!sym->isUsedInRegularObj || !includeInSymtab(*sym))
continue;
- sym->binding = sym->computeBinding();
+ if (!config->relocatable)
+ sym->binding = sym->computeBinding();
if (in.symTab)
in.symTab->addSymbol(sym);
More information about the llvm-commits
mailing list