Static compilation to generate shared library
Brian Dessent
brian@dessent.net
Tue Jul 17 13:02:00 GMT 2007
ccodehelp wrote:
> I want my libfuncs.so to show this latter behaviour while as of now it is
> showing the former. I want the byte code from the C library to be present in
> my executable.
The reason this is not easy to achieve is because it's a terrible idea.
If you are creating a shared object it means it will be dynamically
loaded into the address space of an existing process (one which will
almost certainly be dynamically linked to libc.so) but if your library
contains the static parts of libc it means you now have two copies of
libc loaded into the same process -- potentially two *different* and
incompatible versions. Library ABIs are complicated interactions and
it's very hard to predict all the possible failure modes in this twisted
scenario.
Either make your library a standard static library or a standard shared
library, not this mutant "it's a shared library but it's not" thing.
Brian
More information about the Gcc-help
mailing list