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

via llvm-commits llvm-commits at lists.llvm.org
Thu May 2 17:11:39 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:

I am not sure I understand the question. 
For a category we need to erase the body, the catlist reference and all lists. 
Here, the body and list isec is marked as to be erased. They are not marked anywhere else. So both have to be here. 

`eraseISec` function does not insert into `erasedIsecs` - it does not know it exists. 

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


More information about the llvm-commits mailing list