Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004953OCamlOCaml generalpublic2010-01-04 17:222010-01-08 11:34
ReporterNCommander 
Assigned Toxleroy 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.11.1 
Target VersionFixed in Version3.11.2+dev 
Summary0004953: When compiling for ARM/Thumb, ocamlrun segfaults during build.
DescriptionWhen building for Thumb2 on Ubuntu lucid, ocaml failed to build from source with ocamlrun segfaulting while running make world. The issue was tracked down to an issue when specifying specific registers on Thumb. Here's the output from GDB:

nc@arm:~/src/ocaml-3.11.1$ gdb boot/ocamlrun
GNU gdb (GDB) 7.0.1-ubuntu
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> [^]
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>... [^]
Reading symbols from /home/nc/src/ocaml-3.11.1/boot/ocamlrun...done.
(gdb) r boot/ocamlc
Starting program: /home/nc/src/ocaml-3.11.1/boot/ocamlrun boot/ocamlc
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00026bda in caml_interprete (prog=Cannot access memory at address 0x5
) at interp.c:526
526 int nvars = *pc++;
(gdb) l
521 }
522 Next;
523 }
524
525 Instruct(CLOSURE): {
526 int nvars = *pc++;
527 int i;
528 if (nvars > 0) *--sp = accu;
529 Alloc_small(accu, 1 + nvars, Closure_tag);
530 Code_val(accu) = pc + *pc;
(gdb) bt
#0 0x00026bda in caml_interprete (prog=Cannot access memory at address 0x5
) at interp.c:526
Cannot access memory at address 0x2cd
(gdb) info registers
r0 0x0 0
r1 0x0 0
r2 0x0 0
r3 0x40286f8c 1076391820
r4 0x0 0
r5 0x0 0
r6 0x0 0
r7 0x1 1
r8 0x46928 289064
r9 0x40286f8c 1076391820
r10 0x4001e000 1073864704
r11 0x0 0
r12 0x401210e1 1074925793
sp 0xbebae340 0xbebae340
lr 0x26197 156055
pc 0x26bda 0x26bda <caml_interprete+2810>
fps 0x0 0
cpsr 0x60000030 1610612784
(gdb)
 
I'm willing to help test any patches or provide any debugging information necessary.
Additional InformationThe following patch works around the issue by dropping the per-register assignments when compiling for Thumb:

Index: ocaml-3.11.1/byterun/interp.c
===================================================================
--- ocaml-3.11.1.orig/byterun/interp.c 2010-01-04 10:20:26.387208256 -0500
+++ ocaml-3.11.1/byterun/interp.c 2010-01-04 10:25:41.727191496 -0500
@@ -157,7 +157,8 @@
 #define SP_REG asm("a4")
 #define ACCU_REG asm("d7")
 #endif
-#ifdef __arm__
+/* specifying a specific register breaks when compiling for thumb mode */
+#if defined (__arm__) && !defined(__thumb__)
 #define PC_REG asm("r9")
 #define SP_REG asm("r8")
 #define ACCU_REG asm("r7")
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0005225)
xleroy (administrator)
2010-01-08 11:34

Thanks for the detective work. Patch applied in 3.11 release branch, will go in 3.11.2.

- Issue History
Date Modified Username Field Change
2010-01-04 17:22 NCommander New Issue
2010-01-04 17:36 xleroy Status new => assigned
2010-01-04 17:36 xleroy Assigned To => xleroy
2010-01-08 11:34 xleroy Note Added: 0005225
2010-01-08 11:34 xleroy Status assigned => closed
2010-01-08 11:34 xleroy Resolution open => fixed
2010-01-08 11:34 xleroy Fixed in Version => 3.11.2+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker