PE/COFF format

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
lopidas
Member
Member
Posts: 65
Joined: Sun May 26, 2013 10:12 am

PE/COFF format

Post by lopidas »

From x86 formats the text, data and bss section and their s-versions are said to be free formats where can I find these specifications?
rdata is not considered free format and srdata is. I think this is some error in specification. Isn't it?
Are these formats same as in COFF?
Where to find rdata specification?
And sections used by another compilers are idata edata (DLL) reloc (object file)? Where can I find these specifications?
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: PE/COFF format

Post by sortie »

In general, the Executable and Linkable Format (ELF) is favored in this community because it's fully free, widely available, and well documented/standardized. You may wish to use/study ELF instead of PE/COFF.

If you insist, then I can see a bunch of information on Google. I see a Microsoft specification, two wikipedia pages and a link to our wiki as the first four results on my personal Google. It should be simple enough to find information on this matter, let us know if you fail to find something specific. I don't entirely understand your question, so it's likely you already found this, if I misunderstood your question please rephrase it. :-)

Note that the contents of the program segments (text, data, bss, ...) are not standardized. This is part of the program itself and is meant simply to be loaded into memory by the program loader at certain locations and then execution transferred to the program entry point. All the meaning to these segments is given by the program itself. (Note that some segments may contain debugging information and other standardized embedded resource formats, these may well have some specification).
lopidas
Member
Member
Posts: 65
Joined: Sun May 26, 2013 10:12 am

Re: PE/COFF format

Post by lopidas »

So is it data dependent on instruction set?
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: PE/COFF format

Post by sortie »

What is? The text segment? Yes, that segment is filled with instructions for the target machine. Note however that this is not enforced, it could actually contain anything, the program loader will load it and try to execute it as program code.
Casm
Member
Member
Posts: 221
Joined: Sun Oct 17, 2010 2:21 pm
Location: United Kingdom

Re: PE/COFF format

Post by Casm »

I have been looking in to this, because I want to write a PE conversion to Elf conversion utility. It would seem that .text, .bss, .data and .rdata (read only data) are the only ones we need worry about. The rest have to do with the internal workings of Windows; such as linkage to DLLs or debugging information.

.text is code
.bss is uninitialised data
.data is initialised data
.rdata is read only data

Microsoft hasn't get a monopoly on those names. Even if they had, I doubt if they would bother suing anybody else for using them.

The three types of data are split up in that way because uninitialised data does not need to be stored in the program file (there is nothing to store), and only one copy of read only data needs to be loaded into the computer's memory (different users running the same program would all be able to read it, but none of them could modify it).
Post Reply