diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-10-05 22:26:43 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-10-05 22:26:43 +0000 |
commit | 01f9ea35a71b4efb00de8e4c9e9136c9c88f6273 (patch) | |
tree | 52d597e03518fe7127f934beb7b3d4040082096b /lib/MC | |
parent | d350e4757e649dce07f7492115bd9d19c71426bf (diff) | |
download | external_llvm-01f9ea35a71b4efb00de8e4c9e9136c9c88f6273.zip external_llvm-01f9ea35a71b4efb00de8e4c9e9136c9c88f6273.tar.gz external_llvm-01f9ea35a71b4efb00de8e4c9e9136c9c88f6273.tar.bz2 |
Implement more alias cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115699 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r-- | lib/MC/ELFObjectWriter.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index 7336258..d790291 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/lib/MC/ELFObjectWriter.cpp @@ -807,9 +807,20 @@ void ELFObjectWriterImpl::ComputeSymbolTable(MCAssembler &Asm) { MSD.SymbolData = it; MSD.StringIndex = Entry; + // FIXME: There is duplicated code with the local case. if (it->isCommon()) { MSD.SectionIndex = ELF::SHN_COMMON; ExternalSymbolData.push_back(MSD); + } else if (Symbol.isVariable()) { + const MCExpr *Value = Symbol.getVariableValue(); + assert (Value->getKind() == MCExpr::SymbolRef && "Unimplemented"); + const MCSymbolRefExpr *Ref = static_cast<const MCSymbolRefExpr*>(Value); + const MCSymbol &RefSymbol = Ref->getSymbol(); + if (RefSymbol.isDefined()) { + MSD.SectionIndex = SectionIndexMap.lookup(&RefSymbol.getSection()); + assert(MSD.SectionIndex && "Invalid section index!"); + ExternalSymbolData.push_back(MSD); + } } else if (Symbol.isUndefined()) { MSD.SectionIndex = ELF::SHN_UNDEF; // FIXME: Undefined symbols are global, but this is the first place we |