[commit: ghc] master: libdw: enable support only on i386 and amd64 (e2c518e)

git at git.haskell.org git at git.haskell.org
Fri Dec 4 22:07:21 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/e2c518e6a751b7a16c704198a14dcc688b020038/ghc

>---------------------------------------------------------------

commit e2c518e6a751b7a16c704198a14dcc688b020038
Author: Sergei Trofimovich <slyfox at gentoo.org>
Date:   Fri Dec 4 22:07:13 2015 +0000

    libdw: enable support only on i386 and amd64
    
    Summary:
    Currently libdw requires per-arch implementation of
    set_initial_registers() function.
    
    Otherwise build fails with linkage error
    (seen on sparc):
    
      rts/dist/build/libHSrts_thr-ghc7.11.20151129.so:
          undefined reference to `set_initial_registers'
      collect2: error: ld returned 1 exit status
      `gcc' failed in phase `Linker'. (Exit code: 1)
      make[1]: *** [ghc/stage2/build/tmp/ghc-stage2] Error 1
    
    Converted link-time error to compile-time error,
    added arch whitelist.
    
    Signed-off-by: Sergei Trofimovich <siarheit at google.com>
    
    Reviewers: austin, thomie, bgamari
    
    Reviewed By: bgamari
    
    Differential Revision: https://phabricator.haskell.org/D1567


>---------------------------------------------------------------

e2c518e6a751b7a16c704198a14dcc688b020038
 mk/config.mk.in | 6 +++---
 rts/Libdw.c     | 5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/mk/config.mk.in b/mk/config.mk.in
index 967c751..d7cd05b 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -371,9 +371,9 @@ UseSystemLibFFI=@UseSystemLibFFI@
 FFILibDir=@FFILibDir@
 FFIIncludeDir=@FFIIncludeDir@
 
-
-# Include support for DWARF unwinding
-GhcRtsWithLibdw = @HaveLibdw@
+# GHC needs arch-specific tweak at least in
+#     rts/Libdw.c:set_initial_registers()
+GhcRtsWithLibdw=$(strip $(if $(filter $(TargetArch_CPP),i386 x86_64), at HaveLibdw@,NO))
 
 ################################################################################
 #
diff --git a/rts/Libdw.c b/rts/Libdw.c
index 1ef51b2..8c3c581 100644
--- a/rts/Libdw.c
+++ b/rts/Libdw.c
@@ -299,8 +299,7 @@ static bool set_initial_registers(Dwfl_Thread *thread,
         );
     return dwfl_thread_state_registers(thread, 0, 17, regs);
 }
-#endif
-#ifdef i386_HOST_ARCH
+#elif defined(i386_HOST_ARCH)
 static bool set_initial_registers(Dwfl_Thread *thread,
                                   void *arg STG_UNUSED) {
     Dwarf_Word regs[9];
@@ -321,6 +320,8 @@ static bool set_initial_registers(Dwfl_Thread *thread,
         );
     return dwfl_thread_state_registers(thread, 0, 9, regs);
 }
+#else
+#    error "Please implement set_initial_registers() for your arch"
 #endif
 
 static const Dwfl_Thread_Callbacks thread_cbs = {



More information about the ghc-commits mailing list