[Lldb-commits] [lldb] [lldb] Handle ConstantExpr constants in InjectPointerSigningFixupCode (PR #194476)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 27 20:19:43 PDT 2026


================
@@ -38,38 +38,58 @@
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/IRBuilder.h"
+#include "llvm/IR/Instructions.h"
 #include "llvm/IR/Module.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/TargetParser/Triple.h"
 
 using namespace llvm;
 
 namespace {
+struct ExprStep {
+  ConstantExpr *CE;
+  unsigned OperandIdx;
+};
+
 struct PtrAuthFixup {
   GlobalVariable *GV;
   ConstantPtrAuth *CPA;
-  SmallVector<unsigned> Indices;
+  SmallVector<unsigned> GEPPath;
+  SmallVector<ExprStep> ExprPath;
   PtrAuthFixup(GlobalVariable *GV, ConstantPtrAuth *CPA,
-               const SmallVectorImpl<unsigned> &Indices)
-      : GV(GV), CPA(CPA), Indices(Indices.begin(), Indices.end()) {}
+               const SmallVectorImpl<unsigned> &GEPPath,
+               const SmallVectorImpl<ExprStep> &ExprPath)
+      : GV(GV), CPA(CPA), GEPPath(GEPPath.begin(), GEPPath.end()),
+        ExprPath(ExprPath.begin(), ExprPath.end()) {}
 };
 } // namespace
 
 /// Recursively walk a constant looking for ConstantPtrAuth expressions.
-/// When found, record the global variable containing the ConstantPtrAuth and
-/// the index path to reach it within the initializer.
+/// Aggregate types are walked via GEP indices. ContantExpr types are
----------------
JDevlieghere wrote:

```suggestion
/// Aggregate types are walked via GEP indices. ConstantExpr types are
```

https://github.com/llvm/llvm-project/pull/194476


More information about the lldb-commits mailing list