https://github.com/ahatanak closed
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
https://github.com/kovdan01 approved this pull request.
LGTM, thanks @ahatanak !
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
@@ -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
ahatanak wrote:
Thanks! Please add a line to test linux after this PR is merged
@@ -351,3 +434,125 @@ CodeGenModule::getVTablePointerAuthInfo(CodeGenFunction
*CGF,
/* IsIsaPointer */ false,
/* AuthenticatesNullValues */ false, Discriminator);
}
+
+llvm::Value *CodeGenFunction::AuthPointerToPointerCast(
@@ -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
ahatanak wrote:
Sorry, I just realized th
@@ -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;
+}
+
@@ -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;
+}
+
@@ -165,6 +166,88 @@ CGPointerAuthInfo
CodeGenModule::getPointerAuthInfoForType(QualType T) {
return ::getPointerAuthInfoForType(*this, T);
}
+static bool isZeroConstant(llvm::Value *value) {
ahatanak wrote:
I fixed the names of variables and functions add
@@ -3126,3 +3137,57 @@ CodeGenFunction::EmitPointerAuthAuth(const
CGPointerAuthInfo &PointerAuth,
return EmitPointerAuthCommon(*this, PointerAuth, Pointer,
llvm::Intrinsic::ptrauth_auth);
}
+
+llvm::Value *CodeGenFunction::EmitPointerAuthSign(Q
@@ -2373,7 +2373,9 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
DestLV.setTBAAInfo(TBAAAccessInfo::getMayAliasInfo());
return EmitLoadOfLValue(DestLV, CE->getExprLoc());
}
-return Builder.CreateBitCast(Src, DstTy);
+
+llvm::Value *Result =
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
https://github.com/kovdan01 commented:
Mostly LGTM. There are several new pretty minor comments, but they can be
addressed in a follor-up PR.
The thing which is better to be addressed as a part of this PR is deleting
three unneeded member functions from `CodeGenFunction`. IMHO there is no reas
@@ -351,3 +434,125 @@ CodeGenModule::getVTablePointerAuthInfo(CodeGenFunction
*CGF,
/* IsIsaPointer */ false,
/* AuthenticatesNullValues */ false, Discriminator);
}
+
+llvm::Value *CodeGenFunction::AuthPointerToPointerCast(
@@ -3126,3 +3137,57 @@ CodeGenFunction::EmitPointerAuthAuth(const
CGPointerAuthInfo &PointerAuth,
return EmitPointerAuthCommon(*this, PointerAuth, Pointer,
llvm::Intrinsic::ptrauth_auth);
}
+
+llvm::Value *CodeGenFunction::EmitPointerAuthSign(Q
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
@@ -2373,7 +2373,9 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
DestLV.setTBAAInfo(TBAAAccessInfo::getMayAliasInfo());
return EmitLoadOfLValue(DestLV, CE->getExprLoc());
}
-return Builder.CreateBitCast(Src, DstTy);
+
+llvm::Value *Result =
@@ -4434,16 +4433,41 @@ class CodeGenFunction : public CodeGenTypeCache {
llvm::Value *StorageAddress,
GlobalDecl SchemaDecl,
QualType SchemaType);
+
llvm:
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
@@ -3126,3 +3137,57 @@ CodeGenFunction::EmitPointerAuthAuth(const
CGPointerAuthInfo &PointerAuth,
return EmitPointerAuthCommon(*this, PointerAuth, Pointer,
llvm::Intrinsic::ptrauth_auth);
}
+
+llvm::Value *CodeGenFunction::EmitPointerAuthSign(Q
@@ -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;
+}
+
@@ -3126,3 +3137,57 @@ CodeGenFunction::EmitPointerAuthAuth(const
CGPointerAuthInfo &PointerAuth,
return EmitPointerAuthCommon(*this, PointerAuth, Pointer,
llvm::Intrinsic::ptrauth_auth);
}
+
+llvm::Value *CodeGenFunction::EmitPointerAuthSign(Q
@@ -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
@@ -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;
+}
+
@@ -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
@@ -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
@@ -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
@@ -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;
+}
+
@@ -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;
+}
+
@@ -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
@@ -3126,3 +3137,57 @@ CodeGenFunction::EmitPointerAuthAuth(const
CGPointerAuthInfo &PointerAuth,
return EmitPointerAuthCommon(*this, PointerAuth, Pointer,
llvm::Intrinsic::ptrauth_auth);
}
+
+llvm::Value *CodeGenFunction::EmitPointerAuthSign(Q
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
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
@@ -351,3 +434,125 @@ CodeGenModule::getVTablePointerAuthInfo(CodeGenFunction
*CGF,
/* IsIsaPointer */ false,
/* AuthenticatesNullValues */ false, Discriminator);
}
+
+llvm::Value *CodeGenFunction::AuthPointerToPointerCast(
@@ -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
@@ -3126,3 +3137,57 @@ CodeGenFunction::EmitPointerAuthAuth(const
CGPointerAuthInfo &PointerAuth,
return EmitPointerAuthCommon(*this, PointerAuth, Pointer,
llvm::Intrinsic::ptrauth_auth);
}
+
+llvm::Value *CodeGenFunction::EmitPointerAuthSign(Q
@@ -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;
+}
+
@@ -3126,3 +3137,57 @@ CodeGenFunction::EmitPointerAuthAuth(const
CGPointerAuthInfo &PointerAuth,
return EmitPointerAuthCommon(*this, PointerAuth, Pointer,
llvm::Intrinsic::ptrauth_auth);
}
+
+llvm::Value *CodeGenFunction::EmitPointerAuthSign(Q
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
@@ -3126,3 +3137,57 @@ CodeGenFunction::EmitPointerAuthAuth(const
CGPointerAuthInfo &PointerAuth,
return EmitPointerAuthCommon(*this, PointerAuth, Pointer,
llvm::Intrinsic::ptrauth_auth);
}
+
+llvm::Value *CodeGenFunction::EmitPointerAuthSign(Q
@@ -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
@@ -195,34 +195,45 @@ CodeGenFunction::CGFPOptionsRAII::~CGFPOptionsRAII() {
CGF.Builder.setDefaultConstrainedRounding(OldRounding);
}
-static LValue MakeNaturalAlignAddrLValue(llvm::Value *V, QualType T,
- bool ForPointeeType,
-
@@ -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;
+}
+
@@ -192,14 +215,18 @@ class Address {
/// Return the IR name of the pointer value.
llvm::StringRef getName() const { return Pointer.getPointer()->getName(); }
+ const CGPointerAuthInfo &getPointerAuthInfo() const { return PtrAuthInfo; }
+ void setPointerAuthInfo(const CG
@@ -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;
+}
+
@@ -165,6 +166,88 @@ CGPointerAuthInfo
CodeGenModule::getPointerAuthInfoForType(QualType T) {
return ::getPointerAuthInfoForType(*this, T);
}
+static bool isZeroConstant(llvm::Value *value) {
atrosinenko wrote:
The existing code in `CGPointerAuth.cpp` seem
llvmbot wrote:
@llvm/pr-subscribers-clang-codegen
Author: Akira Hatanaka (ahatanak)
Changes
Re-signing occurs when function type discrimination is enabled and a function
pointer is converted to another function pointer type that requires signing
using a different discriminator. A functio
https://github.com/ahatanak ready_for_review
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
https://github.com/ahatanak 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
48 matches
Mail list logo