|Anonymous | Login | Signup for a new account||2017-11-20 12:22 CET|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0007562||OCaml||back end (clambda to assembly)||public||2017-06-22 18:21||2017-10-20 16:21|
|Platform||ppc64le||OS||Alpine Linux||OS Version||3.6.2|
|Target Version||Fixed in Version|
|Summary||0007562: Ocamlc got segfault in Alpine ppc64le|
|Description||I'm building ocaml in Alpine Linux ppc64le and it builds fine. 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>)
0000005 0x00003fffb7fb1104 in _dlstart () from /lib/ld-musl-powerpc64le.so.1
I know that ocaml was recently ported to ppc64le architecture and works fine with glic, but seems there is an issue with musl.
|Steps To Reproduce||The steps bellow need to be done inside an Alpine ppc64le:|
- Clone aports repository
$ git clone https://github.com/alpinelinux/aports.git [^]
- Build ocaml package
$ cd aports/community/ocaml
$ abuild -r
- Install the built package:
$ sudo apk add <ocaml_apk>
- Run ocamlc to get the segmentation fault.
|Tags||No tags attached.|
The OCaml version seems to be 4.04.1 ( https://github.com/alpinelinux/aports/blob/master/community/ocaml/APKBUILD [^] ) with some downstream patches ( https://github.com/alpinelinux/aports/tree/master/community/ocaml [^] ), most of them being build-system related -- the only one affecting code generation marks the stack as non-executable and a ppc64 fix to CONTEXT_* macros in signal_osdeps.h
Since 4.04.0, "ocamlc" points to the native-compiled ocamlc.opt instead of the bytecode-compiled ocamlc.byte. Out of curiosity, does running ocamlc.byte (also installed in PATH) work correctly?
|I just tried ocamlc.byte and I was able to compile a simple .ml file and run the generated file (no segfault).|
Thanks for trying ocamlc.byte. This confirms my suspicion that the problem is with dynamic loading in OCaml programs compiled to native code, which is the case of ocamlc in this Alpine setup.
The bad news is that we have extremely limited access to ppc64le hardware: just one virtual machine provided by RedHat in Brno, running Fedora (I think). So, I'm at a loss on how to debug this issue.
I have a VM running Alpine ppc64le and I can give you access to this VM, if that helps you with debug.
Can you talk with me at freenode? My username is 'rdutra'.
|I can also try to look at this, I think I can get access to a suitable machine now. @xleroy please let me know if you have time / want to do it.|
|I applied a downstream patch (workaround) in Alpine build of ocaml and it fixed the segfault. Basically, I compiled the ocaml natives using -no-pie flag (https://github.com/alpinelinux/aports/blob/1feea49eaec12328e73541436bd1612228cd7e9a/community/ocaml/fix-segfault-in-ppc64le.patch [^])|
@shinwell: I lost access to a ppc64le machine, so you are most welcome to try and understand this issue while I try to build a qemu-based VM. (virt-builder should make this easy, except that the version that comes with Ubuntu 16.04 LTS doesn't work.)
|That '-no-pie' helps suggests a misunderstanding between ocamlopt and the dynamic loader about register usage or what not. I'm afraid that even with -no-pie, later attempts to do dynamic loading would fail.|
|2017-06-22 18:21||rgdoliveira||New Issue|
|2017-06-22 18:36||gasche||Note Added: 0017941|
|2017-06-22 18:57||rgdoliveira||Note Added: 0017942|
|2017-06-22 20:03||xleroy||Note Added: 0017943|
|2017-06-22 20:03||xleroy||Status||new => acknowledged|
|2017-06-22 20:04||xleroy||Category||~DO NOT USE (was: OCaml general) => back end (clambda to assembly)|
|2017-06-23 15:39||rgdoliveira||Note Added: 0017962|
|2017-06-27 17:44||shinwell||Note Added: 0018007|
|2017-07-06 14:50||rgdoliveira||Note Added: 0018053|
|2017-09-30 18:28||xleroy||Note Added: 0018426|
|2017-09-30 18:28||xleroy||Target Version||=> 4.06.0 +dev/beta1/beta2/rc1|
|2017-09-30 18:30||xleroy||Note Added: 0018427|
|2017-10-20 16:21||doligez||Target Version||4.06.0 +dev/beta1/beta2/rc1 =>|
|Copyright © 2000 - 2011 MantisBT Group|