From: Chad Rosier Date: Wed, 18 Jan 2017 15:02:54 +0000 (+0000) Subject: [Assembler] Fix crash when assembling .quad for AArch32. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73dc33b204e19dd5a60edc41dfd818e962f7500c;p=llvm [Assembler] Fix crash when assembling .quad for AArch32. A 64-bit relocation does not exist in 32-bit ARMELF. Report an error instead of crashing. PR23870 Patch by Sanne Wouda (sanwou01). Differential Revision: https://reviews.llvm.org/D28851 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292373 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp b/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp index a58d5b34131..469c47d236d 100644 --- a/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp +++ b/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp @@ -363,7 +363,8 @@ unsigned ARMAsmBackend::adjustFixupValue(const MCFixup &Fixup, uint64_t Value, unsigned Kind = Fixup.getKind(); switch (Kind) { default: - llvm_unreachable("Unknown fixup kind!"); + if (Ctx) Ctx->reportError(Fixup.getLoc(), "bad relocation fixup type"); + return 0; case FK_Data_1: case FK_Data_2: case FK_Data_4: diff --git a/test/MC/ARM/quad-relocation.s b/test/MC/ARM/quad-relocation.s new file mode 100644 index 00000000000..83d312b0e34 --- /dev/null +++ b/test/MC/ARM/quad-relocation.s @@ -0,0 +1,9 @@ +@ RUN: not llvm-mc -triple arm-arm-none-eabi -filetype obj < %s -o /dev/null 2>&1 | FileCheck %s + + .align 3 +symbol: + .quad(symbol) + +@ CHECK: error: bad relocation fixup type +@ CHECK-NEXT: .quad(symbol) +@ CHECK-NEXT: ^