Simplify the logic in ELFObjectWriter::isInSymtab. NFC.

_GLOBAL_OFFSET_TABLE_ is not magical and we can now directly check for a
symbol never getting an explicit binding.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238978 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2015-06-03 21:23:21 +00:00
parent 96fdaa4f50
commit a41438c5d8

View File

@ -740,17 +740,13 @@ bool ELFObjectWriter::isInSymtab(const MCAsmLayout &Layout,
if (Renamed)
return false;
if (Symbol.getName() == "_GLOBAL_OFFSET_TABLE_")
return true;
if (Symbol.isVariable()) {
const MCSymbol *Base = Layout.getBaseSymbol(Symbol);
if (Base && Base->isUndefined())
return false;
if (Symbol.isVariable() && Symbol.isUndefined()) {
// FIXME: this is here just to diagnose the case of a var = commmon_sym.
Layout.getBaseSymbol(Symbol);
return false;
}
bool IsGlobal = Symbol.getBinding() == ELF::STB_GLOBAL;
if (!Symbol.isVariable() && Symbol.isUndefined() && !IsGlobal)
if (Symbol.isUndefined() && !Symbol.isBindingSet())
return false;
if (Symbol.getType() == ELF::STT_SECTION)