Hacker News new | ask | show | jobs
by ivanjermakov 26 days ago
> The primary goal of this is support for old/obscure hardware with no LLVM/GCC support

Wouldn't it be easier to add old hardware support to LLVM/GCC instead? I adore the project scale and determination, but for this goal extending existing projects seems more logical than building a language translator.

3 comments

> Wouldn't it be easier to add old hardware support to LLVM/GCC instead?

No, in fact it's much, much harded. You have no idea of the scope. I have no idea of the scope. Nobody does. There are obscure machines we've never heard about and there are C compilers for them. Targeting and supporting them from modern toolchains is a fool's errand.

rust to c supports infinite platforms that already have a c compiler by implementing a single rust to c program

on the other hand, porting llvm to an infinite number of platforms requires an infinite amount of work

so, it is less work this way

Some architecture lacks documentation, if you have a working C compiler, it's easier to use it than working on a compiler to target it.
Presumably you still need a C++ compiler for LLVM itself though. Or... a C++ to C translator.

Edit: On second thought, that's only needed if you want to run rustc itself on the old hardware, which is probably not super useful given the main reason you would need to do this is if LLVM can't target that hardware.

For building code written in Rust for such old hardware, this would be sufficient.