Commit Graph
213 Commits
Author SHA1 Message Date
Dean 750eb13d87 Merge pull request #6401 from MarcZX100/codex/windows-tls-eof-read-6391
fix(relinker): guard TLS instruction byte access at EOF
2026-10-17 18:15:00 +13:00
Adrià a3250608a5 Merge pull request #6080 from Zinebyte/fix/linux-guest-weak-imports
fix(relinker): preserve weak imports in Linux guest modules
2026-10-17 06:53:43 +02:00
Dean e1ac3300d3 Merge pull request #6224 from Agnibha007/fix/linux-fixed-base-relocated-phdrs
fix(relinker): rebase the relocated program header table at a fixed Linux base
2026-10-17 14:41:25 +13:00
Adrià 8c90c879e0 Merge pull request #5990 from Get-fix/ps4/windows-libc-for-libkernel
fix(relinker): search libc.prx for libkernel-only Windows executables
2026-10-17 01:16:00 +02:00
Adrià c1d72d9335 Merge pull request #5890 from Piglit09/phase1/tls-protected-entry
fix(relinker): protect Windows TLS code entry roots
2026-10-17 00:15:50 +02:00
Adrià 383cb26339 Merge pull request #5614 from JJenkx/fix/linux-guest-finalizer-arguments
fix(relinker): clear Linux guest finalizer arguments
2026-10-16 21:23:12 +02:00
Get-fix 8c34587598 fix(relinker): search libc.prx for libkernel-only Windows executables
AnyPS5 exports some libkernel functions, such as __error, from
libc.prx, which libkernel.prx links. On Linux they resolve through that
dependency. On Windows, the import stubs search only the listed
modules, and libc.prx was listed only when libSceLibcInternal.prx was
needed. A PS4 homebrew that needs libkernel.prx but no C library (the
OpenOrbis graphics sample) failed with "unresolved ELF import
9BcDykPmo1I". libc.prx is now also listed when libkernel.prx is needed.
PS5 executables need libSceLibcInternal.prx and convert unchanged.
2026-10-15 21:02:31 +03:00
MarcZX100 2a65acd86c fix(relinker): guard TLS instruction byte access at EOF 2026-10-15 14:05:06 +00:00
Adrià f50d4335ab Merge pull request #5587 from nikowolf123/fix/relinker-dependency-diagnostics
fix(relinker): name missing and non-PE modules in Windows dependency diagnostics
2026-10-15 13:39:17 +02:00
Adrià 341613ab62 Merge pull request #5543 from mariuszkreft/fix/gpu-extra-load-drops-guest-tail
fix(relinker): place the Linux extra PT_LOAD past the last guest page
2026-10-15 13:31:07 +02:00
Agnibha Mukherjee 8e5073ebe8 fix(relinker): rebase the relocated program header table at a fixed Linux base 2026-10-15 10:32:57 +05:30
m2 (AI Agent) 7f73643e0c test(relinker): name each program-layout check instead of tracking its line 2026-10-15 03:50:14 +02:00
Zinebyte 875a159f64 fix(relinker): preserve weak imports in Linux guest modules 2026-10-14 17:26:22 -04:00
Adrià 358e218a4c Merge pull request #5083 from Dripl1x/codex/secondary-loadexec
fix(libSceSystemService): pass LoadExec arguments as the whole guest argv
2026-10-14 21:37:44 +02:00
Adrià e23eff5f49 Merge pull request #5386 from simonbronk/fix/relinker-macos-weak-imports
fix(relinker): keep weak imports weak in macOS binds
2026-10-14 21:25:57 +02:00
Adrià 08a7f7a8cf Merge pull request #5298 from Ondra97/codex/fix-macos-runpath-lists
fix(relinker): emit separate macOS run paths from ELF lists
2026-10-14 20:55:24 +02:00
Adrià 6bb4fdc4f3 Merge pull request #5286 from Ondra97/codex/fix-windows-icon-chunk-types
fix(relinker): reject invalid PNG icon chunk types
2026-10-14 20:54:27 +02:00
Evgeniy KazarinandClaude Opus 5.5 a1b80121c1 fix(libSceSystemService): pass LoadExec arguments as the whole guest argv
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 18:41:25 +03:00
Piglit09 1f7bf7413f fix(relinker): protect Windows TLS code entry roots 2026-10-14 08:07:16 -05:00
Adrià ecdcf34f75 Merge pull request #5406 from tibzejoker/feat/relinker-report-all-unresolved-imports
feat(relinker): report every unresolved ELF import before failing on Windows
2026-10-14 14:07:46 +02:00
Adrià 067f4f6147 Merge pull request #5116 from sanxchep/perf/relinker-streamed-scans
perf(relinker): stream scans and reuse executable buffers
2026-10-14 14:02:10 +02:00
thibautandClaude Opus 5.5 4ae26f8ba0 feat(relinker): report every unresolved ELF import before failing on Windows
The Windows startup stub stopped at the first import it could not
resolve, so a title missing several functions showed one
"FAIL: unresolved ELF import" line per run and needed a run per
missing function to list them all.

