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) if (Renamed)
return false; return false;
if (Symbol.getName() == "_GLOBAL_OFFSET_TABLE_") if (Symbol.isVariable() && Symbol.isUndefined()) {
return true; // FIXME: this is here just to diagnose the case of a var = commmon_sym.
Layout.getBaseSymbol(Symbol);
if (Symbol.isVariable()) { return false;
const MCSymbol *Base = Layout.getBaseSymbol(Symbol);
if (Base && Base->isUndefined())
return false;
} }
bool IsGlobal = Symbol.getBinding() == ELF::STB_GLOBAL; if (Symbol.isUndefined() && !Symbol.isBindingSet())
if (!Symbol.isVariable() && Symbol.isUndefined() && !IsGlobal)
return false; return false;
if (Symbol.getType() == ELF::STT_SECTION) if (Symbol.getType() == ELF::STT_SECTION)