title: Usage differences between. a.out, .ELF, .EXE, and .COFF
body: <p>Don't get me wrong by looking at the question title - I know what they are (format for portable executable files). But my interest scope is slightly different</p>
  
  <p><strong>MY CONFUSION</strong></p>
  
  <p>I am involved in re-hosting/retargeting applications that are originally from third parties. The problem is that sometimes the formats for object codes are also in .elf, .COFF formats and still says, "Executable and linkable". </p>
  
  <p>I am primarily a Windows user and know that when you compile and assemble your C/C++ code, you get something similar to .o or .obj. that are not executable (well, I never tried to execute them). But when you complete linking static and dynamic libraries and finish building, the executable appears. My understanding is that you can then go about and link that executable or "bash" test it with some form of script if necessary.</p>
  
  <p>However, in Linux (or UNIX-like systems) there are .o files after you compile and assemble the C/C++ code. And once the linking is done, the executable is in a.out format (at least in Ubuntu distribution of Linux). It may very well be .elf in some other distrib. In my quick web search none of the sources mentioned anything about .o files as executables. </p>
  
  <p><strong>QUESTIONS</strong></p>
  
  <p>Therefore my question turns into the followings:</p>
  
  <ol>
  <li><p>What is the <em>true</em> definitions for portable executables and object code?</p></li>
  <li><p>How is it that Windows and UNIX platform covers both executables annd object code under the same file format (.COFF, .elf).</p></li>
  <li><p>Am I misinterpreting "Linkable"? My interpretation of "Linkable" is something that is compiled object code and can then be "linked" to other static/dynamic link libraries. Is this a stupid thought?</p></li>
  <li><p>Based on question 1. (and perhaps 2) do I need to use symbol tables (e.g. .LUM or .MAP files) with object code then? Symbols as in debug symbols and using them when re-hosting the executables/object files on a different machine.</p></li>
  </ol>
  
  <p>Thanks in advance for the right nudges. Meanwhile, I will keep digging and update the question if necessary.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I have managed to dig <a href="http://www.tenouk.com/ModuleW.html" rel="noreferrer">this</a> out from somewhere :( Seems   like a lot to swallow to me.</p>