Repository navigation
Conversation
The code analysis trims an interpreter path from the start of an executable segment only for images that have a PT_SCE_DYNLIBDATA block. An executable without one keeps that path in the scanned range, so /libexec/ld-elf.so.1 is walked as code: a RELATIVE relocation with addend 0 roots the control flow graph at the first byte of the segment, and the 0x64 of "ld-elf" decodes as an FS-prefixed instruction that the Windows and macOS TLS rewriters refuse. The trim now runs for both layouts, ending at the segment for an image without the block.
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Verdict: confirmed on Windows and Linux, with one edge case below. Environment: Windows 11 Home 10.0.26300, Ryzen 5 9600X, WinLibs GCC 15.2.0 r7, relinker-only Release build. This PR was merged onto
Edge case:
It fails loudly, and linkers normally put AI-assisted: yes (Claude Code); results above were run on this machine. |
Trimming the end of any PT_INTERP inside an executable segment dropped the code in front of one that follows it, so an image without an SCE block whose interpreter sits after its code lost its entry points. The trim now applies to an interpreter that starts the segment, and the SCE path keeps taking any interpreter inside the scanned range, as before.
|
Confirmed and fixed in
Thanks for the Windows and Linux runs, and for the byte-identical check on the PS5 homebrew: that covers the ground I could not, since I have neither host. |
|
Re-tested Environment: Windows 11 Home 10.0.26300, Ryzen 5 9600X, WinLibs GCC 15.2.0 r7, relinker-only Release build. The PR is merged onto Same probe as before:
In every rc 0 case, the original TLS bytes at 0x1240 appear once in the output, as they do on
AI-assisted: yes (Claude Code); results above were run on this machine. |
|
@wachi35676 thanks for the second round, and for diffing all 40 outputs against On the overlap notice: I checked the one pull request in it that shares The other pull requests in the notice share only |
|
Thanks. This now conflicts with |
|
@oneandonlydean rebased onto current This pull request closed when I republished its branch, and GitHub will not reopen it, so the rebased work is in #8599. Apologies for the churn — the two commits and the discussion here are unchanged. |
What
The code analysis trims an interpreter path from the start of an executable segment only for images that have a
PT_SCE_DYNLIBDATAblock. An executable without one keeps that path in the scanned range./libexec/ld-elf.so.1then gets walked as code: aR_X86_64_RELATIVErelocation with addend 0 roots the control flow graph at the first byte of the segment, and the0x64ofld-elfdecodes as an FS-prefixed instruction, which the Windows and macOS TLS rewriters refuse:Linux output is unaffected because it keeps the guest
%fsaccesses. The trim now runs for both layouts, ending at the segment for an image without the block. This is thePT_INTERPitem of the remaining PS4 work in #3093.Tested
Apple M5, macOS 26.4, AppleClang 21.0.0, relinker-only build of current
main.The public OpenOrbis homebrew samples reproduce it, so no title dump is needed:
samples-elf-llvm-18.zipfrom OpenOrbis-PS4-Toolchain v0.5.3 (GPL-3.0). Their executable segment starts with the interpreter path at vaddr 0, and they carry the addend-0 relocation.--windows, 21 sample imagesmaingraphics,SDL2,hello_world,piglet,font,input,networking, …)libc,libSceFios2,right)--macosrefuses and converts the same way;graphicsconverts on all three targets with the change.interpreter_in_codetest: an image without an SCE block whose executable segment begins with the interpreter path, reached through an addend-0 RELATIVE relocation. It fails onmainwith the message above and passes here, for--windowsand--macos, with a second image that has no interpreter path as the control.python3 tools/check_conventions.py --base origin/mainpasses.No Linux or Windows host was available, so the converted images were not executed; the change only narrows what the analysis scans.
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: n/a.mdfiles or images added to the repository