单声道“asmonly”选项

发布于 2024-08-17 13:49:37 字数 1315 浏览 10 评论 0原文

我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

短暂陪伴 2024-08-24 13:49:37

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.

梦冥 2024-08-24 13:49:37

_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.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文