[GHC] #14889: ghc-HEAD broke cross-compilation on multiple tagets due to --via-asm switch
#14889: ghc-HEAD broke cross-compilation on multiple tagets due to --via-asm switch -------------------------------------+------------------------------------- Reporter: slyfox | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Commit http://git.haskell.org/ghc.git/commitdiff/5f6fcf7808b16d066ad0fb2068225b3f2e... enables '''--via-asm''' for all targets: {{{ ifeq "$(CrossCompiling)" "YES" -SRC_HSC2HS_OPTS_STAGE1 += --cross-compile -SRC_HSC2HS_OPTS_STAGE2 += --cross-compile +# We'll assume we compile with gcc or clang, and both support `-S` and can as such use the +# --via-asm pass, which should be faster and is required for cross compiling to windows, as +# the c compiler complains about non-constant expressions even though they are constant and +# end up as constants in the assembly. +SRC_HSC2HS_OPTS_STAGE1 += --cross-compile --via-asm +SRC_HSC2HS_OPTS_STAGE2 += --cross-compile --via-asm endif }}} But the discussion in original submission https://github.com/haskell/hsc2hs/pull/5 talks about opt-in and mostly x86 assembly support. Before this change targets like sparc were cross-compiling just fine. Now '''sparc-unknown-linux-gnu''' fails as: {{{ hsc2hs: Failed to extract integer CallStack (from HasCallStack): error, called at utils/hsc2hs/CrossCodegen.hs:606:27 in main:CrossCodegen make[1]: *** [libraries/unix/ghc.mk:4: libraries/unix/dist- install/build/System/Posix/Files.hs] Error 1 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14889> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14889: ghc-HEAD broke cross-compilation on multiple tagets due to --via-asm switch -------------------------------------+------------------------------------- Reporter: slyfox | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by angerman): Will look into this tomorrow. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14889#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14889: ghc-HEAD broke cross-compilation on multiple tagets due to --via-asm switch -------------------------------------+------------------------------------- Reporter: slyfox | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by slyfox): More debugging: The command is: {{{ $ "inplace/bin/hsc2hs" '--cc=sparc-unknown-linux-gnu-gcc' '--ld=sparc- unknown-linux-gnu-gcc' --cross-safe --cflag=-O2 --cflag=-pipe --cflag=-Wall --cflag=-fno-stack-protector --cross-compile --via-asm --cflag=-Dsparc_HOST_ARCH --cflag=-Dlinux_HOST_OS --cflag=-D__GLASGOW_HASKELL__=805 '--cflag=-fno-stack-protector' '-- cflag=-O2' '--cflag=-pipe' '--cflag=-Wall' '--cflag=-Ilibraries/ghci/dist- install/build/./autogen' '--cflag=-Ilibraries/ghci/.' '--cflag=-DGHCI' '-- cflag=-I/tmp/portage-tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/libraries/directory/.' '--cflag=-I/tmp/portage- tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/libraries/directory/dist-install/build/.' '-- cflag=-I/tmp/portage-tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/libraries/unix/include' '--cflag=-I/tmp /portage-tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/libraries/unix/dist-install/build/include' '-- cflag=-I/tmp/portage-tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/libraries/unix/dist-install/build/include' '-- cflag=-I/tmp/portage-tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/libraries/unix/dist-install/build/dist- install/build/include' '--cflag=-I/tmp/portage-tmpdir/portage/cross-sparc- unknown-linux-gnu/ghc-9999/work/ghc-9999/libraries/time/lib/include' '-- cflag=-I/tmp/portage-tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/libraries/time/lib/dist-install/build/include' '--cflag=-I/tmp/portage-tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/libraries/time/dist-install/build/lib/include' '--cflag=-I/tmp/portage-tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/libraries/time/dist-install/build/lib/dist- install/build/include' '--cflag=-I/tmp/portage-tmpdir/portage/cross-sparc- unknown-linux-gnu/ghc-9999/work/ghc-9999/libraries/containers/include' '-- cflag=-I/tmp/portage-tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/libraries/containers/dist- install/build/include' '--cflag=-I/tmp/portage-tmpdir/portage/cross-sparc- unknown-linux-gnu/ghc-9999/work/ghc-9999/libraries/containers/dist- install/build/include' '--cflag=-I/tmp/portage-tmpdir/portage/cross-sparc- unknown-linux-gnu/ghc-9999/work/ghc-9999/libraries/containers/dist- install/build/dist-install/build/include' '--cflag=-I/tmp/portage- tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/libraries/bytestring/include' '--cflag=-I/tmp /portage-tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/libraries/bytestring/dist- install/build/include' '--cflag=-I/tmp/portage-tmpdir/portage/cross-sparc- unknown-linux-gnu/ghc-9999/work/ghc-9999/libraries/bytestring/dist- install/build/include' '--cflag=-I/tmp/portage-tmpdir/portage/cross-sparc- unknown-linux-gnu/ghc-9999/work/ghc-9999/libraries/bytestring/dist- install/build/dist-install/build/include' '--cflag=-I/tmp/portage- tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/libraries/base/include' '--cflag=-I/tmp /portage-tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/libraries/base/dist-install/build/include' '-- cflag=-I/tmp/portage-tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/libraries/base/dist-install/build/include' '-- cflag=-I/tmp/portage-tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/libraries/base/dist-install/build/dist- install/build/include' '--cflag=-I/tmp/portage-tmpdir/portage/cross-sparc- unknown-linux-gnu/ghc-9999/work/ghc-9999/libraries/integer-gmp/include' ' --cflag=-I/tmp/portage-tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/libraries/integer-gmp/dist- install/build/include' '--cflag=-I/tmp/portage-tmpdir/portage/cross-sparc- unknown-linux-gnu/ghc-9999/work/ghc-9999/libraries/integer-gmp/dist- install/build/include' '--cflag=-I/tmp/portage-tmpdir/portage/cross-sparc- unknown-linux-gnu/ghc-9999/work/ghc-9999/libraries/integer-gmp/dist- install/build/dist-install/build/include' '--cflag=-I/tmp/portage- tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/rts/dist/build' '--cflag=-I/tmp/portage- tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/includes' '--cflag=-I/tmp/portage- tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/includes/dist-derivedconstants/header' '-- cflag=-Werror=unused-but-set-variable' '--cflag=-Wno-error=inline' '-- lflag=-Wl,-O1' --cflag=-Ilibraries/ghci/dist-install/build/./autogen --cflag=-include --cflag=libraries/ghci/dist- install/build/./autogen/cabal_macros.h libraries/ghci/./GHCi/FFI.hsc -o libraries/ghci/dist-install/build/GHCi/FFI.hs }}} Adding '''-k -v''': {{{ ... libraries/ghci/GHCi/FFI.hsc:111 computing FFI_OK executing: sparc-unknown-linux-gnu-gcc -S -c libraries/ghci/dist- install/build/GHCi/FFI_hsc_test10.c -o libraries/ghci/dist- install/build/GHCi/FFI_hsc_test10.s ... }}} Generated files are: {{{ // FFI_hsc_test10.c #include "/tmp/portage-tmpdir/portage/cross-sparc-unknown-linux- gnu/ghc-9999/work/ghc-9999/inplace/lib/template-hsc.h" #line 9 "FFI.hsc" #include <ffi.h> #line 71 "FFI.hsc" #if defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH) #line 73 "FFI.hsc" #endif extern unsigned long long ___hsc2hs_BOM___; unsigned long long ___hsc2hs_BOM___ = 0x100000000; extern unsigned long long ___hsc2hs_int_test___hsc2hs_sign___; unsigned long long ___hsc2hs_int_test___hsc2hs_sign___ = (FFI_OK) < 0; extern unsigned long long ___hsc2hs_int_test; unsigned long long ___hsc2hs_int_test = (FFI_OK); #line 119 "FFI.hsc" #if defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH) #line 122 "FFI.hsc" #endif }}} {{{ ; FFI_hsc_test10.s .file "FFI_hsc_test10.c" .global ___hsc2hs_int_test .section ".bss" .align 8 .type ___hsc2hs_int_test, #object .size ___hsc2hs_int_test, 8 ___hsc2hs_int_test: .skip 8 .global ___hsc2hs_int_test___hsc2hs_sign___ .align 8 .type ___hsc2hs_int_test___hsc2hs_sign___, #object .size ___hsc2hs_int_test___hsc2hs_sign___, 8 ___hsc2hs_int_test___hsc2hs_sign___: .skip 8 .global ___hsc2hs_BOM___ .section ".data" .align 8 .type ___hsc2hs_BOM___, #object .size ___hsc2hs_BOM___, 8 ___hsc2hs_BOM___: .long 1 .long 0 .ident "GCC: (Gentoo 7.2.0-r1 p1.1) 7.2.0" .section .note.GNU-stack,"",@progbits }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14889#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14889: ghc-HEAD broke cross-compilation on multiple tagets due to --via-asm switch -------------------------------------+------------------------------------- Reporter: slyfox | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by slyfox): * cc: hvr, bgamari (added) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14889#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14889: ghc-HEAD broke cross-compilation on multiple tagets due to --via-asm switch -------------------------------------+------------------------------------- Reporter: slyfox | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by slyfox): Meanwhile I've added example outputs for a few targets here: https://github.com/haskell/hsc2hs/pull/7 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14889#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14889: ghc-HEAD broke cross-compilation on multiple tagets due to --via-asm switch -------------------------------------+------------------------------------- Reporter: slyfox | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): angerman, did anything ever happen here? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14889#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14889: ghc-HEAD broke cross-compilation on multiple tagets due to --via-asm switch -------------------------------------+------------------------------------- Reporter: slyfox | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.5 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed * milestone: => 8.6.1 Comment: Fixed by 1ecbe9ccb10f42dc5b133ffb2c7b1e9247b1ba52. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14889#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC