Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't use the -fwhole-program compiler flag
-fwhole-program can be used to tell the gcc that everything that makes up the final program is included in the current command, which allows it to use more aggressive optimizations. This can result in smaller and faster code. However, cmake always uses at least two commands to compile each executable, even with the unity build: one for building the user code and one for linking all libraries. Using the -fwhole-program option here can cause the compiler to not properly internalize some C++ objects (such as typeids) that are used in both the user code and external libraries, resulting in unexpected behavior. From my tests, there is no measurable performance gain and the file size reduction for the arx executable is 'only' around 18%. I think the potential problems outweigh those benefits, so -fwhole-program must go. This only affects unity builds as -fwhole-program was only used for those. Unity builds are still possible and recommended. In the future we can look into using link-time optimizations, but those are not stable enough in current gcc versions to be enabled by default. Also, quick tests show no real benefits. See crash report #245 See also commit 58aa3 and crash report #243
- Loading branch information