[fpc-devel] shared libraries on x86_64 Linux ?

Dominique Leducq dleducq at magellan-ing.fr
Tue May 23 12:20:18 CEST 2006


On Tue, 23 May 2006 08:29:00 +0200
Dominique Leducq <dleducq at magellan-ing.fr> wrote:

> Well, I already tried that with 2.0.2 : make rtl "OPT=-Cg" (is that right ?), but it didn't work (yes, I checked that the right system unit was used by the linker)
> I will try again with 2.1.1

So it works with 2.1.1 when recompiling the RTL with -Cg.

Now when I try to link the resulting library with a C program, I encounter symbol definition problems :

$ gcc -o test2 test2.o -L. -lsoTest3 
./libsoTest3.so: undefined reference to `__stkptr'
./libsoTest3.so: undefined reference to `_haltproc'
./libsoTest3.so: undefined reference to `operatingsystem_parameter_argc'
./libsoTest3.so: undefined reference to `operatingsystem_parameter_argv'
collect2: ld returned 1 exit status

where libsoTest3.so is the shared library built with Free Pascal

I found that this symbols are defined in the loaders ({c,g,}prt0.o), but when I link with those, i get :

$ LC_ALL=C gcc -o test2 test2.o gprt0.o -L. -lsoTest3 
gprt0.o: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/lib/gcc/x86_64-linux-gnu/4.0.3/../../../../lib64/crt1.o:../sysdeps/x86_64/elf/start.S:65: first defined here
gprt0.o: In function `data_start':
(.data+0x0): multiple definition of `__data_start'
/usr/lib/gcc/x86_64-linux-gnu/4.0.3/../../../../lib64/crt1.o:(.data+0x0): first defined here
collect2: ld returned 1 exit status

How may I avoid this symbol conflict ?

Thanks,

Dominique Leducq




More information about the fpc-devel mailing list