[lld] [lld-macho] Category Merger: add support for addrsig references (PR #90903)
Kyungwoo Lee via llvm-commits
llvm-commits at lists.llvm.org
Thu May 2 17:19:31 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);
----------------
kyulee-com wrote:
The confusion (between `eraseISec` and `eraseISecs`) is exactly what I'm asking. I saw you call `eraseISec` below once for the body while inserting both body and list. However, I'm also seeing you do these operations in sync in `tryEraseDefinedAtIsecOffset`.
```
eraseISec(cisec);
erased.insert(cisec);
```
This looks confusing and error-prone. I wonder if we can have a single call to handle these together somehow.
https://github.com/llvm/llvm-project/pull/90903
More information about the llvm-commits
mailing list