For ex: Two machines have the same compiler and the same operating system. But the two machines have different processors (different assembly instructions).As the compiler was downloaded with respect to the operating system, how does the source code get converted to machine language of each processor?

  • 1
    I disagree with the dupe vote - they are not the same question. And the question is perfectly clear, even if a bit basic.
    – user22815
    Commented Jan 26, 2017 at 21:54
  • It doesn't. You can't even run the compiler on one of those processors. Commented Nov 20, 2018 at 2:55

2 Answers 2


Essentially, through configuration options.

A compiler that understands multiple back-ends will usually assume that source code should be compiled to the platform (os + processor type) on which the compiler itself is running. Everything else would be cross-compiling, and would have to be specified via command-line switches or configuration files.


You use different compilers.

The GCC compiler for ARM is different from the GCC compiled for x86. They may share the same source but once they're compiled they become two different programs, different compilers.

You have different steps,

For example you're working on an x86, you can compile your compiler to run on x86, but you can also compile it to run on ARM.

And once you have your compiler running on ARM you can run it to output ARM-programs, but also to output x86-programs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.