[llvm-branch-commits] [llvm] Add deactivation symbol operand to ConstantPtrAuth. (PR #133537)
Peter Collingbourne via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Sep 2 18:15:40 PDT 2025
https://github.com/pcc updated https://github.com/llvm/llvm-project/pull/133537
>From e728f3444624a5f47f0af84c21fb3a584f3e05b7 Mon Sep 17 00:00:00 2001
From: Peter Collingbourne <pcc at google.com>
Date: Fri, 1 Aug 2025 17:27:41 -0700
Subject: [PATCH] Add verifier check
Created using spr 1.3.6-beta.1
---
llvm/lib/IR/Verifier.cpp | 5 +++++
llvm/test/Verifier/ptrauth-constant.ll | 6 ++++++
2 files changed, 11 insertions(+)
create mode 100644 llvm/test/Verifier/ptrauth-constant.ll
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 3ff9895e161c4..3478c2c450ae7 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -2627,6 +2627,11 @@ void Verifier::visitConstantPtrAuth(const ConstantPtrAuth *CPA) {
Check(CPA->getDiscriminator()->getBitWidth() == 64,
"signed ptrauth constant discriminator must be i64 constant integer");
+
+ Check(isa<GlobalValue>(CPA->getDeactivationSymbol()) ||
+ CPA->getDeactivationSymbol()->isNullValue(),
+ "signed ptrauth constant deactivation symbol must be a global value "
+ "or null");
}
bool Verifier::verifyAttributeCount(AttributeList Attrs, unsigned Params) {
diff --git a/llvm/test/Verifier/ptrauth-constant.ll b/llvm/test/Verifier/ptrauth-constant.ll
new file mode 100644
index 0000000000000..fdd6352cf8469
--- /dev/null
+++ b/llvm/test/Verifier/ptrauth-constant.ll
@@ -0,0 +1,6 @@
+; RUN: not opt -passes=verify < %s 2>&1 | FileCheck %s
+
+ at g = external global i8
+
+; CHECK: signed ptrauth constant deactivation symbol must be a global variable or null
+ at ptr = global ptr ptrauth (ptr @g, i32 0, i64 65535, ptr null, ptr inttoptr (i64 16 to ptr))
More information about the llvm-branch-commits
mailing list