Skip to content

coff split: mark linker-written regions in Sections:, not as units - #14

Merged
handsomematt merged 1 commit into
coff_prototypefrom
linker-sections
Oct 12, 2026
Merged

handsomematt merged 1 commit into
coff_prototypefrom
linker-sections

Conversation

@handsomematt

Copy link
Copy Markdown
Member

Follow-up to #13, from review on openblack/bw1-decomp#449: the region is already declared in Sections:, so mark it there instead of adding a unit for it.

Sections:
	.idata$5     type:rodata vaddr:0x008A9000 end:0x008A99C0 linker
	.rdata$debug type:rodata vaddr:0x008A99C0 end:0x008A99DC linker
	.idata       type:data align:4096 linker

What dtk does with a linker section or sub-region:

  • carves it into its own autogenerated unit, named after the region (linker/idata_5, linker/rdata_debug, linker/edata);
  • marks that unit linker as before: objs.rsp leaves it out, and the build config lists its ranges;
  • doesn't split it on duplicate, comdat or alignment symbols, since the linker writes it whole.

Errors: the split fails if a splits.txt unit claims part of a linker region, or if generate_imports/generate_exports is on and an .idata/.edata split isn't in one.

Breaking change: the unit-level linker attribute from 0.0.36 is removed. Only the unmerged bw1-decomp#449 used it.

Verified on bw1-decomp BW1W120:

  • 15/15 hashes match;
  • every module's non-linker unit order is identical to 0.0.36;
  • all 26 linker units are 100% complete.

cargo test passes and clippy reports nothing new.

🤖 Generated with Claude Code

Instead of a `linker` attribute on a splits.txt unit, a section or
sub-region in the `Sections:` group takes a bare `linker` flag:

	.idata$5    type:rodata vaddr:0x008A9000 end:0x008A99C0 linker

dtk carves each `linker` region into its own autogenerated unit, named
after the region (`linker/idata_5`, `linker/edata`), and marks that unit
`linker` as before: objs.rsp leaves it out and the build config lists
its ranges. The gap fill no longer splits a linker region on its symbols,
since the linker writes it whole.

The split fails if a splits.txt unit claims part of a `linker` region,
or if generate_imports/generate_exports is on and an `.idata`/`.edata`
split isn't in one.

The unit-level `linker` attribute from 0.0.36 is gone.
@handsomematt
handsomematt merged commit ffc053e into coff_prototype Oct 12, 2026
30 checks passed
@handsomematt
handsomematt deleted the linker-sections branch October 12, 2026 07:23
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