Pass Binding instead of IsWeak to addBitcode.

We were computing the binding on both the caller and callee.

llvm-svn: 280156
This commit is contained in:
Rafael Espindola 2016-08-30 20:53:26 +00:00
parent 991b12bf09
commit cceb92a075
3 changed files with 6 additions and 8 deletions

View File

@ -635,8 +635,7 @@ Symbol *BitcodeFile::createSymbol(const DenseSet<const Comdat *> &KeptComdats,
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 DenseSet<const Comdat *> &KeptComdats,
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);
}

View File

@ -460,7 +460,7 @@ void SymbolTable<ELFT>::addShared(SharedFile<ELFT> *F, StringRef Name,
}
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(StringRef Name, bool IsWeak,
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)

View File

@ -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,