Store whether a symbol is a comdat signature in MCSymbolELF.

With this getBinging can now return the correct answer for all cases not
involving a .symver and the elf writer doesn't need to patch it last minute.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238980 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2015-06-03 21:41:59 +00:00
parent 2b9f4dc654
commit f3857c334f
4 changed files with 27 additions and 26 deletions

View File

@@ -24,10 +24,20 @@ void MCSymbolELF::setBinding(unsigned Binding) const {
}
unsigned MCSymbolELF::getBinding() const {
uint32_t Binding = (getFlags() & (0xf << ELF_STB_Shift)) >> ELF_STB_Shift;
assert(Binding == ELF::STB_LOCAL || Binding == ELF::STB_GLOBAL ||
Binding == ELF::STB_WEAK || Binding == ELF::STB_GNU_UNIQUE);
return Binding;
if (isBindingSet()) {
uint32_t Binding = (getFlags() & (0xf << ELF_STB_Shift)) >> ELF_STB_Shift;
assert(Binding == ELF::STB_LOCAL || Binding == ELF::STB_GLOBAL ||
Binding == ELF::STB_WEAK || Binding == ELF::STB_GNU_UNIQUE);
return Binding;
}
if (isDefined())
return ELF::STB_LOCAL;
if (isUsedInReloc())
return ELF::STB_GLOBAL;
if (isSignature())
return ELF::STB_LOCAL;
return ELF::STB_GLOBAL;
}
void MCSymbolELF::setType(unsigned Type) const {
@@ -86,4 +96,7 @@ bool MCSymbolELF::isUsedInReloc() const {
return UsedInReloc;
}
void MCSymbolELF::setIsSignature() const { IsSignature = true; }
bool MCSymbolELF::isSignature() const { return IsSignature; }
}