-
Notifications
You must be signed in to change notification settings - Fork 0
[AArch64][PAC] Emit a fatal error when ptrauth target feature is missing #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: elf-pauth
Are you sure you want to change the base?
Changes from 2 commits
e31206a
ccfa70e
52afe42
81cb742
3821445
9ed8fc6
bffc609
8e30a83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| ; REQUIRES: asserts | ||
| ; RUN: split-file %s %t && cd %t | ||
|
|
||
| ;--- MOVaddrPAC.ll | ||
|
|
||
| ; RUN: not --crash llc -debug -mtriple aarch64-elf MOVaddrPAC.ll 2>&1 | \ | ||
| ; RUN: FileCheck MOVaddrPAC.ll | ||
|
|
||
| ; CHECK: Expanding: MOVaddrPAC @foo | ||
| ; 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 -debug -mtriple aarch64-elf LOADgotPAC.ll 2>&1 | \ | ||
| ; RUN: FileCheck LOADgotPAC.ll | ||
|
|
||
| ; CHECK: Expanding: LOADgotPAC @foo | ||
| ; 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 -debug -mtriple aarch64-elf LOADauthptrgot.ll 2>&1 | \ | ||
| ; RUN: FileCheck LOADauthptrgot.ll | ||
|
|
||
| ; CHECK: Expanding: {{.*}}LOADauthptrgot @g_weak | ||
| ; CHECK: LLVM ERROR: pac instructions require ptrauth target feature | ||
|
|
||
| define i8* @foo() #0 { | ||
| %tmp = bitcast { i8*, i32, i64, i64 }* @g_weak.ptrauth to i8* | ||
| ret i8* %tmp | ||
| } | ||
|
|
||
| @g_weak = extern_weak global i32 | ||
| @g_weak.ptrauth = private constant { i8*, i32, i64, i64 } { i8* bitcast (i32* @g_weak to i8*), i32 0, i64 0, i64 0 }, section "llvm.ptrauth" | ||
|
||
|
|
||
| attributes #0 = { "ptrauth-calls" "target-cpu"="generic" } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| ; 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 i8* @foo() #0 { | ||
| %tmp = bitcast { i8*, i32, i64, i64 }* @g_weak.ptrauth to i8* | ||
| ret i8* %tmp | ||
| } | ||
|
|
||
| @g_weak = extern_weak global i32 | ||
| @g_weak.ptrauth = private constant { i8*, i32, i64, i64 } { i8* bitcast (i32* @g_weak to i8*), i32 0, i64 0, i64 0 }, section "llvm.ptrauth" | ||
|
||
|
|
||
| attributes #0 = { "ptrauth-calls" "target-cpu"="generic" } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-debugmay be replaced with-debug-only=aarch64-expand-hardened-pseudosfor less verbose debug output (not sure which is more canonical in tests, though).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed in 52afe42