diff options
Diffstat (limited to 'lib/MC/ELFObjectWriter.cpp')
-rw-r--r-- | lib/MC/ELFObjectWriter.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index f84164d253..93ea77a0e1 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/lib/MC/ELFObjectWriter.cpp @@ -470,10 +470,23 @@ static const MCSymbol &AliasedSymbol(const MCSymbol &Symbol) { const MCSymbol *S = &Symbol; while (S->isVariable()) { const MCExpr *Value = S->getVariableValue(); - if (Value->getKind() != MCExpr::SymbolRef) + MCExpr::ExprKind Kind = Value->getKind(); + switch (Kind) { + case MCExpr::SymbolRef: { + const MCSymbolRefExpr *Ref = static_cast<const MCSymbolRefExpr*>(Value); + S = &Ref->getSymbol(); + break; + } + case MCExpr::Target: { + const MCTargetExpr *TExp = static_cast<const MCTargetExpr*>(Value); + MCValue Res; + TExp->EvaluateAsRelocatableImpl(Res, NULL); + S = &Res.getSymA()->getSymbol(); + break; + } + default: return *S; - const MCSymbolRefExpr *Ref = static_cast<const MCSymbolRefExpr*>(Value); - S = &Ref->getSymbol(); + } } return *S; } |