system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: Why is it so hard to port programs to a different instruction set?

As I understand it, a program compiled for x86 for example can only run on x86. But if a compiler was ported to ARM, why can't the program just be compiled for ARM? Is there more to it than that? And if there isn't, why does it take so long for companies and projects to port their programs to a new platform? Isn't it just as easy as compiling, which in the worst case could take a couple of hours?
gpt
This mostly depends on if the program was originally written with portability in mind. There are plenty of assumptions to make and shortcuts to take if you only target a single architecture.

Modern programming languages eliminate a lot of this, but for anything in the C-family, making assumptions about something as simple as endianess is very common.

Different architectures may also have completely different performance profiles, meaning stuff that's fast on one architecture is slow on another and vice versa. This means you have to figure these differences out and do alternative implementations if performance is necessary for your program to function properly (think games).