[GHC] #8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build: threaded RTS, profiling mode

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build: threaded RTS, profiling mode ------------------------------------+------------------------------------- Reporter: slyfox | Owner: Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- Steps to reproduce: {{{ 0. Pick any platform. I've performed it on amd64, but seen real failures on unreg arches: ia64, ppc64 1. pull sources 2. ./boot 3. ./configure --enable-unregisterised # right, no build.mk 4. make }}} Here we see 2 kinds of bugs at once: 1. threaded RTS misses '''-DNOSMP''' define. Looks like ghc always needs to carry that define (what is the mechanism for it BTW?), it doesn't: {{{ HC [stage 1] compiler/stage2/build/ExtsCompat46.o In file included from /home/slyfox/dev/git/ghc/includes/Stg.h:232:0: 0, from /tmp/ghc6527_0/ghc6527_2.hc:3: /home/slyfox/dev/git/ghc/includes/stg/Regs.h:443:2: error: #error BaseReg must be in a register for THREADED_RTS #error BaseReg must be in a register for THREADED_RTS ^ }}} The implicit declarations are scary as well: {{{ /tmp/ghc1420_0/ghc1420_2.hc: In function 'c7WZ_entry': /tmp/ghc1420_0/ghc1420_2.hc:43:1: warning: implicit declaration of function 'hs_bswap64' [-Wimplicit- function-declaration] _c7X5 = hs_bswap64(*((P_)(R1.w+7))); ^ }}} I naively tried naive approach: {{{ mk/config.mk.in: +# Unregisterised build calls c compiler for every +# .hs file. thus pass it everywhere. +ifneq "$(GhcWithSMP)" "YES" +SRC_HC_OPTS += -optc-DNOSMP +endif }}} but got stage2, which always '''SIGSEGV'''s. Thus it's either incorrect fix or '''UNREG''' is broken. 2. profiling builds (all files with -prof) miss '''enterFunCCS''' declaration: {{{ /tmp/ghc7183_0/ghc7183_1.p_hc: In function 's6Y_entry': /tmp/ghc7183_0/ghc7183_1.p_hc:79:40: error: 'enterFunCCS' undeclared (first use in this function) ghcFunPtr = ((void (*)(void *, void *))enterFunCCS); ^ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8748 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build: threaded RTS, profiling mode -------------------------------------+------------------------------------ Reporter: slyfox | Owner: Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by slyfox): In addition to '''NOSMP''' '''includes/stg/SMP.h''' also contains references to '''WITHSMP''' {{{ #elif !defined(WITHSMP) }}} Are they the same thing? Looks like '''WITHSMP''' is not set anywhere. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8748#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build: threaded RTS, profiling mode -------------------------------------+------------------------------------ Reporter: slyfox | Owner: Type: bug | Status: patch Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by slyfox): * status: new => patch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8748#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build and run with threaded RTS, profiling mode -------------------------------------+------------------------------------ Reporter: slyfox | Owner: Type: bug | Status: patch Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8748#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build and run with threaded RTS, profiling mode -------------------------------------+------------------------------------ Reporter: slyfox | Owner: Type: bug | Status: patch Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by slyfox): With those 3 patches I've managed to get ghci running in --enable- unregisterised mode on amd64. Now ia64 build runs to see if it helps there (it should). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8748#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build and run with threaded RTS, profiling mode -------------------------------------+------------------------------------ Reporter: slyfox | Owner: Type: bug | Status: patch Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by slyfox): Last patch adds missing declarations for hs_popcnt64. It fixes only a warning, but very scary one, as implicit declaration would mean {{{ int hs_popcnt64 (int); }}} Thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8748#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build and run with threaded RTS, profiling mode -------------------------------------+------------------------------------ Reporter: slyfox | Owner: Type: bug | Status: patch Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by slyfox): * version: 7.6.3 => 7.8.1-rc1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8748#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build and run with threaded RTS, profiling mode -------------------------------------+------------------------------------ Reporter: slyfox | Owner: Type: bug | Status: patch Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: 8301 -------------------------------------+------------------------------------ Changes (by trommler): * related: => 8301 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8748#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build and run with threaded RTS, profiling mode -------------------------------------+------------------------------------ Reporter: slyfox | Owner: Type: bug | Status: patch Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: 8301 -------------------------------------+------------------------------------ Changes (by trommler): * cc: ptrommler@… (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8748#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build and run with threaded RTS, profiling mode -------------------------------------+------------------------------------ Reporter: slyfox | Owner: Type: bug | Status: patch Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: 8301 -------------------------------------+------------------------------------ Comment (by slyfox): ghc-7.8.1_rc1-fix-UNREG-system-ffi.patch fixes failure to build working UNREG compiler when you use non-default path to libffi. libdir was already encoded there, but not include dir. Gentoo installs libffi to: /usr/lib64/libffi-3.0.13/ /usr/lib64/libffi-3.0.13/include/ -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8748#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build and run with threaded RTS, profiling mode -------------------------------------+------------------------------------ Reporter: slyfox | Owner: Type: bug | Status: patch Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: 8301 -------------------------------------+------------------------------------ Comment (by slyfox): With minor tweaks I've got ghci on ppc64 running: {{{ timberdoodle ghc-7.8.20140130 # inplace/bin/ghc-stage2 --info [("Project name","The Glorious Glasgow Haskell Compilation System") ,("GCC extra via C opts"," -fwrapv") ,("C compiler command","powerpc64-unknown-linux-gnu-gcc") ,("C compiler flags"," -fno-stack-protector") ,("C compiler link flags","") ,("ld command","/usr/bin/powerpc64-unknown-linux-gnu-ld") ,("ld flags","") ,("ld supports compact unwind","YES") ,("ld supports build-id","YES") ,("ld supports filelist","NO") ,("ld is GNU ld","YES") ,("ar command","/usr/bin/ar") ,("ar flags","q") ,("ar supports at file","YES") ,("touch command","touch") ,("dllwrap command","/bin/false") ,("windres command","/bin/false") ,("libtool command","libtool") ,("perl command","/usr/bin/perl") ,("target os","OSLinux") ,("target arch","ArchPPC_64") ,("target word size","8") ,("target has GNU nonexec stack","True") ,("target has .ident directive","True") ,("target has subsections via symbols","False") ,("Unregisterised","YES") ,("LLVM llc command","llc") ,("LLVM opt command","opt") ,("Project version","7.8.20140130") ,("Booter version","7.4.2") ,("Stage","2") ,("Build platform","powerpc64-unknown-linux") ,("Host platform","powerpc64-unknown-linux") ,("Target platform","powerpc64-unknown-linux") ,("Have interpreter","YES") ,("Object splitting supported","NO") ,("Have native code generator","NO") ,("Support SMP","NO") ,("Tables next to code","NO") ,("RTS ways","l debug thr thr_debug thr_l thr_p dyn debug_dyn thr_dyn thr_debug_dyn l_dyn thr_l_dyn") ,("Support dynamic-too","YES") ,("Support parallel --make","YES") ,("Dynamic by default","NO") ,("GHC Dynamic","YES") ,("Leading underscore","NO") ,("Debug on","False") ,("LibDir","/var/tmp/portage/dev- lang/ghc-7.8.1_rc1/work/ghc-7.8.20140130/inplace/lib") ,("Global Package DB","/var/tmp/portage/dev- lang/ghc-7.8.1_rc1/work/ghc-7.8.20140130/inplace/lib/package.conf.d") ] timberdoodle ghc-7.8.20140130 # inplace/bin/ghc-stage2 --interactive GHCi, version 7.8.20140130: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> 2^128 340282366920938463463374607431768211456 Prelude> }}} The tweak is to build '''compiler/HsExpr.lhs''' as '''ghc --make -O''' instead of '''ghc --make -O2'''. That makes C compiler happy. I think it makes sense to downgrade down to '''-O''' on all UNREG arches, as C cources are already too big to produce code of sane size. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8748#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build and run with threaded RTS, profiling mode -------------------------------------+------------------------------------ Reporter: slyfox | Owner: Type: bug | Status: patch Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: 8301 -------------------------------------+------------------------------------ Comment (by slyfox): Setting compiler option down to -O fixe building of complete dunamic ghc/ghci on powerpc64. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8748#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build and run with
threaded RTS, profiling mode
-------------------------------------+------------------------------------
Reporter: slyfox | Owner:
Type: bug | Status: patch
Priority: high | Milestone: 7.8.1
Component: Compiler | Version: 7.8.1-rc1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets: 8301
-------------------------------------+------------------------------------
Comment (by Austin Seipp

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build and run with
threaded RTS, profiling mode
-------------------------------------+------------------------------------
Reporter: slyfox | Owner:
Type: bug | Status: patch
Priority: high | Milestone: 7.8.1
Component: Compiler | Version: 7.8.1-rc1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets: 8301
-------------------------------------+------------------------------------
Comment (by Austin Seipp

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build and run with
threaded RTS, profiling mode
-------------------------------------+------------------------------------
Reporter: slyfox | Owner:
Type: bug | Status: patch
Priority: high | Milestone: 7.8.1
Component: Compiler | Version: 7.8.1-rc1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets: 8301
-------------------------------------+------------------------------------
Comment (by Austin Seipp

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build and run with
threaded RTS, profiling mode
-------------------------------------+------------------------------------
Reporter: slyfox | Owner:
Type: bug | Status: patch
Priority: high | Milestone: 7.8.1
Component: Compiler | Version: 7.8.1-rc1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets: 8301
-------------------------------------+------------------------------------
Comment (by Austin Seipp

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build and run with
threaded RTS, profiling mode
-------------------------------------+------------------------------------
Reporter: slyfox | Owner:
Type: bug | Status: patch
Priority: high | Milestone: 7.8.1
Component: Compiler | Version: 7.8.1-rc1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets: 8301
-------------------------------------+------------------------------------
Comment (by Austin Seipp

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build and run with
threaded RTS, profiling mode
-------------------------------------+------------------------------------
Reporter: slyfox | Owner:
Type: bug | Status: patch
Priority: high | Milestone: 7.8.1
Component: Compiler | Version: 7.8.1-rc1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets: 8301
-------------------------------------+------------------------------------
Comment (by Austin Seipp

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build and run with threaded RTS, profiling mode -------------------------------------+------------------------------------ Reporter: slyfox | Owner: Type: bug | Status: merge Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.8.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: 8301 -------------------------------------+------------------------------------ Changes (by thoughtpolice): * status: patch => merge -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8748#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8748: ghc-7.8-rc1/HEAD: --enable-unregisterised fails to build and run with threaded RTS, profiling mode -------------------------------------+------------------------------------ Reporter: slyfox | Owner: Type: bug | Status: closed Priority: high | Milestone: 7.8.1 Component: Compiler | Version: 7.8.1-rc1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: 8301 -------------------------------------+------------------------------------ Changes (by thoughtpolice): * status: merge => closed * resolution: => fixed Comment: Merged in 7.8. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8748#comment:19 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC