title: How does a compiler "know" how to translate code into processor specific assembly?
body: <p><strong>Stuff that answerers already know, but here it is anyways to show my thinking process:</strong></p>
  
  <p>Going from HLL to Machine Code, here are rough set of events that takes place (there are Linkers and other things, but let's ignore that for now) :</p>
  
  <p>HLL --> Compiler --> Assembler ----> Machine Code</p>
  
  <p>Depending on what hardware I buy, it may have different Processor (Intel, SPARC, ARM etc.). And Assembly language is Processor specific. So when code goes from Compiler --> Assembler, the Assembly code that gets generated is Processor specific. </p>
  
  <p><strong>Getting to the point:</strong></p>
  
  <p>For example: I have Windows OS on my hardware. And I get, say, 'C compiler for Windows 7 64bit'. And I also have Ubuntu on same hardware, and I get 'C compiler for Ubuntu 64 bit'.</p>
  
  <ol>
  <li><p>I can have same OSs on different hardware with different processor architecture, or different OSs on the same hardware (like above example). When I am downloading C compiler, why is it that Compilers are listed as OS specific? Rather than Processor specific? Since the whole point of a compiler is to translate HLL to Assembly, which is Processor Architecture specific and <strong>not</strong> OS specific.</p></li>
  <li><p>Assuming that 1. is how things are done, and when I download a compiler that is for Windows 7 and for Ubuntu, how does the compiler know what processor specific Assembly code to generate? Does the compiler come with various processor specific Assemblers?</p></li>
  </ol>