[lld] [lld-macho] Category Merger: add support for addrsig references (PR #90903)

via llvm-commits llvm-commits at lists.llvm.org
Fri May 3 12:09:12 PDT 2024


================
@@ -1183,26 +1193,66 @@ void ObjcCategoryMerger::eraseMergedCategories() {
   // the references to the ones we merged.
   generateCatListForNonErasedCategories(catListToErasedOffsets);
 
+  // We use erasedIsecs below to track erased sections so we can later remove
+  // references to it.
+  std::unordered_set<InputSection *> erasedIsecs;
+  erasedIsecs.reserve(categoryMap.size());
+
   // Erase the old method lists & names of the categories that were merged
   for (auto &mapEntry : categoryMap) {
     for (InfoInputCategory &catInfo : mapEntry.second) {
       if (!catInfo.wasMerged)
         continue;
 
+      erasedIsecs.insert(catInfo.catBodyIsec);
+      erasedIsecs.insert(catInfo.catListIsec);
----------------
alx32 wrote:

Move the insert into `eraseISec()` call which simplified the change a lot. 

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


More information about the llvm-commits mailing list