[nhc-bugs] build failure

Ian Lynagh igloo at earth.li
Sat Jun 12 22:42:49 EDT 2004


On Wed, Apr 14, 2004 at 12:05:40PM +0000, Andres Loeh wrote:
> 
[...]
> /var/tmp/portage/nhc98-1.16-r1/work/nhc98-1.16/script/nhc98 -cpp -c +CTS -lib  -redefine -CTS   +RTS -H32M -RTS -o /var/tmp/portage/nhc98-1.16-r1/work/nhc98-1.16/targets/ix86-Linux/obj/prelude/DErrNo/DErrNo.o DErrNo.hs
> /var/tmp/portage/nhc98-1.16-r1/work/nhc98-1.16/script/nhc98: line 605: 10142 Segmentation fault      $COMP $RUNFLAGS $COMPFLAGS $HINCDIRS -I. $UNLIT -P${NHC98INCDIR} $HSFILE $POSTGRFILE $TMPHIFILE $TMPCPPASFILE
> make[1]: *** [/var/tmp/portage/nhc98-1.16-r1/work/nhc98-1.16/targets/ix86-Linux/obj/prelude/DErrNo/DErrNo.o] Error 1
> make[1]: Leaving directory `/var/tmp/portage/nhc98-1.16-r1/work/nhc98-1.16/src/prelude/ix86-Linux/NHC'
> make: *** [targets/ix86-Linux/compiler-gcc] Error 2

I've just had a quick look at this. Between 3.2 and 3.3 gcc seems to
have changed from generating

-----
        .file   "DErrNo.hc"
        .data
        .align 4
        .type   startLabel, at object
        .size   startLabel,0
startLabel:
.globl C0_NHC_46DErrNo_46ERANGE
        .align 4
-----

to generating

-----
        .file   "DErrNo.hc"
        .local  startLabel
        .comm   startLabel,0,4
.globl C0_NHC_46DErrNo_46ERANGE
        .data
        .align 4
-----

It looks like nhc uses offsets from startLabel but (IANA assembler
expert) startLabel is now common to all such files linked together and
will now probably be created at some other location (hmm, or perhaps
nowhere at all if it is 0 size everywhere?)

An (extremely ugly) solution is to add

		perl -e 'undef $/; $_ = <>; s/^\s*\.local\s+startLabel\n\s*.comm\s+startLabel,0,4\n\s*\.globl\s+([^\n]+)\n\s*\.data/\t.data\n\t.align 4\n\t.type   startLabel,\@object\n\t.size   startLabel,0\nstartLabel:\n.globl $1/m; print' |

above the line

		sed -e '/.align 32/s/32/4/' >$TMPASFILE     # evil mangler!

in script/nhc98.inst

I'm not sure if removing the last .data is necessary; the hack is
marginally less ugly if not.

This seems to work for me. Better (or even just prettier  :-)  )
solutions welcomed.


Thanks
Ian



More information about the Nhc-bugs mailing list