Commit Graph
86 Commits
Author SHA1 Message Date
Matheus Herberts ec3cc6b602 fix(build): link the UCRT test fixture without -mcrtdll 2026-10-26 12:29:30 -03:00
Matheus Herberts d15fe22e98 test(relinker): require the exact section string table size 2026-10-25 14:44:13 -03:00
Matheus Herberts 03f382934e fix(relinker): align ELF64 section header tables 2026-10-25 01:57:10 -03:00
Dean c4446bbb09 Merge pull request #9332 from rooklz/fix/windows-console-base
fix(relinker): prefer 0x400000 for Windows executables
2026-10-25 12:57:28 +13:00
Dean 38d463a6cf Merge pull request #10157 from Usama171/fix/relinker-preloaded-crt-log
fix(relinker): rebind a preloaded CRT's standard streams to the startup log
2026-10-25 12:45:29 +13:00
muausandClaude Fable 5 eeaf7b03b5 fix(relinker): open the startup log for append so stub writes cannot clobber CRT output
Co-Authored-By: Claude Fable 5 <[email protected]>
2026-10-24 20:30:27 +05:00
Rookie 39df8e081c fix(relinker): prefer 0x400000 for Windows executables 2026-10-24 15:58:35 +01:00
Dean 34a41ada16 Merge pull request #10341 from Filip722/submit/phnum-20261023
fix(relinker): reject unsupported extended program header counts
2026-10-24 21:08:06 +13:00
Dean a8e32e0017 Merge pull request #9518 from harisibrar1/fix/relinker-tests-nonascii-paths
test(relinker): find the Windows test executables with GetModuleFileNameW
2026-10-24 20:46:17 +13:00
Filip Michalski 62e1d3089c fix(relinker): reject unsupported extended program header counts 2026-10-23 20:16:51 +02:00
harisibrar1andClaude Opus 5.5 e1342e7de2 test(relinker): find the Windows test executables with GetModuleFileNameW
autorun_exit_tests built its own path from argv[0] and
windows_dependency_diagnostics_tests from GetModuleFileNameA. Both are in
the ANSI code page on Windows, but MinGW's std::filesystem::path reads a
narrow string as UTF-8, so in a build directory with characters such as
"ü" both tests stopped with "Cannot convert character sequence: Illegal
byte sequence" before testing anything (windows_diagnostic_fixture_isolation
runs the second one).

