[GHC] #10402: powerpc: unhandled ELF relocation(RelA) type 252
GHC
ghc-devs at haskell.org
Tue Jun 16 20:49:10 UTC 2015
#10402: powerpc: unhandled ELF relocation(RelA) type 252
-----------------------------------+-----------------------------------
Reporter: cjwatson | Owner: simonmar
Type: bug | Status: patch
Priority: normal | Milestone: 7.10.2
Component: Runtime System | Version: 7.8.4
Resolution: | Keywords:
Operating System: Linux | Architecture: powerpc
Type of failure: Runtime crash | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Revisions:
-----------------------------------+-----------------------------------
Comment (by slyfox):
Replying to [comment:8 nomeata]:
> > Does debian disable dynamic GHC by default as `DYNAMIC_GHC_PROGRAMS =
NO`?
>
> No (`ldd /usr/lib/ghc/bin/ghc` lists various `libHS...` libraries).
Do I do something incorrectly? (or the test was on non-powerpc?)
{{{
# debootstrap --arch=powerpc --include=ghc unstable .
# chroot .
# ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.4
# ldd /usr/lib/ghc/bin/ghc
linux-vdso32.so.1 (0x00100000)
libtinfo.so.5 => /lib/powerpc-linux-gnu/libtinfo.so.5 (0x0ffaf000)
librt.so.1 => /lib/powerpc-linux-gnu/librt.so.1 (0x0ff86000)
libutil.so.1 => /lib/powerpc-linux-gnu/libutil.so.1 (0x0ff63000)
libdl.so.2 => /lib/powerpc-linux-gnu/libdl.so.2 (0x0ff3f000)
libpthread.so.0 => /lib/powerpc-linux-gnu/libpthread.so.0
(0x0ff04000)
libgmp.so.10 => /usr/lib/powerpc-linux-gnu/libgmp.so.10
(0x0fe69000)
libm.so.6 => /lib/powerpc-linux-gnu/libm.so.6 (0x0fd93000)
libffi.so.6 => /usr/lib/powerpc-linux-gnu/libffi.so.6 (0x0fd6a000)
libc.so.6 => /lib/powerpc-linux-gnu/libc.so.6 (0x0fbcb000)
/lib/ld.so.1 (0x2052a000)
# ghc --info | grep -i dyn
,("Support dynamic-too","YES")
,("Dynamic by default","NO")
,("GHC Dynamic","NO")
}}}
It's not able to handle PIC:
{{{
// cat a.c
#include <stdio.h>
void ffi_a_hello (int i) {
fprintf (stderr, "WEEEEEEEE: i=%d\n", i);
}
-- cat A.hs
{-# LANGUAGE ForeignFunctionInterface #-}
module A where
import Foreign.C
foreign import ccall "ffi_a_hello" a :: CInt -> IO ()
# ghc -fPIC -c a.c -fforce-recomp
# ghc -fPIC -c A.hs -fforce-recomp
# ghci --interactive ./a.o A
GHCi, version 7.8.4: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading object (static) a.o ... done
final link ... done
[1 of 1] Compiling A ( A.hs, interpreted ) [flags changed]
Ok, modules loaded: A.
*A> a 42
Segmentation fault
}}}
Non-PIC is fine, but it does not contain PLT-style relocations:
{{{
# ghc -c a.c -fforce-recomp
# ghc -c A.hs -fforce-recomp
# ghci --interactive ./a.o A
GHCi, version 7.8.4: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading object (static) a.o ... done
final link ... done
[1 of 1] Compiling A ( A.hs, interpreted ) [flags changed]
Ok, modules loaded: A.
*A> a 42
WEEEEEEEE: i=42
*A>
Leaving GHCi.
# objdump -d -r a.o | grep PLT
# objdump -d -r A.o | grep PLT
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10402#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list