mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
Make AliasedSymbol able to handle MCTargetExpr. They can get here if
a weakref is used with a VariantKind. llvm-svn: 118798
This commit is contained in:
parent
3514fa6b11
commit
f7b3bb84e8
@ -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;
|
||||
}
|
||||
|
8
test/MC/ELF/weakref-plt.s
Normal file
8
test/MC/ELF/weakref-plt.s
Normal file
@ -0,0 +1,8 @@
|
||||
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
|
||||
|
||||
.weakref bar,foo
|
||||
call bar@PLT
|
||||
|
||||
// CHECK: # Symbol 0x00000005
|
||||
// CHECK-NEXT: (('st_name', 0x00000001) # 'foo'
|
||||
// CHECK-NEXT: ('st_bind', 0x00000002)
|
Loading…
Reference in New Issue
Block a user