PE loader: an executable loaded as a library does not run its entry point #1672

Merged
emirduran707 merged 1 commit from upstream-pr/1682 into main 2026-11-30 02:52:12 +00:00
emirduran707 commented 2026-11-24 19:14:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-24T19:14:55Z.


When a title loads an executable from its folder as a library (LoadLibrary of a .exe that is not the main image), load_game_dll logged that it is not a DLL. init_dll then still called the image's entry point with DllMain's arguments, so its mainCRTStartup ran on the calling thread. That either started a second copy of the program inside the process, or the load failed with "DllMain returned FALSE".

Windows does not call that entry point. LoadLibraryW: "If the specified module is an executable module, static imports are not loaded; instead, the module is loaded as if by LoadLibraryEx with the DONT_RESOLVE_DLL_REFERENCES flag", and that flag means DllMain is not called. XCL's thread attach and detach already call the entry point only for a DLL (m.is_dll); process attach now does the same.

What is in it

  • crates/xcl/src/loader.rs: init_dll calls the entry point only when the image is a DLL. Test an_exe_loaded_as_a_library_does_not_run_its_entry_point: an image without the DLL flag whose entry point returns 0 loads, and loads once.

Tested

  • AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release
  • cargo test --workspace -- --test-threads=4 on c8a4266: 859 passed, 0 failed, 42 ignored; SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows)
  • the new test without the change: an EXE loads as a library: "DllMain(xcl_exe_as_library.exe) returned FALSE"

Regression run

main:

xcl-smoke v1
commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1321 (PresentX 1323)
presents per 2 s (last 3): 44 22 24
device removals: 0
crashes: 0
peak commit: 47832 MB

this PR:

xcl-smoke v1
commit: c8a426675198493f21015fcd06567ff61a7847d6
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1385 (PresentX 1388)
presents per 2 s (last 3): 60 54 50
device removals: 0
crashes: 0
peak commit: 49270 MB

Not tested

  • A title that loads an executable as a library; the smoke title's run is a regression check only.
  • XCL still resolves such an image's static imports and runs its TLS callbacks with PROCESS_ATTACH. Windows does not load the imports; the documentation says nothing about TLS callbacks. Both are left as they were.
  • NVIDIA and Intel GPUs.

AI use

  • Claude Code with Claude Opus 5.5: found the problem, wrote the change, the test and this description; I reviewed the diff and ran the tests and smoke runs above.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5478685068 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1682). Originally posted by [emirduran707](https://github.com/emirduran707) on 2026-11-24T19:14:55Z. --- When a title loads an executable from its folder as a library (`LoadLibrary` of a `.exe` that is not the main image), `load_game_dll` logged that it is not a DLL. `init_dll` then still called the image's entry point with DllMain's arguments, so its `mainCRTStartup` ran on the calling thread. That either started a second copy of the program inside the process, or the load failed with "DllMain returned FALSE". Windows does not call that entry point. [LoadLibraryW](https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryw): "If the specified module is an executable module, static imports are not loaded; instead, the module is loaded as if by LoadLibraryEx with the DONT_RESOLVE_DLL_REFERENCES flag", and that flag means DllMain is not called. XCL's thread attach and detach already call the entry point only for a DLL (`m.is_dll`); process attach now does the same. **What is in it** - `crates/xcl/src/loader.rs`: `init_dll` calls the entry point only when the image is a DLL. Test `an_exe_loaded_as_a_library_does_not_run_its_entry_point`: an image without the DLL flag whose entry point returns 0 loads, and loads once. **Tested** - AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release - `cargo test --workspace -- --test-threads=4` on c8a4266: 859 passed, 0 failed, 42 ignored; SKIPPED: `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows) - the new test without the change: `an EXE loads as a library: "DllMain(xcl_exe_as_library.exe) returned FALSE"` **Regression run** main: ``` xcl-smoke v1 commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0 gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1321 (PresentX 1323) presents per 2 s (last 3): 44 22 24 device removals: 0 crashes: 0 peak commit: 47832 MB ``` this PR: ``` xcl-smoke v1 commit: c8a426675198493f21015fcd06567ff61a7847d6 gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1385 (PresentX 1388) presents per 2 s (last 3): 60 54 50 device removals: 0 crashes: 0 peak commit: 49270 MB ``` **Not tested** - A title that loads an executable as a library; the smoke title's run is a regression check only. - XCL still resolves such an image's static imports and runs its TLS callbacks with PROCESS_ATTACH. Windows does not load the imports; the documentation says nothing about TLS callbacks. Both are left as they were. - NVIDIA and Intel GPUs. **AI use** - Claude Code with Claude Opus 5.5: found the problem, wrote the change, the test and this description; I reviewed the diff and ran the tests and smoke runs above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
mantavisual commented 2026-11-24 21:09:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by mantavisual on 2026-11-24T20:47:03Z.


Test report for c8a426675198 on a machine with an NVIDIA GPU, which the PR lists as not tested.

Tested

  • RTX 4060 8 GB (driver 616.92, wave32), i5-13600K, 32 GB, Windows 11 Pro 22631, Rust 1.100.0 MSVC, DXC 1.9.2602.17 (SDK 10.0.26100), debug.
  • cargo test --workspace --locked --no-fail-fast -- --test-threads=4: 859 passed, 0 failed, 42 ignored. The new test ran.
  • Merged locally with main 4178e88: 892 passed, 0 failed, 42 ignored.
  • SKIPPED at the head: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).

