Re: [TECH TOPIC] Rust for Linux

Linus Walleij
2021-07-06T19:12:30Z

On Tue, Jul 6, 2021 at 8:36 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
> On Tue, Jul 6, 2021 at 8:00 PM Linus Walleij <linus.walleij@linaro.org> wrote:
> >
> > I brought this up for discussion with Miguel et al and it turns out
> > the project to develop a GCC front-end for Rust is now well under
> > way and there is already a frankencompiler using LLVM first
> > and then feeding that into GCC IIUC.
>
> By the latter, I think you are referring to `rustc_codegen_gcc` -- in
> that case, a quick note: it does not involve LLVM. `rustc` has its own
> set of IRs which then gets translated into LLVM IR (in the most common
> backend), but in the case of `rustc_codegen_gcc` it gets translated
> into something libgccjit can consume. There is also a third backend in
> the works, called cranelift, for different use cases.
>
> So `rustc_codegen_gcc` is basically a very quick way of supporting the
> entirety of the Rust language (exactly as `rustc` supports it) but
> having a GCC codegen path.

Yeah that was the thing I read about in The Register through my
newsfeed.

Excellent hack! It shows that this can be done, but perhaps partly
due to licensing a Rust front-end needs to be written for GCC
from scratch as well.

Yours,
Linus Walleij