Hacker News new | ask | show | jobs
by kccqzy 303 days ago
TIL. I didn't know clang supports this natively.
2 comments

Clang is natively a cross-compiler. Pass in --sysroot and a corresponding valid sysroot tree for any micro architecture/platform (arm-eabi, macOS, Windows MSVC, PowerPC, Alpine Linux with musl, you name it) and Clang will happily retarget the binary to the correct target platform.
Apple has supported that ‘-arch’ option in their GCC/Clang since at least the PPC->Intel transition, maybe even earlier (PPC64? NeXT/OPENSTEP?)
Yes, since NEXTSTEP.
That would be NeXT, and their GCC fork.