This is a follow-up to D43264, or maybe Sam could take this apply and merge into D43264?
This is a follow-on from the discussion in that issue.
I've tried to separate out InputGlobal from InputChunk, so that it doesn't derive from it (since InputChunk has relocations, but InputGlobal doesn't). This change ripples out and impacts the rest of the code a bit.
Rejected alternative:
InputGlobal (not derived from anything, this duplicates/complicates too much code) InputChunk -> InputFunction -> InputSegment
What I've done here:
InputChunk -> InputSection - new class, all the relocation stuff and section offsets moved from InputChunk to here -> InputFunction -> InputSegment -> InputGlobal
As part of that, I had a re-jigg of the handling of the function/global signature on the FunctionSymbol/GlobalSymbol objects, and discovered a bug! The current handling of undefined function signatures is wrong, oops, as evidenced by the fact that one of tests provides __cxa_at_exit with the wrong signature, yet the test passes. I discovered this when my refactoring broke the test, and then I realised I'd accidentally fixed a bug.
Other small fixes, while I was at it (should surely be rolled into D43264):
- Fixed MarkLive to log the InputGlobals that are discarded
- Fixed Symbol::hasOutputIndex for globals
- Added missing DefinedGlobal::classof! Yikes.