3 ms·
GCC 8 Link Time and Interprocedural Optimization
- ezoe 8y ago>so you can rebuild binary with debug info after your program core dumped and use it to debug the core dump I've never thought it's possible. Rebuild after the core dump ? Rather than build with debug info and strip it away.
- ebikelaw 8y agoIf your build system is reproducible there is no reason this would not work.
- jlarocco 8y agoMaybe that's the case now, with GCC 8, but historically that hasn't been true. In the past the effects of using both -g and -O* flags could interact each other because they can both affect how registers are allocated, how call stacks are setup, how functions are inlined, etc. In other words, adding -g by itself made the build non-reproducible. If that's no longer true in GCC 8 it's great news.
- glandium 8y ago> In other words, adding -g by itself made the build non-reproducible. In my experience, this is largely not true. However, what is plausible is that before GCC 8, LTO, which, for speed reasons, can split work across multiple threads, was not deterministic, and GCC 8 might have made that better.
- readittwice 8y agoAFAIR GCC bootstrap builds by default with "-g -O2". There are 3 stages: 1) use system compiler to compile GCC's source code, 2) use resulting binary to build same source, 3) use binary from 2) to build source one more time. After all stages the binaries from stage 2 and 3 are compared byte for byte if they are identical. Bootstrap failures are taken very seriously by the GCC developers. So I really doubt that -g and -O* lead to non-deterministic builds.
- deleted 8y ago[deleted]
- bumblebritches5 8y agoThe community would be better off by dumping gcc's dead ass, and supporting clang and LLVM entirely.
- plmkijnhyt 8y agothis is a very nice forum,check it out https://www.bit.ly/2M0hqJa https://www.bit.ly/2M0hqJa
- 42432534532532 8y agothis is a very nice forum,check it out https://www.bit.ly/2M0hqJa https://www.bit.ly/2M0hqJa
- geocar 8y agoStatic cold detection sounds really useful. How many __builtin_expects can it remove?
- tylll 8y agonice post https://bit.ly/2HVeGKU https://bit.ly/2HVeGKU
- uwu 8y agowhen i was a full-time hobbyist webdev i was surprised when i learned c compilers don't do whole-program optimization by default but limit themselves by optimizing each translation unit separately (i guess it makes things simpler) you can get "LTO" in javascript by using a minifier together with something like webpack which can inline modules when it's safe to do so (instead of putting them in functions that are called by the module loader and can't be minified away), so i assumed "real" compilers must do that stuff a lot better with the language being less dynamic
- srean 8y agoIn addition to simplicity it cuts down on compilation time. You can checkout MLTon or Felix to get a feel for whole program optimizing compilers, they can do optimizations that are impossible without LTO and hard to do with. https://github.com/felix-lang/felix https://github.com/felix-lang/felix http://felix-documentation-master.readthedocs.io/en/latest/masterdirectory.html#specific-documents http://felix-documentation-master.readthedocs.io/en/latest/m... http://mlton.org http://mlton.org