Kaydet (Commit) bf63a95b authored tarafından Luboš Luňák's avatar Luboš Luňák

make --enable-gdb-index the default for debug builds, if supported

Currently only done on Linux, I'm not sure about the status on other platforms,
feel free to add your platform.
https://lists.freedesktop.org/archives/libreoffice/2018-June/080437.html
https://lists.freedesktop.org/archives/libreoffice/2018-July/080484.html

Change-Id: I5997f54e530c8078250eb7c116cb6bd2604e7925
Reviewed-on: https://gerrit.libreoffice.org/65424
Tested-by: Jenkins
Reviewed-by: 's avatarLuboš Luňák <l.lunak@collabora.com>
üst 36aa3f4d
...@@ -553,6 +553,7 @@ test_cups=yes ...@@ -553,6 +553,7 @@ test_cups=yes
test_dbus=yes test_dbus=yes
test_fontconfig=yes test_fontconfig=yes
test_cairo=no test_cairo=no
test_gdb_index=no
# Default values, as such probably valid just for Linux, set # Default values, as such probably valid just for Linux, set
# differently below just for Mac OSX, but at least better than # differently below just for Mac OSX, but at least better than
...@@ -605,6 +606,7 @@ linux-gnu*|k*bsd*-gnu*) ...@@ -605,6 +606,7 @@ linux-gnu*|k*bsd*-gnu*)
build_gstreamer_0_10=yes build_gstreamer_0_10=yes
test_kde5=yes test_kde5=yes
test_gtk3_kde5=yes test_gtk3_kde5=yes
test_gdb_index=yes
if test "$enable_fuzzers" != yes; then if test "$enable_fuzzers" != yes; then
test_freetype=yes test_freetype=yes
test_fontconfig=yes test_fontconfig=yes
...@@ -1133,9 +1135,9 @@ libo_FUZZ_ARG_ENABLE(split-debug, ...@@ -1133,9 +1135,9 @@ libo_FUZZ_ARG_ENABLE(split-debug,
but requires tools that support it (both build tools and debuggers).])) but requires tools that support it (both build tools and debuggers).]))
libo_FUZZ_ARG_ENABLE(gdb-index, libo_FUZZ_ARG_ENABLE(gdb-index,
AS_HELP_STRING([--enable-gdb-index], AS_HELP_STRING([--disable-gdb-index],
[Creates debug information in the gdb index format, which makes gdb start faster. [Disables creating debug information in the gdb index format, which makes gdb start faster.
Requires the gold or lld linker.])) The feature requires the gold or lld linker.]))
libo_FUZZ_ARG_ENABLE(sal-log, libo_FUZZ_ARG_ENABLE(sal-log,
AS_HELP_STRING([--enable-sal-log], AS_HELP_STRING([--enable-sal-log],
...@@ -3180,31 +3182,6 @@ printf ("hello world\n"); ...@@ -3180,31 +3182,6 @@ printf ("hello world\n");
fi fi
AC_SUBST(USE_LD) 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= HAVE_LD_BSYMBOLIC_FUNCTIONS=
if test "$GCC" = "yes"; then if test "$GCC" = "yes"; then
AC_MSG_CHECKING([for -Bsymbolic-functions linker support]) AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
...@@ -3907,6 +3884,51 @@ if test "$enable_split_debug" = yes; then ...@@ -3907,6 +3884,51 @@ if test "$enable_split_debug" = yes; then
AC_SUBST(HAVE_GCC_SPLIT_DWARF) AC_SUBST(HAVE_GCC_SPLIT_DWARF)
fi fi
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.
if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
AC_MSG_CHECKING([whether $CC supports -ggnu-pubnames])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
have_ggnu_pubnames=
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
if test "$have_ggnu_pubnames" != "TRUE"; then
if test "$enable_gdb_index" = "yes"; then
AC_MSG_ERROR( no, --enable-gdb-index not supported )
else
AC_MSG_RESULT( no )
fi
else
AC_MSG_RESULT( yes )
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
if test "$enable_gdb_index" = "yes"; then
AC_MSG_ERROR( no )
else
AC_MSG_RESULT( no )
fi
fi
LDFLAGS=$ldflags_save
fi
CFLAGS=$save_CFLAGS
fi
if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
fi
fi
AC_SUBST(ENABLE_GDB_INDEX)
if test "$enable_sal_log" = yes; then if test "$enable_sal_log" = yes; then
ENABLE_SAL_LOG=TRUE ENABLE_SAL_LOG=TRUE
fi fi
......
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