How to convert an ELF executable to C code? The generated C code need not be human-readable

左心房为你撑大大i 提交于 2019-12-01 17:53:18

This will give you (almost) an assembly code translation:

objdump --disassemble <elf file>

I say almost because the output contains some annotations like binary file position markers and can't serve directly as input to an assembler, but it's close.

You write a simulator for the processor, then you run the elf instructions through your simulated processor. It's generally not too much of a task because even CISC processors have relatively small, contained instruction sets that perform simple operations.

When you've got that working, look at more efficient solutions, like outputting C code to match instructions.

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