Both files define _start symbol. Which one is actually used? Is it possible to use only ptr0.as(m)?
Mailing lists / fpc-pascal / 2008-11
si_prc.pp or prt0.as(m)?
8 messages · 3 people ·
- Lleledumbo 3
- MMarco van de Voort 3
- JJonas Maebe 2
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
In our previous episode, leledumbo said:
Both files define _start symbol. Which one is actually used? Is it possible to use only ptr0.as(m)?
This afaik depends on the OS. Linux uses si_pr*, and FreeBSD uses (c)prt0.as
OS X afaik has parts that are equivalent to stuff in si_pr* integrated in the main program.
Marco van de Voort wrote 7 lines
So it's integrated in the compiler (I mean, the compiler already knows which one to use depending on the target OS)? Is there any other way to change this other than tweaking the compiler?
In our previous episode, leledumbo said:
Show quoted text 9 lines
No. Though afaik only the names are set, and since (unlike with normal units) you can exchange these files without recompiling everything, except maybe for OS X/
I haven't really tested this for si_* though, but this has been done in the past that allowed to fix the same binary releases to generate FreeBSD 4 or 5 binaries, using the following scripts:
http://www.stack.nl/~marcov/fixfpc
http://www.stack.nl/~marcov/fixfpc19
http://www.stack.nl/~marcov/fixfpc2
As of 2.2, these scripts are no longer supported though, since more post 4 functionality has been integrated into the RTL.
Thanks, I'll follow http://wiki.freepascal.org/Porting_Free_Pascal these instructions instead.
Btw, what other documents do you have in stack.nl/~marcov? Is there any list for them? Some compiler related articles might be useful for me (I'm taking compiler techniques class, but it uses Java as implementation language with traditional intermediate code approach. FPC's unique design might give a new sight).
In our previous episode, leledumbo said: This afaik depends on the OS. Linux uses si_pr*,…
Marco van de Voort wroteOS X afaik has parts that are equivalent to stuff in si_pr* integrated in the main program.
No, Mac OS X uses the system-supplied crt1.o.
Jonas
In our previous episode, Jonas Maebe said:
Show quoted text 5 lines
I know, but the FPC specific stuff (the variables like operatingsystem_argc) moved to main?
Marco van de Voort wrote 9 lines
It's in the system unit (rtl/bsd/system.pp, procedure FPC_SYSTEMMAIN;
FPC_DARWIN_PASCALMAIN and are both always defined)The way it works is that crt1.o calls 'main', and the Pascal program simply contains a branch to FPC_SYSTEMMAIN as its main function (or as whatever you specify using -XM).
Jonas
