Skip to content

cross-endian GHC generates invalid .hi files

I've reproduced the bug in the following setup:

./configure \
    --enable-unregisterised \
    --host=x86_64-pc-linux-gnu \
    --target=m68k-unknown-linux-gnu

m68k is a 32-bit big-endian machine.

$ LD_BIND_NOW=1 inplace/bin/ghc-stage2 --show-iface libraries/base/dist-install/build/System/IO.hi
Magic: Wanted 129742,
       got    3472490752
magic number mismatch: old/corrupt interface file? (wanted 129742, got 3472490752)

$ printf "%08X - %08X\n" 129742 3472490752
0001FACE - CEFA0100

Reverting changeset:fbcef83a restores .hi loading and ghc-stage2.

I'm still not sure what exactly breaks.

WORDS_BIGENDIAN looks suspicious.

I guess it breaks ghc-stage1 endianness understanding.

Trac metadata
Trac field Value
Version 8.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information