File: aarch64-variant_pcs.s

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (128 lines) | stat: -rw-r--r-- 4,403 bytes parent folder | download | duplicates (14)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# REQUIRES: aarch64
# RUN: rm -rf %t && split-file %s %t && cd %t

# RUN: llvm-mc -filetype=obj -triple=aarch64 1.s -o 1.o
# RUN: ld.lld 1.o --shared -o 1.so
# RUN: llvm-readelf -d -s 1.so | FileCheck --check-prefix=CHECK1 %s

# CHECK1:      Symbol table '.dynsym'
# CHECK1:      0 NOTYPE GLOBAL DEFAULT [VARIANT_PCS] [[#]] func_global_def
# CHECK1:      Symbol table '.symtab'
# CHECK1:      0 NOTYPE GLOBAL DEFAULT [VARIANT_PCS] [[#]] func_global_def

# RUN: llvm-mc -filetype=obj -triple=aarch64 2.s -o 2.o
# RUN: ld.lld 2.o --shared -o 2.so
# RUN: llvm-readelf -d -s 2.so | FileCheck --check-prefix=CHECK2 %s

# CHECK2:      0x0000000070000005 (AARCH64_VARIANT_PCS) 0
# CHECK2:      Symbol table '.dynsym'
# CHECK2:      0 NOTYPE GLOBAL DEFAULT [VARIANT_PCS] [[#]] func_global_def
# CHECK2:      Symbol table '.symtab'
# CHECK2:      0 NOTYPE GLOBAL DEFAULT [VARIANT_PCS] [[#]] func_global_def

# RUN: llvm-mc -filetype=obj -triple=aarch64 3.s -o 3.o
# RUN: ld.lld 3.o --shared -o 3.so
# RUN: llvm-readelf -d -s 3.so | FileCheck --check-prefix=CHECK3 %s

# CHECK3:      0x0000000070000005 (AARCH64_VARIANT_PCS) 0
# CHECK3:      Symbol table '.dynsym'
# CHECK3:      0 IFUNC  GLOBAL DEFAULT [VARIANT_PCS] UND   ifunc_global_def
# CHECK3:      0 NOTYPE GLOBAL DEFAULT               [[#]] func_global_def

# RUN: llvm-mc -filetype=obj -triple=aarch64 4.s -o 4.o
# RUN: ld.lld 4.o --shared -o 4.so
# RUN: llvm-readelf -d -s 4.so | FileCheck --check-prefix=CHECK4 %s

# CHECK4-NOT:  0x0000000070000005 (AARCH64_VARIANT_PCS) 0
# CHECK4:      Symbol table '.dynsym'
# CHECK4:      0 IFUNC GLOBAL DEFAULT [VARIANT_PCS]  [[#]] ifunc_global_def

# RUN: llvm-mc -filetype=obj -triple=aarch64 5.s -o 5.o
# RUN: ld.lld 5.o --shared -o 5.so
# RUN: llvm-readelf -d -s 5.so | FileCheck --check-prefix=CHECK5 %s

# CHECK5:      Symbol table '.dynsym' contains 4 entries:
# CHECK5:      0 NOTYPE  GLOBAL DEFAULT [VARIANT_PCS] UND   func_global_undef
# CHECK5-NEXT: 0 NOTYPE  GLOBAL DEFAULT [VARIANT_PCS] [[#]] func_global_def
# CHECK5-NEXT: 0 IFUNC   GLOBAL DEFAULT [VARIANT_PCS] [[#]] ifunc_global_def
# CHECK5:      Symbol table '.symtab' contains 10 entries:
# CHECK5:      0 NOTYPE  LOCAL  DEFAULT [VARIANT_PCS] [[#]] func_local
# CHECK5-NEXT: 0 IFUNC   LOCAL  DEFAULT [VARIANT_PCS] [[#]] ifunc_local
# CHECK5:      0 NOTYPE  LOCAL  HIDDEN  [VARIANT_PCS] [[#]] func_global_hidden
# CHECK5-NEXT: 0 IFUNC   LOCAL  HIDDEN  [VARIANT_PCS] [[#]] ifunc_global_hidden
# CHECK5:      0 NOTYPE  GLOBAL DEFAULT [VARIANT_PCS] [[#]] func_global_def
# CHECK5-NEXT: 0 NOTYPE  GLOBAL DEFAULT [VARIANT_PCS] UND   func_global_undef
# CHECK5-NEXT: 0 IFUNC   GLOBAL DEFAULT [VARIANT_PCS] [[#]] ifunc_global_def

#--- 1.s
## An object with a variant_pcs symbol but without a R_AARCH64_JMP_SLOT
## should not generate a DT_AARCH64_VARIANT_PCS.
.text
.global func_global_def
.variant_pcs func_global_def

func_global_def:
  ret

#--- 2.s
## An object with a variant_pcs symbol and with a R_AARCH64_JMP_SLOT
## should generate a DT_AARCH64_VARIANT_PCS.
.text
.global func_global_def
.variant_pcs func_global_def

func_global_def:
  bl func_global_def

#--- 3.s
## Same as before, but targeting a GNU IFUNC.
.text
.global ifunc_global_def
.global func_global_def
.variant_pcs ifunc_global_def
.type ifunc_global_def, %gnu_indirect_function

func_global_def:
  bl ifunc_global_def

#--- 4.s
## An object with a variant_pcs symbol and with a R_AARCH64_IRELATIVE
## should not generate a DT_AARCH64_VARIANT_PCS.
.text
.global ifunc_global_def
.global func_global_def
.variant_pcs ifunc_global_def
.type ifunc_global_def, %gnu_indirect_function

ifunc_global_def:
  bl func_global_def

#--- 5.s
## Check if STO_AARCH64_VARIANT_PCS is kept on symbol st_other for both undef,
## local, and hidden visibility.
.text
.global func_global_def, func_global_undef, func_global_hidden
.global ifunc_global_def, ifunc_global_hidden
.local func_local

.hidden func_global_hidden, ifunc_global_hidden

.type ifunc_global_def, %gnu_indirect_function
.type ifunc_global_hidden, %gnu_indirect_function
.type ifunc_local, %gnu_indirect_function

.variant_pcs func_global_def
.variant_pcs func_global_undef
.variant_pcs func_global_hidden
.variant_pcs func_local
.variant_pcs ifunc_global_def
.variant_pcs ifunc_global_hidden
.variant_pcs ifunc_local

func_global_def:
func_global_hidden:
func_local:
ifunc_global_def:
ifunc_global_hidden:
ifunc_local:
  ret