summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-01-19 20:11:15 +0100
committerLuboš Luňák <l.lunak@collabora.com>2020-05-26 10:37:00 +0200
commit2d1f1a1c849fd4f2c7f1211f8d3f03aec069bd44 (patch)
tree25bc72516c3cbb536ba21c955e92b658e38ff2c1
parent5202771939da66ac85ca3221d69e7e5f5cca8da7 (diff)
use -Xclang -debug-info-kind=constructor if available
The option, available since Clang10, emits debuginfo for classes with explicit ctors only together with the ctor, which avoids redundant debuginfo for such classes, noticeably saving both build time and disk space. https://reviews.llvm.org/D72427 I've been using this for quite some time, without problems. Change-Id: I24e5339f983cb8d8990185436dd63e00f0d3ce60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94756 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r--config_host.mk.in1
-rw-r--r--configure.ac13
-rw-r--r--solenv/gbuild/platform/com_GCC_defs.mk4
3 files changed, 18 insertions, 0 deletions
diff --git a/config_host.mk.in b/config_host.mk.in
index bcce45b1ce77..f59b51d8f652 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -271,6 +271,7 @@ export GTK3_LIBS=$(gb_SPACE)@GTK3_LIBS@
export USING_X11=@USING_X11@
export HAMCREST_JAR=@HAMCREST_JAR@
export HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=@HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED@
+export HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=@HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR@
export HAVE_GCC_AVX=@HAVE_GCC_AVX@
export HAVE_GCC_BUILTIN_ATOMIC=@HAVE_GCC_BUILTIN_ATOMIC@
export HAVE_GCC_FNO_ENFORCE_EH_SPECS=@HAVE_GCC_FNO_ENFORCE_EH_SPECS@
diff --git a/configure.ac b/configure.ac
index 8f9e1c71047a..ba2a2d0ea3ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4098,6 +4098,19 @@ if test "$enable_split_debug" != no; then
fi
AC_SUBST(HAVE_GCC_SPLIT_DWARF)
+HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
+AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
+save_CFLAGS=$CFLAGS
+CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
+CFLAGS=$save_CFLAGS
+if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+fi
+AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
+
ENABLE_GDB_INDEX=
if test "$enable_gdb_index" != "no"; then
dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index 4d3602864bc8..1707a7481ee6 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -221,6 +221,10 @@ ifeq ($(HAVE_GCC_SPLIT_DWARF),TRUE)
gb_DEBUGINFO_FLAGS+=-gsplit-dwarf
endif
+ifeq ($(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR),TRUE)
+gb_DEBUGINFO_FLAGS+=-Xclang -debug-info-kind=constructor
+endif
+
ifeq ($(ENABLE_GDB_INDEX),TRUE)
gb_LINKER_DEBUGINFO_FLAGS += -Wl,--gdb-index
gb_DEBUGINFO_FLAGS += -ggnu-pubnames