【问题标题】:Mono 'asmonly' option单声道“asmonly”选项
【发布时间】:2010-01-13 18:24:21
【问题描述】:

我使用打印“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”错误是什么?

谢谢!

【问题讨论】:

    标签: assembly mono ld gnu-assembler


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

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

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

      【讨论】:

      • 当然我定义了一个主函数。是的,当我不使用 AOT 时它可以工作。
      猜你喜欢
      • 1970-01-01
      • 2010-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多