fix(relinker): accept paths longer than 260 characters on Windows #4618
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4618"
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 Borooooo on 2026-10-12T16:51:17Z.
What
relinker.exeis not long-path aware on Windows. It carries only MinGW's default manifest (asInvokerandsupportedOS), so Windows keeps the 260-characterMAX_PATHlimit for it even when long paths are enabled in the system (LongPathsEnabled= 1). A title under a deep directory stops before conversion:relinker.exenow embeds its own manifest (core/relinker/relinker.rc) withlongPathAware, keeping theasInvokerlevel and the Windows 10supportedOSentry of the default one. GNU ld takes the language-neutral MinGW manifest (default-manifest.o) as a default and drops it in favour of a manifest with a language, which windres gives a resource by default (rsrc_sort_entriesin binutilsbfd/peXXigen.c), so no link option is needed.OBJECT_DEPENDSrebuilds the resource when only the manifest changes.Windows still needs long paths enabled in the system (Windows 10 1607 and later); without them nothing changes. Converted executables are not changed: Windows does not start a program whose own path exceeds
MAX_PATH.test_long_paths.pyconverts an input whose output paths exceed 260 characters to a Linux ELF and to a Windows PE with--registry. On a Windows host with long paths disabled it returns 77, which ctest reports as skipped; GitHub's Windows images enable them (Configure-BaseImage.ps1in actions/runner-images), so the Windows jobs run it.Tested
Windows 11 Pro 26200, MSYS2 MinGW-w64 GCC 14.2.0, relinker-only build (Ninja, Release),
LongPathsEnabled= 1:ctest --test-dir build-relinker: 129 of 129 passed.long_pathsfails withmain'srelinker.exeand passes with this change.relinker.execarries the new manifest (asInvoker,supportedOS,longPathAware); touchingrelinker.manifestrebuildsrelinker.rc.obj.python tools/check_conventions.py --base origin/mainpasses.Not run: WinLibs GCC 15.2.0 r7, Linux, macOS.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T13:03:25Z.
Windows test: head
39bed4b9dmerged onto currentmain94d995772, together with 8 other open pull requests in one build (the merges were conflict-free); a failure would have been bisected per PR. Windows 10, MinGW GCC (WinLibs), Ninja Release,-j2: full build 0 errors; ctest for the tests this change adds or touches: long_paths passed;python tools/check_conventions.py --base upstream/mainpassed for the combined tree. 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-13T14:45:15Z.
Checked the manifest and resource (keeps
asInvokerand the Windows 10supportedOS, addslongPathAware), the WIN32-only wiring, and the newlong_pathstest (passes on Linux in the relinker build, ctest 125/125; Windows run confirmed by @xXPBSXx). Merging once the full Windows build is green.