[Mono-dev] Mono runtime on ARM920t with many assertions

Dennis Krzyzaniak dkml at conworx.com
Tue Jun 5 11:51:25 UTC 2012


Hi all,

 

I found out that the default optimization level -O2 which is set if CFLAGS
is not used breaks Mono (in my configuration), which results in the behavior
below.

Without, at least my first hello world test works on my device, I will
continue with more tests.

 

Currently I do not know the reason, maybe it is some ARM related code that
did not work for ARMv4 (arm920t), misconfiguration on my side or the old
vendor toolchain (gcc version 3.4.1).

I will keep you informed and thanks for your answers. Would be great to get
some more tips about this issue.

 

 

Best regards,

Dennis Krzyzaniak

 

 

Von: mono-devel-list-bounces at lists.ximian.com
[mailto:mono-devel-list-bounces at lists.ximian.com] Im Auftrag von Dennis
Krzyzaniak
Gesendet: Freitag, 1. Juni 2012 12:30
An: mono-devel-list at lists.ximian.com
Betreff: [Mono-dev] Mono runtime on ARM920t with many assertions

 

Hi all,

 

I am trying to get Mono running on a spider III device including an ARM920t
processor with Linux as OS.

 

/host $ uname -a

Linux Spider-III 2.6.17.3-axo-s07.2 #1425 Fri Jul 25 10:59:30 CEST 2008
armv4tl unknown

 

When I try to invoke a simple hello_world.exe I get 399 assertions in eglib
(always the same asserts):

 

/host $ ./mono hello_world.exe

../../../../eglib/src/ghashtable.c:293: assertion 'hash != NULL' failed

../../../../eglib/src/ghashtable.c:236: assertion 'hash != NULL' failed

../../../../eglib/src/ghashtable.c:293: assertion 'hash != NULL' failed

../../../../eglib/src/ghashtable.c:236: assertion 'hash != NULL' failed

.

 

The 'Hello World' is also displayed:

../../../../eglib/src/ghashtable.c:293: assertion 'hash != NULL' failed

../../../../eglib/src/ghashtable.c:236: assertion 'hash != NULL' failed

Hello World../../../../eglib/src/ghashtable.c:293: assertion 'hash != NULL'
failed

.

 

The hello world code:

using System;

namespace foobar {

   public class foo {

      public static void Main(string[] args) {

         Console.WriteLine("Hello World");

      }

   }

}

 

I am absolutely new to Mono and completely lost with this behavior. Maybe
someone knows the reason or can point me to a direction to find the issue?

I attached a trace (./mono -trace hello_world.exe), maybe this helps? The
trace is cut to fit into this mail, please let me know if a full trace is
needed.

 

I am using the debian source package of Mono 2_10_8.1-1 because in the
official release a unittest fails.

To get Mono build with the 'old' ARM  toolchain provided by the vendor I
made a few changes in the project please see below. 

I am calling configure with the following parameters:

configure  --build=i686-pc-linux-gnu --host=arm-axotec-linux-gnu
LD=arm-axotec-linux-gnu-ld OBJDUMP=arm-axotec-linux-gnu-objdump
--prefix=/host --disable-mcs-build --srcdir=../..

 

configure.in:

+

+dnl

+dnl BEGIN Conworx Spider III ARMv4t settings

+dnl there are already arm-*-linux* settings below but the place is to late,
checks which

+dnl tested before fails. So I added my specific stuff here without changing
the old

+dnl settings.

+dnl

+if test "x$host" = "xarm-axotec-linux-gnu"; then

+dnl looks like this are all needed settings, the rest is redundant.

+  TARGET=ARM;

+  cross_compiling=yes

+  dnl which defines are needed? just copied some

+  dnl CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT
-DARM_FPU_NONE -D__ARM_EABI__"

+  CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -D_REENTRANT -DARM_FPU_NONE
-mcpu=arm920t -D__ARM_ARCH_4__"

+  CPPFLAGS="$CPPFLAGS -DNO_THUMB2_INSTRUCTIONS"

+  arch_target=arm;

+  ACCESS_UNALIGNED="no"

+  JIT_SUPPORTED=yes

+  jit_wanted=true

+  sgen_supported=true

+  dnl Can't use tls, since it depends on the runtime detection of tls
offsets

+  dnl  in mono-compiler.h

+  libgc_threads=pthreads

+  with_tls=pthread

+  use_sigposix=yes

+  dnl Enable support for using sigaltstack for SIGSEGV and

+  dnl stack overflow handling (TODO not sure if it works on my arm)

+  with_sigaltstack=no

+  dnl to bypass the underscore linker check, can't work when
cross-compiling

+  mono_cv_uscore=yes

+  dnl support ahead of time compilation

+  AOT_SUPPORTED="yes"

+  libdl="-ldl"

+  dnl I need some define to enable my hacks oO

+  AC_DEFINE(PLATFORM_AXOTEC_LINUX,1,[Targeting axotec linux on arm920t])

+fi

+

 

+# Added LT_OUTPUT to generate libtool script by config.lt before calling
it.

+LT_OUTPUT

export_ldflags=`(./libtool --config; echo eval echo
\\$export_dynamic_flag_spec <file:///\\$export_dynamic_flag_spec> ) | sh`

AC_SUBST(export_ldflags)

 

+dnl the check for cross compiling is included in the mono release but
removed

+dnl in the debian source package because for the debian distribution no
cross

+dnl compiling is used.

+if test ${TARGET} = ARM  && test x$cross_compiling = xno; then

   dnl ******************************************

   dnl *** Check to see what FPU is available ***

   dnl ******************************************

 

 

 

mono/metadata/sgen-archdep.h:

 

/* We dont store ip, sp */

#define ARCH_NUM_REGS 14

+/* arm920t does not support thumb2 instructions */

+#if !defined (NO_THUMB2_INSTRUCTIONS)

+/* THUMB2 instuctions */

#define ARCH_STORE_REGS(ptr)    \

   __asm__ __volatile__(         \

      "push {lr}\n"           \

@@ -145,6 +148,17 @@

      :                    \

      : "r" (ptr)             \

   )

+#else /* NO_THUMB2_INSTRUCTIONS */

+/* ARM instuctions */

+#define ARCH_STORE_REGS(ptr) \

+   __asm__ __volatile__( \

+         "stmfd sp!, {lr}\n" \

+         "mov lr, %0\n" \

+         "stmia lr!, {r0-r12}\n" \

+         "ldmfd sp!, {lr}\n" \

+         : \

+         : "r" (ptr))

+#endif /* NO_THUMB2_INSTRUCTIONS */

 

 

 

mono/mini/jit-icalls.c:

 

#if defined(__arm__) && MONO_ARCH_SOFT_FLOAT

+#if defined (PLATFORM_AXOTEC_LINUX)

+   /* ULLONG_MAX is not defined, just define here the max size of an
unsigend

+    * long long int. */

+#ifndef ULLONG_MAX

+#define ULLONG_MAX   18446744073709551615ULL

+#endif /* !ULLONG_MAX */

+#endif /* PLATFORM_AXOTEC_LINUX */

   if (isnan (v) || !(v >= -0.5 && v <= ULLONG_MAX+0.5)) {

      mono_raise_exception (mono_get_exception_overflow ());

 

 

Would be great to get some help!

 

 

Best regards,

Dennis Krzyzaniak

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120605/67e540f1/attachment-0001.html>


More information about the Mono-devel-list mailing list