fix(relinker): map standalone RELRO in unused import filtering #4717
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4717"
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 Ondra97 on 2026-10-12T19:42:20Z.
What
unused-filter=1could not read relocation tables or lifecycle arrays placed in a standalonePT_SCE_RELROsegment, even though the executable reader already maps that segment as a load segment. ReuseElfReader::ReadProgramHeaders()in the relative relocation index and entry-point collector, so filtering uses the same mappings as conversion. Remove the obsolete filter limitation from technical debt.Initialize
e_version=1ande_ehsize=64in the separate relative-relocation bounds fixture. After #4441 added these header checks, that hand-built fixture still left both fields zero; using the shared reader exposed it before its positive bounds assertions. Keep the production header validation and all existing relocation-boundary assertions unchanged.Tested
Windows, MinGW-w64 GCC 15.2.0, Release, relinker-only, main
2a2a3dc65. Full build exits 0 and all 140 CTests pass in 24.40 s, including strict_nid_filter, elf_header, elf_reader_bounds, sce_relro, unused_filter_indirect and init_array_roots.The review-reported failure was reproduced before correcting the fixture: strict_nid_filter exited 1 with
Unsupported ELF object version: expected 1. The original 135-test Windows run included strict_nid_filter, but its base predates #4441's new object-version and header-size guards. Linux execution was not run locally.Before the RELRO mapping fix, the added relocation and lifecycle cases failed with unmapped-address errors. The regressions cover standalone and already-covered RELRO, relocation tables, init arrays and filters 0, 1 and 2; retained imports are checked through the registry.
git diff --checkand committed branch/PR conventions pass. No game or console was run; no performance improvement is claimed.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 nicolasfalesy on 2026-10-13T08:28:01Z.
Linux test (Arch, GCC 16.2.1, Release), this PR's head merged alone onto
main7e181fcc3(clean merge):strict_nid_filterfails. Its last case printsUnsupported ELF object version: expected 1after the two passing reachability cases. It passes onmainon the same machine. The Windows run above was a relinker-only build; this test may not have been part of it.Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-13T09:25:14Z.
Thanks for catching this. I reproduced the failure after rebasing onto current main. The relative-relocation bounds fixture left
e_versionande_ehsizeat zero, which became invalid after #4441 added those checks.Fixed in
bde680c85by initializing both fields. Production validation and the existing bounds assertions remain unchanged. The full Windows relinker build and all 140 CTests now pass. I have not run Linux locally.The earlier 135-test run did include
strict_nid_filter, but its base predated those new header checks.AI-assisted: yes. — Codex
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T15:12:28Z.
Checked on this head merged onto current
main: relinker build and tests pass (124/124 in scope). With the production changes reverted,sce_relrofails (the new filter cases hit unmapped addresses) and passes with them;strict_nid_filterpasses with the fixture fix, as expected. Relinker CI is green on Linux, Windows and macOS. Merging once the full Build is green.