Repository navigation
Conversation
…ions Table::Table stored every entry with table()[dll!name] = fn, so a second table serving a name already registered replaced the first silently, in static-initialization order across translation units. ItsNotRexed#7009 and ItsNotRexed#6981 serve the same 10 xapu.dll/chad.dll exports; built together they link cleanly and the game would get whichever table happened to be later. The later entry is still served (no behaviour change), but the collision is now logged once at startup and listed by conflicting_registrations(). shim_table_conflict covers the rule with two synthetic tables, and shim_tables_unique runs gta6rt with no arguments and fails if its own shim set has any collision (main has none). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
devnull34
left a comment
There was a problem hiding this comment.
Verified: builds cleanly and passes both shim_table_conflict and shim_tables_unique tests. Detecting conflicting shim registrations at startup prevents silent link-order dependent function overrides across tables.
|
Independent Windows A/B on
This confirms a second real overlap that the diagnostic catches, alongside the XAPU/CHAD pair in the PR description. Windows 11 build 26300, LLVM-MinGW Clang 23.1.6, CPU-only synthetic calls. No game files. AI-assisted testing (Codex). |
|
Update on why this matters now, measured on the current heads of the three open audio-shim PRs (none merged yet,
The boot thread chose #6885 + #6981 over #7009, but #7009 is still open and was updated after that, so if it lands together with either of the others, 19 exports would be served by whichever table happens to be constructed later, with no message today. With this PR the same build logs each of them and AI-assisted (Claude Code). agent: yes |
Claimed in the coordination issue as: #7231 (comment) (new runtime item, no ID in the tables)
Depends on: none. It reads and writes the map only through
table(), so it composes with #7175 (RT-488), which changestable()'s storage but notTable::Table.What and why
Table::Tableinruntime/shims/registry.cppstored every entry withtable()[dll!name] = fn. A second shim table that serves a name already registered replaced the first silently, and which table runs later is static-initialization order across translation units, which nothing controls.This already happens with two open PRs: #7009 (
xapu.cpp,chad.cpp) and #6981 (xapu_chad.cpp) serve the same 10xapu.dll/chad.dllexports. Built together they compile and link cleanly, and all 10 entries are replaced with no message (measurement). The game would get whichever implementation happened to be constructed later.Now:
[rt] shims: <dll>!<name> is registered by two shim tables with different functions; the later one is served) and listed by the newrt::shims::conflicting_registrations().Tests:
shim_table_conflict(new executable): two synthetic tables in one file. It checks that only the name with a different function is listed, the later table's function is served, a shared function is not listed, and a name in one table is untouched.shim_tables_unique(CTest ongta6rt): runsgta6rtwith no arguments, after every shim table has been constructed, and fails on the collision message. It follows thePASS_REGULAR_EXPRESSION "usage: gta6rt"pattern ofgta6rt_rejects_*.mainhas no collision today, so the test requires zero.Tested
Windows 11 26H2 (26300), MSVC 19.44.35229 (v143) + Ninja, RelWithDebInfo, RTX 3060 (driver 617.14).
7c9e25a84, onmain86d1c862d):shim_table_conflictandshim_tables_uniquepass.gta6rtre-registeringkernel32.dll!ExitProcesswith another function makesshim_tables_uniquefail withkernel32.dll!ExitProcess is registered by two shim tables .... The probe file was removed and is not in this PR.main849d3709bvs this change on it: 257 vs 259 tests, the same two failures on both (d3d12_vulkan_device,d3d12_indirect_dispatch_count, both GPU tests, unrelated), and the same 11 skipped and 1 disabled. No build step failed.xapu_chad.cppadded to runtime: serve chad, xapu, xg_xs and AcpHal console audio/DSP/texture imports (RT-5 follow-up) #7009'sgta6rt, the same logging reports the 10 collisions above.AI-assisted: yes (Claude Code)
Checklist
docs/design.md, with how it was confirmed. (n/a: runtime only)🤖 Generated with Claude Code