summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-11-28 17:22:16 +0100
committerMichael Stahl <mstahl@redhat.com>2016-12-01 16:50:11 +0000
commit6982598524491ee087e69c149eaa958af91b1999 (patch)
treedf2390dbd0240b167d85b5998b11a7bf54b7fe32 /solenv
parentd6a1ba29a512aec9b4aa3d0ab4bd6b92aea7fef4 (diff)
gbuild: replace -O0 with -Og for GCC --enable-debug/dbgutil builds
With Fedora 25 GCC 6.2.1 and my usual config (except without --with-package-format since that is slowest now) on commit 086631af59636cd9a6a45b747a1bc59b4b547794 i get with CCACHE_DISABLE=1: With -O0: "make check" 44490.70user 3127.01system 1:15:23elapsed 1052%CPU (0avgtext+0avgdata 2541312maxresident)k "make check", incremental 7368.19user 153.98system 15:30.06elapsed 808%CPU (0avgtext+0avgdata 510200maxresident)k "make CppunitTest_sc_functions_test" 272.13user 0.65system 4:33.47elapsed 99%CPU (0avgtext+0avgdata 258884maxresident)k With -Og: "make check" 46076.01user 3170.91system 1:16:19elapsed 1075%CPU (0avgtext+0avgdata 2613716maxresident)k "make check", incremental 5478.33user 157.07system 11:50.42elapsed 793%CPU (0avgtext+0avgdata 454980maxresident)k "make CppunitTest_sc_functions_test" 188.48user 0.62system 3:09.59elapsed 99%CPU (0avgtext+0avgdata 259096maxresident)k So we now have so many tests that the time taken by GCC doing optimization is brought back via the tests finishing faster, particularly if we assume a non-negligible ccache hit rate for developers in practice. Add this to gb_DEBUG_CFLAGS instead of gb_COMPILERNOOPTFLAGS because presumably the bridges code that uses gb_COMPILERNOOPTFLAGS really wants -O0; the gb_DEBUG_CFLAGS is added later so -Og overrides -O0. It is an open question how well debugging in gdb actually works with -Og, some experimentation is needed; "man gcc" claims: If you are not using some other optimization option, consider using -Og with -g. With no -O option at all, some compiler passes that collect information useful for debugging do not run at all, so that -Og may result in a better debugging experience. Change-Id: I103499f398b69397cf5aa9993a242680966ce999 Reviewed-on: https://gerrit.libreoffice.org/31334 Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com> Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'solenv')
-rw-r--r--solenv/gbuild/platform/com_GCC_defs.mk4
1 files changed, 3 insertions, 1 deletions
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index 6b697fc9461c..25125334840c 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -186,7 +186,9 @@ ifeq ($(HAVE_GCC_FNO_DEFAULT_INLINE),TRUE)
FNO_DEFAULT_INLINE=-fno-default-inline
endif
-gb_DEBUG_CFLAGS := $(FINLINE_LIMIT0) $(FNO_INLINE)
+# note: this overrides -O0 from the gb_COMPILERNOOPTFLAGS with -Og if
+# available, so that the former remains no-optimization for when that is needed
+gb_DEBUG_CFLAGS := $(if $(HAVE_GCC_OG),-Og) $(FINLINE_LIMIT0) $(FNO_INLINE)
gb_DEBUG_CXXFLAGS := $(FNO_DEFAULT_INLINE)