Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Useful link-time lints #1506

Closed
3 tasks
ISSOtm opened this issue Sep 18, 2024 · 1 comment
Closed
3 tasks

Useful link-time lints #1506

ISSOtm opened this issue Sep 18, 2024 · 1 comment
Labels
enhancement Typically new features; lesser priority than bugs rgbasm This affects RGBASM rgblink This affects RGBLINK

Comments

@ISSOtm
Copy link
Member

ISSOtm commented Sep 18, 2024

These would be useful as opt-in link-time warnings:

  • For every control flow instruction (call, jp, jr, rst1) targeting a label in ROMX, emit a(n equivalent of) assert BANK(@) == 0 || BANK(<target>) == 0 || BANK(@) == BANK(<target>). Do this only if PC is in a ROMX section2, which also excludes LOAD.
  • For every jp, check for and suggest using jr instead if possible.
    • Possibly make this a multi-level lint, where by default cross-SECTION jumps are not checked?

Footnotes

  1. rst always targets ROM0, but if we add support for swappable ROM0, possibly via HDFs ([Feature request/proposal] Hardware layout description files (custom mapper support) #524), then this would be multi-banked.

  2. In theory, BANK(@) != 0 for ROMX, but -t maps ROMX to ROM0. The destination is then guaranteed to be in ROM0 as well, but that may not remain the case if we add some similar feature to HDFs, so a cheap stringent check is good for future-proofing.

@ISSOtm ISSOtm added enhancement Typically new features; lesser priority than bugs rgbasm This affects RGBASM rgblink This affects RGBLINK labels Sep 18, 2024
@Rangi42
Copy link
Contributor

Rangi42 commented Sep 18, 2024

This partly overlaps #1017. Edit: I've consolidated the two.

@Rangi42 Rangi42 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Typically new features; lesser priority than bugs rgbasm This affects RGBASM rgblink This affects RGBLINK
Projects
None yet
Development

No branches or pull requests

2 participants