Converting C source to ARM assembly

一个人想着一个人 提交于 2019-12-06 16:28:17

问题


I am trying to convert .c files for ARM (ARMv7l for Raspberry Pi2) but I could not find any online converter or understand how it works. Previously these .c files were executable in Windows platform and thus unable to execute on Pi's arm architecture. Does anybody can assist me in this?


回答1:


Any c compiler can generate assembly code from C code, if your objective is specifically to generate assembly code for arm then you'll need a cross compiler such as the GNU arm embedded toolchain.

For gcc on particular you just need to use the -S option when compiling, so the line looks something like:

gcc -S -source.c -o output.s

Of course you'll need to include any headers and include directories for it to compile.

if you simply want to cross compile it, then simply do the full compilation assemblage and linking process. Depending on how low level the c code is it's actually possible for it not to work on the pi 2 (but it will compile)



来源:https://stackoverflow.com/questions/44275519/converting-c-source-to-arm-assembly

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