Problems building GHC 6.0 with gcc 3.3

Ian Lynagh
Sun, 8 Jun 2003 13:40:42 +0100

I'm having problems building GHC 6.0 with GCC 3.3. I've fixed a couple
of problems with comments in CPP macros as seen elsewhere, and then
everything seemed to be going fine until it came to create
stage2/ghc-6.0 and it failed with a huge number of things like

stage2/utils/Util.o(.text+0xb8): In function `r4c8_entry':
: undefined reference to `GHCziBase_True_closure'
stage2/utils/Util.o(.text+0xc8): In function `r4c8_entry':
: undefined reference to `GHCziBase_False_closure'

In fact, even building hello world with stage1/ghc-inplace failed,
starting with

./Foo.o(.text+0x28): In function `sxG_srt':
: undefined reference to `GHCziBase_unpackCStringzh_closure'
./Foo.o(.text+0x85): In function `sxG_entry':
: undefined reference to `GHCziBase_unpackCStringzh_closure'
In function `__stginit_Prelude_':
: undefined reference to `_module_registered'
In function `__stginit_Prelude_':
: undefined reference to `_module_registered'

Looking at the first of these I discovered that the split libraries
thought that GHCziBase_unpackCStringzh_closure is a local symbol, so ld
-x was discarding it.

$ ghc6-6.0/ghc/driver/split/ghc-split Base.split_s Base.split Base.split
$ gcc -c -o Base.o Base.s
$ gcc -c -o Base__131.o Base.split__131.s
$ objdump -t Base.o | grep GHCziBase_unpackCStringzh_closure
00000378 g     O .data  00000004 GHCziBase_unpackCStringzh_closure
$ objdump -t Base__131.o | grep GHCziBase_unpackCStringzh_closure
00000000 l       .data  00000000 GHCziBase_unpackCStringzh_closure

Compiling these files with gcc 2.95 has the same problem.
I'm out of my depth here, but I would guess the assembler generated has
changed and the evil mangler now goes wrong?

I've put the GHC build log, the result of compiling hello world with -v,
Base.s, Base.split_s, Base.split, Base.split__131.s at