[clang] [lld] [llvm] [lld-macho][clang][llvm-objcopy] Add x86_64 kext bundle support (PR #204805)

Oskar Wirga via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 3 08:52:17 PST 2026


================
@@ -1444,9 +1480,11 @@ void macho::createSyntheticSections() {
     in.lazyPointers = make<LazyPointerSection>();
     in.stubHelper = make<StubHelperSection>();
   }
-  in.exports = make<ExportSection>();
+  if (config->outputType != MH_KEXT_BUNDLE)
+    in.exports = make<ExportSection>();
   in.got = make<GotSection>();
-  in.stubs = make<StubsSection>();
+  if (config->outputType != MH_KEXT_BUNDLE)
+    in.stubs = make<StubsSection>();
----------------
oskarwirga wrote:

Using `-kext -init_offsets` with a `__mod_init_func` entry that points at an undefined function segfaults.

`InitOffsetsSection::setUp` calls `in.stubs->addEntry`, and `in.stubs` is null for kexts.

Xcode's ld reports an error in that case but otherwise accepts `-init_offsets` for kexts, so maybe error here when the target needs binding?

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


More information about the cfe-commits mailing list