How to test your code on a machine with big-endian architecture?

試著忘記壹切 提交于 2019-12-18 04:35:08

问题


Both ideone.com and codepad.org have Little-Endian architechtures.

I want to test my code on some machine with Big-Endian architechture (for example - Solaris - which I don't have). Is there some easy way that you know about?


回答1:


Googling "big endian online emulator" lead me to PearPC. I assume that if you have the patience you can install Mandrake Linux, get gcc, and go party.




回答2:


QEMU supports emulating several big-endian architectures. Note that some architectures support both endiannesses; some (Itanium, ARM) are primarily used as little-endian while others (PowerPC, MIPS) are primarily used as big-endian.

Aurélien Jarno wrote some HOWTOs on installing Debian on an emulated MIPS or SPARC machine which should be a good start.




回答3:


If you are using Ubuntu, you can download MIPS cross compiler, and QEMU-user, then compile your code in static linkage, and just run it.

sudo apt-get install gcc-multilib-mips-linux-gnu gcc-mips-linux-gnu qemu-user

and then

mips-linux-gnu-gcc test.c -o test -static
qemu-mips ./test


来源:https://stackoverflow.com/questions/2839087/how-to-test-your-code-on-a-machine-with-big-endian-architecture

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!