[fpc-devel] Masm

Adriaan van Os adriaan at microbizz.nl
Fri Nov 7 14:35:17 CET 2014

> I can not make anything of the Visual C++ produced .obj with the Microsoft provides docs. If that 
> isn't typically Microsoft ... How to corrupt any standard by "slightly modifying" it .... I will 
> look further to dig up some meaningful info.

Amusingly, Microsofts own SDK dumpbin tool says

Microsoft (R) COFF/PE Dumper Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.


                1 version
              14C machine (x86)
         545CC084 time date stamp Fri Nov 07 04:52:20 2014
                  ClassID: {0CB3FE38-D9A5-4DAB-AC9B-D6B6222653C2}
             3F5F size
                0 flags

It perfectly well understands FPC generated .o files, but not Visual C++ generated .obj files. 

However, objconv <http://www.agner.org/optimize/#objconv> sheds some light on the issue

	Whole program optimization intermediate file for MS compiler. Undocumented

and indeed the Debug version of the same .obj file has a normal COFF header, is recognized by the 
FPC linker (and produces FPC internal error 200602232).

Anyway, I think the workaround for the "Illegal Coff Magic" linker error is to recompile with 
Visual C++ turning whole-program-optimization off. It suggest to document this somewhere. Or to 
improve the error message in compiler/ogcoff.pas for "Whole program optimization intermediate file 
for MS compiler. Undocumented" files.

I still have to investigate the internal error 200602232.


Adriaan van Os

More information about the fpc-devel mailing list