fix(relinker): retain imports used by sectionless exports #4726
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4726"
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:49:06Z.
What
With
unused-filter=1, a sectionless ELF could lose a non-PLT import used only by an exported function, because that function was not a reachability root. The same image with a section symbol table kept the import.Read the existing executable export list before filtering and pass its defined global/weak functions to the level-1 filter as additional roots. Export emission retains its ordering and bytes. This reuses the existing parser and symbol-count contract; it adds no new ELF metadata format.
Tested
Windows x64, supported WinLibs MinGW-w64 GCC 15.2.0 ucrt-posix-seh r7, Ninja Release, Python 3.14. Rebase handoff adopted, then updated to current
maindacd78525; head7b70941f5.git range-diffconfirms the patch is identical to the previous PR headc8697b15e. Original author and author timestamp are preserved.660db6f0b, Release relinker-only build succeeds; full CTest suite: 150/150 pass, zero skips, zero failures (112.52 seconds). This includesunused_filter_indirect, export roots, weak imports, CFG and strict filtering.dacd78525is also patch-identical bygit range-diff. The only inherited changes are the two AGC files from #4949, outside the relinker-only build. Relinker sources, tools, tests, CMake configuration and workflows are identical to validated660db6f0b; local build/test results above apply to the same relinker code and tests. Fresh current-head CI passed as recorded below.Independent Linux full-build validation is reported in the rebase handoff: 1070/1071, with
agc_driver_tessellationfailing as a reported existing main regression (#4727). That runtime result was not independently reproduced here; this update changes only the rebase of the original relinker patch. No console title or GPU execution is claimed for the local validation.Current-head CI for
7b70941f5passed conventions and eligibility, plus all three relinker builds and complete test suites:Full runtime-library jobs were skipped by the repository's PR workflow.
Checklist
main; no other open PR implements the same functionsImported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T04:52:48Z.
Windows test: head
3d4cf8c7bmerged onto currentmaine51428bf2(clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release,-j2: full build 0 errors; ctest with the filter^unused_filter_indirect$: unused_filter_indirect passed (1 test(s), 0 failed);python tools/check_conventions.py --base upstream/mainpassed. I did not run the new tests againstmainwithout the change.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T15:34:34Z.
Checked the build and the relinker ctest scope (124/124 pass), and the extended
unused_filter_indirecttest fails without the change and passes with it. Roots from defined global/weak exported functions, local/undefined excluded, levels 0/1/2 with and without section headers all behave as expected; relinker CI green on Linux, Windows and macOS. Merging.Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-13T18:50:00Z.
Rebase handoff — rebased onto current
main(staleness only, applied cleanly), authorship unchanged.Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, AMD RX 9070 XT / RADV):tools/check_conventions.py --base origin/mainpassesmainregression (agc_driver_tessellationsegfault, #4727)To pick it up:
Head is
660db6f0b.