papermario
papermario copied to clipboard
Partial linking
Related to #438, since it should also fix that issue.
There is some evidence that overlays were linked by themselves, not together at the end. This evidence includes:
- Existence of dead references. If everything was linked at once, this would not be possible
- Requirement for the namespace macro
N
wherestatic
does not work. It can be presumed that the original developers did not do this
My proposal is that we Do As The Devs Did. I'm unsure if this is possible with GNU tooling (e.g. was it a Nintendo thing?) but we need to figure out how to:
- Link the core game together
- Link overlays (maps) against the core game as if it was a library, throwing away all but a select few 'public' symbols needed by core datastructures (e.g. MapConfig and the init function for maps)
- Produce an ELF at the end
Doing this would make bad references like #277 not compile, which is good.
May be able to partially achieve this with linker export maps:
{
global: mac_00_main;
local: ∗;
};
See https://github.com/pmret/papermario/pull/790#pullrequestreview-1123464917