1; RUN: llc -O0 < %s -mtriple armv7-linux-gnueabi -o - \
2; RUN:   | llvm-mc -triple armv7-linux-gnueabi -filetype=obj -o - \
3; RUN:    | llvm-readobj -r | FileCheck --check-prefix LINUX %s
4
5; RUN: llc -O0 < %s -mtriple armv7-linux-android -o - \
6; RUN:   | llvm-mc -triple armv7-linux-android -filetype=obj -o - \
7; RUN:    | llvm-readobj -r | FileCheck --check-prefix LINUX %s
8
9
10; RUN: llc -O0 < %s -mtriple armv7-apple-ios -o - \
11; RUN:   | llvm-mc -triple armv7-apple-ios -filetype=obj -o - \
12; RUN:    | llvm-readobj -r | FileCheck --check-prefix IOS %s
13
14
15define void @thumb_caller() #0 {
16  call void @internal_arm_fn()
17  call void @global_arm_fn()
18  call void @internal_thumb_fn()
19  call void @global_thumb_fn()
20  ret void
21}
22
23define void @arm_caller() #1 {
24  call void @internal_arm_fn()
25  call void @global_arm_fn()
26  call void @internal_thumb_fn()
27  call void @global_thumb_fn()
28  ret void
29}
30
31define internal void @internal_thumb_fn() #0 {
32  ret void
33}
34
35define void @global_thumb_fn() #0 {
36entry:
37  br label %end
38end:
39  br label %end
40  ret void
41}
42
43define internal void @internal_arm_fn() #1 {
44  ret void
45}
46
47define void @global_arm_fn() #1 {
48entry:
49  br label %end
50end:
51  br label %end
52  ret void
53}
54
55attributes #0 = { "target-features"="+thumb-mode" }
56attributes #1 = { "target-features"="-thumb-mode" }
57
58; LINUX: Section (3) .rel.text {
59; LINUX-NEXT: 0x2 R_ARM_THM_CALL internal_arm_fn 0x0
60; LINUX-NEXT: 0x6 R_ARM_THM_CALL global_arm_fn 0x0
61; LINUX-NEXT: 0xE R_ARM_THM_CALL global_thumb_fn 0x0
62; LINUX-NEXT: 0x1C R_ARM_CALL internal_arm_fn 0x0
63; LINUX-NEXT: 0x20 R_ARM_CALL global_arm_fn 0x0
64; LINUX-NEXT: 0x24 R_ARM_CALL internal_thumb_fn 0x0
65; LINUX-NEXT: 0x28 R_ARM_CALL global_thumb_fn 0x0
66; LINUX-NEXT: }
67
68; IOS:   Section __text {
69; IOS-NEXT: 0x2C 1 2 1 ARM_RELOC_BR24 0 _global_thumb_fn
70; IOS-NEXT: 0x28 1 2 1 ARM_RELOC_BR24 0 _internal_thumb_fn
71; IOS-NEXT: 0x24 1 2 1 ARM_RELOC_BR24 0 _global_arm_fn
72; IOS-NEXT: 0x20 1 2 1 ARM_RELOC_BR24 0 _internal_arm_fn
73; IOS-NEXT: 0x10 1 2 0 ARM_THUMB_RELOC_BR22 0 __text
74; IOS-NEXT: 0xC 1 2 0 ARM_THUMB_RELOC_BR22 0 __text
75; IOS-NEXT: 0x8 1 2 0 ARM_THUMB_RELOC_BR22 0 __text
76; IOS-NEXT: 0x4 1 2 0 ARM_THUMB_RELOC_BR22 0 __text
77; IOS-NEXT: }
78