[Mono-dev] How to access AOTed assembly code?

Kamal Aboul-Hosn kamal at sooloos.com
Wed Jan 25 20:45:41 UTC 2012


Thanks, Robert, that worked very well. I have one more question, if I may. So I'm embedding Mono on Android on ARM. Up until now, I've been AOT compiling the libraries by running a little app on the Android device itself. Obviously, in the long term, this is not really a good option. So now, I'm trying to build a Mono cross compiler for Android ARM on my Mac OS X machine (gcc --arch returns "i686-apple-darwin11-llvm-gcc-4.2" if that is useful).

I do the following configure:

./configure --target=armv5-linux-androideabi --enable-nls=no  --prefix=/Users/kamal/mono-cross --disable-mcs-build

I also have the CC environment variable and CXX environment variable set to "gcc -m32" and "g++ -m32", respectively, as I believe I read that the cross compiler cannot work if built for 64-bit. Whenever I run make, I quickly get the following errors:

mach-support-arm.c: In function ‘mono_mach_arch_get_ip’:
mach-support-arm.c:24: error: ‘arm_thread_state_t’ undeclared (first use in this function)
mach-support-arm.c:24: error: (Each undeclared identifier is reported only once
mach-support-arm.c:24: error: for each function it appears in.)
mach-support-arm.c:24: error: ‘arch_state’ undeclared (first use in this function)
mach-support-arm.c:24: error: expected expression before ‘)’ token
mach-support-arm.c:27: warning: control reaches end of non-void function
mach-support-arm.c: In function ‘mono_mach_arch_get_sp’:
mach-support-arm.c:32: error: ‘arm_thread_state_t’ undeclared (first use in this function)
mach-support-arm.c:32: error: ‘arch_state’ undeclared (first use in this function)
mach-support-arm.c:32: error: expected expression before ‘)’ token
mach-support-arm.c:35: warning: control reaches end of non-void function
mach-support-arm.c: In function ‘mono_mach_arch_get_mcontext_size’:
mach-support-arm.c:40: error: invalid application of ‘sizeof’ to incomplete type ‘struct __darwin_mcontext’ 
mach-support-arm.c: In function ‘mono_mach_arch_thread_state_to_mcontext’:
mach-support-arm.c:46: error: ‘arm_thread_state_t’ undeclared (first use in this function)
mach-support-arm.c:46: error: ‘arch_state’ undeclared (first use in this function)
mach-support-arm.c:46: error: expected expression before ‘)’ token
mach-support-arm.c:49: error: dereferencing pointer to incomplete type
mach-support-arm.c: In function ‘mono_mach_arch_get_thread_state_size’:
mach-support-arm.c:55: error: ‘arm_thread_state_t’ undeclared (first use in this function)
mach-support-arm.c:56: warning: control reaches end of non-void function
mach-support-arm.c: In function ‘mono_mach_arch_get_thread_state’:
mach-support-arm.c:61: error: ‘arm_thread_state_t’ undeclared (first use in this function)
mach-support-arm.c:61: error: ‘arch_state’ undeclared (first use in this function)
mach-support-arm.c:61: error: expected expression before ‘)’ token
mach-support-arm.c:64: error: ‘ARM_THREAD_STATE_COUNT’ undeclared (first use in this function)
make[4]: *** [mach-support-arm.lo] Error 1


Does anyone know how to overcome these errors?

Much appreciated!

Kamal

On Jan 24, 2012, at 4:08 PM, Robert Jordan wrote:

> On 24.01.2012 19:39, Kamal Aboul-Hosn wrote:
>> Hi, everyone,
>> 
>> If I call mono --aot=static,asmonly on a dll to generate a .s file,
>> how can I get Mono to load the generated AOT'ed assembly if I include
>> the .s in a native .so I'm building myself as part of an application?
>> It seems Mono normally just goes looking for a .so file for the
>> AOT'ed code. Is it possible to get Mono to use the linked in AOT'ed
>> code in the same native library as the rest of my application? Please
>> let me know if I can provide any more details.
> 
> First, you must embed the runtime as described here:
> 
> http://mono-project.com/Embedding_Mono
> 
> Second, you must register the static AOT assembly with
> mono_aot_register_module. See the description of
> --aot=static on mono's man page.
> 
> This assembly can be consumed like any other file-based
> assembly using the embedding API.
> 
> Robert
> 
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list



More information about the Mono-devel-list mailing list