[lld] [lld-macho] icf objc stubs (PR #79730)
Kyungwoo Lee via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 29 23:51:06 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;
+ // Newly created mapping from methname to the pair of index (selref) and
+ // offset (methname).
+ llvm::MapVector<StringRef, std::pair<uint32_t, uint32_t>>
+ methnameToidxOffsetPair;
----------------
kyulee-com wrote:
I also felt a bit awkward by having two maps, but also concerned the link time penalty as it diverged from the original implementation.
As you suggested, I came up with a single map implementation by proactively creating new selref entry when it's needed.
https://github.com/llvm/llvm-project/pull/79730
More information about the llvm-commits
mailing list