I have two versions of the Hello World program:
#include <iostream>
int main() {
std::cout<<"Hello World";
}
and
#include <iostream>
int main() {
std::cout<<"Hello World and a very long message";
}
I would expect a different size of the resulting binaries for them if strict size optimization were performed. However, when I compile g++ -Os -o test test.cpp -Wl,--strip-all(c GCC 5.4.0), I get equal file sizes (6336 on my system, Ubuntu). This means that there is some garbage space for a buffer with a minimum size (although in this example I expect the lines to be const char[]).
My question is: what is the nature of this buffer and how to remove garbage characters from the generated binary?
Roman source
share