Home | History | Annotate | Download | only in llvm
      1 From 02638d41bb06858a7b0c25dcbb5aef4ba9724957 Mon Sep 17 00:00:00 2001
      2 From: Logan Chien <loganchien (a] google.com>
      3 Date: Fri, 24 Aug 2012 17:06:53 +0800
      4 Subject: [PATCH 2/2] Add missing ARM fixup kind for ARMELFObjectWriter.
      5 
      6 ---
      7  lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp |    4 +++
      8  test/CodeGen/ARM/fixup-elf.ll                      |   23 ++++++++++++++++++++
      9  2 files changed, 27 insertions(+), 0 deletions(-)
     10  create mode 100644 test/CodeGen/ARM/fixup-elf.ll
     11 
     12 diff --git a/llvm-3.1/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp b/llvm-3.1/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
     13 index 7d6acbc..f24a29f 100644
     14 --- a/llvm-3.1/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
     15 +++ b/llvm-3.1/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
     16 @@ -214,6 +214,10 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
     17      case ARM::fixup_arm_thumb_blx:
     18        Type = ELF::R_ARM_THM_CALL;
     19        break;
     20 +    case ARM::fixup_t2_condbranch:
     21 +    case ARM::fixup_t2_uncondbranch:
     22 +      Type = ELF::R_ARM_THM_JUMP24;
     23 +      break;
     24      }
     25    } else {
     26      switch ((unsigned)Fixup.getKind()) {
     27 diff --git a/llvm-3.1/test/CodeGen/ARM/fixup-elf.ll b/llvm-3.1/test/CodeGen/ARM/fixup-elf.ll
     28 new file mode 100644
     29 index 0000000..90d880f
     30 --- /dev/null
     31 +++ b/llvm-3.1/test/CodeGen/ARM/fixup-elf.ll
     32 @@ -0,0 +1,23 @@
     33 +; RUN: llc -mtriple thumbv7-none-linux-gnueabi -mcpu=cortex-a8 -march=thumb -mattr=thumb2 -filetype=obj -o - < %s | llvm-objdump -r - | FileCheck %s
     34 +
     35 +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"
     36 +target triple = "thumbv7-none-linux-gnueabi"
     37 +
     38 +define i32 @test_fixup_t2_uncondbranch(i8* %a, i8* %b, i8* %c) {
     39 +invoke.cont:
     40 +  invoke void @__cxa_throw(i8* %a, i8* %b, i8* %c) noreturn
     41 +    to label %unreachable unwind label %lpad
     42 +
     43 +; CHECK: 6 R_ARM_THM_JUMP24 __cxa_throw
     44 +
     45 +lpad:
     46 +  %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) cleanup
     47 +  ret i32 0
     48 +
     49 +unreachable:
     50 +  unreachable
     51 +}
     52 +
     53 +declare i32 @__gxx_personality_v0(...)
     54 +
     55 +declare void @__cxa_throw(i8*, i8*, i8*)
     56 -- 
     57 1.7.7.3
     58 
     59