Relinker: weak undefined imports become required (STB_WEAK → STB_GLOBAL), so Porpoise stops at its weak chroot import #4497

Closed
opened 2026-10-12 13:37:36 +00:00 by babyhuey · 0 comments
babyhuey commented 2026-10-12 13:37:36 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-12T13:37:36Z.


Porpoise (PPSA99764, catalog 3.0) imports three functions as weak undefined symbols (STB_WEAK, binding 2, section index 0 in eboot.bin's .dynsym):

  • AKknh8Cx-V8 (chroot)
  • gnyVA6Tj-ak (fchdir)
  • NDcSfcYZRC8 (malloc_usable_size)

That is on purpose. Its source at v3.0 says:

Weak: on some firmware (12.70) the title's libkernel doesn't give these out, and a call through the empty import was a crash right after the jailbreak freed Porpoise. Each is checked, then looked up by name.

put_root_back tests each pointer for null, then tries sceKernelDlsym, then raw system calls. On a console without the export, the import binds to null and the title still loads.

In the relinked app.elf, all three are STB_GLOBAL (binding 1), so a weak import is treated as required:

  • Linux: with #3611 (pathconf) merged, Porpoise stops at undefined symbol: AKknh8Cx-V8 (chroot). ld.so binds a missing weak reference to 0, but the relinker no longer marks it weak.
  • Windows: FAIL: unresolved ELF import AKknh8Cx-V8 (chroot) from libkernel_sys.prx. PE imports have no weak form.

fchdir and malloc_usable_size are exported on main, so chroot is the only one Porpoise hits today. Any title built the same way that weak-imports something AnyPS5 doesn't export will stop the same way.

Possible directions:

  • Keep STB_WEAK on the relinked ELF's undefined symbols.
  • On Windows, leave unresolved weak imports out of the PE import table and zero their GOT slots.

Exporting chroot (a throwing stub after fchdir in libkernel_sys, ready on a branch) would get Porpoise past this one import. It would not help other weak imports, and Porpoise doesn't need it to load.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5814692421 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4497). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-12T13:37:36Z. --- Porpoise (PPSA99764, catalog 3.0) imports three functions as weak undefined symbols (`STB_WEAK`, binding 2, section index 0 in `eboot.bin`'s `.dynsym`): - `AKknh8Cx-V8` (`chroot`) - `gnyVA6Tj-ak` (`fchdir`) - `NDcSfcYZRC8` (`malloc_usable_size`) That is on purpose. Its [source at v3.0](https://github.com/elripalda/Porpoise-Dolphin-Emulator-for-PS5/blob/2ed1ab5a06995aa198f7bccd4da0f90c3fc29d39/src/porpoise_jailbreak.cpp#L60-L64) says: > Weak: on some firmware (12.70) the title's libkernel doesn't give these out, and a call through the empty import was a crash right after the jailbreak freed Porpoise. Each is checked, then looked up by name. `put_root_back` tests each pointer for null, then tries `sceKernelDlsym`, then raw system calls. On a console without the export, the import binds to null and the title still loads. In the relinked `app.elf`, all three are `STB_GLOBAL` (binding 1), so a weak import is treated as required: - Linux: with #3611 (`pathconf`) merged, Porpoise stops at `undefined symbol: AKknh8Cx-V8 (chroot)`. `ld.so` binds a missing weak reference to 0, but the relinker no longer marks it weak. - Windows: `FAIL: unresolved ELF import AKknh8Cx-V8 (chroot) from libkernel_sys.prx`. PE imports have no weak form. `fchdir` and `malloc_usable_size` are exported on `main`, so `chroot` is the only one Porpoise hits today. Any title built the same way that weak-imports something AnyPS5 doesn't export will stop the same way. Possible directions: - Keep `STB_WEAK` on the relinked ELF's undefined symbols. - On Windows, leave unresolved weak imports out of the PE import table and zero their GOT slots. Exporting `chroot` (a throwing stub after `fchdir` in libkernel_sys, ready on a branch) would get Porpoise past this one import. It would not help other weak imports, and Porpoise doesn't need it to load.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#4497
No description provided.