-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[AArch64][PAC][clang][ELF] Support PAuth ABI core info #85235
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
Merged
Merged
Changes from 14 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
919af72
[PAC][clang] Define ptrauth driver flags and preprocessor features
kovdan01 9924f57
[PAC][AArch64][clang][ELF] Support PAuth ABI compatibility tag
kovdan01 f80f4bd
Enhance tests
kovdan01 f069c9b
Merge branch 'main' into pauth-gnuprop-clang
kovdan01 68bf805
Merge branch 'main' into pauth-gnuprop-clang & fix conflict after 6ff…
kovdan01 f3abb48
Update clang/test/Driver/aarch64-ptrauth.c
kovdan01 6dcf86e
Fix code formatting
kovdan01 4fd37cf
Delete clang/test/Driver/ptrauth.c in favor of aarch64-ptrauth.c
kovdan01 2fd8f66
Delete unneeded REQUIRES for aarch64 target
kovdan01 2038f8d
Merge branch 'main' into pauth-gnuprop-clang
kovdan01 a33d91b
Merge branch 'main' into pauth-gnuprop-clang
kovdan01 fdb26a1
Use `%clang_cc1` instead of `%clang`
kovdan01 87f2937
Merge branch 'main' into pauth-gnuprop-clang
kovdan01 b0f9a19
Address review comments
kovdan01 9f6d65c
Merge branch 'main' into pauth-gnuprop-clang
kovdan01 37a4d9d
Address review comments
kovdan01 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// RUN: %clang_cc1 -triple aarch64-linux -S -emit-llvm -o - \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
After #91140 this will lead to an error. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed, thanks, see 37a4d9d |
||
// RUN: -fptrauth-intrinsics \ | ||
// RUN: -fptrauth-calls \ | ||
// RUN: -fptrauth-returns \ | ||
// RUN: -fptrauth-auth-traps \ | ||
// RUN: -fptrauth-vtable-pointer-address-discrimination \ | ||
// RUN: -fptrauth-vtable-pointer-type-discrimination \ | ||
// RUN: -fptrauth-init-fini %s | \ | ||
// RUN: FileCheck %s --check-prefix=ALL | ||
|
||
// RUN: %clang_cc1 -triple aarch64-linux -S -emit-llvm -o - \ | ||
// RUN: -fptrauth-intrinsics %s | FileCheck %s --check-prefix=INTRIN | ||
|
||
// RUN: %clang_cc1 -triple aarch64-linux -S -emit-llvm -o - \ | ||
// RUN: -fptrauth-calls %s | FileCheck %s --check-prefix=CALL | ||
|
||
// RUN: %clang_cc1 -triple aarch64-linux -S -emit-llvm -o - \ | ||
// RUN: -fptrauth-returns %s | FileCheck %s --check-prefix=RET | ||
|
||
// RUN: %clang_cc1 -triple aarch64-linux -S -emit-llvm -o - \ | ||
// RUN: -fptrauth-auth-traps %s | FileCheck %s --check-prefix=TRAP | ||
|
||
// RUN: %clang_cc1 -triple aarch64-linux -S -emit-llvm -o - \ | ||
// RUN: -fptrauth-calls -fptrauth-vtable-pointer-address-discrimination %s | \ | ||
// RUN: FileCheck %s --check-prefix=VPTRADDR | ||
|
||
// RUN: %clang_cc1 -triple aarch64-linux -S -emit-llvm -o - \ | ||
// RUN: -fptrauth-calls -fptrauth-vtable-pointer-type-discrimination %s | \ | ||
// RUN: FileCheck %s --check-prefix=VPTRTYPE | ||
|
||
// RUN: %clang_cc1 -triple aarch64-linux -S -emit-llvm -o - \ | ||
// RUN: -fptrauth-calls -fptrauth-init-fini %s | \ | ||
// RUN: FileCheck %s --check-prefix=INITFINI | ||
|
||
// ALL: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} | ||
// ALL: !{i32 1, !"aarch64-elf-pauthabi-version", i32 127} | ||
|
||
// INTRIN: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} | ||
// INTRIN: !{i32 1, !"aarch64-elf-pauthabi-version", i32 1} | ||
|
||
// CALL: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} | ||
// CALL: !{i32 1, !"aarch64-elf-pauthabi-version", i32 2} | ||
|
||
// RET: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} | ||
// RET: !{i32 1, !"aarch64-elf-pauthabi-version", i32 4} | ||
|
||
// TRAP: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} | ||
// TRAP: !{i32 1, !"aarch64-elf-pauthabi-version", i32 8} | ||
|
||
// VPTRADDR: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} | ||
// VPTRADDR: !{i32 1, !"aarch64-elf-pauthabi-version", i32 18} | ||
|
||
// VPTRTYPE: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} | ||
// VPTRTYPE: !{i32 1, !"aarch64-elf-pauthabi-version", i32 34} | ||
|
||
// INITFINI: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458} | ||
// INITFINI: !{i32 1, !"aarch64-elf-pauthabi-version", i32 66} | ||
|
||
void foo() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,25 @@ | ||
// RUN: %clang -### -c --target=aarch64 -fno-ptrauth-intrinsics -fptrauth-intrinsics %s 2>&1 | FileCheck %s --check-prefix=INTRIN | ||
// INTRIN: "-cc1"{{.*}} "-fptrauth-intrinsics" | ||
// RUN: %clang -### -c --target=aarch64 %s 2>&1 | FileCheck %s --check-prefix NONE | ||
// NONE: "-cc1" | ||
// NONE-NOT: "-fptrauth- | ||
|
||
// RUN: not %clang -### -c --target=x86_64 -fptrauth-intrinsics %s 2>&1 | FileCheck %s --check-prefix=ERR | ||
// ERR: error: unsupported option '-fptrauth-intrinsics' for target '{{.*}}' | ||
// RUN: %clang -### -c --target=aarch64 \ | ||
// RUN: -fno-ptrauth-intrinsics -fptrauth-intrinsics \ | ||
// RUN: -fno-ptrauth-calls -fptrauth-calls \ | ||
// RUN: -fno-ptrauth-returns -fptrauth-returns \ | ||
// RUN: -fno-ptrauth-auth-traps -fptrauth-auth-traps \ | ||
// RUN: -fno-ptrauth-vtable-pointer-address-discrimination -fptrauth-vtable-pointer-address-discrimination \ | ||
// RUN: -fno-ptrauth-vtable-pointer-type-discrimination -fptrauth-vtable-pointer-type-discrimination \ | ||
// RUN: -fno-ptrauth-init-fini -fptrauth-init-fini \ | ||
// RUN: %s 2>&1 | FileCheck %s --check-prefix=ALL | ||
// ALL: "-cc1"{{.*}} "-fptrauth-intrinsics" "-fptrauth-calls" "-fptrauth-returns" "-fptrauth-auth-traps" "-fptrauth-vtable-pointer-address-discrimination" "-fptrauth-vtable-pointer-type-discrimination" "-fptrauth-init-fini" | ||
|
||
// RUN: not %clang -### -c --target=x86_64 -fptrauth-intrinsics -fptrauth-calls -fptrauth-returns -fptrauth-auth-traps \ | ||
// RUN: -fptrauth-vtable-pointer-address-discrimination -fptrauth-vtable-pointer-type-discrimination \ | ||
// RUN: -fptrauth-init-fini %s 2>&1 | FileCheck %s --check-prefix=ERR | ||
// ERR: error: unsupported option '-fptrauth-intrinsics' for target '{{.*}}' | ||
// ERR-NEXT: error: unsupported option '-fptrauth-calls' for target '{{.*}}' | ||
// ERR-NEXT: error: unsupported option '-fptrauth-returns' for target '{{.*}}' | ||
// ERR-NEXT: error: unsupported option '-fptrauth-auth-traps' for target '{{.*}}' | ||
// ERR-NEXT: error: unsupported option '-fptrauth-vtable-pointer-address-discrimination' for target '{{.*}}' | ||
// ERR-NEXT: error: unsupported option '-fptrauth-vtable-pointer-type-discrimination' for target '{{.*}}' | ||
// ERR-NEXT: error: unsupported option '-fptrauth-init-fini' for target '{{.*}}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Linux implies ELF. You can remove
getTriple().isOSBinFormatELF()
Uh oh!
There was an error while loading. Please reload this page.
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.
OK, but I'll leave an assertion against ELF here. Theoretically, we might have non-ELF binary format on Linux, while the Linux itself seems to have deprecated COFF and a.out support and llvm does not seem to support them as well. This assertion makes sense to me since (a) it makes things clear that we want to check both Linux and ELF (b) this will notify us if in future we have binary formats other than ELF supported on Linux.
See 37a4d9d