[PATCH] D128108: [WIP][lld-macho] Add support for objc_msgSend stubs

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 5 12:03:53 PDT 2022


int3 added a comment.

This looks like a reasonable approach. Re the section name conflict, do we just need to apply relocations + concatenate the output (i.e. what ConcatOutputSection is doing), or do we have to do something more complicated? Whether to make SyntheticSections subclasses of InputSections vs OutputSections has been something we've debated for a while... LLD-ELF makes them subclass InputSections but we don't, and maybe this use case should make us rethink that.



================
Comment at: lld/MachO/SyntheticSections.cpp:653-655
+  // TODO: only do this once
+  Symbol *objc =
+      symtab->addUndefined("_objc_msgSend", nullptr, /*isWeakRef=*/false);
----------------
maybe do something similar to what we have for `StubHelperSection::setup()`


================
Comment at: lld/MachO/SyntheticSections.cpp:678
+  // also based on arch seems like?
+  return 32 * symbolsWithOffsets.size(); // fast // TODO: Extract 32 to target
+}
----------------
I would just do an `if` check for 32/64 bit here, I don't think we should having ObjC implementation details exposed on the `Target` class


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128108/new/

https://reviews.llvm.org/D128108



More information about the llvm-commits mailing list