3 ms·
Making arbitrarily-large binaries from fixed-size C++ code
- vog 11y agoI struggle to get the reason of the copyright note of the first example: // Copyright 2015 Google Inc. Does this mean that this code snippet was written during paid development time at Google? Also, why is only the first (failing) attempt marked with a Google copyright, but not the second (actually working) version of this code snippet?
- Kristine1975 11y agoCompiling with clang 3.7.0 and no options took ~1min and ~3.5GB RAM to compile, then another minute and ~200MB RAM to link, resulting in a 39MB binary. With option -Os it took ~5min and ~2.1GB RAM, then a few seconds to link, resulting in an 8.1MB binary. Adding __attribute__((__noinline__)) to the functions resulted in ~4min and ~3.1GB RAM for compiling, and a 22.3MB binary. So if you want real bloat, better turn off optimizations.