Niraj Singh
Niraj Singh

Reputation: 31

Can I generate 64-Bit application binary from a 32-Bit GCC compiler?

I want to understand how a 32-Bit compiler generates 64-Bit binary. I understand that we pass -m64 flag but should we use 64-Bit GCC compiler to generate 64-Bit binary code?

Upvotes: 3

Views: 559

Answers (1)

David Schwartz
David Schwartz

Reputation: 182743

Two compilers can do precisely the same thing, producing precisely the same output from the same input, so long as they both execute the same algorithms. Whether they are compiled as 32-bit or 64-bit executables makes no difference to the logic of their execution so long as the limits of 32-bit executables aren't exceeded. Similarly, you can run a compiler on one platform to produce output for a totally different platform because the platform a program runs on has no effect on its internal logic. The output produced depends only on the logic the compiler follows.

Upvotes: 3

Related Questions