diff options
author | Kaelyn Takata <rikka@google.com> | 2014-04-14 16:50:22 +0000 |
---|---|---|
committer | Kaelyn Takata <rikka@google.com> | 2014-04-14 16:50:22 +0000 |
commit | f9d483128cae3b4b11923d3477752dc92e9decb2 (patch) | |
tree | e8f15c00dfc5005fa5dc541363f63535e577e5a9 /llvm/lib/MC/MCFixup.cpp | |
parent | 95d570335ce3ce35519073732dc185eeb701823f (diff) | |
download | bcm5719-llvm-f9d483128cae3b4b11923d3477752dc92e9decb2.tar.gz bcm5719-llvm-f9d483128cae3b4b11923d3477752dc92e9decb2.zip |
Fix up MCFixup::getAccessVariant to handle unary expressions.
This allows correct relocations to be generated for a symbolic
address that is being adjusted by a negative constant. Since r204294,
such expressions have triggered undefined behavior when LLVM was built
without assertions.
Credit goes to Rafael for this patch; I'm submitting it on his behalf
as he is on vacation this week.
llvm-svn: 206192
Diffstat (limited to 'llvm/lib/MC/MCFixup.cpp')
-rw-r--r-- | llvm/lib/MC/MCFixup.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCFixup.cpp b/llvm/lib/MC/MCFixup.cpp index 8f15db571f3..dab4197b1a4 100644 --- a/llvm/lib/MC/MCFixup.cpp +++ b/llvm/lib/MC/MCFixup.cpp @@ -12,7 +12,12 @@ using namespace llvm; static MCSymbolRefExpr::VariantKind getAccessVariant(const MCExpr *Expr) { switch (Expr->getKind()) { - case MCExpr::Unary: + case MCExpr::Unary: { + const MCUnaryExpr *UE = cast<MCUnaryExpr>(Expr); + assert(getAccessVariant(UE->getSubExpr()) == MCSymbolRefExpr::VK_None); + return MCSymbolRefExpr::VK_None; + } + case MCExpr::Target: llvm_unreachable("unsupported"); |