What other stuff does -static
add to the final binary output that -static-libstdc++
does not add?
I checked the excellent answer for this question but it doesn't address this particular question that I have.
I tried the following program:
#include <iostream>
int main( )
{
std::cout << "What does -static do that -static-libstdc++ doesn't do?\n";
}
Without any of these options specified for link-time, the generated output is only ~17 KB. However, by specifying -static-libstdc++
it becomes ~1.3 MB. And if -static
is used instead, it becomes ~2.4 MB. What is being added by the -static
flag that causes the latter two forms to have such a huge difference in size? And which things can be affected at runtime if only the -static-libstdc++
is specified at the linking stage?
Now which one is more suitable if someone wants to build a small program that can be run on Ubuntu (v18.04 and later)?