Skip to content

coff split: let splits.txt mark units the linker writes - #13

Merged
handsomematt merged 2 commits into
coff_prototypefrom
linker-units
Oct 11, 2026
Merged

handsomematt merged 2 commits into
coff_prototypefrom
linker-units

Conversation

@handsomematt

Copy link
Copy Markdown
Member

A unit marked linker in splits.txt covers a region the linker emits itself (an import or export table, a debug directory). bw1-decomp used to hold these back by naming dtk's address-derived auto_… units in its configure.py; now splits.txt says so directly.

linker/imports: linker
	.idata$2    start:0x10033260 end:0x100332EC
	...
  • The split still writes the unit's object (the original's bytes, for comparison), but objs.rsp leaves it out of the link.
  • The build config marks it "linker": true and lists the image ranges its sections cover.
  • The gap after a linker unit no longer inherits its sub-section name (.idata$5); what follows belongs to the parent section. Other carry-forwards (.text$x, .CRT$XTZ tail padding) are unchanged.
  • A module with generate_imports / generate_exports fails the split if an .idata/.edata split is outside a linker unit, rather than linking the original table a second time.
  • The attribute is written back when dtk rewrites splits.txt.

Verified on bw1-decomp BW1W120 (branch linker-units): all 15 hashes match, and link order and every other unit name are identical to v0.0.35. cargo test passes, with a new parser test.

🤖 Generated with Claude Code

A unit marked `linker` in splits.txt covers a region the linker emits
itself (an import or export table, a debug directory). The split still
writes its object, from the original's bytes, but:

- objs.rsp leaves it out of the link;
- the build config marks it `linker: true` and lists the image ranges its
  sections cover, so a build system can hold it back and compare the
  linked image against the original there;
- the gap after it doesn't inherit its sub-section name: what follows
  belongs to the parent section, not to the table;
- a module with generate_imports or generate_exports fails the split if
  any `.idata`/`.edata` split is outside a `linker` unit, instead of
  linking the original table a second time.

The attribute is written back on split.
@handsomematt
handsomematt merged commit 4a75162 into coff_prototype Oct 11, 2026
30 checks passed
@handsomematt
handsomematt deleted the linker-units branch October 11, 2026 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant