Subject: Shared libraries
To: None <firstname.lastname@example.org>
From: Ian Dall <email@example.com>
Date: 06/27/1999 16:30:47
I have been trying to build Mozzilla, and have realized that there
is a lot I don't understand about our shared library implementation.
If I do
gcc -shared -o libfoo.so.1.0 a.o b.o c.o
what happens if a, b or c have reference to other libraries? I notice
that this will succeed even when symbols are not resolved, presumably
they are just stored somewhere and resolved at runtime. However, what
happens when the symbol is in standard library (say libc). Does the
libc_pic.a ever get used "automatically" in response to a -lc or would
it need -lc_pic?
If the libc_pic.a is not used, what actually happens? I notice the
size of the shared library is considerably smaller if I use -nostdlib
than if I don't. Also if I don't use -nostdlib, libfoo.so ends up with
a whole stack of extra symbols.
Finally, what happens if there is no shared library? I am thinking
specifically of libgcc.a. If a, b or c call a function in libgcc.a, is
it extracted from libgcc.a and linked? If so that is almost certainly
wrong since libgcc.s doesn't appear to be compiled with -fpic.