fix(relinker): drop Windows from errors the macOS target also reports #10391
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10391"
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 roboterspinne on 2026-10-23T20:46:43Z.
What
The macOS output reuses the Windows load image and relocation builder (
MacOsMachOPatcher.cpp:64,:67), so a--macosconversion failed with errors that name Windows. Relocation types 2 (PC32), 5 (COPY) and 10 (32) pass the relocation type check, but neither the PE nor the Mach-O output applies them, and the conversion failed withUnsupported Windows relocation type 2. AnET_EXECinput failed withWindows output requires a position-independent ELF image. These errors now readRelocation type 2 is not supported for this targetandThis target requires a position-independent ELF image, like the builder's other errors such asExecutable DTPMOD64 relocation is not supported for this target. The ELF64 x86-64 check in the same constructor gets the same wording. Which inputs are accepted or rejected does not change.executable_tls_relocationsnow checks the message for types 2 and 10 on--windowsand--macos, andelf_headerchecks theET_EXECerror on both targets, a case it used to skip.MacOsMachOPatcher.cpp, which #9408 edits.Tested
Ubuntu 24.04 x86_64, relinker-only Release build (
-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON); synthetic fixtures only, no title or homebrew.ctest --test-dir build-relinker: 240/240 passed.FAIL: Relocation type 2 is not supported for this target (offset 0x1000)on--windowsand--macos, and the same for type 10.python3 tools/check_conventions.py --base upstream/mainwith this title and description 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 harisibrar1 on 2026-10-24T15:43:19Z.
Review: APPROVED
Checked against main
c9b75825f3and the relinker sources (MacOsMachOPatcher.cpp,WindowsLoadImage.cpp,WindowsRelocationBuilder.cpp,ValidationPolicy.cpp,ElfReader.cpp):--macosgoes through the sameWindowsLoadImageandWindowsRelocationBuilder(MacOsMachOPatcher.cpp:64,67, with only the diagnostics check before them), so on main the macOS cases do print the "Windows output requires..." and "Unsupported Windows relocation type N" messages. That covers the macOS half the earlier test run couldn't reach.ValidationPolicyand now gets "Relocation type 0 is not supported for this target", along with 2, 5 and 10.WindowsLoadImagelooks unreachable in practice, becauseElfReader::ReadHeaderandGuestImageReaderreject those inputs first, so the reword is fine without a test.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.