fix(relinker): name R_X86_64_PC32 in the import registry #10679
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10679"
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-24T17:11:59Z.
What
relocationTypeNamenamedR_X86_64_64,GLOB_DAT,JUMP_SLOT,R_X86_64_32and the three TLS types, but notR_X86_64_PC32(type 2), whichValidationPolicyaccepts andextractRelaadds to the imports likeR_X86_64_64, so a PC32 import relinked for Linux with exit 0 and appeared in the registry asUNKNOWN(2). The name is used only for therelocationTypefield of the executable's--registryJSON (CallRegistryWriter); bundled-module registries leave it empty.R_X86_64_COPY(type 5) printsUNKNOWN(5)the same way onmain; #10658 rejects it in validation, so it gets no name here.case 2returnsR_X86_64_PC32, the psABI name of type 2 and ofElfpatcher::R_X86_64_PC32. Apart fromCOPY, every type that can reach a registry entry was named:NONEandRELATIVEare skipped inextractRela, TLS relocations against no symbol or a definedSTT_TLSsymbol are not imports,IRELATIVEfails validation, and Windows and macOS rejectPC32,COPY,R_X86_64_32and imported TLS inWindowsRelocationBuilderbefore the registry is written.test_call_registry.pysets the info word of the fixture's onlyDT_RELAentry (0x708) to symbol 1 with types 1, 2, 6, 10 and the TLS types 16 to 18 (seven relinks) and asserts the single registry entry'srelocationType. Linux output only: Windows and macOS stop atUnsupported Windows relocation type 2and10before a registry exists.JUMP_SLOT(7) cannot be expressed in thisDT_RELAentry (JUMP_SLOT relocation is not aligned to the original .rela.plt entry size; the fixture has noDT_JMPREL) and its name is already asserted bytest_optional_rela.py.pr_overlap.pycannot compare this branch with #8076 and reports no other shared lines. Checked by hand: theRelinkerPipeline.cpphunk of #8076 starts at line 374, this one at 42. No open PR touchestest_call_registry.py; #10658 shares no file with this PR.Tested
Windows 11, GCC 15.2.0 (WinLibs UCRT), relinker-only Release build (
-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON); synthetic fixtures only, no title or homebrew, relinked outputs not run.mainbuild (e4bb5fc125) passes type 1 and fails at type 2 withAssertionError: (2, 'R_X86_64_PC32', [{... 'relocationType': 'UNKNOWN(2)', ...}]).call_registry,call_registry_writer,guest_registryandunused_filter_indirectpass with this change;call_registrytakes about 3 s onmainand with it.ctest --test-dir build-relinker: 244 tests, 242 passed; the two failures are known on this machine and unrelated to this change:select_tests(Windows symlink fixture) andpatch_advisor_unit(build path with spaces, fixed by #10667).python 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 MarcZX10 on 2026-10-24T17:15:59Z.
Review: COMMENTED
I reviewed head
d63c9533a7cc6370ad6c4d9c87688429a650676b. The newR_X86_64_PC32label matches the accepted relocation type, and the test exercises the registry output for the supported imported relocation types. Independently, I configured a relinker-only Release build with GCC 12.2, built targetrelinker, and ranctest -R '^call_registry$': 1/1 passed.git diff --check, conventions, and merge-tree with currentmainalso pass. Ubuntu relinker and ASan checks are green; Windows and macOS relinker jobs are still pending, so this is a progress report rather than an approval. Product jobs are skipped by path policy.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T17:21:14Z.
Review: APPROVED
Reviewed exact head
d63c9533a7cc6370ad6c4d9c87688429a650676b. The new registry name is consistent with the acceptedR_X86_64_PC32import type; the test checks the JSON field for the supported relocation cases.Independent validation: relinker-only Release build with GCC 12.2 and
ctest -R '^call_registry$'pass on this head. I also ran the PR's updated test script against a relinker built from currentmain: it fails at type 2 withUNKNOWN(2)as expected; the same script passes against the PR build. Diff-check, conventions and merge-tree with currentmainpass. Hosted Ubuntu, Windows, macOS ARM64, macOS x86_64 and ASan relinker jobs are green; product jobs are skipped by path policy.The overlap report could not compare #8076 because that head conflicts with current
main; I manually confirmed itsRelink()change around line 373 is separate from thisrelocationTypeNamecase near line 42. I found no remaining blocker.