diff --git a/lib/MC/MCFixup.cpp b/lib/MC/MCFixup.cpp index 8f15db571f3..dab4197b1a4 100644 --- a/lib/MC/MCFixup.cpp +++ b/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(Expr); + assert(getAccessVariant(UE->getSubExpr()) == MCSymbolRefExpr::VK_None); + return MCSymbolRefExpr::VK_None; + } + case MCExpr::Target: llvm_unreachable("unsupported"); diff --git a/test/MC/ELF/relocation.s b/test/MC/ELF/relocation.s index d2ee6afda36..7755f06f3f4 100644 --- a/test/MC/ELF/relocation.s +++ b/test/MC/ELF/relocation.s @@ -28,6 +28,8 @@ bar: zed = foo +2 call zed@PLT + leaq -1+foo(%rip), %r11 + // CHECK: Section { // CHECK: Name: .rela.text // CHECK: Relocations [ @@ -53,6 +55,7 @@ bar: // CHECK-NEXT: 0x8D R_X86_64_PC16 foo 0x8D // CHECK-NEXT: 0x8F R_X86_64_PC8 foo 0x8F // CHECK-NEXT: 0x91 R_X86_64_PLT32 foo 0xFFFFFFFFFFFFFFFE +// CHECK-NEXT: 0x98 R_X86_64_PC32 foo 0xFFFFFFFFFFFFFFFB // CHECK-NEXT: ] // CHECK-NEXT: }