-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AArch64][PAC][clang][ELF] Support PAuth ABI core info (#85235)
Depends on #87545 Emit PAuth ABI compatibility tag values as llvm module flags: - `aarch64-elf-pauthabi-platform` - `aarch64-elf-pauthabi-version` For platform 0x10000002 (llvm_linux), the version value bits correspond to the following LangOptions defined in #85232: - bit 0: `PointerAuthIntrinsics`; - bit 1: `PointerAuthCalls`; - bit 2: `PointerAuthReturns`; - bit 3: `PointerAuthAuthTraps`; - bit 4: `PointerAuthVTPtrAddressDiscrimination`; - bit 5: `PointerAuthVTPtrTypeDiscrimination`; - bit 6: `PointerAuthInitFini`. --------- Co-authored-by: Ahmed Bougacha <[email protected]>
- Loading branch information
1 parent
c2a87d7
commit ad652ef
Showing
9 changed files
with
274 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 -emit-llvm -o - \ | ||
// 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 -emit-llvm -o - \ | ||
// RUN: -fptrauth-intrinsics %s | FileCheck %s --check-prefix=INTRIN | ||
|
||
// RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \ | ||
// RUN: -fptrauth-calls %s | FileCheck %s --check-prefix=CALL | ||
|
||
// RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \ | ||
// RUN: -fptrauth-returns %s | FileCheck %s --check-prefix=RET | ||
|
||
// RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \ | ||
// RUN: -fptrauth-auth-traps %s | FileCheck %s --check-prefix=TRAP | ||
|
||
// RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \ | ||
// RUN: -fptrauth-calls -fptrauth-vtable-pointer-address-discrimination %s | \ | ||
// RUN: FileCheck %s --check-prefix=VPTRADDR | ||
|
||
// RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \ | ||
// RUN: -fptrauth-calls -fptrauth-vtable-pointer-type-discrimination %s | \ | ||
// RUN: FileCheck %s --check-prefix=VPTRTYPE | ||
|
||
// RUN: %clang_cc1 -triple aarch64-linux -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 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 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