Simplify isLocal().

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207421 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-04-28 14:24:44 +00:00
parent fc1cc11670
commit bb626f0ed9

View File

@ -109,8 +109,7 @@ class ELFObjectWriter : public MCObjectWriter {
static uint64_t SymbolValue(MCSymbolData &Data, const MCAsmLayout &Layout); static uint64_t SymbolValue(MCSymbolData &Data, const MCAsmLayout &Layout);
static bool isInSymtab(const MCAsmLayout &Layout, const MCSymbolData &Data, static bool isInSymtab(const MCAsmLayout &Layout, const MCSymbolData &Data,
bool Used, bool Renamed); bool Used, bool Renamed);
static bool isLocal(const MCSymbolData &Data, bool isSignature, static bool isLocal(const MCSymbolData &Data, bool isUsedInReloc);
bool isUsedInReloc);
static bool IsELFMetaDataSection(const MCSectionData &SD); static bool IsELFMetaDataSection(const MCSectionData &SD);
static uint64_t DataSectionSize(const MCSectionData &SD); static uint64_t DataSectionSize(const MCSectionData &SD);
static uint64_t GetSectionFileSize(const MCAsmLayout &Layout, static uint64_t GetSectionFileSize(const MCAsmLayout &Layout,
@ -971,20 +970,16 @@ bool ELFObjectWriter::isInSymtab(const MCAsmLayout &Layout,
return true; return true;
} }
bool ELFObjectWriter::isLocal(const MCSymbolData &Data, bool isSignature, bool ELFObjectWriter::isLocal(const MCSymbolData &Data, bool isUsedInReloc) {
bool isUsedInReloc) {
if (Data.isExternal()) if (Data.isExternal())
return false; return false;
const MCSymbol &Symbol = Data.getSymbol(); const MCSymbol &Symbol = Data.getSymbol();
const MCSymbol &RefSymbol = Symbol.AliasedSymbol(); if (Symbol.isDefined())
if (RefSymbol.isUndefined() && !RefSymbol.isVariable()) {
if (isSignature && !isUsedInReloc)
return true; return true;
if (isUsedInReloc)
return false; return false;
}
return true; return true;
} }
@ -1072,7 +1067,7 @@ ELFObjectWriter::computeSymbolTable(MCAssembler &Asm, const MCAsmLayout &Layout,
// Undefined symbols are global, but this is the first place we // Undefined symbols are global, but this is the first place we
// are able to set it. // are able to set it.
bool Local = isLocal(SD, isSignature, Used); bool Local = isLocal(SD, Used);
if (!Local && MCELF::GetBinding(SD) == ELF::STB_LOCAL) { if (!Local && MCELF::GetBinding(SD) == ELF::STB_LOCAL) {
assert(BaseSymbol); assert(BaseSymbol);
MCSymbolData &BaseData = Asm.getSymbolData(*BaseSymbol); MCSymbolData &BaseData = Asm.getSymbolData(*BaseSymbol);