Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#7799 closed bug (fixed)

Assembly error while building GHC 7.7

Reported by: Iceland_jack Owned by: igloo
Priority: high Milestone: 7.8.1
Component: Compiler (FFI) Version: 7.7
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: x86
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

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 
<braries/base/dist-install/build/System/Posix/Internals.dyn_o 
ghc23405_0.c: Assembler messages:

ghc23405_0.c:127:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:153:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:181:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:207:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:235:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:261:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:285:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:311:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:339:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:367:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:393:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:421:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:449:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:477:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:505:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:525:0:
     Error: junk at end of line, first unrecognized character is `1'

ghc23405_0.c:526:0:
     Error: junk at end of line, first unrecognized character is `1'

ghc23405_0.c:527:0:  Error: Missing symbol name in directive

ghc23405_0.c:527:0:
     Error: junk at end of line, first unrecognized character is `1'

ghc23405_0.c:528:0:  Error: Missing symbol name in directive
[1] baldur@baldur-lappi:~/ghc> "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 
<braries/base/dist-install/build/System/Posix/Internals.dyn_o 
ghc23405_0.c: Assembler messages:

ghc23405_0.c:127:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:153:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:181:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:207:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:235:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:261:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:285:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:311:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:339:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:367:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:393:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:421:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:449:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:477:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:505:0:
     Error: junk `.get_pc_thunk.bx' after expression

ghc23405_0.c:525:0:
     Error: junk at end of line, first unrecognized character is `1'

ghc23405_0.c:526:0:
     Error: junk at end of line, first unrecognized character is `1'

ghc23405_0.c:527:0:  Error: Missing symbol name in directive

ghc23405_0.c:527:0:
     Error: junk at end of line, first unrecognized character is `1'

ghc23405_0.c:528:0:  Error: Missing symbol name in directive

ghc23405_0.c:528:0:
     Error: junk at end of line, first unrecognized character is `.'

ghc23405_0.c:529:0:
     Error: junk at end of line, first unrecognized character is `1'

ghc23405_0.c:528:0:
     Error: junk at end of line, first unrecognized character is `.'

ghc23405_0.c:529:0:
     Error: junk at end of line, first unrecognized character is `1'

Attachments (4)

ghc23405_0.c (3.3 KB) - added by Iceland_jack 2 years ago.
ghc23405_0.s.tar.gz (26.1 KB) - added by Iceland_jack 2 years ago.
ghc23405_1.s (15.3 KB) - added by Iceland_jack 2 years ago.
T7799-tmpdir.tar.gz (106.9 KB) - added by thorkilnaur 2 years ago.

Download all attachments as: .zip

Change History (11)

Changed 2 years ago by Iceland_jack

Changed 2 years ago by Iceland_jack

Changed 2 years ago by Iceland_jack

comment:1 Changed 2 years ago 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

comment:2 follow-up: Changed 2 years ago by igloo

  • difficulty set to Unknown

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?

comment:3 in reply to: ↑ 2 Changed 2 years ago by thorkilnaur

Replying to 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

Changed 2 years ago by thorkilnaur

comment:4 Changed 2 years ago by igloo

  • Milestone set to 7.8.1
  • Owner set to igloo
  • Priority changed from normal to high

comment:5 Changed 2 years ago by ian@…

commit bf6854bb44f833ec331e2f2c55a825dbaaa2aeec

Author: Ian Lynagh <[email protected]>
Date:   Sun May 19 16:38:37 2013 +0100

    Fix build problem: Error: junk `.get_pc_thunk.bx' after expression; trac #7799
    
    Affects i386 only. Some gcc's generate code containing __i686, and then
    define that symbol to 1, which causes compilation to fail. We undef
    the symbol to work around it.

 aclocal.m4 |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

comment:6 Changed 2 years ago by igloo

  • Resolution set to fixed
  • Status changed from new to closed

Hmm, thanks Thorkil; very curious.

I can't reproduce it here, but the above patch should fix it.

comment:7 Changed 2 years ago by ian@…

commit 12276005b0d72853671b7b2d3f2b0e9cbb44c153

Author: Ian Lynagh <[email protected]>
Date:   Mon May 20 14:05:55 2013 +0100

    Need to work around #7799 on all i386 platforms, not just Darwin

 aclocal.m4 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Note: See TracTickets for help on using tickets.