fix(relinker): recognize ignored segment prefixes in import sites #11626
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11626"
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 Mherberts on 2026-10-26T23:31:15Z.
What
--registrymisses RIP-relative import accesses when their instructions carry the ignored 64-bit CS (2E), ES (26) or SS (36) prefix. For example,2e ff 15 f9 00 00 00at0x200references the import slot at0x300, but currently produces an emptycallSiteslist withcallSitesResolved: false.Recognize those prefixes alongside the existing DS/F2 handling. A legacy prefix still clears a preceding REX.W, so narrow loads remain excluded unless a later REX.W restores pointer width. FS/GS, address/operand-size overrides and unsupported prefixes retain their conservative handling. Update the existing debt entry to remove only the three newly handled prefixes.
AMD64 APM Volume 3, section 1.2.4, describes CS/DS/ES/SS as null prefixes in 64-bit mode. REX placement follows Intel SDM Volume 2A, section 2.2.1.
Tested
Windows x64, GCC 15.2.0 / MinGW-w64, C++20 Release, Ninja, Python 3.13;
ANYPS5_RELINKER_ONLY=ON,BUILD_TESTING=ON. Base:74acfad65b3f0fd4eab653f3a3989d298fba1157; tested head:21211527670dcdcd85918a96a49edcfa0bace0d2.call_site_resolverandcall_registryfail on the first CS-prefixed call; the conversion succeeds but its registry omits0x200.call_registry_writer,call_site_index,call_site_resolver,decoder_length,call_zero_padding,windows_trace_imports,linux_trace_imports,macos_trace_imports,import_symbol_types,guest_registry,guest_unused_import_dependencies,weak_imports,call_registry,unused_filter_indirect,unused_filter_fallthrough_padding,control_flow_graph,strict_nid_filter.git diff --checkpassed.origin/main: 0 errors, 34 warnings in upstream debt files because this fork'smainis older. Check against the actualupstream/mainbase passed without findings.tools/pr_overlap.py --branch codex/fix-segment-prefixed-import-sitesthrough a local public-API adapter (GitHub CLI is unavailable), comparing changed paths across 1,282 open PRs. Seven conflicting PRs required manual comparison ofdocs/dev/debt/relinker.md: #5021, #10479, #10861, #10970, #10983, #11061 and #11107. Their debt changes concern TLS, syscall/code extent, red-zone framing or Rosetta lowering; none changes this registry-prefix entry or implements this fix.This is focused native/synthetic-fixture validation, not the full product test suite. No commercial title or native Linux/macOS runtime was run; Linux and Windows output generation was checked on Windows. No performance claim.
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-26T23:43:09Z.
Review: APPROVED
Reviewed exact head
21211527670dcdcd85918a96a49edcfa0bace0d2. The decoder recognizes only the additional ignored CS/ES/SS prefixes alongside existing DS/F2 handling, resets a preceding REX.W on legacy prefixes, and preserves the conservative treatment of FS/GS and unsupported prefixes. The new matrix covers indirect call/jump/push, pointer loads, prefix order, REX precedence, and negative controls. I independently built and rancall_site_resolverandcall_registryfrom this head on Linux (2/2 passed), andgit diff --checkpassed. Hosted conventions/eligibility/intake/labels plus Linux, Windows, macOS (both configurations) relinker and ASan jobs all pass; product checks are skipped by path policy. I found no blocking issue.