This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Reducing shared object file size


Hi,

I'm wondering how I might be able to reduce the size of shared object files I'm generating.

I'm using the following commands to generate my files:

gcc -fPIC -o file.o -c src.c (which produces a file of around 1.5kb)
gcc -v -shared -o file.so file.o -lmylib (which produces a file of around 5.9kb)


Since there are very few commands in my shared object (essentially two or three calls to functions in libmylib), and because I've seen many shared objects that are much smaller than 5.9kb, I feel I should be able to reduce the .so file in size.

Can anyone give me suggestions as to how to do this? I've tried adding -O2 and -O3 to both calls, and there's barely a difference in size.

Also, can anyone tell me what the 4.4kb of data is that represents the difference between the two file sizes?

Thanks in advance,

Marcus.



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