[lld] [lld-macho] Add swift support to ObjC category merger (PR #95124)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 07:35:53 PDT 2024


================
@@ -679,11 +679,16 @@ void ObjcCategoryMerger::parseProtocolListInfo(const ConcatInputSection *isec,
       (protocolCount * target->wordSize) +
       /*header(count)*/ protocolListHeaderLayout.totalSize +
       /*extra null value*/ target->wordSize;
-  assert(expectedListSize == ptrListSym->isec()->data.size() &&
+
+  // On Swift, the protocol list does not have the extra (unecessary) null value
+  uint32_t expectedListSizeSwift = expectedListSize - target->wordSize;
+
+  assert((expectedListSize == ptrListSym->isec()->data.size() ||
+          expectedListSizeSwift == ptrListSym->isec()->data.size()) &&
----------------
alx32 wrote:

I can add this in a follow-up PR since it will require a lot of NFC refactoring. 

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


More information about the llvm-commits mailing list