The stub now counts unresolved imports, writes the FAIL line of each
and goes on with the next import. After the last import it fails once,
with the searched library list and the last Windows error as before,
and exits with STATUS_ENTRYPOINT_NOT_FOUND. Weak imports, lazy binding
and a startup where every import resolves are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V1W4jdNSKTV7xwuS6xQPJV
2026-10-14 13:38:31 +02:00
Adrià Franch 3d101e8bc5 fix(relinker): drop constants main already defines after the rebase 2026-10-14 12:36:59 +02:00
Renan Pires 75cfcec67c feat(relinker): load Linux executables at a fixed base with --linux-fixed-base 2026-10-14 12:35:36 +02:00
Adrià b6c7893f9e Merge pull request #4869 from omurc4/feat/load-failure-hint
feat(relinker): hint at the MinGW runtime DLLs when a module fails to load with error 126
2026-10-14 12:27:35 +02:00
Dean 58e016f0c8 Merge pull request #4739 from Ondra97/codex/fix-windows-guest-tpoff
fix(relinker): relocate Windows guest TLS from its thread pointer
2026-10-14 19:33:32 +13:00
Ondra97 46b96329e3 fix(relinker): reject invalid PNG icon chunk types 2026-10-14 07:53:01 +02:00
Sanxchep Sharma 94ae3f1bfe perf(relinker): stream scans and reuse executable buffers 2026-10-14 07:40:54 +02:00
Dean 75690a117e Merge pull request #4237 from MarcZX100/codex/carry-fixed-base-3043
fix(relinker): load Windows executables at a fixed low base
2026-10-14 17:49:45 +13:00
Dean a1e1b4d161 Merge pull request #5262 from NaitikJoshiPro/pr/relinker-executable-tls
feat(relinker): executable TLS relocations (TPOFF64, DTPOFF64, DTPMOD64)
2026-10-14 15:41:31 +13:00
Dean 0defec4386 Merge pull request #5199 from Zenodeon/conversion-diagnostics
fix(relinker): identify failed inputs and invalid dynamic values
2026-10-14 15:39:35 +13:00
NikoandClaude Opus 5.5 4ba4ede2a9 fix(relinker): name missing and non-PE modules in Windows dependency diagnostics
When a relinked executable fails to load a staged module, the dependency
diagnostics routine maps the same path as an image resource to walk its
imports. If that mapping failed it printed only "FAIL: dependency
diagnostics Windows API failed". The log then did not say whether the
staged module itself (libs\libSceRegMgr.prx in #4720) was absent or was
not a Windows image, and a module reached through another module's
imports was not named at all.

The register routine now reads GetLastError when LoadLibraryExW fails.
ERROR_FILE_NOT_FOUND and ERROR_PATH_NOT_FOUND print "dependency module
not found", ERROR_BAD_EXE_FORMAT prints "dependency module is not a
Windows PE image"; both name the module path, its importer and the
chain from the executable, like the existing missing-module report.
Other errors keep the generic message. An API set contract that
LoadLibraryExA reports as ERROR_MOD_NOT_FOUND now gets the
missing-module report too.

Refs #4720

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 01:51:23 +02:00
mariuszkreft 58120ca418 fix(relinker): place the Linux extra PT_LOAD past the last guest page
ComputeExtraBlockVaddr kept the ELF congruence p_vaddr == p_offset (mod 0x1000)
and bumped the result by one page only when it fell below the highest guest
load end as a byte address. When that end is not page aligned and the extra
block's file offset remainder reaches it, the extra RWX PT_LOAD landed in the
same 4 KiB page that holds the tail of the highest guest segment. The kernel
maps each PT_LOAD page by page with MAP_FIXED in program-header order, so the
extra block's file page replaced the guest's .data tail and zero-filled .bss
there.

Round the highest kept PT_LOAD end up to the page before adding the offset
remainder, which is the placement GuestModuleWriter::WriteLinux already uses
for the guest module. Only the overlapping case changes; an end that is page
aligned or a remainder below it yields the same address as before.

The extra PT_LOAD now also spans to the end of its own page in p_memsz, so the
page it takes over is fully covered, and its vaddr is derived in WriteLayout
instead of being taken from the request. The header block load carries the
same flags as before.
2026-10-14 01:17:49 +02:00
JJenkx 57a97f61c5 Merge commit '30f961266ade83b41d5c9de7dec1393e7fcecfb7' into fix/linux-guest-finalizer-arguments 2026-10-13 18:59:58 -04:00
SimoneandClaude Opus 5.5 009ed711a9 fix(relinker): keep weak imports weak in macOS binds
The macOS executable patcher dropped PeImport::Weak, so every bind was
written without flags and dyld refused to load a binary whose weak
import no module exports. Carry the flag into MacOsBind and set
BIND_SYMBOL_FLAGS_WEAK_IMPORT for those binds, as Linux and Windows
already bind a missing weak import to 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 21:49:20 +02:00
Leandro Soares e5c782c54f fix(relinker): load converted Windows executables at a fixed low base 2026-10-13 19:11:54 +00:00
Ondra97 eb10acbfbe fix(relinker): emit separate macOS run paths from ELF lists 2026-10-13 18:57:44 +02:00
NaitikJoshiProandClaude Opus 5.5 6f856a7cda feat(relinker): executable TLS relocations (TPOFF64, DTPOFF64, DTPMOD64)
A PS5 eboot can keep initial-exec TLS as R_X86_64_TPOFF64 GOT relocations
(SuperTuxKart, STKT00001, has 13, all without a symbol), which the
relocation allowlist rejected. Relocations against the executable's own
TLS block (no symbol, or a defined STT_TLS symbol folded into the addend)
now go to the Linux ELF as symbolless dynamic relocations that the
dynamic loader resolves against where it placed the block; one against an
import stays named and is typed STT_TLS. The Windows and macOS images
resolve TPOFF64 and DTPOFF64 statically against the block
AlignUp(p_memsz, p_align) below the thread pointer, the offset
WindowsTlsBuilder and MacOsImage use, and reject DTPMOD64 and imported
TLS. TPOFF32 stays unsupported.

New test executable_tls_relocations covers the Linux, Windows and macOS
outputs and the rejected cases.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 21:24:37 +05:30
Adrià 34cee1ef15 Merge pull request #4608 from MiniRML/fix/relinker-icon-png-chunks
fix(relinker): validate icon PNG critical chunks and order
2026-10-13 17:50:39 +02:00
Adrià 27477e5f47 Merge pull request #4583 from MiniRML/fix/relinker-section-name-address
fix(relinker): zero the unmapped section-name table address
2026-10-13 17:49:15 +02:00
Adrià 9dd3c2d1a6 Merge pull request #4547 from codingreapermaps/feat/relinker-trace-imports
feat(relinker): add --trace-imports for Windows executables
2026-10-13 17:48:21 +02:00
codingreapermapsandClaude Opus 5.5 430e5c833e feat(relinker): add --trace-imports for Windows executables
With --trace-imports the entry stub resolves TraceImport_nid_no_patch
in libc.prx and passes each function import through it before writing
the slot: every PLT slot, and a GOT slot only when the original symbol
is a function, so data imports such as __stdoutp keep their address.
Without the option the output is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 16:55:31 +02:00
MiniRML bfffd3359c fix(relinker): validate icon PNG critical chunks and order 2026-10-13 16:38:28 +02:00
Zenodeon 36c11dc926 fix(relinker): identify failed inputs and invalid dynamic values 2026-10-13 18:37:50 +04:00
saxopaandClaude Opus 5.5 b3fa9d8318 fix(relinker): move the Linux program header table when it has no free slot
Linux output reused the input program header table in place, so it could
hold no more entries than the input declared. A title whose kept segments
and the five synthetic headers did not fit lost PT_GNU_EH_FRAME with a
warning, or failed with "Not enough program header slots". When more
headers are needed, the table is now written at the end of the extra block,
e_phoff points there and PT_PHDR maps it through the extra block PT_LOAD;
the header block then maps only the ELF header. Bytes after the input table
are left as they were.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 16:20:00 +02:00
Adrià afbc22fb1a Merge pull request #4140 from veosett/fix/relinker-windows-fixed-base
feat(relinker): support fixed Windows guest image bases
2026-10-13 14:26:54 +02:00
Adrià a2a3a3a94d Merge pull request #4062 from danzaio/fix/windows-log-without-standard-handles
fix(relinker): log Windows output when standard handles are missing
2026-10-13 14:11:42 +02:00
Kovalev Vladislav 319fa5779a feat(relinker): support fixed Windows guest image bases 2026-10-13 12:55:54 +02:00
boykopovar a534bd67ca fix(relinker): report intermediate output image progress 2026-10-13 12:59:23 +03:00
boykopovar 3e658db4b6 refactor(relinker): remove the obsolete file-based icon builder 2026-10-13 12:57:55 +03:00