The below mentioned in the GCC Page for the function sections and data sections options:
-ffunction-sections -fdata-sections
You can use -ffunction-sections and -fdata-sections on static libraries, which will increase the size of the static library, as each function and global data variable will be put in a separate section.
And then use -Wl,--gc-sections on the program linking with this static library, which will remove unused sections.
Thus, the final binary will be smaller than without those flags.
Be careful though, as -Wl,--gc-sections can break things.