[clang] [AArch64][PAC][clang][ELF] Support PAuth ABI core info (PR #85235)

2024-04-23 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 updated https://github.com/llvm/llvm-project/pull/85235 >From 919af72c09216838bfe586c3da503f5d74104a7d Mon Sep 17 00:00:00 2001 From: Daniil Kovalev Date: Tue, 19 Mar 2024 23:57:06 +0300 Subject: [PATCH 1/8] [PAC][clang] Define ptrauth driver flags and preprocessor

[clang] [AArch64][PAC][clang][ELF] Support PAuth ABI core info (PR #85235)

2024-04-23 Thread Daniil Kovalev via cfe-commits
@@ -0,0 +1,59 @@ +// RUN: %clang --target=aarch64-linux -S -emit-llvm -o - \ kovdan01 wrote: Fixed, thanks, see fdb26a14024f5f8297480a74982a37ee988cd30f https://github.com/llvm/llvm-project/pull/85235 ___ cfe-commits m

[clang] [clang-tools-extra] [PAC][clang] Define `PointerAuthQualifier` and `PointerAuthenticationMode` (PR #84384)

2024-04-25 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 closed https://github.com/llvm/llvm-project/pull/84384 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix `remove{CVR|Fast}Qualifiers` with 64-bit `Qualifiers::Mask` (PR #90329)

2024-04-27 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 created https://github.com/llvm/llvm-project/pull/90329 After #84384, `Qualifiers::Mask` becomes 64-bit. So, operations like `Mask &= ~U32` where `U32` is `unsigned` produce undesirable results since higher 32 bits of `Mask` become zeroed while they should be preser

[clang] [clang] Fix `remove{CVR|Fast}Qualifiers` with 64-bit `Qualifiers::Mask` (PR #90329)

2024-04-27 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 ready_for_review https://github.com/llvm/llvm-project/pull/90329 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix `remove{CVR|Fast}Qualifiers` with 64-bit `Qualifiers::Mask` (PR #90329)

2024-04-29 Thread Daniil Kovalev via cfe-commits
kovdan01 wrote: @AaronBallman Please let me know if you have some comments on this or if can be merged https://github.com/llvm/llvm-project/pull/90329 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

[clang] [clang] Fix `remove{CVR|Fast}Qualifiers` with 64-bit `Qualifiers::Mask` (PR #90329)

2024-04-29 Thread Daniil Kovalev via cfe-commits
kovdan01 wrote: @cor3ntin Thanks for feedback! I'll merge it myself https://github.com/llvm/llvm-project/pull/90329 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix `remove{CVR|Fast}Qualifiers` with 64-bit `Qualifiers::Mask` (PR #90329)

2024-04-29 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 closed https://github.com/llvm/llvm-project/pull/90329 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [AArch64][PAC][clang][ELF] Support PAuth ABI core info (PR #85235)

2024-04-30 Thread Daniil Kovalev via cfe-commits
kovdan01 wrote: @MaskRay I've addressed your latest comments in fdb26a14024f5f8297480a74982a37ee988cd30f - would be glad to see your feedback on the changes https://github.com/llvm/llvm-project/pull/85235 ___ cfe-commits mailing list cfe-commits@list

[clang] [llvm] [PAC][Driver] Implement `-mbranch-protection=pauthabi` option (PR #97237)

2024-07-10 Thread Daniil Kovalev via cfe-commits
kovdan01 wrote: Thanks @smithp35 for a detailed description! > Use the environment part of the triple I suppose we should use this this option since it's harder for end users to use that incorrectly - it looks like that many real-world code and corresponding build environments rely on triple

[clang] [compiler-rt] [llvm] [PAC][AArch64] Support init/fini array signing (PR #96478)

2024-07-11 Thread Daniil Kovalev via cfe-commits
kovdan01 wrote: Ping: would be glad to see feedback on the changes from those who are interested. https://github.com/llvm/llvm-project/pull/96478 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/c

[clang] [PAC][clang][Driver] Add signed GOT flag (PR #96160)

2024-07-11 Thread Daniil Kovalev via cfe-commits
kovdan01 wrote: Ping: would be glad to see feedback on the changes from those who are interested. https://github.com/llvm/llvm-project/pull/96160 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/c

[clang] [clang] Implement function pointer type discrimination (PR #96992)

2024-07-11 Thread Daniil Kovalev via cfe-commits
kovdan01 wrote: @ahatanak It would be nice if you explicitly mention the flag name `-fptrauth-function-pointer-type-discrimination` in commit message - I think it might be useful when grepping output of git log. https://github.com/llvm/llvm-project/pull/96992 __

[clang] [llvm] [PAC][Driver] Implement `-mbranch-protection=pauthabi` option (PR #97237)

2024-07-12 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 updated https://github.com/llvm/llvm-project/pull/97237 >From 3b4b1b1739b810d758e68f30c48b648963cff740 Mon Sep 17 00:00:00 2001 From: Daniil Kovalev Date: Mon, 1 Jul 2024 00:50:21 +0300 Subject: [PATCH 1/6] [PAC][Driver] Implement `-mbranch-protection=pauthabi` opti

[clang] [llvm] [PAC][Driver] Implement `-mbranch-protection=pauthabi` option (PR #97237)

2024-07-12 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 updated https://github.com/llvm/llvm-project/pull/97237 >From 3b4b1b1739b810d758e68f30c48b648963cff740 Mon Sep 17 00:00:00 2001 From: Daniil Kovalev Date: Mon, 1 Jul 2024 00:50:21 +0300 Subject: [PATCH 1/6] [PAC][Driver] Implement `-mbranch-protection=pauthabi` opti

[clang] [llvm] [PAC][Driver] Implement `-mbranch-protection=pauthabi` option (PR #97237)

2024-07-12 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 edited https://github.com/llvm/llvm-project/pull/97237 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [PAC][Driver] Support `pauthtest` ABI for AArch64 Linux triples (PR #97237)

2024-07-12 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 edited https://github.com/llvm/llvm-project/pull/97237 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [PAC][Driver] Support `pauthtest` ABI for AArch64 Linux triples (PR #97237)

2024-07-12 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 closed https://github.com/llvm/llvm-project/pull/97237 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [PAC][Driver] Support `pauthtest` ABI for AArch64 Linux triples (PR #97237)

2024-07-12 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 reopened https://github.com/llvm/llvm-project/pull/97237 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [PAC][Driver] Support `pauthtest` ABI for AArch64 Linux triples (PR #97237)

2024-07-12 Thread Daniil Kovalev via cfe-commits
kovdan01 wrote: @smithp35 I've implemented `pauthtest` ABI support - see new PR description for details and tests for examples. I'm not sure if the implementation is nice and maybe I've put some logic in wrong places while there are better ones, but the result looks matching the requirements d

[clang] [PAC][clang] Enhance preprocessor ptrauth tests (PR #98862)

2024-07-14 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 created https://github.com/llvm/llvm-project/pull/98862 Test one feature at a time to make RUN lines shorter. See also https://github.com/llvm/llvm-project/pull/96992#discussion_r1669394582 >From 9436a51f2545434da511c4421099f7501a5472c5 Mon Sep 17 00:00:00 2001 From

[clang] [PAC][clang] Enhance preprocessor ptrauth tests (PR #98862)

2024-07-14 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 ready_for_review https://github.com/llvm/llvm-project/pull/98862 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -165,6 +166,88 @@ CGPointerAuthInfo CodeGenModule::getPointerAuthInfoForType(QualType T) { return ::getPointerAuthInfoForType(*this, T); } +static bool isZeroConstant(llvm::Value *value) { + if (auto ci = dyn_cast(value)) +return ci->isZero(); + return false; +} +

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -195,34 +195,45 @@ CodeGenFunction::CGFPOptionsRAII::~CGFPOptionsRAII() { CGF.Builder.setDefaultConstrainedRounding(OldRounding); } -static LValue MakeNaturalAlignAddrLValue(llvm::Value *V, QualType T, - bool ForPointeeType, -

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -0,0 +1,77 @@ +// RUN: %clang_cc1 -fptrauth-function-pointer-type-discrimination -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm %s -o - | FileCheck -check-prefix=CHECK -check-prefix=NOPCH %s kovdan01 wrote: Nit: maybe use `-check-pr

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -3126,3 +3137,57 @@ CodeGenFunction::EmitPointerAuthAuth(const CGPointerAuthInfo &PointerAuth, return EmitPointerAuthCommon(*this, PointerAuth, Pointer, llvm::Intrinsic::ptrauth_auth); } + +llvm::Value *CodeGenFunction::EmitPointerAuthSign(Q

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 commented: I've left a bunch of mostly cosmetic comments and minor nits which are non-blocking in terms of merging that. However, I'll take another look at this "with fresh eyes" within a day - I need a bit more time to drill into actual logic. https://github.com/l

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -3126,3 +3137,57 @@ CodeGenFunction::EmitPointerAuthAuth(const CGPointerAuthInfo &PointerAuth, return EmitPointerAuthCommon(*this, PointerAuth, Pointer, llvm::Intrinsic::ptrauth_auth); } + +llvm::Value *CodeGenFunction::EmitPointerAuthSign(Q

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -165,6 +166,88 @@ CGPointerAuthInfo CodeGenModule::getPointerAuthInfoForType(QualType T) { return ::getPointerAuthInfoForType(*this, T); } +static bool isZeroConstant(llvm::Value *value) { + if (auto ci = dyn_cast(value)) +return ci->isZero(); + return false; +} +

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -3126,3 +3137,57 @@ CodeGenFunction::EmitPointerAuthAuth(const CGPointerAuthInfo &PointerAuth, return EmitPointerAuthCommon(*this, PointerAuth, Pointer, llvm::Intrinsic::ptrauth_auth); } + +llvm::Value *CodeGenFunction::EmitPointerAuthSign(Q

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -0,0 +1,55 @@ +// RUN: %clang_cc1 %s -triple arm64e-apple-ios13 -fptrauth-calls -fptrauth-intrinsics -emit-llvm -o- -fptrauth-function-pointer-type-discrimination | FileCheck %s + +typedef void (*fptr_t)(void); + +char *cptr; +void (*fptr)(void); + +// CHECK-LABEL: define vo

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -351,3 +434,125 @@ CodeGenModule::getVTablePointerAuthInfo(CodeGenFunction *CGF, /* IsIsaPointer */ false, /* AuthenticatesNullValues */ false, Discriminator); } + +llvm::Value *CodeGenFunction::AuthPointerToPointerCast(

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 edited https://github.com/llvm/llvm-project/pull/98847 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -3126,3 +3137,57 @@ CodeGenFunction::EmitPointerAuthAuth(const CGPointerAuthInfo &PointerAuth, return EmitPointerAuthCommon(*this, PointerAuth, Pointer, llvm::Intrinsic::ptrauth_auth); } + +llvm::Value *CodeGenFunction::EmitPointerAuthSign(Q

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
kovdan01 wrote: Could you please clarify what tests should go to ptrauth.c? The test name is very generic, and we have more than 10 tests with clang/test/CodeGen/ptrauth*.c names. Maybe this should be renamed to smth more specific? https://github.com/llvm/llv

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -190,8 +190,8 @@ class CGBuilderTy : public CGBuilderBaseTy { const llvm::Twine &Name = "") { if (!Addr.hasOffset()) return Address(CreateAddrSpaceCast(Addr.getBasePointer(), Ty, Name), - ElementTy, Addr.getAlignmen

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -165,6 +166,88 @@ CGPointerAuthInfo CodeGenModule::getPointerAuthInfoForType(QualType T) { return ::getPointerAuthInfoForType(*this, T); } +static bool isZeroConstant(llvm::Value *value) { + if (auto ci = dyn_cast(value)) +return ci->isZero(); + return false; +} +

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -165,6 +166,88 @@ CGPointerAuthInfo CodeGenModule::getPointerAuthInfoForType(QualType T) { return ::getPointerAuthInfoForType(*this, T); } +static bool isZeroConstant(llvm::Value *value) { + if (auto ci = dyn_cast(value)) +return ci->isZero(); + return false; +} +

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -0,0 +1,55 @@ +// RUN: %clang_cc1 %s -triple arm64e-apple-ios13 -fptrauth-calls -fptrauth-intrinsics -emit-llvm -o- -fptrauth-function-pointer-type-discrimination | FileCheck %s kovdan01 wrote: Nit: it would also be nice to have RUN lines against linux trip

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -0,0 +1,77 @@ +// RUN: %clang_cc1 -fptrauth-function-pointer-type-discrimination -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm %s -o - | FileCheck -check-prefix=CHECK -check-prefix=NOPCH %s +// RUN: %clang_cc1 -fptrauth-function-pointer-type-discrim

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -0,0 +1,77 @@ +// RUN: %clang_cc1 -fptrauth-function-pointer-type-discrimination -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm %s -o - | FileCheck -check-prefix=CHECK -check-prefix=NOPCH %s kovdan01 wrote: Nit: long RUN lines shoul

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -165,6 +166,88 @@ CGPointerAuthInfo CodeGenModule::getPointerAuthInfoForType(QualType T) { return ::getPointerAuthInfoForType(*this, T); } +static bool isZeroConstant(llvm::Value *value) { + if (auto ci = dyn_cast(value)) +return ci->isZero(); + return false; +} +

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -165,6 +166,88 @@ CGPointerAuthInfo CodeGenModule::getPointerAuthInfoForType(QualType T) { return ::getPointerAuthInfoForType(*this, T); } +static bool isZeroConstant(llvm::Value *value) { + if (auto ci = dyn_cast(value)) kovdan01 wrote: Nit ```suggest

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -3126,3 +3137,57 @@ CodeGenFunction::EmitPointerAuthAuth(const CGPointerAuthInfo &PointerAuth, return EmitPointerAuthCommon(*this, PointerAuth, Pointer, llvm::Intrinsic::ptrauth_auth); } + +llvm::Value *CodeGenFunction::EmitPointerAuthSign(Q

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -165,6 +166,88 @@ CGPointerAuthInfo CodeGenModule::getPointerAuthInfoForType(QualType T) { return ::getPointerAuthInfoForType(*this, T); } +static bool isZeroConstant(llvm::Value *value) { + if (auto ci = dyn_cast(value)) +return ci->isZero(); + return false; +} +

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
@@ -3126,3 +3137,57 @@ CodeGenFunction::EmitPointerAuthAuth(const CGPointerAuthInfo &PointerAuth, return EmitPointerAuthCommon(*this, PointerAuth, Pointer, llvm::Intrinsic::ptrauth_auth); } + +llvm::Value *CodeGenFunction::EmitPointerAuthSign(Q

[clang] [PAC] Implement function pointer re-signing (PR #98847)

2024-07-15 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 edited https://github.com/llvm/llvm-project/pull/98847 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [PAC][clang] Enhance preprocessor ptrauth tests (PR #98862)

2024-07-15 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 closed https://github.com/llvm/llvm-project/pull/98862 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [AArch64][PAC][clang][ELF] Support PAuth ABI core info (PR #85235)

2024-05-06 Thread Daniil Kovalev via cfe-commits
@@ -1,5 +1,37 @@ +// RUN: %clang -### -c --target=aarch64 %s 2>&1 | FileCheck %s --check-prefix NONE +// NONE: "-cc1" +// NONE-NOT: "-fptrauth- + // RUN: %clang -### -c --target=aarch64 -fno-ptrauth-intrinsics -fptrauth-intrinsics %s 2>&1 | FileCheck %s --check-prefix=INTRIN /

[clang] [AArch64][PAC][clang][ELF] Support PAuth ABI core info (PR #85235)

2024-05-06 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 updated https://github.com/llvm/llvm-project/pull/85235 >From 919af72c09216838bfe586c3da503f5d74104a7d Mon Sep 17 00:00:00 2001 From: Daniil Kovalev Date: Tue, 19 Mar 2024 23:57:06 +0300 Subject: [PATCH 1/9] [PAC][clang] Define ptrauth driver flags and preprocessor

[clang] [AArch64][PAC][clang][ELF] Support PAuth ABI core info (PR #85235)

2024-05-06 Thread Daniil Kovalev via cfe-commits
@@ -1,5 +1,37 @@ +// RUN: %clang -### -c --target=aarch64 %s 2>&1 | FileCheck %s --check-prefix NONE +// NONE: "-cc1" +// NONE-NOT: "-fptrauth- + // RUN: %clang -### -c --target=aarch64 -fno-ptrauth-intrinsics -fptrauth-intrinsics %s 2>&1 | FileCheck %s --check-prefix=INTRIN /

[clang] [AArch64][PAC][clang][ELF] Support PAuth ABI core info (PR #85235)

2024-05-06 Thread Daniil Kovalev via cfe-commits
@@ -1796,6 +1796,26 @@ void Clang::AddAArch64TargetArgs(const ArgList &Args, Args.addOptInFlag(CmdArgs, options::OPT_fptrauth_intrinsics, options::OPT_fno_ptrauth_intrinsics); + kovdan01 wrote: Deleted, see b0f9a1985846448d01af9bacdb6e3d

[clang] [AArch64][PAC][clang][ELF] Support PAuth ABI core info (PR #85235)

2024-05-08 Thread Daniil Kovalev via cfe-commits
kovdan01 wrote: @MaskRay Please let me know if you have some additional feedback after the latest updates b0f9a1985846448d01af9bacdb6e3ddb23d4588f or if this can be merged. https://github.com/llvm/llvm-project/pull/85235 ___ cfe-commits mailing list

[clang] [AArch64][PAC][clang][ELF] Support PAuth ABI core info (PR #85235)

2024-05-09 Thread Daniil Kovalev via cfe-commits
@@ -1190,6 +1191,36 @@ void CodeGenModule::Release() { if (!LangOpts.isSignReturnAddressWithAKey()) getModule().addModuleFlag(llvm::Module::Min, "sign-return-address-with-bkey", 1); + +if (getTriple().isOSLinux() && getTriple().isOS

[clang] [AArch64][PAC][clang][ELF] Support PAuth ABI core info (PR #85235)

2024-05-09 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 updated https://github.com/llvm/llvm-project/pull/85235 >From 919af72c09216838bfe586c3da503f5d74104a7d Mon Sep 17 00:00:00 2001 From: Daniil Kovalev Date: Tue, 19 Mar 2024 23:57:06 +0300 Subject: [PATCH 01/10] [PAC][clang] Define ptrauth driver flags and preprocesso

[clang] [AArch64][PAC][clang][ELF] Support PAuth ABI core info (PR #85235)

2024-05-09 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 edited https://github.com/llvm/llvm-project/pull/85235 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [AArch64][PAC][clang][ELF] Support PAuth ABI core info (PR #85235)

2024-05-09 Thread Daniil Kovalev via cfe-commits
@@ -0,0 +1,59 @@ +// RUN: %clang_cc1 -triple aarch64-linux -S -emit-llvm -o - \ kovdan01 wrote: Fixed, thanks, see 37a4d9d08fefd8c42c21b92ad2e3c1fa07fac126 https://github.com/llvm/llvm-project/pull/85235 ___ cfe-commit

[clang] [AArch64][PAC][clang][ELF] Support PAuth ABI core info (PR #85235)

2024-05-09 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 closed https://github.com/llvm/llvm-project/pull/85235 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement type/address discrimination of type_info vtable. (PR #99726)

2024-07-31 Thread Daniil Kovalev via cfe-commits
@@ -0,0 +1,87 @@ +// RUN: %clang_cc1 -DENABLE_TID=0 -I%S -std=c++11 -triple=arm64e-apple-darwin \ +// RUN: -fptrauth-calls -fptrauth-intrinsics \ +// RUN: -fptrauth-vtable-pointer-type-discrimination \ +// RUN: -fptrauth-vtable-pointer-address-discrimination \ +// RUN: %s

[clang] [llvm] [PAC][clang][Driver] Add signed GOT flag (PR #96160)

2024-08-01 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 updated https://github.com/llvm/llvm-project/pull/96160 >From f891f791dfe882389d83d3c4c4fb57d67a845c04 Mon Sep 17 00:00:00 2001 From: Daniil Kovalev Date: Tue, 18 Jun 2024 15:38:18 +0300 Subject: [PATCH 1/3] [PAC][clang][Driver] Add signed GOT flag Add `-fptrauth-el

[clang] [compiler-rt] [llvm] [PAC][AArch64] Support init/fini array signing (PR #96478)

2024-08-01 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 updated https://github.com/llvm/llvm-project/pull/96478 >From 5399237a71c0ccd872821034d83ea2c3a04bed3f Mon Sep 17 00:00:00 2001 From: Daniil Kovalev Date: Fri, 21 Jun 2024 12:32:51 +0300 Subject: [PATCH 1/7] [PAC][AArch64] Support init/fini array signing If both `-f

[clang] [compiler-rt] [llvm] [PAC][AArch64] Support init/fini array signing (PR #96478)

2024-08-01 Thread Daniil Kovalev via cfe-commits
kovdan01 wrote: Ping: would be glad to see feedback on the changes from those who are interested. https://github.com/llvm/llvm-project/pull/96478 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/c

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-02 Thread Daniil Kovalev via cfe-commits
@@ -2196,6 +2196,58 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) { return V; } +static bool isDeclRefKnownNonNull(CodeGenFunction &CGF, const ValueDecl *D) { + return !D->isWeak(); +} + +static bool isLValueKnownNonNull(CodeGenFunction &CGF, const Expr *

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-02 Thread Daniil Kovalev via cfe-commits
@@ -956,6 +956,25 @@ def err_ptrauth_indirect_goto_addrlabel_arithmetic : Error< "%select{subtraction|addition}0 of address-of-label expressions is not " "supported with ptrauth indirect gotos">; +// __ptrauth qualifier +def err_ptrauth_qualifier_invalid : Error< + "%sele

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-02 Thread Daniil Kovalev via cfe-commits
@@ -166,6 +193,92 @@ CGPointerAuthInfo CodeGenModule::getPointerAuthInfoForType(QualType T) { return ::getPointerAuthInfoForType(*this, T); } +static std::pair +emitLoadOfOrigPointerRValue(CodeGenFunction &CGF, const LValue &LV, +SourceLocation L

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-02 Thread Daniil Kovalev via cfe-commits
@@ -2190,6 +2198,15 @@ RValue CodeGenFunction::EmitLoadOfAnyValue(LValue LV, AggValueSlot Slot, /// method emits the address of the lvalue, then loads the result as an rvalue, /// returning the rvalue. RValue CodeGenFunction::EmitLoadOfLValue(LValue LV, SourceLocation Loc) { +

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-02 Thread Daniil Kovalev via cfe-commits
@@ -2196,6 +2196,58 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) { return V; } +static bool isDeclRefKnownNonNull(CodeGenFunction &CGF, const ValueDecl *D) { + return !D->isWeak(); +} + +static bool isLValueKnownNonNull(CodeGenFunction &CGF, const Expr *

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-02 Thread Daniil Kovalev via cfe-commits
@@ -166,6 +193,92 @@ CGPointerAuthInfo CodeGenModule::getPointerAuthInfoForType(QualType T) { return ::getPointerAuthInfoForType(*this, T); } +static std::pair +emitLoadOfOrigPointerRValue(CodeGenFunction &CGF, const LValue &LV, +SourceLocation L

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-02 Thread Daniil Kovalev via cfe-commits
@@ -2196,6 +2196,58 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) { return V; } +static bool isDeclRefKnownNonNull(CodeGenFunction &CGF, const ValueDecl *D) { + return !D->isWeak(); +} + +static bool isLValueKnownNonNull(CodeGenFunction &CGF, const Expr *

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-02 Thread Daniil Kovalev via cfe-commits
@@ -1460,6 +1467,12 @@ class QualType { return getQualifiers().getPointerAuth(); } + bool hasAddressDiscriminatedPointerAuth() const { +if (PointerAuthQualifier ptrauth = getPointerAuth()) kovdan01 wrote: Nit ```suggestion if (PointerAuthQuali

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-02 Thread Daniil Kovalev via cfe-commits
@@ -166,6 +193,92 @@ CGPointerAuthInfo CodeGenModule::getPointerAuthInfoForType(QualType T) { return ::getPointerAuthInfoForType(*this, T); } +static std::pair +emitLoadOfOrigPointerRValue(CodeGenFunction &CGF, const LValue &LV, +SourceLocation L

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-02 Thread Daniil Kovalev via cfe-commits
@@ -166,6 +193,92 @@ CGPointerAuthInfo CodeGenModule::getPointerAuthInfoForType(QualType T) { return ::getPointerAuthInfoForType(*this, T); } +static std::pair +emitLoadOfOrigPointerRValue(CodeGenFunction &CGF, const LValue &LV, +SourceLocation L

[clang] [clang] Implement type/address discrimination of type_info vtable. (PR #99726)

2024-08-02 Thread Daniil Kovalev via cfe-commits
kovdan01 wrote: Submitted an issue #101716 describing incorrect behavior in terms of address discrimination (see also comments above) https://github.com/llvm/llvm-project/pull/99726 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-04 Thread Daniil Kovalev via cfe-commits
@@ -0,0 +1,132 @@ +// RUN: %clang_cc1 %s -fptrauth-function-pointer-type-discrimination -triple arm64e-apple-ios13 -fptrauth-calls -fptrauth-intrinsics -disable-llvm-passes -emit-llvm -o- | FileCheck %s kovdan01 wrote: Nit: it looks like you can use arm64

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-04 Thread Daniil Kovalev via cfe-commits
@@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios \ +// RUN: -fptrauth-calls -fptrauth-intrinsics -emit-llvm -fblocks \ +// RUN: %s -debug-info-kind=limited -o - | FileCheck %s + +// Constant initializers for data pointers. +extern int external_int; + +int *__ptraut

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-04 Thread Daniil Kovalev via cfe-commits
@@ -0,0 +1,132 @@ +// RUN: %clang_cc1 %s -fptrauth-function-pointer-type-discrimination -triple arm64e-apple-ios13 -fptrauth-calls -fptrauth-intrinsics -disable-llvm-passes -emit-llvm -o- | FileCheck %s kovdan01 wrote: Nit: it's probably worth to also hav

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-04 Thread Daniil Kovalev via cfe-commits
@@ -0,0 +1,87 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm %s -o - | FileCheck %s + +#include + +// Constant initializers for data pointers. +extern int external_int; + +// CHECK: @g1 = global ptr ptrauth (ptr @external_int, i32

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-04 Thread Daniil Kovalev via cfe-commits
@@ -,6 +5579,27 @@ CGCallee CodeGenFunction::EmitCallee(const Expr *E) { return EmitCallee(ICE->getSubExpr()); } +// Try to remember the original __ptrauth qualifier for loads of +// function pointers. +if (ICE->getCastKind() == CK_LValueToRValue) { +

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-04 Thread Daniil Kovalev via cfe-commits
@@ -1758,6 +1758,34 @@ Also see the documentation for `@available }]; } +def PtrAuthDocs : Documentation { + let Category = DocCatVariable; + let Heading = "__ptrauth, __ptrauth_restricted_intptr"; + let Content = [{ +The ``__ptrauth`` qualifier allows the programmer to d

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-04 Thread Daniil Kovalev via cfe-commits
@@ -0,0 +1,84 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -verify -fptrauth-intrinsics %s + +#include + +#if __has_feature(ptrauth_qualifier) +#warning __ptrauth qualifier enabled! +// expected-warning@-1 {{__ptrauth qualifier enabled!}} +#endif + +#if __aarch64

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-04 Thread Daniil Kovalev via cfe-commits
@@ -2196,6 +2196,58 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) { return V; } +static bool isDeclRefKnownNonNull(CodeGenFunction &CGF, const ValueDecl *D) { + return !D->isWeak(); +} + +static bool isLValueKnownNonNull(CodeGenFunction &CGF, const Expr *

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-04 Thread Daniil Kovalev via cfe-commits
@@ -2196,6 +2196,58 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) { return V; } +static bool isDeclRefKnownNonNull(CodeGenFunction &CGF, const ValueDecl *D) { + return !D->isWeak(); +} + +static bool isLValueKnownNonNull(CodeGenFunction &CGF, const Expr *

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-04 Thread Daniil Kovalev via cfe-commits
@@ -0,0 +1,84 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -verify -fptrauth-intrinsics %s + +#include + +#if __has_feature(ptrauth_qualifier) +#warning __ptrauth qualifier enabled! +// expected-warning@-1 {{__ptrauth qualifier enabled!}} +#endif + +#if __aarch64

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-04 Thread Daniil Kovalev via cfe-commits
@@ -0,0 +1,84 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -verify -fptrauth-intrinsics %s + +#include kovdan01 wrote: It looks like this include is not needed https://github.com/llvm/llvm-project/pull/100830 ___

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-04 Thread Daniil Kovalev via cfe-commits
@@ -2196,6 +2196,58 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) { return V; } +static bool isDeclRefKnownNonNull(CodeGenFunction &CGF, const ValueDecl *D) { + return !D->isWeak(); +} + +static bool isLValueKnownNonNull(CodeGenFunction &CGF, const Expr *

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-04 Thread Daniil Kovalev via cfe-commits
@@ -2196,6 +2196,58 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) { return V; } +static bool isDeclRefKnownNonNull(CodeGenFunction &CGF, const ValueDecl *D) { + return !D->isWeak(); +} + +static bool isLValueKnownNonNull(CodeGenFunction &CGF, const Expr *

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2024-08-04 Thread Daniil Kovalev via cfe-commits
@@ -8210,6 +8228,70 @@ static void HandleNeonVectorTypeAttr(QualType &CurType, const ParsedAttr &Attr, CurType = S.Context.getVectorType(CurType, numElts, VecKind); } +/// Handle the __ptrauth qualifier. +static void HandlePtrAuthQualifier(ASTContext &Ctx, QualType &T, +

[clang] [compiler-rt] [llvm] [PAC][AArch64] Support init/fini array signing (PR #96478)

2024-08-05 Thread Daniil Kovalev via cfe-commits
kovdan01 wrote: Ping: this PR blocks merging already approved #96159 (see https://github.com/llvm/llvm-project/pull/96159#issuecomment-2211411440), which transitively also blocks merging already approved dependent #96164. Would be glad to see feedback on the changes from those who are interest

[clang] [compiler-rt] [llvm] [PAC][AArch64] Support init/fini array signing (PR #96478)

2024-08-05 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 closed https://github.com/llvm/llvm-project/pull/96478 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [PAC][ELF][AArch64] Encode signed GOT flag in PAuth core info (PR #96159)

2024-08-06 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 updated https://github.com/llvm/llvm-project/pull/96159 >From 4eeb1b4e82941681b6cafda8579d136e3e7cb09f Mon Sep 17 00:00:00 2001 From: Daniil Kovalev Date: Tue, 18 Jun 2024 15:37:18 +0300 Subject: [PATCH 1/3] [PAC][ELF][AArch64] Encode signed GOT flag in PAuth core i

[clang] [llvm] [PAC][ELF][AArch64] Encode signed GOT flag in PAuth core info (PR #96159)

2024-08-06 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 updated https://github.com/llvm/llvm-project/pull/96159 >From 4eeb1b4e82941681b6cafda8579d136e3e7cb09f Mon Sep 17 00:00:00 2001 From: Daniil Kovalev Date: Tue, 18 Jun 2024 15:37:18 +0300 Subject: [PATCH 1/4] [PAC][ELF][AArch64] Encode signed GOT flag in PAuth core i

[clang] [compiler-rt] [llvm] [PAC][AArch64] Support init/fini array signing (PR #96478)

2024-08-06 Thread Daniil Kovalev via cfe-commits
kovdan01 wrote: @piotrAMD It looks like that `__has_feature` preprocessor directive support was implemented in gcc only in 2023: https://github.com/gcc-mirror/gcc/commit/06280a906cb3dc80cf5e07cf3335b758848d488d Thanks for reporting. I suppose we can just surround this chunk of code with `#ifd

[clang] [compiler-rt] [llvm] [PAC][AArch64] Support init/fini array signing (PR #96478)

2024-08-06 Thread Daniil Kovalev via cfe-commits
kovdan01 wrote: @piotrAMD Submitted #102154 with a fix. Could you please check if it resolves the issue for you? https://github.com/llvm/llvm-project/pull/96478 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mai

[clang] [llvm] [PAC][ELF][AArch64] Encode signed GOT flag in PAuth core info (PR #96159)

2024-08-06 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 edited https://github.com/llvm/llvm-project/pull/96159 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [PAC][ELF][AArch64] Encode signed GOT flag in PAuth core info (PR #96159)

2024-08-06 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 closed https://github.com/llvm/llvm-project/pull/96159 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [PAC][clang][Driver] Add signed GOT flag (PR #96160)

2024-08-06 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 updated https://github.com/llvm/llvm-project/pull/96160 >From 1ca6cf823585b03a6c580b23caafd1ff44d83aa7 Mon Sep 17 00:00:00 2001 From: Daniil Kovalev Date: Tue, 6 Aug 2024 20:02:07 +0300 Subject: [PATCH] [PAC][clang][Driver] Add signed GOT flag Depends on #96159 Add

[clang] [PAC][clang][Driver] Add signed GOT flag (PR #96160)

2024-08-06 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 updated https://github.com/llvm/llvm-project/pull/96160 >From 1ca6cf823585b03a6c580b23caafd1ff44d83aa7 Mon Sep 17 00:00:00 2001 From: Daniil Kovalev Date: Tue, 6 Aug 2024 20:02:07 +0300 Subject: [PATCH 1/2] [PAC][clang][Driver] Add signed GOT flag Depends on #96159

[clang] [llvm] [PAC] Fix address discrimination for type info vtable pointers (PR #102199)

2024-08-06 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 created https://github.com/llvm/llvm-project/pull/102199 In #99726, `-fptrauth-type-info-vtable-pointer-discrimination` was introduced, which is intended to enable type and address discrimination for type_info vtable pointers. However, some codegen logic for actuall

[clang] [llvm] [PAC] Fix address discrimination for type info vtable pointers (PR #102199)

2024-08-06 Thread Daniil Kovalev via cfe-commits
kovdan01 wrote: Also tagging @ojhunt (GitHub still does not let to add as a reviewer) https://github.com/llvm/llvm-project/pull/102199 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [PAC] Fix address discrimination for type info vtable pointers (PR #102199)

2024-08-06 Thread Daniil Kovalev via cfe-commits
https://github.com/kovdan01 ready_for_review https://github.com/llvm/llvm-project/pull/102199 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    1   2   3   4   5   >