loader: skip R_X86_64_NONE relocations #1146
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1146
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1146/head"
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?
@NevesHenry on GitHub · 2026-10-07 15:18 UTC · original
NevesHenry:loader/skip-none-relocations→main· +33 −0 · 4 files · 1 commits · closed without mergingSummary
GetRelocationInfohas no case for relocation type 0,R_X86_64_NONE, so loading a module that contains one stops the emulator withunknown type: 0.R_X86_64_NONEis a no-op, and FreeBSD's rtld skips it (reloc.c, releng/11.0).RelocateRecordnow returns true for these entries before resolving them. They are marked done inrela_bitsand nothing is written. Adding only acasetoGetRelocationInfowould not be enough: the entry would come back unresolved and get a stub, and the stub's address would be written atbase_vaddr + r_offset.@tucubanit0 found the cause and suggested this fix in #610 (comment). The commit credits them as co-author.
Evidence
#610 Hello Kitty Island Adventure (PPSA18176) doesn't boot. The game reads
Media/boot.config, then loadsMedia/Modules/PS5Util.prxwithsceKernelLoadStartModule.eboot.bin,libc.prxandlibSceNpCppWebApi.prxrelocate fine, and the error comes while relocating that module:This shows on two builds and two systems:
d3d7bd3on Windows (issue log) and719e025on Linux (log in tucubanit0's comment).In the other logs attached to issues here,
PS5Util.prx(a Unity module) is relocated in 60 other issues with no error, andunknown type: 0appears only in #610. So only this game's copy has such entries.I don't have the game, so I can't say how far it gets with this change. tucubanit0 noted that the log also shows unresolved imports that may be the next blocker.
Testing
TestRelocationSkipsNoneEntries(hook inruntimeLinker.cpp, run byvirtual_memory_allocation_tests) passes an all-zeroR_X86_64_NONEentry and anR_X86_64_RELATIVEentry toRelocateRecordover a two-word buffer. It checks that both report done, that the NONE entry leaves the memory alone and that the RELATIVE entry writesbase + addend.I ran it in an Ubuntu 24.04 container (clang 18, Release, no LTO). Results:
RelocateRecord, the test exits withunknown type: 0, the error from #610case R_X86_64_NONE: break;inGetRelocationInfo, it fails with "R_X86_64_NONE was not skipped or changed module memory"In the same container,
kyty_emulatorandkyty_testsbuild, and the 34 ctest tests that don't need a Vulkan device pass. I left out the other 16 (kernel_file_systemand the ones that runshader_recompiler_compute_tests) because they can't create a Vulkan instance there, with or without this change.The changed lines in
src/are clean under clang-format 22.1.3. Not built on Windows or macOS.AI assistance
An AI coding assistant (Claude Code) helped me check the logs and the FreeBSD source, write the change and the test, and run the builds above. I reviewed the code and the test results. All communication on this PR comes from me.
🤖 Generated with Claude Code
@coderabbitai[bot] on GitHub · 2026-10-07 15:22 UTC · original
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
dec40352-6f00-461e-a48a-a1fd884ef875📥 Commits
Reviewing files that changed from the base of the PR and between
d2413fc2eband29e9bcad07.📒 Files selected for processing (4)
src/loader/elf.hsrc/loader/runtimeLinker.cppsrc/loader/runtimeLinker.htests/VirtualMemoryAllocationTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Walkthrough
Walkthrough
The loader now defines
R_X86_64_NONEand treats entries of this type as complete without resolving symbols or patching memory. A test checks that a no-op relocation leaves its target unchanged and that a relative relocation updates its target. The test is registered in the standard test sequence.Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
29e9bThe change skips no-op relocations while preserving other relocation behavior in the described tests. No concrete merge-blocking issue is evident; proceed with normal checks.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.Pull request closed