单声道“asmonly”选项
我使用 MonoDevelop 创建了一个简单的单声道可执行文件,可以打印“hello world”。我想尝试 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”错误是什么?
谢谢你!
I created a simple mono executable using MonoDevelop that prints "hello world". I wanted to try the AOT 'asmonly' option. So:
[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]#
Why am I getting Segmentation fault? I'm using Fedora 12 x64. And what is the "cannot find entry symbol _start" error in ld?
Thank You!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
AOT 仍然需要 Mono 运行时,用于 GC、IO 层、反射、线程、运行时代码生成等。它只是预编译 JIT 将编译的代码并将其放入可共享库中。启动 Mono 运行时的“真正”入口点仍然在 Mono 中。
AOT still requires the Mono runtime, for the GC, IO-layer, reflection, threading, runtime code generation, etc. It simply precompiles that code that the JIT would compile and puts it in a shareable library. The "real" entry point that start up the Mono runtime is still in Mono.
_start
是二进制文件的入口点。这是操作系统调用的函数来启动并运行您的二进制文件。您定义了 Main 函数吗?当您不使用 AOT 时它还能工作吗? (即运行
mono hello_world.exe
。)_start
is the entry point for your binary. It's the function the OS calls to get your binary up and running. Do you have a Main function defined?Does it work when you're not using AOT? (I.e. running
mono hello_world.exe
.)