Fix mismatched visibility of StgRun
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/libHSrts_debug-ghc7.7.20130402.so /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: https://gist.github.com/phonohawk/5308015 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.
From Gabor Greif:
Thanks a lot! This worked, but now we have the libffi-related problem on install: /home/ggreif/lib/ghc-7.7.20130403/bin/ghc-pkg: error while loading shared libraries: libHSterminfo-0.3.2.5-ghc7.7.20130403.so: cannot open shared object file: No such file or directory make: *** [install_packages] Error 127 This is described in another mail thread, so I'll relax now.
My patch is to change the visibility of
StgReturn for each and every platforms, but I've only tested it on my NetBSD/amd64, Linux/x86_64 and FreeBSD/i386 boxes. I hope I've not broken other platforms namely Darwin/i386, Darwin/x86_64, Darwin/PPC32, Linux/PPC32, Linux/PPC64, Linux/ARM, iOS/ARM and Sparc.