Bug#347270: [OCaml 0003952]: camomile produces a segmentation fault on arm and ia64
FWIW, there seems to be a patch for the arm ocamlopt bug (attached).
On Sun, Feb 10, 2008 at 16:28:53 +0100, nouser@inria.fr wrote:
> ----------------------------------------------------------------------
> bacam - 2008-02-10 16:28
> ----------------------------------------------------------------------
> I've had a look at this on a qemu-emulated arm system. (My 'real' ARM
> system uses the new ARM EABI, so isn't suitable.)
>
> When caml_allocN decides to call the GC, it saves the requested size for
> allocation while the GC is running. However, it saves it in the text
> section
> of memory, which is read-only. I'll attach a patch uses the data section
> instead. I've successfully built the most recent versions of camomile,
> camlp5
> and coq with it.
>
> (I've no access to ia64, though.)
>
diff -ru ocaml-3.10.1/asmrun/arm.S ocaml-3.10.1.armfix/asmrun/arm.S
--- ocaml-3.10.1/asmrun/arm.S 2004-01-03 12:51:18.000000000 +0000
+++ ocaml-3.10.1.armfix/asmrun/arm.S 2008-02-09 16:09:42.000000000 +0000
@@ -91,11 +91,13 @@
/* Record return address and desired size */
ldr alloc_limit, .Lcaml_last_return_address
str lr, [alloc_limit, #0]
- str r10, .Lcaml_requested_size
+ ldr alloc_limit, .LLcaml_requested_size
+ str r10, [alloc_limit, #0]
/* Invoke GC */
bl .Linvoke_gc
/* Try again */
- ldr r10, .Lcaml_requested_size
+ ldr r10, .LLcaml_requested_size
+ ldr r10, [r10, #0]
b caml_allocN
/* Shared code to invoke the GC */
@@ -323,9 +325,12 @@
.LLtrap_handler: .word .Ltrap_handler
.Lcaml_apply2: .word caml_apply2
.Lcaml_apply3: .word caml_apply3
-.Lcaml_requested_size: .word 0
+.LLcaml_requested_size: .word .Lcaml_requested_size
.Lcaml_array_bound_error: .word caml_array_bound_error
+.data
+.Lcaml_requested_size: .word 0
+
/* GC roots for callback */
.data
Reply to: