[CDG5] MPW code mysteries

Max Poliakovski maximumspatium at googlemail.com
Sat Dec 29 06:26:42 AWST 2018


> No clue. I note that Apple’s entire point of putting that pointer to the
> TOC there is because ELF files don’t initialize the TOC for you. If you
> were to compile for XCOFF, you could just leave that code snippet out
> entirely.


Unfortunately no. Every object module has to define an entry point. If no
custom entry point was specified, PPCLink will link to "__start" from
StdCRuntime.o which, in turn, depends on InterfaceLib etc. In other words,
tons of code Trampoline doesn't need.

Trampoline's start code initializes the stack pointer as well. Stack area
is located in the BSS section and is 65536 bytes big. Referencing this
stack area in the assembly was easy.


> Maybe the TOC was put there by some late-stage tool that converts the
> XCOFF to ELF?
>

This is surely possible and easy doable. I'll reconsider this solution
later when writing a XCOFF->ELF converter...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ucc.gu.uwa.edu.au/pipermail/cdg5/attachments/20181228/0f9fea95/attachment.htm 


More information about the cdg5 mailing list