Kaydet (Commit) 69825985 authored tarafından Michael Stahl's avatar Michael Stahl

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
086631af 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/31334Reviewed-by: 's avatarNorbert Thiebaud <nthiebaud@gmail.com>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst d6a1ba29
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment