Message board for the users of flat assembler.
> Windows > coff help
b1528932 19 Oct 2010, 16:54
i am writing now my own compiler, and i have more than few questions about file ehaders.
- I want it to work on windows and unix. I have coff pdf in front of my eyes and i semi understand it, however i cant find anything regarding elf format.
Where will i find it?
- What is coff object file?
i understand that header look likt: MZ/COFF/PE/DD/SS/rest
MZ - dos header
COFF - coff header staritng with PE
PE - optional header
DD - part of optional header, but even more optional
ss - section headers
why PE is optional?
- there is ambiguity in size of optional header.
SizeOfOptionalHeader, and NumberOfRvaAndSizes.
Whats the diffrence?
All that can change (excluding pe+, wich has diffrent header) are ammount of data directories. Why 2 fields describe 1 thing?
|19 Oct 2010, 16:54||
baldr 19 Oct 2010, 18:08
Optional header can be present in COFF (MS PE/COFF spec contradicts itself on that matter: description for SizeOfOptionalHeader insists on value 0 for COFF, yet in the next subchapter it says "An object file can have an optional header, but generally this header has no function in an object file except to increase its size.")
While it seems superfluous to have both SizeOfOptionalHeader and NumberOfRvaAndSizes, it allows COFF parser to successfully skip optional header without parsing it (PE32/PE32+/PE32++/etc.)
|19 Oct 2010, 18:08||
f0dder 22 Oct 2010, 17:39
For information on ELF format, the wikipedia article is a starting point, with overview and links to multiple resources. If you're implementing ELF support, you might want to dive into GNU Binutils sources, and you'll likely want to use binutils to verify/examine your generated object files as you go.
Might also want to check out the BSD LibElf - I haven't had a look at it myself, but in general I find BSD code to be better written than a lot of GNU stuff. I messed around a bit with GNU binutils several years ago, and it wasn't exactly super pretty
The Portable Executable format is a bit of a mess - not so much from it's specification, but more in that different versions of Windows have slightly different requirements for what it considers to be a well-formed executable - and then there's the issue of anti-malware software going apeshit heuristic crazy on "non-standard" files.
|22 Oct 2010, 17:39||
< Last Thread | Next Thread >
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.