fix(relinker): ignore empty guest load ranges in overlap checks #13818
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13818"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Ninot1Quyi on 2026-10-31T07:58:23Z.
What
A guest PRX containing an empty
PT_LOADinside another load segment, or before a nonempty segment at the same address, currently fails withOverlapping load segments. The ELF program-header specification permits a zerop_memsz; that segment contributes no bytes to the memory-range overlap check.Exclude empty memory ranges from the overlap index after validating their file bounds, sizes, flags and alignment. Keep the program headers intact for output writers. Windows output retains its existing explicit rejection of empty
PT_LOADsegments.Add parser regressions for empty segments before and after real segments, at starts, interiors and ends; malformed empty segments and actual nonempty overlaps still fail. A Linux conversion regression loads every generated guest module and calls its exported function on Linux x86-64.
The repository overlap checker scanned all 1,603 open PRs and exited 2 for shared-file conflicts. Each reported change was reviewed manually: #10518, #11628, #11661, #11689 and #11698 edit the adjacent alignment validation; #12495 and the seven base-conflicting CMake entries add other tests or targets. None implements empty-load exclusion; these are mechanical conflicts, not dependencies.
Tested
ANYPS5_RELINKER_ONLY=ON, Release,BUILD_TESTING=ON.guest_load_rangesandguest_empty_loads: 2/2 passed. The parser test exercises 35 cases; all 12 converted guest modules load through the native ELF loader and return 42 from their exported function.main828ac0b2ae: the final parser test fails eight valid empty-segment cases withOverlapping load segments; its all-empty case also reaches the old later diagnostic. The final conversion test exits 1 when the empty segment at0x1080is incorrectly rejected. Both tests compile/run against main; no implementation declarations need to be removed.pad_inputfails when this environment rejectschowntonobodywithEINVAL;file_writer_binaryandfile_writer_textreportThe previous executable did not startin their existing running-file replacement harness. Their implementation and tests are unchanged by this PR.python3 tools/check_conventions.py --base origin/main: passed.git diff --check: passed.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T08:07:26Z.
Review: APPROVED
Reviewed — looks good
The exact-head change excludes zero-sized load ranges only after validating them, and the added regressions cover malformed ranges, real overlaps, and Linux conversion.
What I ran
Reviewed head
134b6cf0be5d9060f3958780f5e80c295b88afbeagainst PR base828ac0b2ae74aac181ba128fb59b08a1534f2041; currentmainise8c25dd3baa6e78531d5eee067fec5cbe8af3dcf, and the merge preview is clean. The relevant parser, CMake, fixture, and test paths have not changed between the PR base and currentmain. Environment: Debian 12 x86_64, Python 3.11.2, GCC 12.2.0. I did not build or run C++ tests locally.Results
guest_load_rangesandguest_empty_loadsUnedited precheck output
Negative control
PT_LOADranges are accepted, and conversion loads828ac0b2ae74aac181ba128fb59b08a1534f2041Sources
Not verified
I did not independently reproduce the C++ or conversion tests. The author-reported full-suite run and negative control are not local results; Windows and macOS relinker jobs were not complete at review time.