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

Daniil Kovalev via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 16 12:08:37 PDT 2024


================
@@ -1056,12 +1056,18 @@ class ConstantPtrAuth final : public Constant {
     return !getAddrDiscriminator()->isNullValue();
   }
 
-  /// A constant value for the address discriminator which has special
-  /// significance to ctors/dtors lowering. Regular address discrimination can't
-  /// be applied for them since uses of llvm.global_{c|d}tors are disallowed
-  /// (see Verifier::visitGlobalVariable) and we can't emit getelementptr
-  /// expressions referencing these special arrays.
-  enum { AddrDiscriminator_CtorsDtors = 1 };
+  /// Constant values for the address discriminator which have special
+  /// significance to lowering in some contexts.
+  /// - For ctors/dtors, regular address discrimination can't
+  ///   be applied for them since uses of llvm.global_{c|d}tors are disallowed
+  ///   (see Verifier::visitGlobalVariable) and we can't emit getelementptr
+  ///   expressions referencing these special arrays.
+  /// - For vtable pointers of std::type_info and classes derived from it,
+  ///   we do not know the storage address when emitting ptrauth constant.
----------------
kovdan01 wrote:

@ahmedbougacha @efriedma-quic Should be fixed in 0c20bcdf35f3c15024986da50cafb2a8c155e3cf

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


More information about the cfe-commits mailing list