[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / aarch64-feature-pauth.s
blobc50f38f4a7c975c8ecabf0faddda9aa6b0211087
1 # REQUIRES: aarch64
3 # RUN: rm -rf %t && split-file %s %t && cd %t
5 # RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu abi-tag1.s -o tag1.o
6 # RUN: cp tag1.o tag1a.o
7 # RUN: ld.lld -shared tag1.o tag1a.o -o tagok.so
8 # RUN: llvm-readelf -n tagok.so | FileCheck --check-prefix OK %s
10 # OK: AArch64 PAuth ABI core info: platform 0x2a (unknown), version 0x1
12 # RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu abi-tag2.s -o tag2.o
13 # RUN: not ld.lld tag1.o tag1a.o tag2.o -o /dev/null 2>&1 | FileCheck --check-prefix ERR1 %s
15 # ERR1: error: incompatible values of AArch64 PAuth core info found
16 # ERR1-NEXT: >>> tag1.o: 0x2a000000000000000{{1|2}}00000000000000
17 # ERR1-NEXT: >>> tag2.o: 0x2a000000000000000{{1|2}}00000000000000
19 # RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu abi-tag-short.s -o short.o
20 # RUN: not ld.lld short.o -o /dev/null 2>&1 | FileCheck --check-prefix ERR2 %s
22 # ERR2: error: short.o:(.note.gnu.property+0x0): GNU_PROPERTY_AARCH64_FEATURE_PAUTH entry is invalid: expected 16 bytes, but got 12
24 # RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu abi-tag-long.s -o long.o
25 # RUN: not ld.lld long.o -o /dev/null 2>&1 | FileCheck --check-prefix ERR3 %s
27 # ERR3: error: long.o:(.note.gnu.property+0x0): GNU_PROPERTY_AARCH64_FEATURE_PAUTH entry is invalid: expected 16 bytes, but got 24
29 # RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu abi-tag-multiple.s -o multiple.o
30 # RUN: not ld.lld multiple.o -o /dev/null 2>&1 | FileCheck --check-prefix ERR4 %s
31 # ERR4: error: multiple.o:(.note.gnu.property+0x0): multiple GNU_PROPERTY_AARCH64_FEATURE_PAUTH entries are not supported
33 # RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu no-info.s -o noinfo1.o
34 # RUN: cp noinfo1.o noinfo2.o
35 # RUN: not ld.lld -z pauth-report=error noinfo1.o tag1.o noinfo2.o -o /dev/null 2>&1 | FileCheck --check-prefix ERR5 %s
36 # RUN: ld.lld -z pauth-report=warning noinfo1.o tag1.o noinfo2.o -o /dev/null 2>&1 | FileCheck --check-prefix WARN1 %s
37 # RUN: ld.lld -z pauth-report=none noinfo1.o tag1.o noinfo2.o --fatal-warnings -o /dev/null
39 # ERR5: error: noinfo1.o: -z pauth-report: file does not have AArch64 PAuth core info while 'tag1.o' has one
40 # ERR5-NEXT: error: noinfo2.o: -z pauth-report: file does not have AArch64 PAuth core info while 'tag1.o' has one
41 # WARN1: warning: noinfo1.o: -z pauth-report: file does not have AArch64 PAuth core info while 'tag1.o' has one
42 # WARN1-NEXT: warning: noinfo2.o: -z pauth-report: file does not have AArch64 PAuth core info while 'tag1.o' has one
44 # RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu abi-tag-zero.s -o tag-zero.o
45 # RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu %p/Inputs/aarch64-func2.s -o func2.o
46 # RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu %p/Inputs/aarch64-func3.s -o func3.o
47 # RUN: ld.lld func3.o --shared -o func3.so
48 # RUN: ld.lld tag1.o func2.o func3.so -z pac-plt --shared -o pacplt-nowarn --fatal-warnings
49 # RUN: ld.lld tag-zero.o func2.o func3.so -z pac-plt --shared -o pacplt-warn 2>&1 | FileCheck --check-prefix WARN2 %s
51 # WARN2: warning: tag-zero.o: -z pac-plt: file does not have GNU_PROPERTY_AARCH64_FEATURE_1_PAC property and no valid PAuth core info present for this link job
52 # WARN2-NEXT: warning: func2.o: -z pac-plt: file does not have GNU_PROPERTY_AARCH64_FEATURE_1_PAC property and no valid PAuth core info present for this link job
54 # RUN: llvm-readelf -d pacplt-nowarn | FileCheck --check-prefix=PACPLTTAG %s
55 # RUN: llvm-readelf -d pacplt-warn | FileCheck --check-prefix=PACPLTTAG %s
57 # PACPLTTAG: 0x0000000070000003 (AARCH64_PAC_PLT)
59 # RUN: llvm-objdump -d pacplt-nowarn | FileCheck --check-prefixes=PACPLT,NOHINT -DA=10380 -DB=478 -DC=480 %s
60 # RUN: llvm-objdump -d pacplt-warn | FileCheck --check-prefixes=PACPLT,HINT -DA=10390 -DB=488 -DC=490 %s
62 # PACPLT: Disassembly of section .text:
63 # PACPLT: <func2>:
64 # PACPLT-NEXT: bl 0x[[A]] <func3@plt>
65 # PACPLT-NEXT: ret
66 # PACPLT: Disassembly of section .plt:
67 # PACPLT: <.plt>:
68 # PACPLT-NEXT: stp x16, x30, [sp, #-0x10]!
69 # PACPLT-NEXT: adrp x16, 0x30000 <func3+0x30000>
70 # PACPLT-NEXT: ldr x17, [x16, #0x[[B]]]
71 # PACPLT-NEXT: add x16, x16, #0x[[B]]
72 # PACPLT-NEXT: br x17
73 # PACPLT-NEXT: nop
74 # PACPLT-NEXT: nop
75 # PACPLT-NEXT: nop
76 # PACPLT: <func3@plt>:
77 # PACPLT-NEXT: adrp x16, 0x30000 <func3+0x30000>
78 # PACPLT-NEXT: ldr x17, [x16, #0x[[C]]]
79 # PACPLT-NEXT: add x16, x16, #0x[[C]]
80 # NOHINT-NEXT: braa x17, x16
81 # NOHINT-NEXT: nop
82 # HINT-NEXT: autia1716
83 # HINT-NEXT: br x17
84 # PACPLT-NEXT: nop
86 #--- abi-tag-short.s
88 .section ".note.gnu.property", "a"
89 .long 4
90 .long 20
91 .long 5
92 .asciz "GNU"
93 .long 0xc0000001
94 .long 12
95 .quad 2
96 .long 31
98 #--- abi-tag-long.s
100 .section ".note.gnu.property", "a"
101 .long 4
102 .long 32
103 .long 5
104 .asciz "GNU"
105 .long 0xc0000001
106 .long 24
107 .quad 2
108 .quad 31
109 .quad 0
111 #--- abi-tag-multiple.s
113 .section ".note.gnu.property", "a"
114 .long 4
115 .long 48
116 .long 5
117 .asciz "GNU"
118 .long 0xc0000001
119 .long 16
120 .quad 42 // platform
121 .quad 1 // version
122 .long 0xc0000001
123 .long 16
124 .quad 42 // platform
125 .quad 1 // version
127 #--- abi-tag1.s
129 .section ".note.gnu.property", "a"
130 .long 4
131 .long 24
132 .long 5
133 .asciz "GNU"
134 .long 0xc0000001
135 .long 16
136 .quad 42 // platform
137 .quad 1 // version
139 #--- abi-tag2.s
141 .section ".note.gnu.property", "a"
142 .long 4
143 .long 24
144 .long 5
145 .asciz "GNU"
146 .long 0xc0000001
147 .long 16
148 .quad 42 // platform
149 .quad 2 // version
151 #--- abi-tag-zero.s
153 .section ".note.gnu.property", "a"
154 .long 4
155 .long 24
156 .long 5
157 .asciz "GNU"
158 .long 0xc0000001
159 .long 16
160 .quad 0 // platform
161 .quad 0 // version
163 #--- no-info.s
165 ## define _start to avoid missing entry warning and use --fatal-warnings to assert no diagnostic
166 ## allow multiple definitions of _start for simplicity
167 .weak _start;
168 _start: