可以读取目标文件吗?
我对 .obj
文件很好奇:我几乎不知道它们是什么(或者它们包含什么),所以我用 Vim 文本编辑器打开它们,我在里面发现了一种类似外星人的语言...
有什么方法可以理解它们代表什么以及它们的内容是什么 另外,它们的用途是什么?
I was curious about .obj
files: I pretty much don't know what they are (or what they contain), so I opened them with Vim text editor and what I found inside was an Alien like language...
Is there any way to understand what they represent and what is their content
Also, for what are they being used?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当然。
但每个不同的平台都有不同的对象格式。在 Windows 上,您可以使用 dumpbin 之类的工具(dumpbin 随 Visual工作室)。在 Linux 上,您可以使用“dumpobj”,或反汇编程序。
这里有一个很好的 Linux 链接:
http://www.linuxjournal.com/article/1060
PS :
objdump 还可以让您反汇编对象。就像您过去能够在 DOS PC 上进行“调试”一样......
Sure.
But every different platform has a different object format. On Windows, you could use a tool like dumpbin (dumpbin comes with Visual Studio). On Linux, you could use "dumpobj", or disassemble the program.
Here's a good link for Linux:
http://www.linuxjournal.com/article/1060
PS:
objdump also lets you disassemble the object. Like you used to be able to do with "debug" on DOS PCs...
link.exe
使用的.obj
文件具有 MS COFF 格式。您可以此处找到“Microsoft PE 和 COFF 规范”,并解析 < code>.obj 文件根据它。
或者,您可以使用现有工具,例如
dumpbin
。The
.obj
files used bylink.exe
has MS COFF format.You can find "Microsoft PE and COFF Specification" here, and parse
.obj
file according to it.Or, you can use existing tool like
dumpbin
.readelf
工具擅长向您展示一些数据细节:它检查可执行文件特定部分的一些能力也可以派上用场:
实际上反汇编代码有点困难;如果你用
-g
编译代码来调试符号,你可以使用readelf --debug-dump
来读取程序源码、类型信息等。The
readelf
tool is good at showing you some details on the data:Some of its abilities to inspect specific sections of the executable can come in handy too:
Actually disassembling the code is a bit of a stretch; if you compile your code with
-g
for debugging symbols, you can usereadelf --debug-dump
to read the program source, type information, etc.