[fpc-devel]compiling on openbsd 3.5

Marco van de Voort marcov at stack.nl
Sun Jun 6 14:28:46 CEST 2004

> >
> > I can still assist, but I'm not going to do the bulk of the work anymore,
> > I simply don't have the time.
> All I use is openbsd, if you can give some help over the prt0 problem, I  
> can certainly send you any openbsd fixes...
> The amount of fixing needed for 1.9.x/2.0 doesn't seem that heavy (except  
> for the prt0..)

The basic idea is:


- compile the original crt<x>.c code that comes with the OS.
- move the argc, argv and environ variables to Pascal space
	(1.0.x SYSBSD$identifier, 1.9.x: SYSTEM$identifier)
- remove all libc initialisation and finalisation code.
- copy the initcode of the coprocessor (the fstcw code)
- Remove the pushes of parameter before main, replace it with
	a xorl %ebp,%ebp
- Change the name of main (IIRC 1.9.x: PASCALMAIN (capitals), 
	older: main)
- copy the code to exit the program (a syscall to exit in asm,
	load the program exitcode from pascal space)
- Sometimes one has to add ELF identifiers too.

cprt0.as: (prt0.as for shared linking to libc programs)

Pretty much the same, except that removing the libc init/finalisation
stuff is not necessary. 

More information about the fpc-devel mailing list