所以我想开始编写一些mips程序集,并设置我的工具。 我正在使用Arch Linux,并从用户存储库安装了交叉mipsel-linux-gnu-gcc和binutils,这很好用,并且成功地将我的简单测试程序编译为mipsel二进制文件。由于无效的ELF头文件,MIPS仿真程序无法运行mips可执行文件
我不想要任何花式的gui或类似的东西来模仿我,并且去了qemu。这是我有问题。当我尝试运行我的可执行文件qemu-mipsel ./test
时,qemu只是回复./test: Invalid ELF image for this architecture
。
的第一件事,我虽然是“可以QEMU真的只是运行基地MIPS的二进制文件这样呢?这看起来几乎像魔术,这不可能是正确的。”,所以我就开始使用Google,如果它实际上是可能的,found a tutorial on how to to similar compilation for a openwrt but with C code <,在看完这篇教程之后,我的步骤似乎也应该起作用。
这是我编的组装,清洁,简单的命令 mipsel-linux-gnu-as test.asm -o test; chmod +x ./test
这里的file
命令 ./test: ELF 32-bit LSB relocatable, MIPS, MIPS-I version 1 (SYSV), not stripped
这里的输出年代readelf -a ./test
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: REL (Relocatable file)
Machine: MIPS R3000
Version: 0x1
Entry point address: 0x0
Start of program headers: 0 (bytes into file)
Start of section headers: 164 (bytes into file)
Flags: 0x1000, o32, mips1
Size of this header: 52 (bytes)
Size of program headers: 0 (bytes)
Number of program headers: 0
Size of section headers: 40 (bytes)
Number of section headers: 9
Section header string table index: 6
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 00000000 000040 000010 00 AX 0 0 16
[ 2] .data PROGBITS 00000000 000050 000000 00 WA 0 0 16
[ 3] .bss NOBITS 00000000 000050 000000 00 WA 0 0 16
[ 4] .reginfo MIPS_REGINFO 00000000 000050 000018 18 A 0 0 4
[ 5] .pdr PROGBITS 00000000 000068 000000 00 0 0 4
[ 6] .shstrtab STRTAB 00000000 000068 00003a 00 0 0 1
[ 7] .symtab SYMTAB 00000000 00020c 000060 10 8 6 4
[ 8] .strtab STRTAB 00000000 00026c 000001 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
There are no section groups in this file.
There are no program headers in this file.
There are no relocations in this file.
The decoding of unwind sections for machine type MIPS R3000 is not currently supported.
Symbol table '.symtab' contains 6 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 SECTION LOCAL DEFAULT 1
2: 00000000 0 SECTION LOCAL DEFAULT 2
3: 00000000 0 SECTION LOCAL DEFAULT 3
4: 00000000 0 SECTION LOCAL DEFAULT 4
5: 00000000 0 SECTION LOCAL DEFAULT 5
No version information found in this file.
FYI:Debian的MIPS VM在HTTPS QEMU系统,MIPS: //people.debian.org/~aurel32/qemu/mips/,可执行文件可以运行,并且可以跨平台安装“multiarch”软件包。 (和ppc和胳膊和sh4也) – user3710044 2015-04-04 17:39:59