为什么 DumpBin 告诉我二进制文件中没有 COMDAT?
这是我从 dumpbin AchievementsTable.obj /HEADERS 得到的输出,
Microsoft (R) COFF/PE Dumper Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file AchievementsTable.obj
File Type: ANONYMOUS OBJECT
ANON OBJECT HEADER VALUES
1 version
14C machine (x86)
4C51334D time date stamp Thu Jul 29 08:52:45 2010
ClassID: {0CB3FE38-D9A5-4DAB-AC9B-D6B6222653C2}
945F size
0 flags
我的所有源代码都是这样做的。我正在使用 VisualStudio 2005。我知道有很多 COMDAT 被导出,因为 .exe 随后正确链接和执行:是否有我应该避免的编译器开关?以下是我正在使用的:
/O1
/Ob2
/Oi
/GT
/GL
/I "..\dxsdk\include" <lots of include paths>
/D "WIN32" <lots of #defines>
/GF
/FD
/MT
/GS-
/Gy
/arch:SSE2
/fp:fast
/GR-
/Fo <directory specified>
/Fd <pdb filename specified>
/FR <directory specified>
/W4
/c
/Zi
/TP .\Source\databases\AchievementsTable.cpp
我愿意接受对我的选择的一般评论,但 DumpBin 的使用是这个问题的焦点:把它拿走,男孩和女孩......
This is the output I get from dumpbin AchievementsTable.obj /HEADERS
Microsoft (R) COFF/PE Dumper Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file AchievementsTable.obj
File Type: ANONYMOUS OBJECT
ANON OBJECT HEADER VALUES
1 version
14C machine (x86)
4C51334D time date stamp Thu Jul 29 08:52:45 2010
ClassID: {0CB3FE38-D9A5-4DAB-AC9B-D6B6222653C2}
945F size
0 flags
ALL my source does this. I am using VisualStudio 2005. I know for a fact that there are lots of COMDATs being exported, as the .exe subsequently links and executes correctly: are there compiler switches I should be avoiding? Here are the ones I am using:
/O1
/Ob2
/Oi
/GT
/GL
/I "..\dxsdk\include" <lots of include paths>
/D "WIN32" <lots of #defines>
/GF
/FD
/MT
/GS-
/Gy
/arch:SSE2
/fp:fast
/GR-
/Fo <directory specified>
/Fd <pdb filename specified>
/FR <directory specified>
/W4
/c
/Zi
/TP .\Source\databases\AchievementsTable.cpp
I'm open to commentary on my selection in general, but DumpBin use is the focus of this question: take it away, boys and girls...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过一天的排除,发现DUMPBIN文档有点含糊。
需要打开功能级链接 (/Gy) 才能获得 COMDAT 输出。打开跨模块优化 (/GL) 会延迟代码生成到链接时间。因此,尽管头信息确实可用于使用 /GL 编译的代码,但它非常有限。这就是为什么它是 DUMPBIN 唯一可用的选项 - 所有其他选项都需要更多信息,其生成会被 /GL 延迟。
After a day of elimination, I discovered that the DUMPBIN documentation is a little ambiguous.
Switching on function level linking (/Gy) is needed to get the COMDAT output. Switching on cross module optimisations (/GL) delays code generation to link time. Therefore, although it is true that header information is available to code compiled with /GL, it is very limited. That's why it's the only option available to DUMPBIN - all the other options require more information, the generation of which is delayed by /GL.