[lld] r280156 - Pass Binding instead of IsWeak to addBitcode.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 30 13:53:26 PDT 2016
Author: rafael
Date: Tue Aug 30 15:53:26 2016
New Revision: 280156
URL: http://llvm.org/viewvc/llvm-project?rev=280156&view=rev
Log:
Pass Binding instead of IsWeak to addBitcode.
We were computing the binding on both the caller and callee.
Modified:
lld/trunk/ELF/InputFiles.cpp
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/SymbolTable.h
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=280156&r1=280155&r2=280156&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Tue Aug 30 15:53:26 2016
@@ -635,8 +635,7 @@ Symbol *BitcodeFile::createSymbol(const
StringRef NameRef = Saver.save(StringRef(Name));
uint32_t Flags = Sym.getFlags();
- bool IsWeak = Flags & BasicSymbolRef::SF_Weak;
- uint32_t Binding = IsWeak ? STB_WEAK : STB_GLOBAL;
+ uint32_t Binding = (Flags & BasicSymbolRef::SF_Weak) ? STB_WEAK : STB_GLOBAL;
uint8_t Type = STT_NOTYPE;
bool CanOmitFromDynSym = false;
@@ -681,7 +680,7 @@ Symbol *BitcodeFile::createSymbol(const
Binding, Visibility, STT_OBJECT,
HasUnnamedAddr, this);
}
- return Symtab<ELFT>::X->addBitcode(NameRef, IsWeak, Visibility, Type,
+ return Symtab<ELFT>::X->addBitcode(NameRef, Binding, Visibility, Type,
CanOmitFromDynSym, HasUnnamedAddr, this);
}
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=280156&r1=280155&r2=280156&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Tue Aug 30 15:53:26 2016
@@ -460,7 +460,7 @@ void SymbolTable<ELFT>::addShared(Shared
}
template <class ELFT>
-Symbol *SymbolTable<ELFT>::addBitcode(StringRef Name, bool IsWeak,
+Symbol *SymbolTable<ELFT>::addBitcode(StringRef Name, uint8_t Binding,
uint8_t StOther, uint8_t Type,
bool CanOmitFromDynSym,
bool HasUnnamedAddr, BitcodeFile *F) {
@@ -469,8 +469,7 @@ Symbol *SymbolTable<ELFT>::addBitcode(St
std::tie(S, WasInserted) =
insert(Name, Type, StOther & 3, CanOmitFromDynSym, HasUnnamedAddr,
/*IsUsedInRegularObj*/ false, F);
- int Cmp = compareDefinedNonCommon<ELFT>(S, WasInserted,
- IsWeak ? STB_WEAK : STB_GLOBAL);
+ int Cmp = compareDefinedNonCommon<ELFT>(S, WasInserted, Binding);
if (Cmp > 0)
replaceBody<DefinedBitcode>(S, Name, StOther, Type, F);
else if (Cmp == 0)
Modified: lld/trunk/ELF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.h?rev=280156&r1=280155&r2=280156&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.h (original)
+++ lld/trunk/ELF/SymbolTable.h Tue Aug 30 15:53:26 2016
@@ -72,8 +72,8 @@ public:
void addLazyArchive(ArchiveFile *F, const llvm::object::Archive::Symbol S);
void addLazyObject(StringRef Name, LazyObjectFile &Obj);
- Symbol *addBitcode(StringRef Name, bool IsWeak, uint8_t StOther, uint8_t Type,
- bool CanOmitFromDynSym, bool HasUnnamedAddr,
+ Symbol *addBitcode(StringRef Name, uint8_t Binding, uint8_t StOther,
+ uint8_t Type, bool CanOmitFromDynSym, bool HasUnnamedAddr,
BitcodeFile *File);
Symbol *addCommon(StringRef N, uint64_t Size, uint64_t Alignment,
More information about the llvm-commits
mailing list