[fpc-devel] MIPS big-endian program starts but does nothing

Mark Morgan Lloyd markMLl.fpc-devel at telemetry.co.uk
Tue Sep 9 13:14:09 CEST 2014


Marco van de Voort wrote:
> In our previous episode, Mark Morgan Lloyd said:
>>> In addition, what is the supposed difference between an "empty program"
>>> and program "built with only minimal RTL initialisation"?
>> I don't see why something like this
>>
>> program test;
>> begin
>> end.
>>
>> should use anything other than the absolute minimum that's needed to 
>> terminate in good order. 
> 
> Well, first you must realize that that program is equal to 
> 
> program test;
> Uses System;
> begin
>   FPC_INITIALIZEUNITS;
>   // nothing
>   FPC_FINALIZEUNITS;
> end.
> 
> The FPC_* routines walk tables  and call the all units' initialization
> and finalization sections. In this case System's.
> 
> Your observation reduces to letting the compiler figuring out that in the
> system unit initialization the FPU Initialization can be safely skipped, and
> that possible state (like the FPU control word) is not important.
> 
> This is nearly impossible.

In fairness, my original question was "Could a completely empty program 
be recognised by the compiler etc. as a special case". So what you're 
saying- entirely fairly- is that because of the "Uses System" the 
problem is probably intractable.

But could the "Uses system" be omitted or replaced by a simpler stub if 
the program was recognised to be trivial?

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-devel mailing list