[GHC] #7799: Assembly error while building GHC 7.7

#7799: Assembly error while building GHC 7.7
--------------------------------+-------------------------------------------
Reporter: Iceland_jack | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler (FFI)
Version: 7.7 | Keywords:
Os: Unknown/Multiple | Architecture: x86
Failure: Building GHC failed | Blockedby:
Blocking: | Related:
--------------------------------+-------------------------------------------
While building GHC 7.7 (after running `make') I got this error message:
{{{
$ "inplace/bin/ghc-stage1" -keep-tmp-files -hisuf dyn_hi -osuf dyn_o
-hcsuf dyn_hc -fPIC -dynamic -H64m -O0 -fasm -package-name
base-4.7.0.0 -hide-all-packages -i -ilibraries/base/. -ilibraries/base
/dist-install/build -ilibraries/base/dist-install/build/autogen
-Ilibraries/base/dist-install/build -Ilibraries/base/dist-
install/build/autogen -Ilibraries/base/include -optP-
DOPTIMISE_INTEGER_GCD_LCM -optP-include -optPlibraries/base/dist-
install/build/autogen/cabal_macros.h -package ghc-prim-0.3.1.0 -package
integer-gmp-0.5.1.0 -package rts-1.0 -package-name base -XHaskell98 -XCPP
-O -fasm -no-user-package-db -rtsopts -odir libraries/base/dist-
install/build -hidir libraries/base/dist-install/build -stubdir
libraries/base/dist-install/build -c
libraries/base/./System/Posix/Internals.hs -o libraries/base/dist-
install/build/System/Posix/Internals.dyn_o

#7799: Assembly error while building GHC 7.7 --------------------------------+------------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Component: Compiler (FFI) Version: 7.7 | Keywords: Os: Unknown/Multiple | Architecture: x86 Failure: Building GHC failed | Blockedby: Blocking: | Related: --------------------------------+------------------------------------------- Comment(by thorkilnaur): I get the same error with my: {{{ $ uname -a Linux tn24 3.2.0-39-generic #62-Ubuntu SMP Wed Feb 27 22:05:17 UTC 2013 i686 i686 i386 GNU/Linux $ ghc --version The Glorious Glasgow Haskell Compilation System, version 7.4.2 $ gcc --version gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ }}} I have tried running the failing assmbly by hand with -E: {{{ $ '/usr/bin/gcc' '-fno-stack-protector' '-DTABLES_NEXT_TO_CODE' '-Ilibraries/base/dist-install/build' '-Ilibraries/base/dist- install/build' '-Ilibraries/base/dist-install/build/autogen' '-Ilibraries/base/include' '-x' 'assembler-with-cpp' -E '-c' '/home/tn/tn/GHCGitRepository/ghc/delete/ghc1351_0/ghc1351_3.s' }}} The resulting output contains: {{{ call 1 .get_pc_thunk.bx }}} This is in agreement with http://sourceware.org/bugzilla/show_bug.cgi?id=411 that describes problems caused by the name {{{__i686}}} unexpectedly being defined as a macro by {{{gcc}}}. As a temporary fix, adding {{{ SRC_HC_OPTS += -opta-U__i686 }}} to {{{mk/build.mk}}} enables the build to proceed. Best regards Thorkil -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7799#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7799: Assembly error while building GHC 7.7 -------------------------------+-------------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (FFI) | Version: 7.7 Keywords: | Os: Unknown/Multiple Architecture: x86 | Failure: Building GHC failed Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | -------------------------------+-------------------------------------------- Changes (by igloo): * difficulty: => Unknown Comment: Thanks for the link, Thorkil. Could you test whether instead changing all 4 instances of `__i686` in `compiler/nativeGen/PIC.hs` to `__x86` works, please? -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7799#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7799: Assembly error while building GHC 7.7 -------------------------------+-------------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (FFI) | Version: 7.7 Keywords: | Os: Unknown/Multiple Architecture: x86 | Failure: Building GHC failed Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | -------------------------------+-------------------------------------------- Comment(by thorkilnaur): Replying to [comment:2 igloo]:
Could you test whether instead changing all 4 instances of `__i686` in `compiler/nativeGen/PIC.hs` to `__x86` works, please?
I have tried that (where, by the way, {{{___i686}}} in {{{compiler/nativeGen/PIC.hs}}} is with three leading underscores) but, unfortunately, it didn't help. And, in fact, the curious fact seems to be that the code that {{{gcc}}}, the asssembler, complains about has been generated by {{{gcc}}}, the C compiler. In an attempt to clarify, I ran the failing compile like this: {{{ $ "inplace/bin/ghc-stage1" -hisuf hi -osuf o -hcsuf hc -static -H32m -O -package-name base-4.7.0.0 -hide-all-packages -i -ilibraries/base/. -ilibraries/base/dist-install/build -ilibraries/base/dist- install/build/autogen -Ilibraries/base/dist-install/build -Ilibraries/base /dist-install/build/autogen -Ilibraries/base/include -optP- DOPTIMISE_INTEGER_GCD_LCM -optP-include -optPlibraries/base/dist- install/build/autogen/cabal_macros.h -package ghc-prim-0.3.1.0 -package integer-gmp-0.5.1.0 -package rts-1.0 -package-name base -XHaskell98 -XCPP -O2 -no-user-package-db -rtsopts -odir libraries/base/dist- install/build -hidir libraries/base/dist-install/build -stubdir libraries/base/dist-install/build -split-objs -dynamic-too -c libraries/base/./System/Posix/Internals.hs -o libraries/base/dist- install/build/System/Posix/Internals.o -dyno libraries/base/dist- install/build/System/Posix/Internals.dyn_o -v -tmpdir T7799-tmpdir -keep- tmp-files > T7799-tmpdir/ghc_T7799.out 2>&1 }}} I will attach {{{T7799-tmpdir.tar.gz}}}, the contents of the resulting {{{T7799-tmpdir}}} directory. For convenience, this contains much which is similar to the original report. {{{T7799-tmpdir/ghc_T7799.out}}} contains {{{ *** C Compiler: '/usr/bin/gcc' '-fno-stack-protector' '-DTABLES_NEXT_TO_CODE' '-x' 'c' 'T7799-tmpdir/ghc26404_0/ghc26404_1.c' '-o' 'T7799-tmpdir/ghc26404_0/ghc26404_2.s' '-fPIC' '-U __PIC__' '-D__PIC__' '-Wimplicit' '-S' '-O2' '-D__GLASGOW_HASKELL__=707' '-I' 'libraries/base /dist-install/build' '-I' 'libraries/base/dist-install/build' '-I' 'libraries/base/dist-install/build/autogen' '-I' 'libraries/base/include' '-I' '/home/tn/tn/GHCGitRepository/ghc/rts/dist/build' '-I' '/home/tn/tn/GHCGitRepository/ghc/includes' '-I' '/home/tn/tn/GHCGitRepository/ghc/includes/dist-derivedconstants/header' *** Assembler: '/usr/bin/gcc' '-fno-stack-protector' '-DTABLES_NEXT_TO_CODE' '-Ilibraries/base/dist-install/build' '-Ilibraries/base/dist- install/build' '-Ilibraries/base/dist-install/build/autogen' '-Ilibraries/base/include' '-x' 'assembler-with-cpp' '-c' 'T7799-tmpdir/ghc26404_0/ghc26404_2.s' '-o' 'T7799-tmpdir/ghc26404_0/ghc26404_0.dyn_o' ghc26404_1.c: Assembler messages: ghc26404_1.c:138:0: Error: junk `.get_pc_thunk.bx' after expression ... }}} Although the assembler error report mentions the file {{{ghc26404_1.c}}}, it can be seen that the complaints actually concerns the contents of {{{ghc26404_2.s}}}. Confirming this {{{ $ head -138 T7799-tmpdir/ghc26404_0/ghc26404_2.s | tail -1 call __i686.get_pc_thunk.bx $ }}} where the complaint is caused by the replacement shown earlier of "{{{__i686}}}" by "{{{1 }}}". Best regards Thorkil -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7799#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7799: Assembly error while building GHC 7.7 -------------------------------+-------------------------------------------- Reporter: Iceland_jack | Owner: igloo Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: Compiler (FFI) | Version: 7.7 Keywords: | Os: Unknown/Multiple Architecture: x86 | Failure: Building GHC failed Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | -------------------------------+-------------------------------------------- Changes (by igloo): * owner: => igloo * priority: normal => high * milestone: => 7.8.1 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7799#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7799: Assembly error while building GHC 7.7
-------------------------------+--------------------------------------------
Reporter: Iceland_jack | Owner: igloo
Type: bug | Status: new
Priority: high | Milestone: 7.8.1
Component: Compiler (FFI) | Version: 7.7
Keywords: | Os: Unknown/Multiple
Architecture: x86 | Failure: Building GHC failed
Difficulty: Unknown | Testcase:
Blockedby: | Blocking:
Related: |
-------------------------------+--------------------------------------------
Comment(by ian@…):
commit bf6854bb44f833ec331e2f2c55a825dbaaa2aeec
{{{
Author: Ian Lynagh

#7799: Assembly error while building GHC 7.7 ----------------------------------+----------------------------------------- Reporter: Iceland_jack | Owner: igloo Type: bug | Status: closed Priority: high | Milestone: 7.8.1 Component: Compiler (FFI) | Version: 7.7 Resolution: fixed | Keywords: Os: Unknown/Multiple | Architecture: x86 Failure: Building GHC failed | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ----------------------------------+----------------------------------------- Changes (by igloo): * status: new => closed * resolution: => fixed Comment: Hmm, thanks Thorkil; very curious. I can't reproduce it here, but the above patch should fix it. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7799#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7799: Assembly error while building GHC 7.7
----------------------------------+-----------------------------------------
Reporter: Iceland_jack | Owner: igloo
Type: bug | Status: closed
Priority: high | Milestone: 7.8.1
Component: Compiler (FFI) | Version: 7.7
Resolution: fixed | Keywords:
Os: Unknown/Multiple | Architecture: x86
Failure: Building GHC failed | Difficulty: Unknown
Testcase: | Blockedby:
Blocking: | Related:
----------------------------------+-----------------------------------------
Comment(by ian@…):
commit 12276005b0d72853671b7b2d3f2b0e9cbb44c153
{{{
Author: Ian Lynagh
participants (1)
-
GHC