2 // RUN
: llvm-mc
-arm-add-build-attributes
-filetype
=obj
-triple
=armv7a-linux-gnueabihf
%s
-o
%t
3 // RUN
: echo
"SECTIONS { \
4 // RUN: . = SIZEOF_HEADERS; \
5 // RUN: .text 0x00011000 : { *(.text.*) } \
7 // RUN: sym = .;" > %t.script
8 // RUN
: ld.lld
--script
%t.script
%t -o
%t2
9 // RUN
: llvm-readobj
--sections
--symbols
%t2 | FileCheck
--check-prefix
=CHECK-ELF
%s
10 // RUN
: llvm-objdump
--no-show-raw-insn
--start-address
=0x11000 --stop-address
=0x11048 -d
%t2 | FileCheck
%s
12 // An example of thunk generation that takes the maximum number of permitted
13 // passes to converge. We start with
a set of branches of which all but one are
14 // in range. Any thunk added to extend the range of
a branch is inserted in
15 // between the branches
and the targets which knocks some more branches out
16 // of range. At the end of
9 passes of createThunks
() every branch has
a
17 // range extension thunk
, allowing the final pass to check that no more thunks
20 // As the size of the
.text section changes 9 times, the symbol sym which
21 // depends on the size of
.text will be updated 9 times. This test checks that
22 // any iteration limit to updating symbols does
not limit thunk convergence.
23 // up to its pass limit without
25 // CHECK-ELF
: Name
: .text
26 // CHECK-ELF-NEXT
: Type
: SHT_PROGBITS
27 // CHECK-ELF-NEXT
: Flags
[
28 // CHECK-ELF-NEXT
: SHF_ALLOC
29 // CHECK-ELF-NEXT
: SHF_EXECINSTR
31 // CHECK-ELF-NEXT
: Address
: 0x11000
32 // CHECK-ELF-NEXT
: Offset
: 0x1000
33 // CHECK-ELF-NEXT
: Size
: 16777292
34 // CHECK-ELF
: Name
: sym
35 // CHECK-ELF-NEXT
: Value
: 0x101104C
37 // CHECK
: 00011000 <_start
>:
38 // CHECK-NEXT
: 11000: b.w
0xe11048 <__Thumbv7ABSLongThunk_f2
>
39 // CHECK-NEXT
: 11004: b.w
0xe11048 <__Thumbv7ABSLongThunk_f2
>
40 // CHECK-NEXT
: 11008: b.w
0xe1104c <__Thumbv7ABSLongThunk_f3
>
41 // CHECK-NEXT
: 1100c
: b.w
0xe1104c <__Thumbv7ABSLongThunk_f3
>
42 // CHECK-NEXT
: 11010: b.w
0xe11050 <__Thumbv7ABSLongThunk_f4
>
43 // CHECK-NEXT
: 11014: b.w
0xe11050 <__Thumbv7ABSLongThunk_f4
>
44 // CHECK-NEXT
: 11018: b.w
0xe11054 <__Thumbv7ABSLongThunk_f5
>
45 // CHECK-NEXT
: 1101c
: b.w
0xe11054 <__Thumbv7ABSLongThunk_f5
>
46 // CHECK-NEXT
: 11020: b.w
0xe11058 <__Thumbv7ABSLongThunk_f6
>
47 // CHECK-NEXT
: 11024: b.w
0xe11058 <__Thumbv7ABSLongThunk_f6
>
48 // CHECK-NEXT
: 11028: b.w
0xe1105c <__Thumbv7ABSLongThunk_f7
>
49 // CHECK-NEXT
: 1102c
: b.w
0xe1105c <__Thumbv7ABSLongThunk_f7
>
50 // CHECK-NEXT
: 11030: b.w
0xe11060 <__Thumbv7ABSLongThunk_f8
>
51 // CHECK-NEXT
: 11034: b.w
0xe11060 <__Thumbv7ABSLongThunk_f8
>
52 // CHECK-NEXT
: 11038: b.w
0xe11064 <__Thumbv7ABSLongThunk_f9
>
53 // CHECK-NEXT
: 1103c
: b.w
0xe11064 <__Thumbv7ABSLongThunk_f9
>
54 // CHECK-NEXT
: 11040: b.w
0xe11068 <__Thumbv7ABSLongThunk_f10
>
55 // CHECK-NEXT
: 11044: b.w
0xe11068 <__Thumbv7ABSLongThunk_f10
>
59 .section .text.00, "ax", %progbits
81 .section .text.01, "ax", %progbits
82 .space 14 * 1024 * 1024
83 // Thunks are inserted here
, initially only
1 branch is out of range
and needs
84 // a thunk. However the added thunk is
4-bytes in size which makes another
85 // branch out of range
, which adds another thunk
...
86 .section .text.02, "ax", %progbits
87 .space (2 * 1024 * 1024) - 68