[fpc-devel] Masm

Pierre Free Pascal pierre at freepascal.org
Fri Nov 7 15:01:40 CET 2014


  The is no COFF magic.
the first 2 bytes indicate normally a MACHINE type.

  The files I produced start etiher by:
0x8664 indicating a x86 coff header
or
0x014c indicating a i386 coff header.

Nevertheless, 
0x0000 is also listed as IMAGE_FILE_MACHINE_UNKNOWN

Could it be that your coff object only contains raw data,
so that it is usable on different formats?

After some searching, I think that the
answer to your problem is here:
http://llvm.org/docs/doxygen/html/structllvm_1_1COFF_1_1BigObjHeader.html

Your header looks like a BigObjHeader
This means that the object is prepared to handle relocation that are not in
the 4-byte
range... A feature that Free Pascal indeed does not support IIRC...

  There is probably an option somewhere to use normal 32-bit relocation type
objects in you Visual C++ configuration, unless you really need those 64-bit
relocations...


Pierre

> -----Message d'origine-----
> De : fpc-devel-bounces at lists.freepascal.org [mailto:fpc-devel-
> bounces at lists.freepascal.org] De la part de Adriaan van Os
> Envoyé : vendredi 7 novembre 2014 13:10
> À : FPC developers' list
> Objet : Re: [fpc-devel] Masm
> 
> > But .... if the formats are the same, what is the cause of the error
> > message " Illegal COFF Magic" when trying to statically link with FPC
> a
> > VCC produced .obj or .lib ?
> 
> I found the COFF docs here <http://wiki.osdev.org/COFF> and here
> <http://msdn.microsoft.com/en-us/gg463119.aspx>
> 
> the Visual C++ produced .obj has a header that starts with
> 
> 	00 00 FF FF 01 00  4C 01 ....
> 
> The FPC .o has a header that starts with
> 
> 	4C 01 ....
> 
> which indicates a standard COFF header (as checked by
> compiler/ogcoff.pas).
> 
> 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.
> 
> Regards,
> 
> Adriaan van Os
> 
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel



More information about the fpc-devel mailing list