Pergunta

Criei um simples executável mono usando o Monodevelo que imprime "Hello World". Eu queria experimentar a opção AOT 'ASMONLY'. Então:

[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 que estou recebendo falha de segmentação? Estou usando o Fedora 12 x64. E qual é o erro "Não é possível encontrar símbolo de entrada _start" em LD?

Obrigada!

Foi útil?

Solução

O AOT ainda requer o tempo de execução do Mono, para a geração GC, IO-camada, reflexão, encadeamento, tempo de execução, etc. Simplesmente pré-compila esse código que o JIT compilaria e o coloca em uma biblioteca compartilhável. O ponto de entrada "real" que inicia o tempo de execução do Mono ainda está em mono.

Outras dicas

_start é o ponto de entrada para o seu binário. É a função que o sistema operacional chama para colocar seu binário em funcionamento. Você tem uma função principal definida?

Funciona quando você não está usando AOT? (Ou seja, correndo mono hello_world.exe.)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top