1 ; RUN: llc < %s -mtriple=armv6-apple-darwin -relocation-model=static | FileCheck %s -check-prefix=DarwinStatic 2 ; RUN: llc < %s -mtriple=armv6-apple-darwin -relocation-model=dynamic-no-pic | FileCheck %s -check-prefix=DarwinDynamic 3 ; RUN: llc < %s -mtriple=armv6-apple-darwin -relocation-model=pic | FileCheck %s -check-prefix=DarwinPIC 4 ; RUN: llc < %s -mtriple=armv6-linux-gnueabi -relocation-model=pic | FileCheck %s -check-prefix=LinuxPIC 5 6 @G = external global i32 7 8 define i32 @test1() { 9 %tmp = load i32* @G 10 ret i32 %tmp 11 } 12 13 ; DarwinStatic: _test1: 14 ; DarwinStatic: ldr r0, LCPI0_0 15 ; DarwinStatic: ldr r0, [r0] 16 ; DarwinStatic: bx lr 17 18 ; DarwinStatic: .align 2 19 ; DarwinStatic: LCPI0_0: 20 ; DarwinStatic: .long {{_G$}} 21 22 23 ; DarwinDynamic: _test1: 24 ; DarwinDynamic: ldr r0, LCPI0_0 25 ; DarwinDynamic: ldr r0, [r0] 26 ; DarwinDynamic: ldr r0, [r0] 27 ; DarwinDynamic: bx lr 28 29 ; DarwinDynamic: .align 2 30 ; DarwinDynamic: LCPI0_0: 31 ; DarwinDynamic: .long L_G$non_lazy_ptr 32 33 ; DarwinDynamic: .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers 34 ; DarwinDynamic: .align 2 35 ; DarwinDynamic: L_G$non_lazy_ptr: 36 ; DarwinDynamic: .indirect_symbol _G 37 ; DarwinDynamic: .long 0 38 39 40 41 ; DarwinPIC: _test1: 42 ; DarwinPIC: ldr r0, LCPI0_0 43 ; DarwinPIC: LPC0_0: 44 ; DarwinPIC: ldr r0, [pc, r0] 45 ; DarwinPIC: ldr r0, [r0] 46 ; DarwinPIC: bx lr 47 48 ; DarwinPIC: .align 2 49 ; DarwinPIC: LCPI0_0: 50 ; DarwinPIC: .long L_G$non_lazy_ptr-(LPC0_0+8) 51 52 ; DarwinPIC: .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers 53 ; DarwinPIC: .align 2 54 ; DarwinPIC: L_G$non_lazy_ptr: 55 ; DarwinPIC: .indirect_symbol _G 56 ; DarwinPIC: .long 0 57 58 59 60 ; LinuxPIC-LABEL: test1: 61 ; LinuxPIC: ldr r0, .LCPI0_0 62 ; LinuxPIC: ldr r1, .LCPI0_1 63 64 ; LinuxPIC: .LPC0_0: 65 ; LinuxPIC: add r0, pc, r0 66 ; LinuxPIC: ldr r0, [r1, r0] 67 ; LinuxPIC: ldr r0, [r0] 68 ; LinuxPIC: bx lr 69 70 ; LinuxPIC: .align 2 71 ; LinuxPIC: .LCPI0_0: 72 ; LinuxPIC: .long _GLOBAL_OFFSET_TABLE_-(.LPC0_0+8) 73 ; LinuxPIC: .LCPI0_1: 74 ; LinuxPIC: .long G(GOT) 75