I'm seeing what I think is strange behaviour from object files output by the Microsoft Visual Studio 2003 tools. The file
utility tells me:
asmfile.obj: 80386 COFF executable not stripped - version 30821
For objects created by the assembler, but for objects coming from C files, I get just:
cfile.obj: data
Using Microsoft's dumpbin
utility and the objdump
I got from cygwin, I can disassemble the assembly-built file, but I get no useful results from either utility for the C-built files.
I have a couple of questions related to this difference:
- What is the object file format generated by the MSVC2003 compiler?
- How can I disassemble that object file?
I am particularly interested in getting the disassembly in AT&T syntax - I'm doing a port of a large source base to make it work with GCC, and I would like to use this method as a shortcut for some of the inline assembly routines in the project.
Edit: Adding some more information.
When I run dumpbin
on one of these files gives me no results:
C:\> dumpbin /disasm Func.obj
Microsoft (R) COFF/PE Dumper Version 7.10.6030
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file Func.obj
FileType: ANONYMOUS OBJECT
With objdump
, it gives:
$ objdump -d Func.obj
objdump: Func.obj: File truncated
On the files built from assembly, I get reasonable results.
Edit again: Adding command line information.
The assembly files are built with a command line resembling the following:
ml -nologo -W3 -WX -c -coff -FoAssemblyFile.obj -Zi -Cx AssemblyFile.asm
ml
when executed by itself says:
Microsoft (R) Macro Assembler Version 6.15.8803
Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
The C files are built with the following command:
cl -nologo -W4 -WX -Gs32768 -GX -Gy -c -FdCFile.pdb -FoCFile.obj -Zi
-Gm -O1 -Oy- -Gy -GL -X CFile.c
There are some -I
and -D
options passed to ml
and to cl
, but I've omitted them for brevity here. The cl
options are described here.