Fix kalam.dylib chained-fixups seg_count so OpenMTP launches on newer macOS#468
Open
northgate-dev wants to merge 1 commit into
Open
Fix kalam.dylib chained-fixups seg_count so OpenMTP launches on newer macOS#468northgate-dev wants to merge 1 commit into
northgate-dev wants to merge 1 commit into
Conversation
The Go linker emitted a dyld_chained_starts_in_image header in kalam.dylib (arm64 and amd64) declaring seg_count = 4, while the binaries actually contain 5 segments (__TEXT, __DATA_CONST, __DATA, __LINKEDIT, plus the trailing __DWARF debug segment the Go toolchain appends). Older dyld ignored the mismatch; newer macOS validates it strictly and refuses to load the library, so OpenMTP crashes at startup with: dlopen(.../kalam.dylib, 0x0006): chained fixups, seg_count does not match number of segments This patches seg_count from 4 to 5 in both dylibs, with the new seg_info_offset entry set to 0 (no fixups in __DWARF) written into the existing zero padding before the first starts_in_segment blob — a 4-byte change per binary, then ad-hoc re-signed. Verified with `xcrun dyld_info -fixups` and a successful dlopen on a macOS version that previously rejected the libraries. The medieval/amd64 build uses classic relocations (no LC_DYLD_CHAINED_FIXUPS) and is unaffected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner
|
What os version, and app version are you facing this issue? |
Owner
|
Are you on golden gate? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
OpenMTP 3.2.25 crashes instantly at startup on recent macOS versions with:
Likely the same root cause as the startup crashes reported in #412.
Root cause
The Go toolchain that built
kalam.dylibemitted adyld_chained_starts_in_imageheader declaringseg_count = 4, but the binaries actually contain 5 segments:__TEXT,__DATA_CONST,__DATA,__LINKEDIT, plus the trailing__DWARFdebug segment Go appends after__LINKEDIT. Older versions of dyld ignored the mismatch; newer macOS validates it strictly and refuses to load the library, which takes the whole app down before the UI appears.You can see the defect on the current
masterbinaries:Fix
A 4-byte patch per binary: bump
seg_countfrom 4 to 5, with the newseg_info_offset[4]entry set to0("no fixups in this segment", correct for__DWARF), written into the existing zero padding before the firstdyld_chained_starts_in_segmentblob — so no other offsets shift. Botharm64andamd64dylibs are patched and ad-hoc re-signed. Themedieval/amd64build uses classic relocations (noLC_DYLD_CHAINED_FIXUPS) and is unaffected.Verified after patching:
xcrun dyld_info -fixupsparses both binaries cleanlydlopenof the patched arm64 dylib succeeds on a macOS version that rejected the originalScript used to apply the patch (for review/reproduction)
Long-term fix
Rebuilding the kalam kernel with a recent Go toolchain (or stripping DWARF from the c-shared output) should produce correct chained-fixups metadata at the source; this PR patches the vendored binaries so the shipped app works on current macOS in the meantime.
🤖 Generated with Claude Code