[fpc-devel] elf load order

Andrew Haines AndrewD207 at aol.com
Fri Mar 16 21:37:35 CET 2012


On 03/16/12 15:27, Sven Barth wrote:
> On 16.03.2012 19:16, Andrew Haines wrote:
>> Hi,
>>
>> I'm trying to figure out the order of events when an elf file is
>> executed.
>>
>> I think that the _start symbol just points to the start of the .text
>> section and crt1 is first followed by crti followed by crtbegin. After
>> that I'm not sure.

> Take a look at e.g. $fpcdir/rtl/linux/i386/prt0.as. This contains the
> startup (and shutdown) code for Free Pascal executables on linux-i386
> that don't use libc. You'll see the call to PASCALMAIN there as well as
> the halt code after it (which is executed once PASCALMAIN returns).
> 
Thanks that is helpful. PASCALMAIN is the begin end block at the end of
the system unit? Or is it the begin end block in the program.pas file?

libxenon, which I am linking to, uses newlib.

Regards,

Andrew



More information about the fpc-devel mailing list