diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-05-29 14:20:40 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-05-29 14:20:40 +0000 |
commit | 10d238751e4e887fb7dc5142da04f640fb3504f8 (patch) | |
tree | e63af28d613120430c879e9a1bda08e625530d34 /llvm/lib/MC/ELFObjectWriter.cpp | |
parent | b45fb36f2060f171e07a2b96bce0e9d096e9dcd5 (diff) | |
download | bcm5719-llvm-10d238751e4e887fb7dc5142da04f640fb3504f8.tar.gz bcm5719-llvm-10d238751e4e887fb7dc5142da04f640fb3504f8.zip |
Fix ELFObjectWriter::isLocal for signature symbols.
And with that simplify the logic for inserting them in ExternalSymbolData or
LocalSymbolData.
No functionality change overall since the old code avoided the isLocal bug.
llvm-svn: 238555
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/ELFObjectWriter.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index 9bfe679b449..827a1e3b6d7 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -74,7 +74,8 @@ class ELFObjectWriter : public MCObjectWriter { static uint64_t SymbolValue(const MCSymbol &Sym, const MCAsmLayout &Layout); static bool isInSymtab(const MCAsmLayout &Layout, const MCSymbol &Symbol, bool Used, bool Renamed); - static bool isLocal(const MCSymbol &Symbol, bool isUsedInReloc); + static bool isLocal(const MCSymbol &Symbol, bool IsUsedInReloc, + bool IsSignature); /// Helper struct for containing some precomputed information on symbols. struct ELFSymbolData { @@ -766,7 +767,8 @@ bool ELFObjectWriter::isInSymtab(const MCAsmLayout &Layout, return true; } -bool ELFObjectWriter::isLocal(const MCSymbol &Symbol, bool isUsedInReloc) { +bool ELFObjectWriter::isLocal(const MCSymbol &Symbol, bool IsUsedInReloc, + bool IsSignature) { const MCSymbolData &Data = Symbol.getData(); if (Data.isExternal()) return false; @@ -774,10 +776,10 @@ bool ELFObjectWriter::isLocal(const MCSymbol &Symbol, bool isUsedInReloc) { if (Symbol.isDefined()) return true; - if (isUsedInReloc) + if (IsUsedInReloc) return false; - return true; + return IsSignature; } void ELFObjectWriter::computeSymbolTable( @@ -825,7 +827,7 @@ void ELFObjectWriter::computeSymbolTable( // Undefined symbols are global, but this is the first place we // are able to set it. - bool Local = isLocal(Symbol, Used); + bool Local = isLocal(Symbol, Used, isSignature); if (!Local && MCELF::GetBinding(SD) == ELF::STB_LOCAL) { assert(BaseSymbol); MCSymbolData &BaseData = BaseSymbol->getData(); @@ -900,9 +902,7 @@ void ELFObjectWriter::computeSymbolTable( if (MCELF::GetType(SD) != ELF::STT_SECTION) MSD.Name = StrTabBuilder.add(Name); - if (MSD.SectionIndex == ELF::SHN_UNDEF) - ExternalSymbolData.push_back(MSD); - else if (Local) + if (Local) LocalSymbolData.push_back(MSD); else ExternalSymbolData.push_back(MSD); |