aboutsummaryrefslogblamecommitdiffstats
path: root/community/ocaml/fix-segfault-in-ppc64le.patch
blob: 81c837079cc5e682ad0f3c8764e52beea2700e3f (plain) (tree)





















                                                                                                         
                               

                                
                        
                                                 
           
                          

                                     
Compile ocaml natives with -no-pie flag as a workaround for some problem
with dynamic loader.

ocaml builds fine on ppc64le, but when I try to use ocamlc, I'm getting
a segfault.

Gdb backtrace shows:

    #0 0x00003fffb7fad710 in do_relocs (dso=0x3fffb7ff26a0 <app>, rel=0x200ab4b8, rel_size=2495088,
        stride=3) at ldso/dynlink.c:379
    #1 0x00003fffb7fae1ec in reloc_all (p=0x3fffb7ff26a0 <app>) at ldso/dynlink.c:1195
    #2 0x00003fffb7fafc94 in __dls3 (sp=<optimized out>) at ldso/dynlink.c:1638
    0000003 0x00003fffb7faf3d4 in __dls2 (base=<optimized out>, sp=0x3ffffffffba0) at ldso/dynlink.c:1424
    0000004 0x00003fffb7facd2c in _dlstart_c (sp=<optimized out>, dynv=<optimized out>)
        at ldso/dlstart.c:147
    0000005 0x00003fffb7fb1104 in _dlstart () from /lib/ld-musl-powerpc64le.so.1

Upstream-Issue: https://caml.inria.fr/mantis/view.php?id=7562.

--- a/configure
+++ b/configure
@@ -867,6 +867,9 @@
       sharedcccompopts="-fPIC"
       mksharedlib="$cc -shared"
       ldflags="$ldflags -Wl,-E"
+      case "$target" in
+        powerpc64le*) ldflags="$ldflags -no-pie"
+      esac
       rpath="-Wl,-rpath,"
       mksharedlibrpath="-Wl,-rpath,"
       natdynlinkopts="-Wl,-E"