[lld] [lld-macho] icf objc stubs (PR #79730)

Jez Ng via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 16:51:19 PST 2024


================
@@ -332,10 +333,17 @@ class ObjCStubsSection final : public SyntheticSection {
   void setUp();
 
   static constexpr llvm::StringLiteral symbolPrefix = "_objc_msgSend$";
+  static bool isObjCStubSymbol(Symbol *sym);
+  static StringRef getMethName(Symbol *sym);
 
 private:
   std::vector<Defined *> symbols;
-  std::vector<uint32_t> offsets;
+  // Existing mapping from methname to selref (0 index is assumed).
+  llvm::StringMap<InputSection *> methnameToselref;
----------------
int3 wrote:

also we generally don't use `StringMap` in LLD, instead preferring `DenseMap`s of `CachedHashStringRef` keys. StringMap manages the memory for its string keys, but since we mmap everything when running LLD, we don't actually want a separate allocation / copy here

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


More information about the llvm-commits mailing list