arm-thunk-linkerscript-sort.s
1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// REQUIRES: arm
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t
// RUN: echo "SECTIONS { \
// RUN: .text 0x100000 : { *(SORT_BY_NAME(.text.*)) } \
// RUN: }" > %t.script
// RUN: ld.lld --script %t.script %t -o %t2
// RUN: llvm-objdump -d %t2 --start-address=1048576 --stop-address=1048584 --triple=thumbv7a-linux-gnueabihf | FileCheck --check-prefix=CHECK1 %s
// RUN: llvm-objdump -d %t2 --start-address=16777220 --stop-address=16777230 --triple=thumbv7a-linux-gnueabihf | FileCheck --check-prefix=CHECK2 %s
.syntax unified
// Test that linkerscript sorting does not apply to Thunks, we expect that the
// sort will reverse the order of sections presented here.
// Define a function aligned on a megabyte boundary
.macro FUNCTION suff
.section .text.\suff\(), "ax", %progbits
.thumb
.balign 0x100000
.globl tfunc\suff\()
.type tfunc\suff\(), %function
tfunc\suff\():
bx lr
.endm
FUNCTION 31
FUNCTION 30
FUNCTION 29
FUNCTION 28
FUNCTION 27
FUNCTION 26
FUNCTION 25
FUNCTION 24
FUNCTION 23
FUNCTION 22
FUNCTION 21
FUNCTION 20
FUNCTION 19
FUNCTION 18
FUNCTION 17
FUNCTION 16
FUNCTION 15
// CHECK2: <__Thumbv7ABSLongThunk_tfunc31>:
// CHECK2-NEXT: 1000004: ff f3 fc 97 b.w #16777208 <tfunc31>
FUNCTION 14
FUNCTION 13
FUNCTION 12
FUNCTION 11
FUNCTION 10
FUNCTION 09
FUNCTION 08
FUNCTION 07
FUNCTION 06
FUNCTION 05
FUNCTION 04
FUNCTION 03
FUNCTION 02
FUNCTION 01
.section .text.00, "ax", %progbits
.thumb
.globl _start
_start:
// Expect no range extension needed for tfunc01 and an extension needed for
// tfunc31
bl tfunc01
bl tfunc31
// CHECK1: <_start>:
// CHECK1-NEXT: 100000: ff f0 fe ff bl #1048572
// CHECK1-NEXT: 100004: ff f2 fe d7 bl #15728636