diff options
author | Erik de Castro Lopo <erikd@mega-nerd.com> | 2016-06-01 06:14:00 +1000 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2016-06-01 06:14:00 +1000 |
commit | 0676e68cf5fe8696f1f760fef0f35dba14db1104 (patch) | |
tree | eade146204a9d1e64767e3eeb62feb1dbef789da | |
parent | 930e74f8f494962745c16a59f156a0ed9f2f1df1 (diff) | |
download | haskell-0676e68cf5fe8696f1f760fef0f35dba14db1104.tar.gz |
Fix detection and use of `USE_LIBDW`
Test Plan: Configure/build with and without --enable-libdw
Reviewers: trofi, hvr, austin, simonmar, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2276
-rw-r--r-- | configure.ac | 16 | ||||
-rw-r--r-- | distrib/configure.ac.in | 4 | ||||
-rw-r--r-- | mk/config.mk.in | 2 | ||||
-rw-r--r-- | rts/Libdw.c | 2 | ||||
-rw-r--r-- | rts/Libdw.h | 2 | ||||
-rw-r--r-- | rts/LibdwPool.c | 2 | ||||
-rw-r--r-- | rts/LibdwPool.h | 2 | ||||
-rw-r--r-- | rts/ghc.mk | 8 | ||||
-rw-r--r-- | rts/package.conf.in | 2 | ||||
-rw-r--r-- | rts/posix/Signals.c | 2 |
10 files changed, 21 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac index 4adf9c5558..15561d059f 100644 --- a/configure.ac +++ b/configure.ac @@ -1092,14 +1092,22 @@ AC_DEFINE_UNQUOTED([RTS_LINKER_USE_MMAP], [$RtsLinkerUseMmap], dnl ** Have libdw? dnl -------------------------------------------------------------- -AC_ARG_ENABLE(libdw, +UseLibdw=NO +USE_LIBDW=0 +AC_ARG_ENABLE(dwarf-unwind, [AC_HELP_STRING([--enable-dwarf-unwind], [Enable DWARF unwinding support in the runtime system via elfutils' libdw [default=no]])], - [AC_CHECK_LIB(dw, dwfl_attach_state, [HaveLibdw=YES], [HaveLibdw=NO])], - [HaveLibdw=NO] + [AC_CHECK_LIB(dw, dwfl_attach_state, [UseLibdw=YES], [UseLibdw=NO])], + [UseLibdw=NO] ) -AC_SUBST(HaveLibdw) +AC_SUBST(UseLibdw) +if test $UseLibdw = "YES" ; then + USE_LIBDW=1 +fi +AC_DEFINE_UNQUOTED([USE_LIBDW], [$USE_LIBDW], [Set to 1 to use libdw]) +dnl ** Documentation +dnl -------------------------------------------------------------- if test -n "$SPHINXBUILD"; then BUILD_MAN=YES BUILD_SPHINX_HTML=YES diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index fdd9fd92d6..33023a730f 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -93,9 +93,9 @@ dnl ** Have libdw? dnl -------------------------------------------------------------- dnl Check for a usable version of libdw/elfutils dnl Currently we need 0.158 or newer. -BinDistNeedsLibdw=@HaveLibdw@ +BinDistNeedsLibdw=@UseLibdw@ if test "x$BinDistNeedsLibdw" = "xyes" ; then - AC_CHECK_LIB(dw, dwfl_attach_state, [HaveLibdw=YES], + AC_CHECK_LIB(dw, dwfl_attach_state, [UseLibdw=YES], [AC_MSG_ERROR([Binary distribution was built with libdw support but target system doesn't have supported libdw version (needs at least 0.158)])] )]; fi diff --git a/mk/config.mk.in b/mk/config.mk.in index 5dbde02e55..47198b942a 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -381,7 +381,7 @@ FFIIncludeDir=@FFIIncludeDir@ # GHC needs arch-specific tweak at least in # rts/Libdw.c:set_initial_registers() -GhcRtsWithLibdw=$(strip $(if $(filter $(TargetArch_CPP),i386 x86_64),@HaveLibdw@,NO)) +GhcRtsWithLibdw=$(strip $(if $(filter $(TargetArch_CPP),i386 x86_64),@UseLibdw@,NO)) ################################################################################ # diff --git a/rts/Libdw.c b/rts/Libdw.c index e7968407a6..a16ea59fb5 100644 --- a/rts/Libdw.c +++ b/rts/Libdw.c @@ -10,7 +10,7 @@ #include "RtsUtils.h" #include "Libdw.h" -#ifdef USE_LIBDW +#if USE_LIBDW #include <elfutils/libdwfl.h> #include <dwarf.h> diff --git a/rts/Libdw.h b/rts/Libdw.h index e5fa054155..bb3e71b78f 100644 --- a/rts/Libdw.h +++ b/rts/Libdw.h @@ -16,7 +16,7 @@ #include "BeginPrivate.h" -#ifdef USE_LIBDW +#if USE_LIBDW /* Begin a libdw session. A session is tied to a particular capability */ LibdwSession *libdwInit(void); diff --git a/rts/LibdwPool.c b/rts/LibdwPool.c index 2363212eaa..8d065c342d 100644 --- a/rts/LibdwPool.c +++ b/rts/LibdwPool.c @@ -10,7 +10,7 @@ #include "RtsUtils.h" #include "LibdwPool.h" -#ifdef USE_LIBDW +#if USE_LIBDW #include <unistd.h> diff --git a/rts/LibdwPool.h b/rts/LibdwPool.h index a6b670e6f1..3c4216d09b 100644 --- a/rts/LibdwPool.h +++ b/rts/LibdwPool.h @@ -14,7 +14,7 @@ #include "Rts.h" #include "Libdw.h" -#ifdef USE_LIBDW +#if USE_LIBDW /* Initialize the pool */ void libdwPoolInit(void); diff --git a/rts/ghc.mk b/rts/ghc.mk index 6fdc2cc213..49eaab5be3 100644 --- a/rts/ghc.mk +++ b/rts/ghc.mk @@ -480,14 +480,6 @@ rts_PACKAGE_CPP_OPTS += '-DFFI_LIB="C$(LIBFFI_NAME)"' endif -#----------------------------------------------------------------------------- -# Add support for reading DWARF debugging information, if available - -ifeq "$(GhcRtsWithLibdw)" "YES" -rts_CC_OPTS += -DUSE_LIBDW -rts_PACKAGE_CPP_OPTS += -DUSE_LIBDW -endif - # ----------------------------------------------------------------------------- # dependencies diff --git a/rts/package.conf.in b/rts/package.conf.in index 5c6d240fc2..b52a8672d5 100644 --- a/rts/package.conf.in +++ b/rts/package.conf.in @@ -61,7 +61,7 @@ unresolved symbols. */ ,"mingwex" # endif #endif -#ifdef USE_LIBDW +#if USE_LIBDW , "elf" , "dw" /* for backtraces */ #endif diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c index 496ec7b2df..d73143bd31 100644 --- a/rts/posix/Signals.c +++ b/rts/posix/Signals.c @@ -536,7 +536,7 @@ shutdown_handler(int sig STG_UNUSED) static void backtrace_handler(int sig STG_UNUSED) { -#ifdef USE_LIBDW +#if USE_LIBDW LibdwSession *session = libdwInit(); Backtrace *bt = libdwGetBacktrace(session); libdwPrintBacktrace(session, stderr, bt); |