Do the tests notice a broken fix?

  • Fix reverted: the new test fails with DllMain(xcl_exe_as_library.exe) returned FALSE.
  • The entry point never called for anything, DLLs included: an existing loader::tests test fails.

Not tested: AMD, retail title, a real executable loaded as a library.

AI use: Claude Code (Claude Opus 5.5) ran this on my machine, wrote the report and posted it for me.

<!-- greyfinch-sync:ivall/xcl:comment:7144050715 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1682#issuecomment-7144050715). Originally posted by [mantavisual](https://github.com/mantavisual) on 2026-11-24T20:47:03Z. --- Test report for `c8a426675198` on a machine with an NVIDIA GPU, which the PR lists as not tested. **Tested** - RTX 4060 8 GB (driver 616.92, wave32), i5-13600K, 32 GB, Windows 11 Pro 22631, Rust 1.100.0 MSVC, DXC 1.9.2602.17 (SDK 10.0.26100), debug. - `cargo test --workspace --locked --no-fail-fast -- --test-threads=4`: 859 passed, 0 failed, 42 ignored. The new test ran. - Merged locally with main `4178e88`: 892 passed, 0 failed, 42 ignored. - SKIPPED at the head: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` (no wave64), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). **Do the tests notice a broken fix?** - Fix reverted: the new test fails with `DllMain(xcl_exe_as_library.exe) returned FALSE`. - The entry point never called for anything, DLLs included: an existing `loader::tests` test fails. **Not tested:** AMD, retail title, a real executable loaded as a library. **AI use:** Claude Code (Claude Opus 5.5) ran this on my machine, wrote the report and posted it for me.
DavidM1911 commented 2026-11-24 22:06:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T21:37:48Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7145182938 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1682#issuecomment-7145182938). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T21:37:48Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
MiharaxD commented 2026-11-24 22:06:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by MiharaxD on 2026-11-24T21:44:20Z.


Test report on an NVIDIA card, head c8a4266 (on main c160d86), which covers the "NVIDIA" line.

Tested

  • RTX 3070 Ti 8 GB (driver 621.01), Intel i5-14400F, 32 GB RAM, Windows 11 Pro 10.0.26300, Rust 1.100.0, DXC 1.9.2602.17.
  • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4 (debug) on c8a4266: 859 passed, 0 failed, 42 ignored (lib tests 810 / 0 / 22).
  • SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask (no wave64), gpu_wave32_program_in_wave64_hardware (no wave64).
  • an_exe_loaded_as_a_library_does_not_run_its_entry_point passes.

Regression run
scripts/smoke.ps1 -Game <game folder> -Seconds 60 (release builds, start screen, no input). main is c160d86:

main:

xcl-smoke v1
commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0
gpu: NVIDIA GeForce RTX 3070 Ti
title: game
seconds: 60
exit: 0x0
frames shown: 1586 (PresentX 1586)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15055 MB

this PR's head:

xcl-smoke v1
commit: c8a426675198493f21015fcd06567ff61a7847d6
gpu: NVIDIA GeForce RTX 3070 Ti
title: game
seconds: 60
exit: 0x0
frames shown: 1602 (PresentX 1602)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15420 MB

Not tested

  • A title that loads an executable as a library: the smoke run is a regression check only.
  • AMD / Intel, gameplay past the start screen.

