Clarification on Binary file (PE/COFF & ELF) formats & terminology Clarification on Binary file (PE/COFF & ELF) formats & terminology windows windows

Clarification on Binary file (PE/COFF & ELF) formats & terminology


I'm the OP. Every one's answer is a partial answer. So, I'm combining all the other answers with what I learnt to complete the answer.

This is the "Generally" used terminology.

  • A file that is given as input to the linker (output of assembler) is called Object File or Relocatable File.

  • The linker produces an Image file, which in turn is used as input by the loader. Now, an Image file can either be an Executable file or Library file. These 'Library files' are of two kinds:

    1. Static Library (*.lib files for windows. *.a for linux)
    2. Shared/Dynamic libraries : DLL ( *.dll on windows) & Shared Object file( *.so in Linux)
  • The term Binary File / Binary can be used to refer to either an ObjectFile or an ImageFile. Undestand depending up on the context. It is a very general term.

  • Loader when loads the image file into memory. Then it is called Module (I'm not sure about Linux guys, but windows guys call it Module

http://www.gliffy.com/pubdoc/1978433/L.jpgalt text http://www.gliffy.com/pubdoc/1978433/L.jpg

As I said, these are "Generally" used terminology. There are no strict definitions for the terms 'binary file', 'image file', or 'object file'.

Particularly the term 'object file' might sometimes be used to mean an intermediate file output by the compiler for use by the linker, but in another context might mean an executable file.

Especially on different platforms they might be used for refer to different or similar things. Even when discussing issues on a single platform, one writer might use the terms somewhat differently than another.

  • Both ObjectFile & ImageFile are in PE Format in windows & ELF format in linux.
  • ELF is not only the format of the image file but is also the format of the object file.
  • Every ELF file starts with an ELF Header. The second field of an ELF Header is e_type; this fields lets us know whether the file is an object file (aka a relocatable in ELF parlance), or an image (which can be either an executable or a shared object) or something else (core file's are also ELF files).
  • I don't know if there is any bit in header that differentiates an Object file from Image file. It needs to be checked.

I know that PE is derived from COFF. But why does the Microsoft specifications of PE format is named Microsoft Portable Executable "and Common Object File Format Specification". Do they still support COFF? If they, in which OS? I thought PE completely replaced COFF long ago.

As far as "PE" vs "COFF", my recollection is that Microsoft use the "COFF" specification as the starting point for the "PE" specification but extended it for their needs. So strictly speaking a "PE" file isn't a "COFF" file, but it's very similar in many ways.


There are no strict definitions for the terms 'binary file', 'image file', or 'object file'.

Particularly the term 'object file' might sometimes be used to mean an intermediate file output by the compiler for use by the linker, but in another context might mean an executable file.

Especially on different platforms they might be used for refer to different or similar things. Even when discussing issues on a single platform, one writer might use the terms somewhat differently than another.

As far as "PE" vs "COFF", my recollection is that Microsoft use the "COFF" specification as the starting point for the "PE" specification but extended it for their needs. So strictly speaking a "PE" file isn't a "COFF" file, but it's very similar in many ways.


gcc -c will produce a .o file, which is an elf format object file, on a Linux system. "ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV)" is how a .o file is described by the file command on my machine.