I’m using GCC on Linux to create a shared library. The library itself has no code but links to a couple of static libraries (archives) also built using GCC.
I need to export the static libs’ symbols through my shared library. What happens is that the resulting shared lib is too small and it actually does not contain any of the symbols provided by the static libs mentioned above.
I also tried with a map of exported symbols but that did not help at all.
You need the linker’s
--whole-archiveoption to pull in all of the static archives:The
-Wlis needed because--whole-archiveis a linker option.In order to do this, the code in libstatic.a will need to have been properly compiled for use in a shared object (i.e. with
-fpicon platforms that require that).