Linker error in stage2

PHO pho at
Thu Apr 4 10:32:59 CEST 2013

From: Gabor Greif <ggreif at>
Subject: Linker error in stage2
Date: Wed, 3 Apr 2013 11:42:08 +0200

> I am getting linker errors when bootstrapping HEAD with a recent
> v7.7-20130220 GHC. This is a RHEL5 system:
> "inplace/bin/ghc-stage1" -package-name rts -shared -dynamic -dynload
> deploy -no-auto-link-packages -Lrts/dist/build -lffi  -optl-Wl,-rpath
> -optl-Wl,'$ORIGIN' `cat rts/libs.depend`
> <<snip>>
> rts/dist/build/AutoApply.debug_dyn_o  -o
> rts/dist/build/
> /usr/bin/ld: rts/dist/build/Schedule.dyn_o: relocation R_X86_64_PC32
> against `StgRun' can not be used when making a shared object;
> recompile with -fPIC
> /usr/bin/ld: final link failed: Bad value
> collect2: ld returned 1 exit status

The old binutils comes with RHEL5 fails to link a shared library if
there is a reference to a hidden symbol that isn't locally
defined. See:

Personally I don't think this is an old binutils' fault, because the
newer one is essentially turning an otherwise global symbol to a local
one depending on its call site, which feels rather wrong to me.

The attached patch should fix the problem anyway.

 - PHO -               
OpenPGP public key: 1024D/1A86EF72
Fpr: 5F3E 5B5F 535C CE27 8254  4D1A 14E7 9CA7 1A86 EF72

More information about the ghc-devs mailing list