flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Characteristics field of MS64 COFF header

Author
Thread Post new topic Reply to topic
system error



Joined: 01 Sep 2013
Posts: 670
system error 27 Apr 2017, 21:06
I checked this field against MS spec (Jan 2017) and the 2-byte Characteristic field generated by FASM's COFF object (0x0184) doesn't tally with any of the designated values of COFF header data structure. How so? I suspect it is supposed to be 0x0100?

The spec is attached.


Description:
Download
Filename: pecoff.zip
Filesize: 247.42 KB
Downloaded: 736 Time(s)

Post 27 Apr 2017, 21:06
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 27 Apr 2017, 22:28
If you look at the COFFMS.INC implementation that comes in fasmg package, which was made to produce the same output as fasm 1, you will find how is it defined:
Code:
        Characteristics         dw IMAGE_FILE_32BIT_MACHINE + IMAGE_FILE_LINE_NUMS_STRIPPED + IMAGE_FILE_BYTES_REVERSED_LO    
Some of these flags are deprecated but fasm traditionally used them in their original meaning and so far there was no reason to get rid of them.

Of course with fasmg macros you can easily tweak any features of the produced file if you need.
Post 27 Apr 2017, 22:28
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 28 Apr 2017, 10:26
In the PE macros the default choice of flags was already changed to more "modern" and I only made the "format" macro (which is there to emulate the namesake directive of fasm 1) to alter these settings in such way that the output is the same as of fasm 1. I think this was a good choice, so I'm now updating the COFF macros to work the same way. The COFFMS.INC by default no longer sets the deprecated flags, but "format" macro from FORMAT.INC does set the for compatibility.
Post 28 Apr 2017, 10:26
View user's profile Send private message Visit poster's website Reply with quote
system error



Joined: 01 Sep 2013
Posts: 670
system error 28 Apr 2017, 12:46
Tomasz Grysztar wrote:
In the PE macros the default choice of flags was already changed to more "modern" and I only made the "format" macro (which is there to emulate the namesake directive of fasm 1) to alter these settings in such way that the output is the same as of fasm 1. I think this was a good choice, so I'm now updating the COFF macros to work the same way. The COFFMS.INC by default no longer sets the deprecated flags, but "format" macro from FORMAT.INC does set the for compatibility.


I understand it's not an easy decision to make. But I don't see how "modernizing" such deprecated flag will harm any compatibility either. Is there any dependency on this flag somewhere in the FASM's internal? I suspect there is. But anyway it's a relieve to know that it is, at least, a calculated value.
Post 28 Apr 2017, 12:46
View user's profile Send private message Reply with quote
system error



Joined: 01 Sep 2013
Posts: 670
system error 28 Apr 2017, 13:03
You're right and correct. I think I got your point now. Thanks for clarification.
Post 28 Apr 2017, 13:03
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.