config_host.mk.in                      |    1 +
 configure.ac                           |   30 ++++++++++++++++++++++++++++++
 solenv/gbuild/platform/com_GCC_defs.mk |    6 ++++++
 3 files changed, 37 insertions(+)

New commits:
commit c90312c6d61bfa43c70c9acf1093edd731c5f02a
Author: Luboš Luňák <l.lu...@collabora.com>
Date:   Thu Jun 28 04:10:52 2018 +0200

    add --enable-gdb-index for --gdb-index from gold/lld
    
    https://lists.freedesktop.org/archives/libreoffice/2018-June/080437.html
    
    Change-Id: I66904333bf329e804025d4b229a0db573e21c3af
    Reviewed-on: https://gerrit.libreoffice.org/56566
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/config_host.mk.in b/config_host.mk.in
index 0bc686e916da..e53c9a12f8b0 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -130,6 +130,7 @@ export ENABLE_EOT=@ENABLE_EOT@
 export ENABLE_EVOAB2=@ENABLE_EVOAB2@
 export ENABLE_FIREBIRD_SDBC=@ENABLE_FIREBIRD_SDBC@
 export ENABLE_FORMULA_LOGGER=@ENABLE_FORMULA_LOGGER@
+export ENABLE_GDB_INDEX=@ENABLE_GDB_INDEX@
 export ENABLE_GIO=@ENABLE_GIO@
 export ENABLE_GPGMEPP=@ENABLE_GPGMEPP@
 export ENABLE_GSTREAMER_0_10=@ENABLE_GSTREAMER_0_10@
diff --git a/configure.ac b/configure.ac
index ebe5d0c5be9b..3ca4d8e8ab90 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1121,6 +1121,11 @@ libo_FUZZ_ARG_ENABLE(split-debug,
         [Uses split debug information (-gsplit-dwarf compile flag). Saves disk 
space and build time,
          but requires tools that support it (both build tools and 
debuggers).]))
 
+libo_FUZZ_ARG_ENABLE(gdb-index,
+    AS_HELP_STRING([--enable-gdb-index],
+        [Creates debug information in the gdb index format, which makes gdb 
start faster.
+         Requires the gold or lld linker.]))
+
 libo_FUZZ_ARG_ENABLE(sal-log,
     AS_HELP_STRING([--enable-sal-log],
         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug 
build.]))
@@ -3180,6 +3185,31 @@ printf ("hello world\n");
 fi
 AC_SUBST(USE_LD)
 
+ENABLE_GDB_INDEX=
+if test "$enable_gdb_index" = "yes"; then
+    AC_MSG_CHECKING([whether $CC supports -ggnu-pubnames])
+    save_CFLAGS=$CFLAGS
+    CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ AC_MSG_RESULT( 
yes )],[ AC_MSG_ERROR( no )])
+
+    AC_MSG_CHECKING([whether $CC supports -Wl,--gdb-index])
+    ldflags_save=$LDFLAGS
+    LDFLAGS="$LDFLAGS -Wl,--gdb-index"
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([
+#include <stdio.h>
+        ],[
+printf ("hello world\n");
+        ])], ENABLE_GDB_INDEX=TRUE, [])
+    if test "$ENABLE_GDB_INDEX" = "TRUE"; then
+        AC_MSG_RESULT( yes )
+    else
+        AC_MSG_ERROR( no )
+    fi
+    CFLAGS=$save_CFLAGS
+    LDFLAGS=$ldflags_save
+fi
+AC_SUBST(ENABLE_GDB_INDEX)
+
 HAVE_LD_BSYMBOLIC_FUNCTIONS=
 if test "$GCC" = "yes"; then
     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk 
b/solenv/gbuild/platform/com_GCC_defs.mk
index c9cbe0d96a54..25bb4bdf6889 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -81,6 +81,12 @@ gb_CXXFLAGS_COMMON := \
 
 gb_CXXFLAGS_Wundef = -Wno-undef
 
+ifeq ($(ENABLE_GDB_INDEX),TRUE)
+gb_LinkTarget_LDFLAGS += -Wl,--gdb-index
+gb_CFLAGS_COMMON += -ggnu-pubnames
+gb_CXXFLAGS_COMMON += -ggnu-pubnames
+endif
+
 ifeq ($(strip $(gb_GCOV)),YES)
 gb_CFLAGS_COMMON += -fprofile-arcs -ftest-coverage
 gb_CXXFLAGS_COMMON += -fprofile-arcs -ftest-coverage
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to