They are not lost, they are ignored. When the shared library is linked, the linker only pulls out the functions that are actually used in the object files. (This is how static libraries work).
I believe that passing the -whole-archive flag to the linker will cause it to pull all the object files from the static library. You can provide it on the gcc link line with "-Wl, -wall-archive". You must follow it with "-Wl, -no-whole-archive" after specifying your library, or ld will continue the behavior for any other static libraries it encounters, which is most likely not the behavior you want. See also the ld (1) man page on a Linux system.
Another way to do the same is to output a single massive .o file instead of the .a file.
EDIT: A simple command line example using libz on the desktop:
% echo "int main() { return 0; }" > foo.c % gcc -o foo /usr/lib/libz.a foo.c % ls -s foo 12 foo* % gcc -o foo -Wl,-whole-archive /usr/lib/libz.a -Wl,-no-whole-archive foo.c % ls -s foo 104 foo*
(You should use "/usr/lib/libz.a" instead of "-lz" here, because the latter finds the shared library /usr/lib/libz.so.)
I haven’t used NDK very much, but it seems like adding flags to LOCAL_LDFLAGS can do the trick.
fadden
source share