This is the mail archive of the egcs@egcs.cygnus.com mailing list for the EGCS project. See the EGCS home page for more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Exporting symbols from static binary?


Linux, x86:

We are trying to build a statically linked binary which still exports
symbols to shared objects it loads dynamically via dlopen().

Apparently if -static is used, then the dynamic sections of the executable
are not written, and the symbol information is gone.  Also, if the command
line explicitly has all the required objects for linking, and none of them
are dynamic objects, then the binary is statically linked.
If you add a bogus shared object, then that object gets linked in as well
as the shared version of libc, and /lib/ld-linux.so...

As a side note, if for some reason two versions of libc are linked, either
explicitly via -lc,/usr/lib/libc.a, or implicitly by the dependencies of
the shared libraries the binary is linked with, then the resulting binary
will crash with a segmentation fault.

If there's a better place to take this question, please let me know.

Thanks! :)

	-Sam Lantinga				(slouken@devolution.com)

Lead Programmer, Loki Entertainment Software
--
Author of Simple DirectMedia Layer -
	http://www.devolution.com/~slouken/SDL/
--