代码之家  ›  专栏  ›  技术社区  ›  Alon Gubkin

单声道“asmonly”选项

  •  1
  • Alon Gubkin  · 技术社区  · 15 年前

    我使用MonoDevelopment创建了一个简单的Mono可执行文件,它打印了“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中,“找不到入口符号\u start”错误是什么?

    谢谢您!

    2 回复  |  直到 13 年前
        1
  •  2
  •   Mikayla Hutchinson    15 年前

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

        2
  •  0
  •   supercheetah    15 年前

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

    当你不使用AOT的时候它能工作吗?(即运行 mono hello_world.exe )