1

我使用打印“hello world”的 MonoDevelop 创建了一个简单的单声道可执行文件。我想尝试 AOT 'asmonly' 选项。所以:

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

为什么我得到分段错误?我正在使用 Fedora 12 x64。ld中的“找不到条目符号_start”错误是什么?

谢谢你!

4

2 回答 2

2

AOT 仍然需要 Mono 运行时,用于 GC、IO 层、反射、线程、运行时代码生成等。它只是预编译 JIT 将编译的代码并将其放入可共享的库中。启动 Mono 运行时的“真正”入口点仍在 Mono 中。

于 2010-01-14T02:25:49.003 回答
0

_start是您的二进制文件的入口点。这是操作系统调用以启动和运行二进制文件的函数。您是否定义了 Main 函数?

当您不使用 AOT 时它是否有效?(即运行mono hello_world.exe。)

于 2010-01-13T20:39:43.100 回答