-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathptrauth-lowering-err.ll
More file actions
102 lines (66 loc) · 2.5 KB
/
ptrauth-lowering-err.ll
File metadata and controls
102 lines (66 loc) · 2.5 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
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
; RUN: split-file %s %t && cd %t
;--- MOVaddrPAC.ll
; RUN: not --crash llc -mtriple aarch64-elf MOVaddrPAC.ll 2>&1 | \
; RUN: FileCheck MOVaddrPAC.ll
; CHECK: LLVM ERROR: pac instructions require ptrauth target feature
@foo.ptrauth = private constant { ptr, i32, i64, i64 } { ptr @foo, i32 0, i64 0, i64 0 }, section "llvm.ptrauth", align 8
define ptr @bar() #0 {
ret ptr @foo.ptrauth
}
define private void @foo() {
ret void
}
attributes #0 = { "ptrauth-calls" "target-cpu"="generic" }
;--- LOADgotPAC.ll
; RUN: not --crash llc -mtriple aarch64-elf LOADgotPAC.ll 2>&1 | \
; RUN: FileCheck LOADgotPAC.ll
; CHECK: LLVM ERROR: pac instructions require ptrauth target feature
@foo.ptrauth = private constant { ptr, i32, i64, i64 } { ptr @foo, i32 0, i64 0, i64 0 }, section "llvm.ptrauth", align 8
define ptr @bar() #0 {
ret ptr @foo.ptrauth
}
declare void @foo()
attributes #0 = { "ptrauth-calls" "target-cpu"="generic" }
;--- LOADauthptrgot.ll
; RUN: not --crash llc -mtriple aarch64-elf LOADauthptrgot.ll 2>&1 | \
; RUN: FileCheck LOADauthptrgot.ll
; CHECK: LLVM ERROR: pac instructions require ptrauth target feature
define ptr @foo() #0 {
ret ptr @g_weak.ptrauth
}
@g_weak = extern_weak global i32
@g_weak.ptrauth = private constant { ptr, i32, i64, i64 } { ptr @g_weak, i32 0, i64 0, i64 0 }, section "llvm.ptrauth"
attributes #0 = { "ptrauth-calls" "target-cpu"="generic" }
;--- ptrauth-returns.ll
; RUN: not --crash llc -mtriple aarch64-elf ptrauth-returns.ll 2>&1 | \
; RUN: FileCheck ptrauth-returns.ll
; CHECK: LLVM ERROR: aarch64 LR authentication requires ptrauth
define i32 @bar() #0 {
ret i32 42
}
define i32 @foo() {
%tmp = call i32 @bar()
ret i32 %tmp
}
attributes #0 = { "ptrauth-returns" "target-cpu"="generic" }
;--- auth-call.ll
; RUN: not --crash llc -mtriple aarch64-elf auth-call.ll 2>&1 | \
; RUN: FileCheck auth-call.ll
; CHECK: LLVM ERROR: Cannot select:{{.*}}AArch64ISD::AUTH_CALL
define void @bar(ptr %foo) #0 {
call void %foo() [ "ptrauth"(i32 0, i64 0) ]
ret void
}
attributes #0 = { "ptrauth-calls" "target-cpu"="generic" }
;--- tryAuthLoad.ll
; RUN: not --crash llc -mtriple aarch64-elf tryAuthLoad.ll 2>&1 | \
; RUN: FileCheck tryAuthLoad.ll
; CHECK: LLVM ERROR: pac instructions require ptrauth target feature
define i64 @test(ptr %ptr) {
%tmp0 = ptrtoint ptr %ptr to i64
%tmp1 = call i64 @llvm.ptrauth.auth(i64 %tmp0, i32 2, i64 0)
%tmp2 = inttoptr i64 %tmp1 to ptr
%tmp3 = load i64, ptr %tmp2
ret i64 %tmp3
}
declare i64 @llvm.ptrauth.auth(i64, i32, i64)