AI use: Claude Code (Claude Opus 5.5) built the PR, ran the tests and both smoke runs, read the logs and wrote this report; I checked it before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7145323320 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1682#issuecomment-7145323320). Originally posted by [MiharaxD](https://github.com/MiharaxD) on 2026-11-24T21:44:20Z. --- Test report on an NVIDIA card, head `c8a4266` (on `main` `c160d86`), which covers the "NVIDIA" line. **Tested** - RTX 3070 Ti 8 GB (driver 621.01), Intel i5-14400F, 32 GB RAM, Windows 11 Pro 10.0.26300, Rust 1.100.0, DXC 1.9.2602.17. - `cargo build --workspace`, then `cargo test --workspace --no-fail-fast -- --test-threads=4` (debug) on `c8a4266`: **859 passed, 0 failed, 42 ignored** (lib tests 810 / 0 / 22). - SKIPPED: `gpu_geometry_wave32_prefix_count_over_a_mask` (no wave64), `gpu_wave32_program_in_wave64_hardware` (no wave64). - `an_exe_loaded_as_a_library_does_not_run_its_entry_point` passes. **Regression run** `scripts/smoke.ps1 -Game <game folder> -Seconds 60` (release builds, start screen, no input). `main` is `c160d86`: main: ``` xcl-smoke v1 commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0 gpu: NVIDIA GeForce RTX 3070 Ti title: game seconds: 60 exit: 0x0 frames shown: 1586 (PresentX 1586) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15055 MB ``` this PR's head: ``` xcl-smoke v1 commit: c8a426675198493f21015fcd06567ff61a7847d6 gpu: NVIDIA GeForce RTX 3070 Ti title: game seconds: 60 exit: 0x0 frames shown: 1602 (PresentX 1602) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15420 MB ``` **Not tested** - A title that loads an executable as a library: the smoke run is a regression check only. - AMD / Intel, gameplay past the start screen. **AI use:** Claude Code (Claude Opus 5.5) built the PR, ran the tests and both smoke runs, read the logs and wrote this report; I checked it before posting.
Decodere commented 2026-11-27 13:38:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T13:38:49Z.


Independent desktop NVIDIA verification of PR #1682 at head c8a426675198493f21015fcd06567ff61a7847d6 (1 commit; exact parent & merge-base: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0, pre-#2555 ancestor of main).

Environment

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12, Wave32-only Ada), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6C / 12T), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200 (Developer Mode off)
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC, DXC 1.9.2609.5, --release

Targeted tests & build (c8a42667)

Command Result
cargo test --release -p xcl --lib -- --nocapture an_exe_loaded_as_a_library_does_not_run_its_entry_point (3 consecutive runs) 1 passed; 0 failed; 0 ignored; 831 filtered out × 3 (0.00s, 0.00s, 0.00s, 0 skipped)
cargo test --release -p xcl --lib -- --nocapture loader:: (3 consecutive runs) 3 passed; 0 failed; 0 ignored; 829 filtered out × 3 (0.00s, 0.00s, 0.00s, 0 skipped)
cargo build --release -p xcl Clean build (1m 23s, exit 0, 0 new warnings in loader.rs)

Paired quiet 60 s retail smoke (title: 29640639)

(Note: scripts/smoke.ps1 at c160d86e predates 9683e7a6 and printed the local folder basename on title:; replaced below with the standard 9683e7a6 title hash 29640639, with all measured fields verbatim.)

Exact parent & merge-base (c160d86ef2efe3a07e4dfb473e4fa72eafb413c0, cached baseline on the same machine):

xcl-smoke v1
commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1533 (PresentX 1533)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14721 MB

PR #1682 (c8a426675198493f21015fcd06567ff61a7847d6):

xcl-smoke v1
commit: c8a426675198493f21015fcd06567ff61a7847d6
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1560 (PresentX 1560)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14703 MB

Limits of coverage

  • an_exe_loaded_as_a_library_does_not_run_its_entry_point and the full loader:: suite (3/3, 0 skipped) passed 3/3, directly verifying that init_dll skips calling the entry point when m.is_dll is false (so loading a non-DLL executable as a library maps cleanly without executing entry_rva as DllMain) while preserving DLL DllMain behavior.
  • The 60 s retail smoke confirms live PE loading and runtime stability (0 device removals, 0 crashes, steady 60 Hz) without testing a real title loading a secondary .exe via LoadLibrary; single-run frame/commit delta vs. the cached parent reflects normal startup variance.

AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).

