Domanda

ho creato un semplice eseguibile mono utilizzando MonoDevelop che stampa "ciao mondo". Ho voluto provare il 'asmonly' opzione AOT. Quindi:

[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]# 

Perché ricevo Segmentation fault? Sto usando Fedora 12 x64. E qual è l'errore "non riesce a trovare la voce simbolo _start" in ld?

Grazie!

È stato utile?

Soluzione

AOT richiede ancora il runtime Mono, per il GC, IO-layer, riflessione, filettatura, runtime generazione di codice, ecc precompiles semplicemente che il codice che il JIT sarebbe compilare e lo mette in una libreria condivisibile. Il "vero" punto di ingresso che si avvia il runtime di Mono è ancora in Mono.

Altri suggerimenti

_start è il punto di ingresso per il vostro binario. E 'la funzione del sistema operativo chiamate per ottenere il vostro binario installato e funzionante. Avete una funzione principale definita?

Funziona quando non è in uso AOT? (Cioè mono hello_world.exe in esecuzione).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top