Skip to content

Patch every matching PLT/lazy-bind entry, not just the first - #112

Open
mreastman wants to merge 1 commit into
NeighTools:masterfrom
mreastman:fix/macos-dlsym-multi-bind-slots
Open

Patch every matching PLT/lazy-bind entry, not just the first#112
mreastman wants to merge 1 commit into
NeighTools:masterfrom
mreastman:fix/macos-dlsym-multi-bind-slots

Conversation

@mreastman

Copy link
Copy Markdown

plthook_replace() on macOS stopped at the first symbol match and returned immediately. On arm64 builds we observed duplicate lazy-bind entries for the same imported symbol (e.g. two separate _dlsym slots in UnityPlayer.dylib). Only patching the first left the second, actually-called slot unhooked, so Doorstop's dlsym interception (used to redirect mono_jit_init_version on modern Unity/Mono builds) never fired and Chainloader never started -- silently, with no error.

Continue iterating and patch every matching entry instead.

Verified against Valheim's dedicated server binary (Unity 6000.0.61f1, arm64 native, no Rosetta): before this fix, Doorstop's own verbose log showed no successful hook of dlsym/mono_jit_init_version and BepInEx.Preloader.dll was never invoked. After, the full chain (dlsym hook -> mono domain init -> Preloader.dll load and invoke) completes successfully.

🤖 Generated with Claude Code

plthook_replace() on macOS stopped at the first symbol match and
returned immediately. On arm64 builds we observed duplicate lazy-bind
entries for the same imported symbol (e.g. two separate _dlsym slots
in UnityPlayer.dylib). Only patching the first left the second,
actually-called slot unhooked, so Doorstop's dlsym interception (used
to redirect mono_jit_init_version on modern Unity/Mono builds) never
fired and Chainloader never started -- silently, with no error.

Continue iterating and patch every matching entry instead.

Verified against Valheim's dedicated server binary (Unity 6000.0.61f1,
arm64 native, no Rosetta): before this fix, Doorstop's own verbose log
showed no successful hook of dlsym/mono_jit_init_version and
BepInEx.Preloader.dll was never invoked. After, the full chain
(dlsym hook -> mono domain init -> Preloader.dll load and invoke)
completes successfully.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant