On Thursday 01 of December 2011, Lubos Lunak wrote:
On Wednesday 30 of November 2011, Tom Tromey wrote:
These options cause debuginfo for
most big types to be shared across compilation units, a huge size win.
This also makes gdb use less memory.
I've tried it and it seems to save about 1/3 of .so size, so it indeed is
very noticeable. Would it make sense to have this even enabled by default
if gcc supports the option?
The downside of this feature is that not all tools have been upgraded to
understand it. gdb works fine, but the 7 dwarves, and systemtap, and I
think valgrind, will barf. They will all come around eventually, though
I am not sure when.
I have gcc-4.5.1, gdb-7.2 and valgrind 3.6.1 (openSUSE 11.4) and after
some quick tests I didn't notice any problems with -gdwarf-4.
As a followup, I've already noticed that gdb-7.2 has some trouble with
completing C++ function names if the libs have been built with -gdwarf-4, but
upgrading to gdb-7.3 fixed that, and I remember gdb used to have these kind
of problems already somewhen without -gdwarf-4, so I don't that's such a
serious problem. As for the rest of the tools listed above that I haven't
tried, I think they're not used widely enough to be a blocker for this.
So -gdwarf-4 looks like a sensible default to me. Even if not, I'm going
to use it (quick hack: modify your LO make script to add it to $CXXFLAGS).
So, how about the attached patch? If it's ok, I will still wait until 3.5 has
been branched off, just in case. I also have no idea if this should be
enabled for the WNT_INTEL_GCC target too, but it and unxgcc were the only two
to use -ggdbX flags.
--
Lubos Lunak
l.lunak@suse.cz
diff --git a/configure.in b/configure.in
index cafaf1f..78156c6 100644
--- a/configure.in
+++ b/configure.in
@@ -3827,6 +3827,24 @@ AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
AC_SUBST(HAVE_GCC_VISIBILITY_BROKEN)
dnl ===================================================================
+dnl gcc DWARF-4 support (smaller debug info)
+dnl ===================================================================
+if test "$GCC" = "yes"; then
+ AC_MSG_CHECKING([whether $CC supports -gdwarf-4])
+ save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS -Werror -gdwarf-4"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_DWARF_4=TRUE ],[])
+ CFLAGS=$save_CFLAGS
+ if test "$HAVE_GCC_DWARF_4" = "TRUE"; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+fi
+
+AC_SUBST(HAVE_GCC_DWARF_4)
+
+dnl ===================================================================
dnl allocator
dnl ===================================================================
AC_MSG_CHECKING([which memory allocator to use])
diff --git a/set_soenv.in b/set_soenv.in
index 4070684..6271025 100755
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -1792,6 +1792,7 @@ ToFile( "HAVE_GCC_VISIBILITY_FEATURE",
"@HAVE_GCC_VISIBILITY_FEATURE@", "e" );
ToFile( "HAVE_GCC_VISIBILITY_BROKEN",
"@HAVE_GCC_VISIBILITY_BROKEN@", "e" );
+ToFile( "HAVE_GCC_DWARF_4","@HAVE_GCC_DWARF_4@","e" );
ToFile( "HAVE_LD_HASH_STYLE","@HAVE_LD_HASH_STYLE@","e" );
ToFile( "WITH_LINKER_HASH_STYLE","@WITH_LINKER_HASH_STYLE@","e" );
ToFile( "HAVE_LD_BSYMBOLIC_FUNCTIONS",
diff --git a/solenv/gbuild/platform/WNT_INTEL_GCC.mk b/solenv/gbuild/platform/WNT_INTEL_GCC.mk
index ae99f11..6bafd23 100644
--- a/solenv/gbuild/platform/WNT_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/WNT_INTEL_GCC.mk
@@ -99,6 +99,9 @@ gb_LinkTarget_LDFLAGS += -shared-libgcc
endif
gb_DEBUG_CFLAGS := -ggdb3 -finline-limit=0 -fno-inline -fno-default-inline
+ifeq ($(HAVE_GCC_DWARF_4),TRUE)
+gb_DEBUG_CFLAGS += -gdwarf-4
+endif
gb_STDLIBS := \
mingwthrd \
@@ -162,6 +165,10 @@ gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) $(gb_CXXFLAGS_WERROR)
ifeq ($(gb_SYMBOL),$(true))
gb_LinkTarget_CXXFLAGS += -ggdb2
gb_LinkTarget_CFLAGS += -ggdb2
+ifeq ($(HAVE_GCC_DWARF_4),TRUE)
+gb_LinkTarget_CXXFLAGS += -gdwarf-4
+gb_LinkTarget_CFLAGS += -gdwarf-4
+endif
endif
gb_LinkTarget_INCLUDE +=\
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index fe2aa7e..8bd405e7 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -164,6 +164,9 @@ gb_LINKEROPTFLAGS := -Wl,-O1
endif
gb_DEBUG_CFLAGS := -ggdb3 -finline-limit=0 -fno-inline -fno-default-inline
+ifeq ($(HAVE_GCC_DWARF_4),TRUE)
+gb_DEBUG_CFLAGS += -gdwarf-4
+endif
gb_COMPILERNOOPTFLAGS := -O0
@@ -219,6 +222,10 @@ gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) $(gb_CXXFLAGS_WERROR)
ifeq ($(gb_SYMBOL),$(true))
gb_LinkTarget_CXXFLAGS += -ggdb2
gb_LinkTarget_CFLAGS += -ggdb2
+ifeq ($(HAVE_GCC_DWARF_4),TRUE)
+gb_LinkTarget_CXXFLAGS += -gdwarf-4
+gb_LinkTarget_CFLAGS += -gdwarf-4
+endif
endif
# note that `cat $(extraobjectlist)` is needed to build with older gcc versions, e.g. 4.1.2 on
SLED10
Context
- [Libreoffice] [PATCH] Use -gdwarf-4 by default if possible (was Re: Even more debugging info) · Lubos Lunak
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.