[fpc-devel] fpc-2.0.0 generating SYSV .o files on FreeBSD

Marco van de Voort marcov at stack.nl
Thu Oct 20 22:51:14 CEST 2005

> I'm having problems with fpc on FreeBSD and would to know if you
> have seen this.
> My intention is compile a delphi project to generate a library (.so)
> file to use inside firebird database. But I always have problems,
> the .so file is generated aparently correctly, like you can see here:
> libgalleudf2.so: ELF 32-bit LSB shared object, Intel 80386, version 1
> (FreeBSD), stripped
> But, the .o files is generated as SYSV instead FreeBSD, look:
> galleudf2.o:      ELF 32-bit LSB relocatable, Intel 80386, version 1
> (SYSV), not stripped
> u_conjunto.o:     ELF 32-bit LSB relocatable, Intel 80386, version 1
> (SYSV), not stripped
> Have you ever seen something like this? Or have any idea how to fix
> this?

I suspect the FPC runtime is not initialised. Currently, the ways to link
FPC code into foreign programs (IOW with non FPC implementing the main
program and calling the linker) are not fully explored yet, contrary
to the opposite way.

Probably need a call to FPC_INITIALIZE somewhere. Tips that could lead you
to the solution:
- compare FPC startupcode (cprt0.as) to glibc (/usr/crt0.o) startupcode,
	and make sure the differences are also done for the .so
- compile a hello world FPC program that "uses cmem" (and thus uses glibc),
	and check the main program for library initializing calls.

More information about the fpc-devel mailing list