From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D9B770 for ; Wed, 7 Jul 2021 14:10:49 +0000 (UTC) Received: from mail-wm1-f52.google.com ([209.85.128.52]) by mrelayeu.kundenserver.de (mreue009 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MS3r9-1ldFiG1l2x-00TRpO for ; Wed, 07 Jul 2021 16:10:47 +0200 Received: by mail-wm1-f52.google.com with SMTP id u8-20020a7bcb080000b02901e44e9caa2aso1795689wmj.4 for ; Wed, 07 Jul 2021 07:10:47 -0700 (PDT) X-Gm-Message-State: AOAM531b4/jGD+gefJktYeRR39DqwccyTvcUNoBT2qD1PlfogVgBDT+b SbkLAUaPwGJSxEogTdfcCcfzal/NIQFDRgNTpao= X-Google-Smtp-Source: ABdhPJyza9Z2dQj7FlDd8a3xG+uMzs59V/QkESaq+k9aWY92TPGP1l0r4+X+Gcgk1o1+zm0BZqy1qV899XM6TcW9p44= X-Received: by 2002:a1c:c90f:: with SMTP id f15mr7105697wmb.142.1625667046924; Wed, 07 Jul 2021 07:10:46 -0700 (PDT) Precedence: bulk X-Mailing-List: ksummit@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Arnd Bergmann Date: Wed, 7 Jul 2021 16:10:30 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [TECH TOPIC] Rust for Linux To: Miguel Ojeda Cc: Linus Walleij , Geert Uytterhoeven , Leon Romanovsky , ksummit@lists.linux.dev Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:GH2cLtsJxLEa1MGjBWeZHaLK4u3lOtb5QJyRHFtQcMAr9T2YS7v k30fj4liTTdMm81B5Bow7PERkepOOK4Z+56jOSh0MHX5V2ek9rT3XrCY3P/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36 PM Miguel Ojeda wrote: > > On Tue, Jul 6, 2021 at 8:00 PM Linus Walleij 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. I suppose using this for building kernels is actually easier than doing an architecture port for user space, because it does not have to wrap the syscall interface, right? I've had a quick look at what it would take to integrate this into the prebuilt toolchains on kernel.org to give developers the chance to try their rust code across architectures. I've managed to cross-build the patched gcc sources for rustc_codegen_gcc, but haven't actually figured out how to build rustc_codegen_gcc itself. Before I look at this further, can you clarify what the version dependencies are? I.e. if I want to build this for five gcc versions, 27 target architectures, and seven versions of rustc as shipped by the most common distros, can I do this with a single rustc_codegen_gcc binary, or do I need to build 5*27*7=945 versions of the binary, or something inbetween? Arnd