static + dynamic linking problem
mathew.benson at gmail.com
Fri May 12 18:41:27 UTC 2017
I have an application using the RTL dynamic loader. The loader seems to
work just fine, but two of the dynamic libraries that I'm loading require
math functions in libm.a. Correct me if I'm wrong, but I can't link those
into the dynamic libraries without symbols colliding. However, if I put
the -lm in the main executable, the symbols get stripped out even though I
use the "-Wl,--export-dynamic" switch. If I use a function in the main
executable, that function is exported correctly. But all unused functions
get stripped out. It would appear the --export-dynamic only applies to the
.o's and not to any .a's.
I think there are multiple ways to solve this, but I haven't found a clean
solution yet. One working, but ugly solution is to use "ar x libm.a" to
extract the .o's, then link the .o's with mine. That combined with the
--export-dynamic exports all the symbols.
I'm thinking this can probably be solved with a toolchain switch. Is there
any way I can tell the linker to also export all the symbols from the .a's
linked in? Can I specify specific symbols to export?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the users