<!-- greyfinch-sync:ivall/xcl:comment:7219756341 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1682#issuecomment-7219756341). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-27T13:38:49Z. --- Independent desktop NVIDIA verification of **PR #1682** at head `c8a426675198493f21015fcd06567ff61a7847d6` (`1` commit; exact parent & merge-base: `c160d86ef2efe3a07e4dfb473e4fa72eafb413c0`, pre-`#2555` ancestor of `main`). ### Environment - **GPU:** NVIDIA GeForce RTX 4060 (8 GB / `7956 MiB` reported by D3D12, Wave32-only Ada), driver `32.0.16.2114` (NVIDIA `621.14`, WDDM 3.2) - **CPU / RAM / OS:** Intel Core i5-11400F (6C / 12T), 32 GB RAM (`31.9 GiB` usable), Windows 11 Home `26200` (Developer Mode off) - **Toolchain:** `rustc 1.100.0 (0ef1bc386 2026-11-09)` MSVC, DXC `1.9.2609.5`, `--release` ### Targeted tests & build (`c8a42667`) | Command | Result | | --- | --- | | `cargo test --release -p xcl --lib -- --nocapture an_exe_loaded_as_a_library_does_not_run_its_entry_point` (3 consecutive runs) | `1 passed; 0 failed; 0 ignored; 831 filtered out` × 3 (`0.00s`, `0.00s`, `0.00s`, `0` skipped) | | `cargo test --release -p xcl --lib -- --nocapture loader::` (3 consecutive runs) | `3 passed; 0 failed; 0 ignored; 829 filtered out` × 3 (`0.00s`, `0.00s`, `0.00s`, `0` skipped) | | `cargo build --release -p xcl` | Clean build (`1m 23s`, exit `0`, `0` new warnings in `loader.rs`) | ### Paired quiet 60 s retail smoke (`title: 29640639`) *(Note: `scripts/smoke.ps1` at `c160d86e` predates `9683e7a6` and printed the local folder basename on `title:`; replaced below with the standard `9683e7a6` title hash `29640639`, with all measured fields verbatim.)* Exact parent & merge-base (`c160d86ef2efe3a07e4dfb473e4fa72eafb413c0`, cached baseline on the same machine): ``` xcl-smoke v1 commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1533 (PresentX 1533) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14721 MB ``` PR #1682 (`c8a426675198493f21015fcd06567ff61a7847d6`): ``` xcl-smoke v1 commit: c8a426675198493f21015fcd06567ff61a7847d6 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1560 (PresentX 1560) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14703 MB ``` ### Limits of coverage - `an_exe_loaded_as_a_library_does_not_run_its_entry_point` and the full `loader::` suite (`3/3`, `0` skipped) passed `3/3`, directly verifying that `init_dll` skips calling the entry point when `m.is_dll` is false (so loading a non-DLL executable as a library maps cleanly without executing `entry_rva` as `DllMain`) while preserving DLL `DllMain` behavior. - The 60 s retail smoke confirms live PE loading and runtime stability (`0` device removals, `0` crashes, steady 60 Hz) without testing a real title loading a secondary `.exe` via `LoadLibrary`; single-run frame/commit delta vs. the cached parent reflects normal startup variance. *AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).*
throny commented 2026-11-28 14:12:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-28T14:12:39Z.


merge-check claim
head: c8a4266751

<!-- greyfinch-sync:ivall/xcl:comment:7240500137 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1682#issuecomment-7240500137). Originally posted by [throny](https://github.com/throny) on 2026-11-28T14:12:39Z. --- merge-check claim head: c8a426675198493f21015fcd06567ff61a7847d6
throny commented 2026-11-28 14:26:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-28T14:26:30Z.


