I created a .c file that is converted to a .o file along with about 300 other .c files and is included in the .a static library. This library, along with many others, is used to create the .so dynamic library. When analyzing .a and .so files with nm I found that for some reason the characters defined in the .c file are present in the .a file, but not in the .so file. I do not think that this is not so. Can someone please help me here? The steps used to create two binary files:
gcc -fvisibility=hidden -c foo.c -o foo.co ar cr libbar.a foo.co ... gcc -fvisibility=hidden -fPIC -o libfinal.so libbar.a xo ya ...
The reason I hide visibility is because I want to set only a few selected characters. To output characters from foo.c , I specified a visibility attribute so that the signature functions in the foo.h header look like this:
extern int _____attribute_____ ((visibility ("default"))) func ();
EDIT: nm libbar.a | grep Ctx team nm libbar.a | grep Ctx nm libbar.a | grep Ctx gives:
000023c5 T CtxAcquireBitmap 000026e9 T CtxAcquireArray 00001e77 T CtxCallMethod
However nm libfinal.so | grep Ctx nm libfinal.so | grep Ctx nothing.
UPDATE: Found another post discussing the use of the --whole-archive option. Also, I came across the --export-dynamic option, which apparently tells the linker to save characters without links. Consequence
source share