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:
64 # PACPLT-NEXT: bl 0x[[A]] <func3@plt>
66 # PACPLT: Disassembly of section .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]]
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
82 # HINT-NEXT: autia1716
88 .section ".note.gnu.property", "a"
100 .section ".note.gnu.property", "a"
111 #--- abi-tag-multiple.s
113 .section ".note.gnu.property", "a"
129 .section ".note.gnu.property", "a"
141 .section ".note.gnu.property", "a"
153 .section ".note.gnu.property", "a"
165 ## define _start to avoid missing entry warning and use --fatal-warnings to assert no diagnostic
166 ## allow multiple definitions of _start for simplicity