2 // RUN
: llvm-mc
-filetype
=obj
-triple
=thumbv7a-none-linux-gnueabi
%p
/Inputs
/arm-plt-reloc.s
-o
%t1
3 // RUN
: llvm-mc
-filetype
=obj
-triple
=thumbv7a-none-linux-gnueabi
%s
-o
%t2
4 // RUN
: ld.lld
%t1
%t2
-o
%t
5 // RUN
: llvm-objdump
--no-print-imm-hex
--triple
=thumbv7a-none-linux-gnueabi
-d
%t | FileCheck
%s
6 // RUN
: ld.lld
-shared
%t1
%t2
-o
%t.so
7 // RUN
: llvm-objdump
--no-print-imm-hex
--triple
=thumbv7a-none-linux-gnueabi
-d
%t.so | FileCheck
--check-prefix
=DSO
%s
8 // RUN
: llvm-readobj
-S
-r
%t.so | FileCheck
-check-prefix
=DSOREL
%s
10 // RUN
: llvm-mc
-filetype
=obj
-triple
=thumbv7aeb-none-linux-gnueabi
%p
/Inputs
/arm-plt-reloc.s
-o
%t1
11 // RUN
: llvm-mc
-filetype
=obj
-triple
=thumbv7aeb-none-linux-gnueabi
%s
-o
%t2
12 // RUN
: ld.lld
%t1
%t2
-o
%t
13 // RUN
: llvm-objdump
--no-print-imm-hex
--triple
=thumbv7aeb-none-linux-gnueabi
-d
%t | FileCheck
%s
14 // RUN
: ld.lld
-shared
%t1
%t2
-o
%t.so
15 // RUN
: llvm-objdump
--no-print-imm-hex
--triple
=thumbv7aeb-none-linux-gnueabi
-d
%t.so | FileCheck
--check-prefix
=DSO
%s
16 // RUN
: llvm-readobj
-S
-r
%t.so | FileCheck
-check-prefix
=DSOREL
%s
18 // RUN
: ld.lld
--be8
%t1
%t2
-o
%t
19 // RUN
: llvm-objdump
--no-print-imm-hex
--triple
=thumbv7aeb-none-linux-gnueabi
-d
%t | FileCheck
%s
20 // RUN
: ld.lld
--be8
-shared
%t1
%t2
-o
%t.so
21 // RUN
: llvm-objdump
--no-print-imm-hex
--triple
=thumbv7aeb-none-linux-gnueabi
-d
%t.so | FileCheck
--check-prefix
=DSO
%s
22 // RUN
: llvm-readobj
-S
-r
%t.so | FileCheck
-check-prefix
=DSOREL
%s
24 // Test PLT entry generation
29 .type _start,%function
31 // FIXME
, interworking is only supported for
BL via BLX at the moment
, when
32 // interworking thunks are available for b.w
and b<cond
>.w this can be altered
33 // to test the different forms of interworking.
38 // Executable
, expect no PLT
39 // CHECK
: Disassembly of section
.text:
41 // CHECK-NEXT
: <func1
>:
42 // CHECK-NEXT
: 200b4
: 4770 bx
lr
44 // CHECK-NEXT
: 200b6
: 4770 bx
lr
46 // CHECK-NEXT
: 200b8
: 4770 bx
lr
47 // CHECK-NEXT
: 200ba: d4d4
49 // CHECK-NEXT
: 200bc: f7ff fffa
bl 0x200b4 <func1
>
50 // CHECK-NEXT
: 200c0
: f7ff fff9
bl 0x200b6 <func2
>
51 // CHECK-NEXT
: 200c4
: f7ff fff8
bl 0x200b8 <func3
>
53 // Expect PLT entries as symbols can
be preempted
54 // .text is Thumb and .plt is ARM, llvm-objdump can currently only disassemble
55 // as ARM
or Thumb. Work around by disassembling twice.
56 // DSO
: Disassembly of section
.text:
59 // DSO-NEXT
: 10214: 4770 bx
lr
61 // DSO-NEXT
: 10216: 4770 bx
lr
63 // DSO-NEXT
: 10218: 4770 bx
lr
64 // DSO-NEXT
: 1021a: d4d4
66 // 0x10250 = PLT func1
67 // DSO-NEXT
: 1021c
: f000 e818 blx
0x10250
68 // 0x10260 = PLT func2
69 // DSO-NEXT
: 10220: f000 e81e blx
0x10260
70 // 0x10270 = PLT func3
71 // DSO-NEXT
: 10224: f000 e824 blx
0x10270
72 // DSO
: Disassembly of section
.plt:
75 // DSO-NEXT
: 10230: e52de004 str
lr, [sp
, #-4]!
76 // (0x10234 + 8) + (0 RoR
12) + (32 RoR
20 = 0x20000) + 164 = 0x302e0 = .got.plt[2]
77 // DSO-NEXT
: 10234: e28fe600
add lr, pc
, #0, #12
78 // DSO-NEXT
: 10238: e28eea20
add lr, lr, #32, #20
79 // DSO-NEXT
: 1023c
: e5bef0a4 ldr pc
, [lr, #164]!
81 // DSO-NEXT
: 10240: d4 d4 d4 d4
.word 0xd4d4d4d4
82 // DSO-NEXT
: 10244: d4 d4 d4 d4
.word 0xd4d4d4d4
83 // DSO-NEXT
: 10248: d4 d4 d4 d4
.word 0xd4d4d4d4
84 // DSO-NEXT
: 1024c
: d4 d4 d4 d4
.word 0xd4d4d4d4
85 // (0x10250 + 8) + (0 RoR
12) + (32 RoR
20 = 0x20000) + 140 = 0x302e4
86 // DSO-NEXT
: 10250: e28fc600
add r12, pc
, #0, #12
87 // DSO-NEXT
: 10254: e28cca20
add r12, r12, #32, #20
88 // DSO-NEXT
: 10258: e5bcf08c ldr pc
, [r12, #140]!
89 // DSO-NEXT
: 1025c
: d4 d4 d4 d4
.word 0xd4d4d4d4
90 // (0x10260 + 8) + (0 RoR
12) + (32 RoR
20 = 0x20000) + 128 = 0x302e8
91 // DSO-NEXT
: 10260: e28fc600
add r12, pc
, #0, #12
92 // DSO-NEXT
: 10264: e28cca20
add r12, r12, #32, #20
93 // DSO-NEXT
: 10268: e5bcf080 ldr pc
, [r12, #128]!
94 // DSO-NEXT
: 1026c
: d4 d4 d4 d4
.word 0xd4d4d4d4
95 // (0x10270 + 8) + (0 RoR
12) + (32 RoR
20 = 0x20000) + 116 = 0x302ec
96 // DSO-NEXT
: 10270: e28fc600
add r12, pc
, #0, #12
97 // DSO-NEXT
: 10274: e28cca20
add r12, r12, #32, #20
98 // DSO-NEXT
: 10278: e5bcf074 ldr pc
, [r12, #116]!
99 // DSO-NEXT
: 1027c
: d4 d4 d4 d4
.word 0xd4d4d4d4
101 // DSOREL
: Name
: .got.plt
102 // DSOREL-NEXT
: Type
: SHT_PROGBITS
103 // DSOREL-NEXT
: Flags
[
104 // DSOREL-NEXT
: SHF_ALLOC
105 // DSOREL-NEXT
: SHF_WRITE
107 // DSOREL-NEXT
: Address
: 0x302D8
108 // DSOREL-NEXT
: Offset
:
109 // DSOREL-NEXT
: Size
: 24
110 // DSOREL-NEXT
: Link
:
111 // DSOREL-NEXT
: Info
:
112 // DSOREL-NEXT
: AddressAlignment
: 4
113 // DSOREL-NEXT
: EntrySize
:
114 // DSOREL
: Relocations
[
115 // DSOREL-NEXT
: Section
(5) .rel.plt {
116 // DSOREL-NEXT
: 0x302E4 R_ARM_JUMP_SLOT func1
117 // DSOREL-NEXT
: 0x302E8 R_ARM_JUMP_SLOT func2
118 // DSOREL-NEXT
: 0x302EC R_ARM_JUMP_SLOT func3