6.4.2 release plans

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Tue Mar 21 18:31:34 EST 2006

On Wed, 2006-03-15 at 16:24 +0000, Simon Marlow wrote:

> If you have anything else for 6.4.2, please let me know.

Chris Parrott found that ghc-6.4.1 doesn't work with gcc 4.1 on amd64,
although it does work on x86.

The error manifests itself as link errors due to undefined symbols:

/var/tmp/portage/ghc-6.4.1-r2/work/ghc-6.4.1/ghc/rts/libHSrts.a(Linker.o):(.data+0x48): undefined reference to `StgReturn'
/var/tmp/portage/ghc-6.4.1-r2/work/ghc-6.4.1/ghc/rts/libHSrts.a(RtsStartup.o): In function `hs_add_root':
RtsStartup.c:(.text+0x1a8): undefined reference to `StgRun'

Chris found that the problem is that gcc 4.1 is noticing that
StgRunIsImplementedInAssembler is not actually used anywhere. It is in
inline assembly in StgRunIsImplementedInAssembler that the global
symbols StgRun and StgReturn are being defined. This is why it works on
x86 and not on amd64, because on x86 it uses StgRun rather than
StgRunIsImplementedInAssembler so the function (and the global syms
defined therein) are not discarded.

So the solution is to get gcc to not discard the function by using the
gcc __attribute__((used)). To make this portable we use the existing
GNUC3_ATTRIBUTE macro, so it's: GNUC3_ATTRIBUTE(used).

The patch we are using in the Gentoo ebuild is here:


This patch fixes it for amd64, ppc linux, ppc64 and ia64. The patch
doesn't touch ppc darwin, we'll leave that to the judgement of someone
else but it's probably required for gcc-4.1 on darwin too. We've tested
it on amd64 linux & x86 linux with gcc-4.1 and gcc-4.0.2 so far. We're
testing gcc 3.4.x next. There should not be much chance of breakage
since for earlier gccs it should be a noop.

The gcc attribute 'unused' is already being used in Adjustor.c for x86
and amd64. (Actually the 'used' attribute is only available in gcc 3.1
and later. Presumably nobody uses gcc 3.0.x or they would have found
this problem earlier.)

It'd be nice if this were included for ghc-6.4.2 since gcc-4.1.x will
probably become common during the lifespan of the ghc-6.4.2 release.


More information about the Glasgow-haskell-users mailing list