Subject: Re: How to make a shared lib from static one
To: VaX#n8 <vax@ccwf.cc.utexas.edu>
From: Paul Kranenburg <pk@cs.few.eur.nl>
List: current-users
Date: 09/14/1995 21:26:38
> ld -Bdynamic -o libc.so.12.3 *
> (This worked in SunOS). It complains of no "__DYNAMIC" symbol.
To make a shared library, use:
ld -Bshareable -o lib... *.o
or, to convert an archive of `-fpic' objects use the special shortcut:
ld -Bforcearchive -Bshareable -o lib... *.o
(this is equivalent to doing `ar x foo.a; ld -Bshareable *.o').
> ld -Bshareable -Bdynamic -o libc.so.12.3 *
> Which worked but gave hundreds of errors like:
> ld: yplib.o: RRS text relocation at 0x3ed6f for "_clnt_perror"
> ld: yplib.o: RRS text relocation at 0x3ed9d for "_strdup"
You get those if you try to link non-PIC object files into a shared library.
The linker tries to tell you that it was forced to leave in relocations
to the output file's text segment.
> Hmm... now that I think about it, perhaps I should have used libc_pic.a
> as the basis rather than libc.a...
Yes.
-pk