papermario icon indicating copy to clipboard operation
papermario copied to clipboard

Partial linking

Open bates64 opened this issue 3 years ago • 3 comments

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 where static 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.

bates64 avatar Sep 26 '21 12:09 bates64

May be able to partially achieve this with linker export maps:

{
global: mac_00_main;
local: ∗;
};

bates64 avatar Jun 08 '22 00:06 bates64

See https://github.com/pmret/papermario/pull/790#pullrequestreview-1123464917

bates64 avatar Sep 28 '22 10:09 bates64