merge-check
base: b937fbab
head: c8a4266751
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2141 passed, 1 failed, 48 ignored (26 SKIPPED lines). The one failure is gpu::dxil::msaa_tests::direct_msaa_loads_precede_get_dimensions, which fails on main without this PR too (reported on #3093) and in every tree of this batch; the nine failures main had since #2959 are gone at b937fbab. I did not run b937fbab alone: the last base-only run is e13d6250 (2130 passed, 10 failed, 48 ignored).
review: none blocking. Before, the entry point of any loaded image was called as a DllMain, so an executable loaded as a library ran its startup routine with DllMain arguments and a return of 0 failed the load; now such an image is mapped and its entry point is not run. The flag is the right one (the DLL bit of the file header), thread attach and detach already check it, and the changed function has one caller. Minor, not fixed: TLS callbacks still run and imports are still resolved for such an executable, which Windows does not do in that mode.
performance: none.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

<!-- greyfinch-sync:ivall/xcl:comment:7240672160 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1682#issuecomment-7240672160). Originally posted by [throny](https://github.com/throny) on 2026-11-28T14:26:30Z. --- merge-check base: b937fbab head: c8a426675198493f21015fcd06567ff61a7847d6 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2141 passed, 1 failed, 48 ignored (26 SKIPPED lines). The one failure is gpu::dxil::msaa_tests::direct_msaa_loads_precede_get_dimensions, which fails on main without this PR too (reported on #3093) and in every tree of this batch; the nine failures main had since #2959 are gone at b937fbab. I did not run b937fbab alone: the last base-only run is e13d6250 (2130 passed, 10 failed, 48 ignored). review: none blocking. Before, the entry point of any loaded image was called as a DllMain, so an executable loaded as a library ran its startup routine with DllMain arguments and a return of 0 failed the load; now such an image is mapped and its entry point is not run. The flag is the right one (the DLL bit of the file header), thread attach and detach already check it, and the changed function has one caller. Minor, not fixed: TLS callbacks still run and imports are still resolved for such an executable, which Windows does not do in that mode. performance: none. verdict: safe to merge hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
fromthemoonx commented 2026-11-30 01:11:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-30T01:11:53Z.


merge-check
base: 53e85fb124
head: c8a4266751
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2792 passed, 2 failed, 49 ignored; SKIPPED: 28 (mostly "no wave64"); failing: hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline fails on the base 53e85fb alone too (#2369's test against late_release, see #2369); hle::d3d12x::list_x::tests::mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares hit E_OUTOFMEMORY (0x8007000E) in the parallel run and passes 3/3 alone on both trees. Neither is from this PR.
review: none blocking, after reading the whole diff (loader.rs). init_dll is called only from load_game_dll (the title's LoadLibrary), so the title's own executable is not affected, and an EXE loaded as a library still runs its TLS callbacks. The new test passes 3/3; with the m.is_dll condition removed (scratch) it fails with "DllMain(xcl_exe_as_library.exe) returned FALSE". Side note, from before this PR and not blocking: tls_install treats every !is_dll image as the title's executable and tries take_slot_zero, so an EXE loaded as a library would also try to take TLS slot 0. Also seen once: in my first suite run, e2e::incomplete_discovered_corpus_blocks_headless_title_entry hung, with its xcl child spinning for 40 minutes. Afterwards it passed 3/3 alone on this merge and on main, and the whole e2e binary passed 5/5 on both, so I count it as a one-off rather than this PR.
performance: none (one more condition at library load).
verdict: safe to merge
hardware / tool and model: RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug / Claude Code (Claude Opus 5.5)

<!-- greyfinch-sync:ivall/xcl:comment:7265927849 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1682#issuecomment-7265927849). Originally posted by [fromthemoonx](https://github.com/fromthemoonx) on 2026-11-30T01:11:53Z. --- merge-check base: 53e85fb124eae624641e9884517e4f3c4a7d8794 head: c8a426675198493f21015fcd06567ff61a7847d6 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2792 passed, 2 failed, 49 ignored; SKIPPED: 28 (mostly "no wave64"); failing: `hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline` fails on the base `53e85fb` alone too (#2369's test against `late_release`, see #2369); `hle::d3d12x::list_x::tests::mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares` hit E_OUTOFMEMORY (0x8007000E) in the parallel run and passes 3/3 alone on both trees. Neither is from this PR. review: none blocking, after reading the whole diff (`loader.rs`). `init_dll` is called only from `load_game_dll` (the title's `LoadLibrary`), so the title's own executable is not affected, and an EXE loaded as a library still runs its TLS callbacks. The new test passes 3/3; with the `m.is_dll` condition removed (scratch) it fails with "DllMain(xcl_exe_as_library.exe) returned FALSE". Side note, from before this PR and not blocking: `tls_install` treats every `!is_dll` image as the title's executable and tries `take_slot_zero`, so an EXE loaded as a library would also try to take TLS slot 0. Also seen once: in my first suite run, `e2e::incomplete_discovered_corpus_blocks_headless_title_entry` hung, with its `xcl` child spinning for 40 minutes. Afterwards it passed 3/3 alone on this merge and on `main`, and the whole `e2e` binary passed 5/5 on both, so I count it as a one-off rather than this PR. performance: none (one more condition at library load). verdict: safe to merge hardware / tool and model: RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug / Claude Code (Claude Opus 5.5)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1672
No description provided.