[clang] [ObjC] Add reserved field in 64-bit ABI mode (PR #85487)

via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 16 16:41:13 PDT 2024


https://github.com/AtariDreams updated https://github.com/llvm/llvm-project/pull/85487

>From b881ab8ff6d89860c5f49dec3baa63ed639edef3 Mon Sep 17 00:00:00 2001
From: Rose <gfunni234 at gmail.com>
Date: Fri, 15 Mar 2024 19:58:03 -0400
Subject: [PATCH] [ObjC] Add reserved field in 64-bit ABI mode

---
 clang/lib/CodeGen/CGObjCMac.cpp | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index e815e097e1fb48..9f59a3a371ac33 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -6047,11 +6047,17 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul
   //   const struct _prop_list_t * const properties;
   // }
 
-  // FIXME. Add 'reserved' field in 64bit abi mode!
-  ClassRonfABITy = llvm::StructType::create(
-      "struct._class_ro_t", IntTy, IntTy, IntTy, Int8PtrTy, Int8PtrTy,
-      MethodListnfABIPtrTy, ProtocolListnfABIPtrTy, IvarListnfABIPtrTy,
-      Int8PtrTy, PropertyListPtrTy);
+  if (CGM.getTarget().getTriple().isArch64Bit())
+    ClassRonfABITy = llvm::StructType::create(
+        // Extra reserved field in 64-bit ABI
+        "struct._class_ro_t", IntTy, IntTy, IntTy, IntTy, Int8PtrTy, Int8PtrTy,
+        MethodListnfABIPtrTy, ProtocolListnfABIPtrTy, IvarListnfABIPtrTy,
+        Int8PtrTy, PropertyListPtrTy);
+  else
+    ClassRonfABITy = llvm::StructType::create(
+        "struct._class_ro_t", IntTy, IntTy, IntTy, Int8PtrTy, Int8PtrTy,
+        MethodListnfABIPtrTy, ProtocolListnfABIPtrTy, IvarListnfABIPtrTy,
+        Int8PtrTy, PropertyListPtrTy);
 
   // ImpnfABITy - LLVM for id (*)(id, SEL, ...)
   llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };



More information about the cfe-commits mailing list