fix(relinker): allow duplicate Linux guest exports that no module imports #733

Merged
alfalfa-star merged 1 commit from upstream-pr/733 into main 2026-10-05 21:34:07 +00:00
alfalfa-star commented 2026-10-05 18:21:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-05T18:21:35Z.


What

On Linux a title fails to convert when two bundled modules export the same name, even if nothing imports it:

FAIL: Duplicate guest export after stripping #: 82XiaP80JDo in .../prx/ak3daudiobedmixer.prx and .../prx/akaudioinput.prx

82XiaP80JDo is g_pAKPluginList. Every Wwise effect plugin exports it (36 modules in PPSA14632's prx/), and the title opens each plugin with sceKernelLoadStartModule and looks the symbol up through that handle (sceKernelDlsym, which resolves within the module's own scope). No module or executable imports it, and no relocation in the plugins references it by symbol.

On Linux a duplicate guest export is now accepted unless the executable or a guest module imports the name, which fails as Ambiguous guest import <name> in <importer>: exported by <providers> because the provider would be ambiguous. A duplicate within one module still fails. Windows keeps rejecting duplicates.

This is the Linux counterpart of #684, which allows duplicates on Windows when imports select their module and keeps the Linux policy. Both edit the duplicate check in GuestModuleBuilder.cpp, so whichever lands second needs a rebase there. It also works with #672: the #guest renaming runs after this check.

Tested

  • Arch Linux, GCC 16.2, Release, based on 33e9a121. guest_module_directories now covers two modules exporting the same name (converts on Linux, rejected on Windows) and a third module importing it (ambiguous import on Linux). The other relinker tests pass.
  • LEGO Horizon Adventures (PPSA14632): on main the conversion fails as above; with this change all 43 bundled modules convert, and with #672 the plugin exports become 82XiaP80JDo#guest. The title does not reach the plugin loading yet (see #730), so the runtime lookups are not exercised by it.
  • Windows not built or tested.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none (related: #684, #672)
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4749153929 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/733). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-05T18:21:35Z. --- ### What On Linux a title fails to convert when two bundled modules export the same name, even if nothing imports it: ``` FAIL: Duplicate guest export after stripping #: 82XiaP80JDo in .../prx/ak3daudiobedmixer.prx and .../prx/akaudioinput.prx ``` `82XiaP80JDo` is `g_pAKPluginList`. Every Wwise effect plugin exports it (36 modules in PPSA14632's `prx/`), and the title opens each plugin with `sceKernelLoadStartModule` and looks the symbol up through that handle (`sceKernelDlsym`, which resolves within the module's own scope). No module or executable imports it, and no relocation in the plugins references it by symbol. On Linux a duplicate guest export is now accepted unless the executable or a guest module imports the name, which fails as `Ambiguous guest import <name> in <importer>: exported by <providers>` because the provider would be ambiguous. A duplicate within one module still fails. Windows keeps rejecting duplicates. This is the Linux counterpart of #684, which allows duplicates on Windows when imports select their module and keeps the Linux policy. Both edit the duplicate check in `GuestModuleBuilder.cpp`, so whichever lands second needs a rebase there. It also works with #672: the `#guest` renaming runs after this check. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. --> - Arch Linux, GCC 16.2, Release, based on `33e9a121`. `guest_module_directories` now covers two modules exporting the same name (converts on Linux, rejected on Windows) and a third module importing it (ambiguous import on Linux). The other relinker tests pass. - LEGO Horizon Adventures (PPSA14632): on `main` the conversion fails as above; with this change all 43 bundled modules convert, and with #672 the plugin exports become `82XiaP80JDo#guest`. The title does not reach the plugin loading yet (see #730), so the runtime lookups are not exercised by it. - Windows not built or tested. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none (related: #684, #672) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-05 21:03:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-05T21:03:44Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#755 core/relinker/relinker/src/guest/GuestModuleBuilder.cpp L68
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6002882867 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/733#issuecomment-6002882867). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-05T21:03:44Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #755 | `core/relinker/relinker/src/guest/GuestModuleBuilder.cpp` [L68](https://github.com/boykopovar/AnyPS5/blob/f00750e7bd7d43060d0bf6608be4faeec7601f59/core/relinker/relinker/src/guest/GuestModuleBuilder.cpp#L68) | | |
Sign in to join this conversation.
No reviewers
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!733
No description provided.