我想用 clang
编译我的 C 文件,然后用 ndisasm
反编译它(用于教育目的)。然而,ndisasm
在它的手册中说它只适用于二进制 而不是可执行 文件:
ndisasm only disassembles binary files: it has
no understanding of the header information
present in object or executable files. If you
want to disassemble an object file, you should
probably be using objdump(1).
究竟有什么区别?当我用一个简单的 C 文件、可执行文件或二进制文件运行它时,clang
会输出什么?
最佳答案
目标文件包含机器语言代码、和各种其他信息。听起来 ndisasm
只想要机器代码,而不是其他东西。因此,该消息告诉您使用 objdump
实用程序从目标文件中仅提取机器代码段。然后你大概可以在上面运行 ndisasm
。
关于c - ndisasm手册中提到的二进制文件和可执行文件有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31126109/