I have compiled a static library and size -t summary is like this
text data bss dec hex filename
100166 2944 950 104060 1967c (TOTALS)
But when this library is linked with an executable, net addition in .text/.data/.bss in the final binary is much more than the sizes of these sections in the static library. As an example, size of .data/.bss is increased by 8k in the binary while the linked library has a combined .data/.bss size of 4k.
As per my understanding, all this bloat is caused by the presence of relocation symbols in the static library. Can anyone confirm on this and is there a way to reduce the memory footprint of the executable?