2 // RUN
: llvm-mc
-arm-add-build-attributes
-filetype
=obj
-triple
=armv5-none-linux-gnueabi
%s
-o
%t
3 // RUN
: ld.lld
%t -o
%t2
--shared
4 // RUN
: llvm-objdump
--no-print-imm-hex
--no-show-raw-insn
--start-address
=0x70000c --stop-address
=0x700010 --triple
=armv5-none-linux-gnueabi
-d
%t2 | FileCheck
%s
5 // RUN
: llvm-objdump
--no-print-imm-hex
--no-show-raw-insn
--start-address
=0x80000c --stop-address
=0x800010 -d
%t2 | FileCheck
%s
--check-prefix
=CHECK-CALL
6 // RUN
: llvm-objdump
--no-print-imm-hex
--no-show-raw-insn
--start-address
=0xd00020 --stop-address
=0xd00060 --triple
=armv5-none-linux-gnueabi
-d
%t2 | FileCheck
%s
--check-prefix
=CHECK-PLT
8 // RUN
: llvm-mc
-arm-add-build-attributes
-filetype
=obj
-triple
=armv5eb-none-linux-gnueabi
%s
-o
%t
9 // RUN
: ld.lld
%t -o
%t2
--shared
10 // RUN
: llvm-objdump
--no-print-imm-hex
--no-show-raw-insn
--start-address
=0x70000c --stop-address
=0x700010 --triple
=armv5eb-none-linux-gnueabi
-d
%t2 | FileCheck
%s
11 // RUN
: llvm-objdump
--no-print-imm-hex
--no-show-raw-insn
--start-address
=0x80000c --stop-address
=0x800010 -d
%t2 | FileCheck
%s
--check-prefix
=CHECK-CALL
12 // RUN
: llvm-objdump
--no-print-imm-hex
--no-show-raw-insn
--start-address
=0xd00020 --stop-address
=0xd00060 --triple
=armv5eb-none-linux-gnueabi
-d
%t2 | FileCheck
%s
--check-prefix
=CHECK-PLT
14 /// When we create
a thunk to
a PLT entry the relocation is redirected to the
15 /// Thunk
, changing its expression to
a non-PLT equivalent. If the thunk
16 /// becomes unusable we need to restore the relocation expression to the PLT
17 /// form so that when we create
a new thunk it targets the PLT.
19 /// Test case that checks the case
:
20 /// - Thunk is created on pass
1 to
a PLT entry for preemptible
21 /// - Some other Thunk added in the same pass moves the thunk to
22 /// preemptible out of range of its caller.
23 /// - New Thunk is created on pass
2 to PLT entry for preemptible
27 .section .text.01, "ax", %progbits
31 .type needsplt, %function
34 .section .text.02, "ax", %progbits
37 .section .text.03, "ax", %progbits
40 .section .text.04, "ax", %progbits
43 .section .text.05, "ax", %progbits
46 .section .text.06, "ax", %progbits
49 .section .text.07, "ax", %progbits
51 /// 0xd00040 = preemptible@plt
52 // CHECK
: 0070000c
<__ARMv4PILongBXThunk_preemptible
>:
53 // CHECK-NEXT
: 70000c
: b 0xd00040
55 .section .text.08, "ax", %progbits
56 .space (1024 * 1024) - 4
58 .section .text.10, "ax", %progbits
62 // CHECK-CALL
: 80000c
: blx
0x70000c <__ARMv4PILongBXThunk_preemptible
>
65 .type preemptible, %function
69 .type preemptible2, %function
74 .section .text.11, "ax", %progbits
75 .space (5 * 1024 * 1024)
78 // CHECK-PLT
: Disassembly of section
.plt:
80 // CHECK-PLT-NEXT
: 00d00020
<.plt>:
81 // CHECK-PLT-NEXT
: d00020
: str
lr, [sp
, #-4]!
82 // CHECK-PLT-NEXT
: add lr, pc
, #0, #12
83 // CHECK-PLT-NEXT
: add lr, lr, #32, #20
84 // CHECK-PLT-NEXT
: ldr pc
, [lr, #148]!
85 // CHECK-PLT-NEXT
: d00030
: d4 d4 d4 d4
.word 0xd4d4d4d4
86 // CHECK-PLT-NEXT
: d00034
: d4 d4 d4 d4
.word 0xd4d4d4d4
87 // CHECK-PLT-NEXT
: d00038
: d4 d4 d4 d4
.word 0xd4d4d4d4
88 // CHECK-PLT-NEXT
: d0003c
: d4 d4 d4 d4
.word 0xd4d4d4d4
89 // CHECK-PLT-NEXT
: d00040
: add r12, pc
, #0, #12
90 // CHECK-PLT-NEXT
: d00044
: add r12, r12, #32, #20
91 // CHECK-PLT-NEXT
: d00048
: ldr pc
, [r12, #124]!
92 // CHECK-PLT-NEXT
: d0004c
: d4 d4 d4 d4
.word 0xd4d4d4d4
93 // CHECK-PLT-NEXT
: d00050
: add r12, pc
, #0, #12
94 // CHECK-PLT-NEXT
: d00054
: add r12, r12, #32, #20
95 // CHECK-PLT-NEXT
: d00058
: ldr pc
, [r12, #112]!
96 // CHECK-PLT-NEXT
: d0005c
: d4 d4 d4 d4
.word 0xd4d4d4d4