Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly 由于ELF头无效,MIPS emulator无法运行MIPS可执行文件_Assembly_Mips_Qemu_Emulation - Fatal编程技术网

Assembly 由于ELF头无效,MIPS emulator无法运行MIPS可执行文件

Assembly 由于ELF头无效,MIPS emulator无法运行MIPS可执行文件,assembly,mips,qemu,emulation,Assembly,Mips,Qemu,Emulation,所以我想开始编写一些mips程序集,并设置我的工具。 我使用的是Arch Linux,并从用户存储库安装了cross-mipsel Linux gnu gcc和binutils,这非常有效,并成功地将我的简单测试程序编译成了mipsel二进制文件 我不想要任何花哨的gui或类似的东西来模仿我,我选择了qemu。这是我遇到的问题。当我尝试使用qemu mipsel./test运行可执行文件时,qemu只是简单地回答/test:此体系结构的ELF映像无效 我想到的第一件事是“qemu真的可以像那样运

所以我想开始编写一些mips程序集,并设置我的工具。 我使用的是Arch Linux,并从用户存储库安装了cross-mipsel Linux gnu gcc和binutils,这非常有效,并成功地将我的简单测试程序编译成了mipsel二进制文件

我不想要任何花哨的gui或类似的东西来模仿我,我选择了qemu。这是我遇到的问题。当我尝试使用
qemu mipsel./test运行可执行文件时,qemu只是简单地回答
/test:此体系结构的ELF映像无效


我想到的第一件事是“qemu真的可以像那样运行基本的mips二进制文件吗?这看起来很神奇,这不可能是正确的。”所以我开始在谷歌上搜索,如果它真的可行,并且你忘记了链接你的代码。汇编程序
只生成对象文件,您需要链接它。大概你想要的是:

mipsel-linux-gnu-as test.asm -o test.o
mipsel-linux-gnu-ld test.o -o test
如果操作正确,则
文件
命令输出应包括
可执行文件
,例如:

ELF 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV), statically linked, not stripped

仅供参考:Debian mips VM for qemu系统mips位于,可运行此系统中的可执行文件,并可跨平台安装带有“multiarch”软件包的可执行文件。(还有ppc、arm和sh4)非常感谢。我认为as编译器跳过了对象阶段,但我这么认为是愚蠢的。现在可以工作了,qemu真是太棒了!
ELF 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV), statically linked, not stripped