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
--triple
=thumbv7a-none-linux-gnueabi
-d
%t | FileCheck
%s
6 // RUN
: ld.lld
-shared
%t1
%t2
-o
%t.so
7 // RUN
: llvm-objdump
--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 // Test PLT entry generation
15 .type _start,%function
17 // FIXME
, interworking is only supported for
BL via BLX at the moment
, when
18 // interworking thunks are available for b.w
and b<cond
>.w this can be altered
19 // to test the different forms of interworking.
24 // Executable
, expect no PLT
25 // CHECK
: Disassembly of section
.text:
27 // CHECK-NEXT
: <func1
>:
28 // CHECK-NEXT
: 200b4
: 70 47 bx
lr
30 // CHECK-NEXT
: 200b6
: 70 47 bx
lr
32 // CHECK-NEXT
: 200b8
: 70 47 bx
lr
33 // CHECK-NEXT
: 200ba: d4 d4
35 // CHECK-NEXT
: 200bc: ff
f7 fa ff
bl 0x200b4 <func1
>
36 // CHECK-NEXT
: 200c0
: ff
f7 f9 ff
bl 0x200b6 <func2
>
37 // CHECK-NEXT
: 200c4
: ff
f7 f8 ff
bl 0x200b8 <func3
>
39 // Expect PLT entries as symbols can
be preempted
40 // .text is Thumb and .plt is ARM, llvm-objdump can currently only disassemble
41 // as ARM
or Thumb. Work around by disassembling twice.
42 // DSO
: Disassembly of section
.text:
45 // DSO-NEXT
: 10214: 70 47 bx
lr
47 // DSO-NEXT
: 10216: 70 47 bx
lr
49 // DSO-NEXT
: 10218: 70 47 bx
lr
50 // DSO-NEXT
: 1021a: d4 d4
52 // 0x10250 = PLT func1
53 // DSO-NEXT
: 1021c
: 00 f0 18 e8 blx
0x10250
54 // 0x10260 = PLT func2
55 // DSO-NEXT
: 10220: 00 f0 1e e8 blx
0x10260
56 // 0x10270 = PLT func3
57 // DSO-NEXT
: 10224: 00 f0 24 e8 blx
0x10270
58 // DSO
: Disassembly of section
.plt:
61 // DSO-NEXT
: 10230: 04 e0
2d e5 str
lr, [sp
, #-4]!
62 // (0x10234 + 8) + (0 RoR
12) + (32 RoR
20 = 0x20000) + 164 = 0x302e0 = .got.plt[2]
63 // DSO-NEXT
: 10234: 00 e6
8f e2
add lr, pc
, #0, #12
64 // DSO-NEXT
: 10238: 20 ea
8e e2
add lr, lr, #32, #20
65 // DSO-NEXT
: 1023c
: a4
f0 be e5 ldr pc
, [lr, #164]!
68 // DSO-NEXT
: 10240: d4 d4 d4 d4
.word 0xd4d4d4d4
69 // DSO-NEXT
: 10244: d4 d4 d4 d4
.word 0xd4d4d4d4
70 // DSO-NEXT
: 10248: d4 d4 d4 d4
.word 0xd4d4d4d4
71 // DSO-NEXT
: 1024c
: d4 d4 d4 d4
.word 0xd4d4d4d4
73 // (0x10250 + 8) + (0 RoR
12) + (32 RoR
20 = 0x20000) + 140 = 0x302e4
74 // DSO-NEXT
: 10250: 00 c6
8f e2
add r12, pc
, #0, #12
75 // DSO-NEXT
: 10254: 20 ca
8c e2
add r12, r12, #32, #20
76 // DSO-NEXT
: 10258: 8c
f0 bc e5 ldr pc
, [r12, #140]!
78 // DSO-NEXT
: 1025c
: d4 d4 d4 d4
.word 0xd4d4d4d4
80 // (0x10260 + 8) + (0 RoR
12) + (32 RoR
20 = 0x20000) + 128 = 0x302e8
81 // DSO-NEXT
: 10260: 00 c6
8f e2
add r12, pc
, #0, #12
82 // DSO-NEXT
: 10264: 20 ca
8c e2
add r12, r12, #32, #20
83 // DSO-NEXT
: 10268: 80 f0 bc e5 ldr pc
, [r12, #128]!
85 // DSO-NEXT
: 1026c
: d4 d4 d4 d4
.word 0xd4d4d4d4
87 // (0x10270 + 8) + (0 RoR
12) + (32 RoR
20 = 0x20000) + 116 = 0x302ec
88 // DSO-NEXT
: 10270: 00 c6
8f e2
add r12, pc
, #0, #12
89 // DSO-NEXT
: 10274: 20 ca
8c e2
add r12, r12, #32, #20
90 // DSO-NEXT
: 10278: 74 f0 bc e5 ldr pc
, [r12, #116]!
92 // DSO-NEXT
: 1027c
: d4 d4 d4 d4
.word 0xd4d4d4d4
94 // DSOREL
: Name
: .got.plt
95 // DSOREL-NEXT
: Type
: SHT_PROGBITS
96 // DSOREL-NEXT
: Flags
[
97 // DSOREL-NEXT
: SHF_ALLOC
98 // DSOREL-NEXT
: SHF_WRITE
100 // DSOREL-NEXT
: Address
: 0x302D8
101 // DSOREL-NEXT
: Offset
:
102 // DSOREL-NEXT
: Size
: 24
103 // DSOREL-NEXT
: Link
:
104 // DSOREL-NEXT
: Info
:
105 // DSOREL-NEXT
: AddressAlignment
: 4
106 // DSOREL-NEXT
: EntrySize
:
107 // DSOREL
: Relocations
[
108 // DSOREL-NEXT
: Section
(5) .rel.plt {
109 // DSOREL-NEXT
: 0x302E4 R_ARM_JUMP_SLOT func1
110 // DSOREL-NEXT
: 0x302E8 R_ARM_JUMP_SLOT func2
111 // DSOREL-NEXT
: 0x302EC R_ARM_JUMP_SLOT func3