Reputation: 826
Let's say I've got a collection of source code written for second-generation sparc processors, and some of the C code is architecture-dependent. How can I compile this code for x86 and ARM processors? I initially thought it'd be easy to use GCC and cross compile, but that seems to be too simple. Am I at least on the right track? Thanks!
Upvotes: 1
Views: 228
Reputation: 399871
You can compile it by using compilers that target the required platforms, on whatever host you like. If you're cross-compiling or not doesn't matter.
What matter is that if the code contains non-portable things, you're going to have to fix those manually. No compiler can do that for you.
For instance, if you assume that the code is running on a big-endian architecture, you're going to have to find all such places and fix them (since x86 and, typically, ARM too are both little-endian). Have fun.
Upvotes: 2