fix(relinker): accept paths longer than 260 characters on Windows #4618

Merged
Borooooo merged 1 commit from upstream-pr/4618 into main 2026-10-13 15:31:06 +00:00
Borooooo commented 2026-10-12 16:51:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Borooooo on 2026-10-12T16:51:17Z.


What

relinker.exe is not long-path aware on Windows. It carries only MinGW's default manifest (asInvoker and supportedOS), so Windows keeps the 260-character MAX_PATH limit for it even when long paths are enabled in the system (LongPathsEnabled = 1). A title under a deep directory stops before conversion:

FAIL: Cannot open file: C:\...\eboot.elf

relinker.exe now embeds its own manifest (core/relinker/relinker.rc) with longPathAware, keeping the asInvoker level and the Windows 10 supportedOS entry 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_entries in binutils bfd/peXXigen.c), so no link option is needed. OBJECT_DEPENDS rebuilds 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.py converts 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.ps1 in 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_paths fails with main's relinker.exe and passes with this change.
  • The built relinker.exe carries the new manifest (asInvoker, supportedOS, longPathAware); touching relinker.manifest rebuilds relinker.rc.obj.
  • python tools/check_conventions.py --base origin/main passes.

Not run: WinLibs GCC 15.2.0 r7, Linux, macOS.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4832451084 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4618). Originally posted by [Borooooo](https://github.com/Borooooo) on 2026-10-12T16:51:17Z. --- ### What `relinker.exe` is not long-path aware on Windows. It carries only MinGW's default manifest (`asInvoker` and `supportedOS`), so Windows keeps the 260-character `MAX_PATH` limit for it even when long paths are enabled in the system (`LongPathsEnabled` = 1). A title under a deep directory stops before conversion: ``` FAIL: Cannot open file: C:\...\eboot.elf ``` `relinker.exe` now embeds its own manifest (`core/relinker/relinker.rc`) with `longPathAware`, keeping the `asInvoker` level and the Windows 10 `supportedOS` entry 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_entries` in binutils `bfd/peXXigen.c`), so no link option is needed. `OBJECT_DEPENDS` rebuilds 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.py` converts 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.ps1` in 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_paths` fails with `main`'s `relinker.exe` and passes with this change. - The built `relinker.exe` carries the new manifest (`asInvoker`, `supportedOS`, `longPathAware`); touching `relinker.manifest` rebuilds `relinker.rc.obj`. - `python tools/check_conventions.py --base origin/main` passes. Not run: WinLibs GCC 15.2.0 r7, Linux, macOS. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [x] AI-assisted: yes
xXPBSXx commented 2026-10-13 13:03:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T13:03:25Z.


Windows test: head 39bed4b9d merged onto current main 94d995772, 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/main passed for the combined tree. I did not run the new tests against main without the change.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6146176080 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4618#issuecomment-6146176080). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-13T13:03:25Z. --- Windows test: head `39bed4b9d` merged onto current `main` `94d995772`, 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/main` passed for the combined tree. I did not run the new tests against `main` without the change. AI-assisted (Claude Code).
adriadam10 commented 2026-10-13 14:45:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T14:45:15Z.


Checked the manifest and resource (keeps asInvoker and the Windows 10 supportedOS, adds longPathAware), the WIN32-only wiring, and the new long_paths test (passes on Linux in the relinker build, ctest 125/125; Windows run confirmed by @xXPBSXx). Merging once the full Windows build is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6148203376 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4618#issuecomment-6148203376). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-13T14:45:15Z. --- Checked the manifest and resource (keeps `asInvoker` and the Windows 10 `supportedOS`, adds `longPathAware`), the WIN32-only wiring, and the new `long_paths` test (passes on Linux in the relinker build, ctest 125/125; Windows run confirmed by @xXPBSXx). Merging once the full Windows build is green.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!4618
No description provided.