loader: bind delay-load imports at map time #3
No reviewers
Labels
No labels
area: audio
area: d3d11
area: d3d12
area: gdk
area: gui
area: kernel
area: loader
area: shaders
area: video
area: winrt
bug
compat
console: series-xs
console: xbox-one
duplicate
enhancement
graphics-glitch
needs-log
needs-repro
not-a-dump
regression
status: boots
status: in-game
status: intro
status: menu
status: nothing
status: playable
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/sammwyy--xvalkyrie!3
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3"
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?
@FZNull on GitHub · 2026-11-23 00:43 UTC · original
FZNull:phase1/delay-import-binding→main· +110 −22 · 4 files · 3 commits · openChange
Fixes #1. Delay-load imports are now bound at map time, the same way regular imports are.
src/formats/pe/directories.cppalready parsed the delay-load directory and reported each descriptor'smodule,iat_rvaandsymbols(or astatuswhen the descriptor has no name table).MappedImagerecorded only the module names underimports.delay_load_modules_untouchedand left the IAT slots unresolved.src/loader/image.cppnow runs one binding pass over both import lists. For each delay descriptor with a name table, every IAT slot receivesoptions.resolve(module, symbol), or the sameunresolved_tag | nplaceholder the regular imports use, with a per-symbol entry in the report. The name table (INT) is left untouched, so a host delay helper could still resolve later. The mapper runs no code, so the lazy__delayLoadHelper2path stays out of scope and out of the change.The mapping report gains a root-level
delay_importsobject withslots,resolved,unresolvedandmodules_without_symbols(the last one keeps thepe::inspectstatus for descriptors without a name table). The oldimports.delay_load_modules_untouchedkey is removed; nothing in the tree read it, andimportsotherwise keeps its shape.Descriptor layout and the RVA attribute bit follow the Microsoft PE Format documentation, Delay-Load Import Tables (Image Only).
Tests
tests/loader_image.cppgains one test with three sections, using the corpusdelayfixture (KERNEL32.dllregular;dxcompiler_xs.dllordinal#1andtitle-local.dllProbedelayed):(value >> 47) != 0, so calling one faults), the twounresolvedentries carry the right module, symbol andslot_va, and regularimports.slotsis unchanged;resolved == 1;modules_without_symbolswith thepe::inspectstatus preserved, andslots == 1.ROADMAP.md marks the item done and ARCHITECTURE.md says which part is still missing (the lazy helper).
Verification
Built and tested on Windows 11 build 26300.9974, MSVC 14.50.35717 (VS Build Tools 2026), CMake 4.5.1 + Ninja 1.13.2.
Command-line evidence with the corpus
delay.pefixture:xvboot bind delay.peis identical before and after: the plan does not read the loader report.xvboot map delay.pebefore:delay_load_modules_untouched: ["dxcompiler_xs.dll", "title-local.dll"], delay slots unbound.xvboot map delay.peafter:delay_importsreportsslots: 2, resolved: 0and the twounresolvedentries (dxcompiler_xs.dll #1,title-local.dll Probe) withslot_value=0x4000000000000000|slot; the regularimportssection is unchanged.No game files, dumps or SDK content are involved; the fixture is generated by
tests/corpus/generate.py.AI-assisted.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.