Skip to content

Expose spimdisasm pad creation options#540

Merged
ethteck merged 4 commits into
ethteck:mainfrom
andresj-sanchez:expose-spimdisasm-pad-options
Jun 2, 2026
Merged

Expose spimdisasm pad creation options#540
ethteck merged 4 commits into
ethteck:mainfrom
andresj-sanchez:expose-spimdisasm-pad-options

Conversation

@andresj-sanchez
Copy link
Copy Markdown
Contributor

Summary

  • Add config options for controlling Spimdisasm autogenerated data, rodata, and BSS/SBSS pad symbols.
  • Map the new options to Spimdisasm GlobalConfig.
  • Document the new options in the configuration reference.

Thanks to @dreamingmoths and @Mc-muffin for the help.

Context

Spimdisasm exposes options for controlling autogenerated pad symbols:

CREATE_DATA_PADS
CREATE_RODATA_PADS
CREATE_BSS_PADS

This PR exposes those options through splat config as:

create_data_pads: false
create_rodata_pads: false
create_bss_pads: false

This lets projects control whether generated data, rodata, and BSS/SBSS output includes dummy unreferenced pad symbols.

For example, disabling BSS pad creation can fold gaps into the preceding BSS symbol instead of emitting an extra autogenerated pad label:

dlabel some_bss_symbol
 .space 0x08

Instead of:

dlabel some_bss_symbol
 .space 0x04

/* Automatically generated and unreferenced pad */
dlabel D_XXXXXXXX
 .space 0x04

Notes

Testing

  • Verified create_data_pads, create_rodata_pads, and create_bss_pads map to the corresponding Spimdisasm GlobalConfig values.
  • Ran PYTHONPATH=src python test.py.
  • Ran PYTHONPATH=src python test_n64_entrypoints.py.

Co-authored-by: dreamingmoths <252494949+dreamingmoths@users.noreply.github.com>
Co-authored-by: Mc-muffin <8714476+Mc-muffin@users.noreply.github.com>
@andresj-sanchez
Copy link
Copy Markdown
Contributor Author

Small correction to the BSS example in the PR description: the intended behavior is not to fold the padding into the previous BSS symbol's .space, since that makes tools like objdiff infer the symbol as larger. The companion Spimdisasm PR was updated to fix this.

Before, with the autogenerated pad label:

dlabel "m_tpcSingleton__27clsSingleton<11clsPfSystem>", weak
    /* 006E69B8 */ .space 0x04

/* Automatically generated and unreferenced pad */
dlabel D_006E69BC
    /* 006E69BC */ .space 0x04

Current behavior with create_bss_pads: false:

dlabel "m_tpcSingleton__27clsSingleton<11clsPfSystem>", weak
    /* 006E69B8 */ .space 0x04
enddlabel "m_tpcSingleton__27clsSingleton<11clsPfSystem>"
    /* 006E69BC */ .space 0x04

So the dummy D_006E69BC label is gone, but the real BSS symbol still keeps its declared 0x04 size.

@AngheloAlf
Copy link
Copy Markdown
Collaborator

Since this uses a feature from a newer spimdisasm version then you need to bump that version in a few places.
src/splat/disassembler/spimdisasm_disassembler.py, pyproject.toml, requirements.txt and a mention in changelog.md.

Would be also nice to mention the new changes in the changelog too

Co-authored-by: dreamingmoths <252494949+dreamingmoths@users.noreply.github.com>
Co-authored-by: Mc-muffin <8714476+Mc-muffin@users.noreply.github.com>
@andresj-sanchez
Copy link
Copy Markdown
Contributor Author

Done. I left the changelog entries under the current top section for now since I’m not sure whether this will be released as 0.40.2, 0.41.0, or something else. Happy to move them if there’s a preferred version section.

Comment thread CHANGELOG.md Outdated
Comment on lines +11 to +12
* Add options `create_data_pads`, `create_rodata_pads` and `create_bss_pads` for controlling spimdisasm autogenerated data, rodata, and BSS/SBSS pad symbols.
* `spimdisasm` 1.41.0 or above is now required.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should go above the current version, to avoid forgetting to move it while version bumping.
btw, this probably will be 0.41.0 since it adds new features/options

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. I moved the changelog entries to a new 0.41.0 section. Thanks!

@ethteck
Copy link
Copy Markdown
Owner

ethteck commented Jun 2, 2026

Thanks a bunch for the contribution to splat :)

@ethteck ethteck merged commit e27c1e0 into ethteck:main Jun 2, 2026
29 checks passed
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.

3 participants