@@ -611,8 +611,8 @@ void ObjcCategoryMerger::collectCategoryWriterInfoFromCategory(
611
611
void ObjcCategoryMerger::parseProtocolListInfo (const ConcatInputSection *isec,
612
612
uint32_t secOffset,
613
613
PointerListInfo &ptrList) {
614
- if (! isec || (secOffset + target->wordSize > isec->data .size ()))
615
- assert ( " Tried to read pointer list beyond protocol section end" );
614
+ assert ( isec && (secOffset + target->wordSize <= isec->data .size ()) &&
615
+ " Tried to read pointer list beyond protocol section end" );
616
616
617
617
const Reloc *reloc = isec->getRelocAt (secOffset);
618
618
if (!reloc)
@@ -903,9 +903,9 @@ ObjcCategoryMerger::emitCatListEntrySec(const std::string &forCateogryName,
903
903
return catListSym;
904
904
}
905
905
906
- // Here we generate the main category body and just the body and link the name
907
- // and base class into it. We don't link any other info like the protocol and
908
- // class/instance methods/props.
906
+ // Here we generate the main category body and link the name and base class into
907
+ // it. We don't link any other info yet like the protocol and class/instance
908
+ // methods/props.
909
909
Defined *ObjcCategoryMerger::emitCategoryBody (const std::string &name,
910
910
const Defined *nameSym,
911
911
const Symbol *baseClassSym,
@@ -1062,8 +1062,10 @@ void ObjcCategoryMerger::collectAndValidateCategoriesData() {
1062
1062
Defined *categorySym = tryGetDefinedAtIsecOffset (catListCisec, off);
1063
1063
assert (categorySym &&
1064
1064
" Failed to get a valid cateogry at __objc_catlit offset" );
1065
+
1066
+ // We only support ObjC categories (no swift + @objc)
1065
1067
if (!categorySym->getName ().starts_with (objc::symbol_names::category))
1066
- continue ; // Only support ObjC categories (no swift + @objc)
1068
+ continue ;
1067
1069
1068
1070
auto *catBodyIsec = dyn_cast<ConcatInputSection>(categorySym->isec );
1069
1071
assert (catBodyIsec &&
@@ -1082,18 +1084,6 @@ void ObjcCategoryMerger::collectAndValidateCategoriesData() {
1082
1084
collectCategoryWriterInfoFromCategory (catInputInfo);
1083
1085
}
1084
1086
}
1085
-
1086
- for (auto &entry : categoryMap)
1087
- if (entry.second .size () > 1 ) {
1088
- // Sort categories by offset to make sure we process categories in
1089
- // the same order as they appear in the input
1090
- auto cmpFn = [](const InfoInputCategory &a, const InfoInputCategory &b) {
1091
- return (a.catListIsec == b.catListIsec ) &&
1092
- (a.offCatListIsec < b.offCatListIsec );
1093
- };
1094
-
1095
- llvm::sort (entry.second , cmpFn);
1096
- }
1097
1087
}
1098
1088
1099
1089
// In the input we have multiple __objc_catlist InputSection, each of which may
0 commit comments