[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: jessie for x32



On Sun, Feb 22, 2015 at 11:59:17PM +0100, Adam Borowski wrote:
> On Sun, Feb 22, 2015 at 05:00:30PM +0000, Colin Watson wrote:
> > the simplest procedure I've found involves going via 7.8 (yes, really). 
> > But I bootstrapped ghc successfully that way on arm64 and ppc64el, and I
> > can probably remember enough of how I did it to put it together for x32 as
> > well.  I'll give it a shot and let you know.
> 
> Would be nice.

It does in fact require at least a bit of porting.  A "straightforward"
attempt to bootstrap GHC 7.8 results in generating bogus HC code with
broken constants such as 0xU, which the C compiler then of course
rejects.  I tried telling it that x32 is a different architecture to
rule out pointer-length assumptions in GHC's specialised code to support
x86_64 (although --enable-unregisterised should have disabled all that),
and still got much the same error:

  "inplace/bin/ghc-stage1" -hisuf hi -osuf  o -hcsuf hc -static  -H64m -O0    -package-name base-4.7.0.2 -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-include -optPlibraries/base/dist-install/build/autogen/cabal_macros.h -package ghc-prim-0.3.1.0 -package integer-simple-0.1.1.0 -package rts-1.0 -package-name base -XHaskell2010 -O  -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/./GHC/Float.lhs -o libraries/base/dist-install/build/GHC/Float.o
  
  /tmp/ghc8465_0/ghc8465_3.hc:10758:44:
       error: invalid suffix "xU" on integer constant
       (W_)&ghczmprim_GHCziTypes_Fzh_static_info, 0xU
                                                  ^
  
  /tmp/ghc8465_0/ghc8465_3.hc:10947:46:
       error: invalid suffix "xU" on integer constant
       (W_)&ghczmprim_GHCziTypes_Dzh_static_info, (-0xU), 0x0
                                                    ^
  
  /tmp/ghc8465_0/ghc8465_3.hc:10947:45:
       error: wrong type argument to unary minus
       (W_)&ghczmprim_GHCziTypes_Dzh_static_info, (-0xU), 0x0
                                                   ^
  
  /tmp/ghc8465_0/ghc8465_3.hc:10947:1:
       error: initializer element is not constant
       (W_)&ghczmprim_GHCziTypes_Dzh_static_info, (-0xU), 0x0
       ^
  
  /tmp/ghc8465_0/ghc8465_3.hc:10947:1:
       error: (near initialization for 'base_GHCziFloat_zdfNumDouble2_closure[1]')
  
  /tmp/ghc8465_0/ghc8465_3.hc:10951:44:
       error: invalid suffix "xU" on integer constant
       (W_)&ghczmprim_GHCziTypes_Dzh_static_info, 0xU, 0x0
                                                  ^
  
  /tmp/ghc8465_0/ghc8465_3.hc:10951:1:
       error: initializer element is not constant
       (W_)&ghczmprim_GHCziTypes_Dzh_static_info, 0xU, 0x0
       ^
  
  /tmp/ghc8465_0/ghc8465_3.hc:10951:1:
       error: (near initialization for 'base_GHCziFloat_zdfNumDouble1_closure[1]')
  libraries/base/ghc.mk:4: recipe for target 'libraries/base/dist-install/build/GHC/Float.o' failed

The compiler isn't totally broken, because it managed to compile a
number of other files before this point.  The C-- that generates the bad
C code here looks like this:

  [section "data" {
       GHC.Float.$fNumDouble2_closure:
           const GHC.Types.D#_static_info;
           const -1.0 :: W64;
   }]
  
  [section "data" {
       GHC.Float.$fNumDouble1_closure:
           const GHC.Types.D#_static_info;
           const 1.0 :: W64;
   }]

Adding a bit of debugging, pprHexVal is being asked to render
0x4010000000000000 as a 32-bit wide integer, which is clearly bogus.  So
I think something is wrong with the floatToWords / doubleToWords
machinery.  But, for the moment, I have work to do ...

-- 
Colin Watson                                       [cjwatson@debian.org]


Reply to: