5 ms·
> I'm pretty sure that the range of platforms for which Go does cross compilation "very well" is quite small Given that the number of popular platforms is appr
by tomp 11y ago
> I'm pretty sure that the range of platforms for which Go does cross compilation "very well" is quite small
Given that the number of popular platforms is approximately 2 (Intel and ARM), I don't see that as a huge problem.
- pcwalton 11y agoWell, the OS and bit width matters too. {x86-32, x86-64, 32-bit ARM, AArch64} on {Windows, Mac, Linux, Android, iOS} ends up describing a decently large set of targets. Also, you'd be surprised how often people request minor platforms. It's enough that we regularly get people asking for a C backend because they only have a C compiler for that target (though I think a C backend ends up usually not being what those people actually want).
- tomp 11y agoHm... I probably don't know enough about compilers, but why does Windows/Mac/... matter for a compiler (I see why it would matter for the standard library)? AFAIK, the main differences between these platforms are calling conventions (and possibly exception mechanisms), which LLVM should abstract away.
- pcwalton 11y agoYou're missing at least (a) structure padding/alignment; (b) debug info; (c) name mangling. LLVM abstracts over some of the differences but definitely not all. In any case, just having a Rust compiler isn't very useful; you need a standard library (or at least libcore) to do anything interesting with the language, and that's where most of the porting effort comes in.
- jcranmer 11y agoActually, for compilers, platform is typically not just hardware, but the operating system as well. Windows and Linux are night-and-day different for major platform requirements (e.g., filesystems, I/O), and even Linux and FreeBSD can be important target differences in some platform areas. So the number of platforms is approximately {x86-32, x86-64, ARM, AArch64}×{Windows, OS X, Linux, iOS, Android} (- a few combos) ~= 17 (I think). MIPS, Sparc, and PowerPC can be useful in some scenarios, as can even x86-16 (hey, wanna write the initial startup code on x86?), and platforms like PNaCl, Emscripten, or WebAssembly are effectively their own platforms as well.
- Manishearth 11y agoIn that case Rust has exactly the same cross compilation story. You're lowering the bar for Go but not for Rust if you're making that comparison.
- vvanders 11y agoYou're missing PIC, AVR and quite a few other architectures that exist in the uC space(and Rust could be a great target for).