OrangeCalx01
OrangeCalx01

Reputation: 826

Compiling sparc code for x86 and arm

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

Answers (1)

unwind
unwind

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

Related Questions