You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Signing fails on app extension targets: appex stub has no __text section, zsign aborts on free-space check #379
xtool dev build --sign fails on an app whose package declares an extension when zsign processes the appex trampoline stub:
>>> Can't find free space of LoadCommands for CodeSignature!
Error: Signing failed
Root cause
The -Extension-product link step emits a stub Mach-O whose __TEXT segment contains only __stubs and __got — there is no __text section. The bundled zsign fork computes load-command free space as
(ZArchO::Init, archo.cpp). With no __text section the value is 0, so ReallocCodeSignSpace refuses to append LC_CODE_SIGNATURE and aborts. A __text-less stub is legal Mach-O — codesign signs these fine; the abort is specific to zsign's free-space shortcut.
Repro
xtool 1.21.0, aarch64 Linux (Arch/Asahi), Darwin SDK artifactbundle. Any SwiftPM app package with an extensions: entry in xtool.yml — in my case a WidgetKit ControlWidget extension. The stub binary at .build/out/Products/Debug-iphoneos/<Name>-Extension has ncmds=24, __TEXT with __stubs at fileoff 16384 and no __text section.
Workaround that unblocked me
Post-link hook in the artifactbundle's toolset/bin/ld64.lld wrapper: after orig/ld64.lld succeeds, inject an empty LC_CODE_SIGNATURE { dataoff: filesize, datasize: 0 } into the stub's load-command padding (it has ~15 KB free). zsign then takes its existing-pcslc path, skips the free-space check, and writes the real signature at dataoff — both app and appex sign and the bundle deploys.
Possible fixes
Emit a __text section in the extension stub link (e.g. a real entry-point object), or
Patch zsign's ZArchO::Init to fall back to the __TEXT segment's fileoff/filesize when no __text section exists.
Happy to send a PR against whichever side you prefer.
Activity
Add home and lock screen widgets and a Dynamic Island focus activity
kabiroberai commentedon Nov 16, 2026
This should be resolved by v2.0.0-beta.1. Please check and let me know!