Take the path from GetModuleFileNameW on Windows. The relinker and the
generated diagnostic runner already use UTF-8 and wide APIs, so nothing
else changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 08:48:34 -04:00
bluandClaude Opus 5.5 a946c469d6 Merge upstream main into feat/libc-num-get-objects
Resolves the conflict with #8867 in EntryStubTests.cpp: keep its two
kernel-variant tests and the BufferUtils include, and this branch's
libSceAmpr-to-libc fallback test, with all three called from main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 12:33:11 -07:00
MarcZX10 0d0b29cf44 test(relinker): require libc for kernel variant fallback 2026-10-21 05:47:05 +00:00
MarcZX10 7157ebb4e8 test(relinker): cover libc fallback for Ampr imports
(cherry picked from commit babde2b5bd9ea9af9fec545fcff33f00d1583fd6)
2026-10-20 21:30:07 -07:00
bluandClaude Fable 5.1 2657a81218 test(relinker): resolve a libSceAmpr-qualified import of the locale objects against libc's
windows_import_identity generates two probes with the entry stub builder, as the diagnostics
test does, and runs them next to the patched libraries: same.exe imports the three locale objects
of #8875 twice, qualified to libSceAmpr.prx and to libc.prx, and exits 0 only if each pair
resolved to one address; different.exe compares the first with libkernel's getpagesize and must
exit 1. That pins the fallback from a host module to libc at run time, independently of how the
stub builds its search order.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-10-20 21:28:05 -07:00
MarcZX10 fef2755c76 test(relinker): cover scoped kernel variant imports 2026-10-21 03:42:04 +00:00
Dean 892a4f1328 Merge pull request #7993 from MarrasFederico/fix/relinker-windows-trampoline-builder-guards
fix(relinker): validate Windows trampoline section placement and sites
2026-10-21 06:30:55 +13:00
tkcm01 4d07bc0231 fix(relinker): format invalid Windows icon paths as UTF-8 2026-10-20 12:10:00 -04:00
JJenkxandClaude Opus 5.5 92ea0b9ce3 test(relinker): wait for the exited diagnostic runner to release its fixtures
windows_dependency_diagnostics rewrites the fixture images right after the
diagnostic runner exits. The runner ends with an unhandled RaiseException of
STATUS_DLL_NOT_FOUND, and Windows fault handling keeps the exited process's
image files open for a short time after its handle is signaled: on Windows 11
22621 the Restart Manager names the exited runner as the holder and the file
opens 37 to 153 ms later. The rewrite then fails with ERROR_SHARING_VIOLATION,
and the final removal of the fixtures with access denied. Retry opening a
fixture while it fails with a sharing violation and the removal while it fails
with access denied, for at most 10 s each; every other failure still fails the
test at once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 21:45:35 -04:00
Adrià 7e12b3da80 Merge pull request #7736 from jotitadev/fix/relinker-desktop-entry-test-unique-dir
test(relinker): give the desktop entry test its own temporary directory
2026-10-20 03:13:23 +02:00
Adrià 48790e0233 Merge pull request #7039 from nabil88/fix/windows-libkernel-and-tests
feat(libkernel): implement getdtablesize and fix Windows host-tree removal
2026-10-19 19:36:18 +02:00
Federico Marras b336f0c4dc fix(relinker): validate Windows trampoline section placement and sites 2026-10-19 18:57:12 +02:00
Dean 00d7e611ef Merge pull request #7363 from plokmklo/fix/relinker-gnu-stack-relro
fix(relinker): synthesise a non-executable PT_GNU_STACK for Linux executables
2026-10-20 03:52:18 +13:00
Dean 98024d4bce Merge pull request #7772 from fogydes/fix/relinker-section-header-table-overlap-and-bounds
fix(relinker): validate section header table bounds and reject overlapping sections
2026-10-20 02:23:11 +13:00
Dean 111f9eb6f2 Merge pull request #7771 from fogydes/fix/relinker-program-header-layout-extra-block-overlap
fix(relinker): reject program header table overlapping the extra block
2026-10-20 02:22:57 +13:00
Dean 1fad170b8b Merge pull request #7770 from fogydes/fix/relinker-windows-icon-resource-rva-and-overlap-guards
fix(relinker): validate resource section RVA and prevent section overlaps
2026-10-20 02:22:43 +13:00
UAQ Taxi 379dca5cac test: raise the slow-host timeouts 2026-10-19 14:49:36 +02:00
Adrià 4630318457 Merge pull request #6681 from milescoviello/fix/relinker-bss-page-overlap
fix(relinker): keep a segment's zero-filled tail zero when the next PT_LOAD starts on its page
2026-10-19 10:48:54 +02:00
plokmklo c1866af79b fix(relinker): synthesize PT_GNU_STACK for Linux outputs without one
Outputs whose input carries no PT_GNU_STACK get one appended with
PF_R|PF_W and alignment 16 so the kernel does not fall back to an
executable stack marking.

RequiredProgramHeaderCount and WriteLayout now derive from one shared
header list, so the reserved slot and the written header cannot
disagree at any PhNum boundary, when a free input slot should be
reused, or when the RELRO coverage guard reduces the kept count.
Space exhaustion beyond the 16-bit header limit fails loudly instead
of silently skipping the header.
2026-10-19 07:30:56 +00:00
fogydes 5536aa8c0d fix(relinker): validate section header table bounds and reject overlapping sections 2026-10-19 12:22:43 +05:30
fogydes 93d3f89b51 fix(relinker): reject program header table overlapping the extra block 2026-10-19 12:21:35 +05:30
fogydes a7374e243e fix(relinker): validate resource section RVA and prevent section overlaps 2026-10-19 12:19:59 +05:30
Jota 21325fba43 test(relinker): give the desktop entry test its own temporary directory 2026-10-19 04:51:37 +00:00
Mehran 9824c46fe0 feat(libs): let relinked Windows games opt into mimalloc 2026-10-19 00:08:47 +03:00
milescovielloandClaude Opus 5.5 24ec391c06 fix(relinker): keep a segment's zero-filled tail zero when the next PT_LOAD starts on its page
On Linux the kernel maps each PT_LOAD from the start of its first page.
When a segment begins inside the page that holds the end of the previous
segment's zero-filled memory, that page is mapped again from the file, and
the bss tail reads whatever bytes precede the segment in the file. Nuvio
Max'd 0.5.27 (PPSA99288) keeps a mutex there and crashes at launch.

A segment whose page would read wrong bytes is now appended to the output
with that page prefix rebuilt from the segments below it. Outputs whose
pages already read right are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-17 18:41:25 +00: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à 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
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
m2 (AI Agent) 7f73643e0c test(relinker): name each program-layout check instead of tracking its line 2026-10-15 03:50:14 +02:00
Ondra97 46b96329e3 fix(relinker): reject invalid PNG icon chunk types 2026-10-14 07:53:01 +02: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
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
MiniRML bfffd3359c fix(relinker): validate icon PNG critical chunks and order 2026-10-13 16:38:28 +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
boykopovar 3e658db4b6 refactor(relinker): remove the obsolete file-based icon builder 2026-10-13 12:57:55 +03:00