Comments (14)
This would certainly reduce a lot of ROM bloat, such as in Pokemon Crystal EN-US.
from rgbds.
I'm not sure if this would be possible in all cases. Example:
SECTION "A", ROMX[$4000], BANK[1]
LABEL_A:
SECTION "B", ROMX[$4000], BANK[2]
LABEL_B:
SECTION "C", ROMX[$4000], BANK[3]
LABEL_C:
SECTION "D", ROMX[$4000], BANK[4]
LABEL_D:
SECTION "Code", ROM0
Function: ; a = Bank to read from
ld [$2000],a
ld a,[LABEL_A]
ret
But maybe for floating sections...
from rgbds.
Such sections could be specially marked as "preserve", couldn't they?
from rgbds.
Is there an IRC channel?
from rgbds.
#gbdev on EFNet, or the GBDev Discord server, why?
from rgbds.
from rgbds.
toxa on gbdev Discord reports that dropping unused sections (those not reachable from -s entry_label
) still isn't implemented in ISSOtm's rewritten linker.
from rgbds.
I'm pretty sure it isn't a priority right now.
from rgbds.
This is not possible in general for non-floating sections, as AntonioND mentioned. People sometimes do write code that uses raw hex values for banks or addresses when they know what code/data to expect at those locations, so just looking at which labels are referenced wouldn't catch that.
There's also a case in pokecrystal where two data tables (for mon pics and Unown pics) are both org
ed to the same address in different banks, and only one label gets loaded into hl
, but either table may be needed depending on which bank it switches to. And more generally, tricks like "I know hl == $4200
right now, so let's inc h
to read the content I know is at $4300
, which may not be referenced or labeled at all."
Perhaps floating sections could opt in to being left out if not referenced, like SECTION "Library Function Foo", ROMX, OPTIONAL
, but even then the linker should print a notification if it gets omitted. (And any reference should count, whether it's ld hl, FunctionFoo
or ld b, BANK("Library Function Foo")
or dw FunctionFoo + 42
.)
from rgbds.
We could assign -s -
(or something like that) to mean treat every non-floating section as an entry label.
from rgbds.
Enabling a feature like this by default is downright insane; I don't think anyone was even proposing this. It's pretty clear something like this should only be enabled by a flag. Isn't there already a flag for this purpose (that perhaps doesn't work very well)?
from rgbds.
@Rangi42 labels like those are trivial to reference with an assert
, and in fact that's a good idea anyway. (Adding assert(PokemonPicPointers == UnownPicPointers)
or whatever the labels are to pokecrystal would probably be a smart call.)
That being said, assemblers/linkers automatically discarding code and data from assembly input by default is still insanity, and I don't think anyone would want that to be the default.
from rgbds.
@aaaaaa123456789 True, an assert
would be ideal there (it falls under pret/pokecrystal#706), but the code is valid without one, and a "smart linker" should not break it.
It seems to me that since this would be a section-based feature, putting OPTIONAL
instead of BANK[$XX]
at the SECTION
declaration would be a convenient method, since it relies on the developer to be explicit that they're not relying on the section. Rather than a -s
linker flag that has to judge for all the sections (or at least for the floating ones).
from rgbds.
Maybe another section "kind", like we have SECTION UNION
and SECTION FRAGMENT
already?
from rgbds.
Related Issues (20)
- `-Wtruncation=1` warns on -$100, -$10000, etc.
- Feature request: RGBGFX auto-named output to a different directory than input HOT 2
- Rename the RGBGFX `--output-*` options to `--auto-*` HOT 5
- Allow RGBGFX to output SNES attribute maps HOT 2
- [Feature request] Allow negative alignment offsets HOT 2
- [Feature request] `rgbgfx -r` should encode the reverse image appropriately HOT 2
- Rewrite the linkerscript parser to use Bison HOT 1
- Add generic Linux x86_64 binaries to old releases HOT 6
- Abbreviate `s.begin(), s.end()` with a `RANGE(x)` macro
- Warn or error if linker script `ALIGN` is out of range
- Allow specifying align offsets in a linker script
- Add tests to improve RGBLINK code coverage
- Warning/error function refactoring HOT 2
- Update dates in man pages
- Segfault in RGBGFX given a transparent+3-color PNG HOT 1
- `ALIGN 16` inconsistently works or breaks
- Declared version can be affected by another Git repository HOT 1
- The "rgbds-0.7.0.tar.gz" identifies itself as v0.6.1 HOT 1
- why can't charmaps be 16-bit HOT 5
- Why canβt use newer 7.0version in nix HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rgbds.