Pregunta
He creado un simple ejecutable mono usando MonoDevelop que las impresiones "hola mundo". Quería probar la AOT opción 'asmonly'. Por lo tanto:
[root@localhost Debug]# ls
abc.exe
[root@localhost Debug]# mono --aot=full,static,asmonly abc.exe
Mono Ahead of Time compiler - compiling assembly /home/alon/Projects/abc/abc/bin/Debug/abc.exe
Code: 1538 Info: 50 Ex Info: 114 Class Info: 30 PLT: 5 GOT Info: 105 GOT Info Offsets: 24 GOT: 60
Output file: '/home/alon/Projects/abc/abc/bin/Debug/abc.exe.s'.
Linking symbol: 'mono_aot_module_abc_info'.
Compiled 9 out of 9 methods (100%)
Methods without GOT slots: 1 (11%)
Direct calls: 0 (100%)
JIT time: 1 ms, Generation time: 0 ms, Assembly+Link time: 0 ms.
GOT slot distribution:
class: 1
image: 1
ldstr: 1
interruption_request_flag: 7
[root@localhost Debug]# ls
abc.exe abc.exe.s
[root@localhost Debug]# as -o hello_world.o abc.exe.s
[root@localhost Debug]# ls
abc.exe abc.exe.s hello_world.o
[root@localhost Debug]# ld -o hello_world.so hello_world.o
ld: warning: cannot find entry symbol _start; defaulting to 0000000008049000
[root@localhost Debug]# ls
abc.exe abc.exe.s hello_world.o hello_world.so
[root@localhost Debug]# ./hello_world.so
Segmentation fault (core dumped)
[root@localhost Debug]#
¿Por qué recibo Fallo de segmentación? Estoy usando Fedora 12 x64. Y lo que es el error "no puede encontrar la entrada símbolo _start" en LD?
Gracias!
Solución
AOT todavía requiere el tiempo de ejecución Mono, para la GC, IO-capa, la reflexión, roscado, tiempo de ejecución de la generación de código, etc. Simplemente precompila que el código que el JIT se compilará y lo pone en una biblioteca compartida. El "verdadero" punto de entrada hasta que se inicia el tiempo de ejecución Mono se encuentra todavía en Mono.
Otros consejos
_start
es el punto de entrada para su binario. Es la función del sistema operativo llama para obtener su binario en funcionamiento. ¿Tiene una función principal define?
¿Funciona cuando no se está usando AOT? (Es decir, se ejecuta mono hello_world.exe
.)