[clang] [clang][CodeGen] `used` globals && the payloads for global ctors & dtors are globals (PR #93601)

Alex Voicu via cfe-commits cfe-commits at lists.llvm.org
Tue May 28 12:40:22 PDT 2024


================
@@ -2047,9 +2047,9 @@ void CodeGenModule::EmitCtorList(CtorList &Fns, const char *GlobalName) {
   llvm::Type *CtorPFTy = llvm::PointerType::get(CtorFTy,
       TheModule.getDataLayout().getProgramAddressSpace());
 
-  // Get the type of a ctor entry, { i32, void ()*, i8* }.
+  // Get the type of a ctor entry, { i32, program void ()*, global i8* }.
   llvm::StructType *CtorStructTy = llvm::StructType::get(
-      Int32Ty, CtorPFTy, VoidPtrTy);
+      Int32Ty, CtorPFTy, GlobalsInt8PtrTy);
----------------
AlexVlx wrote:

We cannot do this, for some targets 0 can point to something that does not work as a global at all.

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


More information about the cfe-commits mailing list