From 8fccd013d87c4b12edb4c9982fd9f3517917d2f7 Mon Sep 17 00:00:00 2001 From: Logan Chien Date: Sat, 1 Sep 2012 15:06:36 +0000 Subject: [PATCH] Fix Thumb2 fixup kind in the integrated-as. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163063 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../ARM/MCTargetDesc/ARMELFObjectWriter.cpp | 4 ++++ test/CodeGen/Thumb/thumb_jump24_fixup.ll | 23 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 test/CodeGen/Thumb/thumb_jump24_fixup.ll diff --git a/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp b/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp index 7d6acbc5cfd..b53da3b1e49 100644 --- a/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp +++ b/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp @@ -194,6 +194,10 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target, case ARM::fixup_arm_uncondbranch: Type = ELF::R_ARM_JUMP24; break; + case ARM::fixup_t2_condbranch: + case ARM::fixup_t2_uncondbranch: + Type = ELF::R_ARM_THM_JUMP24; + break; case ARM::fixup_arm_movt_hi16: case ARM::fixup_arm_movt_hi16_pcrel: Type = ELF::R_ARM_MOVT_PREL; diff --git a/test/CodeGen/Thumb/thumb_jump24_fixup.ll b/test/CodeGen/Thumb/thumb_jump24_fixup.ll new file mode 100644 index 00000000000..e6a6b25ca14 --- /dev/null +++ b/test/CodeGen/Thumb/thumb_jump24_fixup.ll @@ -0,0 +1,23 @@ +; RUN: llc -mtriple thumbv7-none-linux-gnueabi -mcpu=cortex-a8 -march=thumb -mattr=thumb2 -filetype=obj -o - < %s | llvm-objdump -r - | FileCheck %s + +target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:32-n32-S64" +target triple = "thumbv7-none-linux-gnueabi" + +define i32 @test_fixup_t2_uncondbranch() { +b0: + invoke void @__cxa_throw(i8* null, i8* null, i8* null) noreturn + to label %unreachable unwind label %lpad + +; CHECK: {{[0-9]+}} R_ARM_THM_JUMP24 __cxa_throw + +lpad: + %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) cleanup + ret i32 0 + +unreachable: + unreachable +} + +declare i32 @__gxx_personality_v0(...) + +declare void @__cxa_throw(i8*, i8*, i8*)