<snip>
On Linux (I guess)
gpc --automake -shared -Wl,-soname=/usr/local/lib/mylib.so -o
mylib.so mylib.pas
<snip>
Thanks a lot for the hints; this works on my Linux box I use for development. But my target platform is SPARC Solaris 10. When I put -shared on the gpc command-line, the linker complains about all symbols of libgpc.a.
<gnu-pascal> gpc -v --automake -shared -o module1.so module1.pas Reading specs from /usr/local/lib/gcc/sparc-sun-solaris2.10/3.4.4/specs Configured with: ../gcc-3.4.4/configure --enable-languages=pascal Thread model: posix gpc version 20051116, based on gcc-3.4.4 /usr/local/libexec/gcc/sparc-sun-solaris2.10/3.4.4/gpc1 -quiet -v module1.pas -quiet -dumpbase module1.pas -mcpu=v7 -auxbase module1 -famtmpfile=/var/tmp//ccTaVS8M.gpa -fautomake -version -o /var/tmp//cc2gQmmp.s GNU Pascal version 20051116, based on gcc-3.4.4 (sparc-sun-solaris2.10) compiled by GNU C version 3.4.6. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU Pascal Compiler PreProcessor version 20051116, based on gcc-3.4.4
/usr/ccs/bin/as -V -Qy -s -xarch=v8 -o /var/tmp//ccN8lK2a.o /var/tmp//cc2gQmmp.s /usr/ccs/bin/as: Sun Compiler Common 10 Patch 05/06/2005 /usr/local/libexec/gcc/sparc-sun-solaris2.10/3.4.4/collect2 -V -G -dy -z text -Y P,/usr/ccs/lib:/usr/lib -Qy -o module1.so /usr/local/lib/gcc/sparc-sun-solaris2.10/3.4.4/crti.o /usr/ccs/lib/values-Xa.o /usr/local/lib/gcc/sparc-sun-solaris2.10/3.4.4/crtbegin.o -L/usr/local/lib/gcc/sparc-sun-solaris2.10/3.4.4 -L/usr/ccs/bin -L/usr/ccs/lib -L/usr/local/lib/gcc/sparc-sun-solaris2.10/3.4.4/../../.. /var/tmp//ccN8lK2a.o -lgpc -lm -lgcc_s -lgcc_s /usr/local/lib/gcc/sparc-sun-solaris2.10/3.4.4/crtend.o /usr/local/lib/gcc/sparc-sun-solaris2.10/3.4.4/crtn.o ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.486 Text relocation remains referenced against symbol offset in file <unknown> 0x3600 /usr/local/lib/gcc/sparc-sun-solaris2.10/3.4.4/libgpc.a(error.o) <unknown> 0x3604 /usr/local/lib/gcc/sparc-sun-solaris2.10/3.4.4/libgpc.a(error.o) <zillions of errors...> ld: fatal: relocations remain against allocatable but non-writable sections collect2: ld returned 1 exit status
The flags passed to the linker look good as far as I can see in the documentation of Sun ld. Should I recompile libgpc.a with the -fPIC compiler option to make the code position-independent?
Regards
Pascal Viandier