Skip to content

Commit

Permalink
Add an autoconf option for turning on -gsplit-dwarf by default
Browse files Browse the repository at this point in the history
when building llvm. This saves quite a bit of time and space when
linking. Please report any problems via bugzilla.

Caveats:

a) This will only work on linux
b) This requires a fairly new binutils
c) This requires a fairly new gdb

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184808 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
echristo committed Jun 25, 2013
1 parent 593fcb5 commit 1baa381
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Makefile.config.in
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ ENABLE_LIBCPP = @ENABLE_LIBCPP@
# When ENABLE_CXX11 is enabled, LLVM uses c++11 mode by default to build.
ENABLE_CXX11 = @ENABLE_CXX11@

# When ENABLE_SPLIT_DWARF is enabled, LLVM uses -gfission to build in debug mode.
ENABLE_SPLIT_DWARF = @ENABLE_SPLIT_DWARF@

# When ENABLE_CLANG_ARCMT is enabled, clang will have ARCMigrationTool.
ENABLE_CLANG_ARCMT = @ENABLE_CLANG_ARCMT@

Expand Down
5 changes: 5 additions & 0 deletions Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,13 @@ else
KEEP_SYMBOLS := 1
else
BuildMode := Debug
ifeq ($(ENABLE_SPLIT_DWARF), 1)
CXX.Flags += -gsplit-dwarf
C.Flags += -gsplit-dwarf
else
CXX.Flags += -g
C.Flags += -g
endif
KEEP_SYMBOLS := 1
endif
endif
Expand Down
13 changes: 13 additions & 0 deletions autoconf/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,19 @@ case "$enableval" in
*) AC_MSG_ERROR([Invalid setting for --enable-cxx11. Use "yes" or "no"]) ;;
esac

dnl --enable-fission : check whether or not to use -gsplit-dwarf on the command
dnl line
AC_ARG_ENABLE(split-dwarf,
AS_HELP_STRING([--enable-split-dwarf],
[Use split-dwarf if available (default is NO)]),,
enableval=default)
case "$enableval" in
yes) AC_SUBST(ENABLE_SPLIT_DWARF,[1]) ;;
no) AC_SUBST(ENABLE_SPLIT_DWARF,[0]) ;;
default) AC_SUBST(ENABLE_SPLIT_DWARF,[0]);;
*) AC_MSG_ERROR([Invalid setting for --enable-split-dwarf. Use "yes" or "no"]) ;;
esac

dnl --enable-clang-arcmt: check whether to enable clang arcmt
clang_arcmt="yes"
AC_ARG_ENABLE(clang-arcmt,
Expand Down
30 changes: 26 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,7 @@ BUILD_CXX
CVSBUILD
ENABLE_LIBCPP
ENABLE_CXX11
ENABLE_SPLIT_DWARF
ENABLE_CLANG_ARCMT
ENABLE_CLANG_STATIC_ANALYZER
ENABLE_CLANG_REWRITER
Expand Down Expand Up @@ -1406,6 +1407,7 @@ Optional Features:
--enable-polly Use polly if available (default is YES)
--enable-libcpp Use libc++ if available (default is NO)
--enable-cxx11 Use c++11 if available (default is NO)
--enable-split-dwarf Use split-dwarf if available (default is NO)
--enable-clang-arcmt Enable building of clang ARCMT (default is YES)
--enable-clang-static-analyzer
Enable building of clang Static Analyzer (default is
Expand Down Expand Up @@ -5165,6 +5167,25 @@ echo "$as_me: error: Invalid setting for --enable-cxx11. Use \"yes\" or \"no\""
{ (exit 1); exit 1; }; } ;;
esac

# Check whether --enable-split-dwarf was given.
if test "${enable_split_dwarf+set}" = set; then
enableval=$enable_split_dwarf;
else
enableval=default
fi

case "$enableval" in
yes) ENABLE_SPLIT_DWARF=1
;;
no) ENABLE_SPLIT_DWARF=0
;;
default) ENABLE_SPLIT_DWARF=0
;;
*) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-split-dwarf. Use \"yes\" or \"no\"" >&5
echo "$as_me: error: Invalid setting for --enable-split-dwarf. Use \"yes\" or \"no\"" >&2;}
{ (exit 1); exit 1; }; } ;;
esac

clang_arcmt="yes"
# Check whether --enable-clang-arcmt was given.
if test "${enable_clang_arcmt+set}" = set; then
Expand Down Expand Up @@ -10518,7 +10539,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 10521 "configure"
#line 10542 "configure"
#include "confdefs.h"

#if HAVE_DLFCN_H
Expand Down Expand Up @@ -23349,6 +23370,7 @@ BUILD_CXX!$BUILD_CXX$ac_delim
CVSBUILD!$CVSBUILD$ac_delim
ENABLE_LIBCPP!$ENABLE_LIBCPP$ac_delim
ENABLE_CXX11!$ENABLE_CXX11$ac_delim
ENABLE_SPLIT_DWARF!$ENABLE_SPLIT_DWARF$ac_delim
ENABLE_CLANG_ARCMT!$ENABLE_CLANG_ARCMT$ac_delim
ENABLE_CLANG_STATIC_ANALYZER!$ENABLE_CLANG_STATIC_ANALYZER$ac_delim
ENABLE_CLANG_REWRITER!$ENABLE_CLANG_REWRITER$ac_delim
Expand All @@ -23362,7 +23384,6 @@ DEBUG_RUNTIME!$DEBUG_RUNTIME$ac_delim
DEBUG_SYMBOLS!$DEBUG_SYMBOLS$ac_delim
KEEP_SYMBOLS!$KEEP_SYMBOLS$ac_delim
JIT!$JIT$ac_delim
TARGET_HAS_JIT!$TARGET_HAS_JIT$ac_delim
_ACEOF

if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
Expand Down Expand Up @@ -23404,6 +23425,7 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
TARGET_HAS_JIT!$TARGET_HAS_JIT$ac_delim
ENABLE_DOCS!$ENABLE_DOCS$ac_delim
ENABLE_DOXYGEN!$ENABLE_DOXYGEN$ac_delim
LLVM_ENABLE_THREADS!$LLVM_ENABLE_THREADS$ac_delim
Expand Down Expand Up @@ -23500,7 +23522,6 @@ LLVM_MANDIR!$LLVM_MANDIR$ac_delim
LLVM_CONFIGTIME!$LLVM_CONFIGTIME$ac_delim
BINDINGS_TO_BUILD!$BINDINGS_TO_BUILD$ac_delim
ALL_BINDINGS!$ALL_BINDINGS$ac_delim
OCAML_LIBDIR!$OCAML_LIBDIR$ac_delim
_ACEOF

if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
Expand Down Expand Up @@ -23542,6 +23563,7 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
OCAML_LIBDIR!$OCAML_LIBDIR$ac_delim
ENABLE_VISIBILITY_INLINES_HIDDEN!$ENABLE_VISIBILITY_INLINES_HIDDEN$ac_delim
RPATH!$RPATH$ac_delim
RDYNAMIC!$RDYNAMIC$ac_delim
Expand All @@ -23550,7 +23572,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF

if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 6; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 7; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
Expand Down

0 comments on commit 1baa381

Please sign in to comment.