-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge rustc_codegen_gcc backend as compiler/rustc_codegen_gcc #442
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed. cc @rust-lang/compiler @rust-lang/compiler-contributors |
@rustbot second |
GCC backend for rustc is still in a very early state. It is in the process of being merged in main rustc source: rust-lang/compiler-team#442 Currently reusing main rust compiler class and simply remove -Cllvm= argument if any (only for intel asm syntax). refs compiler-explorer#2683
GCC backend for rustc is still in a very early state. It is in the process of being merged in main rustc source: rust-lang/compiler-team#442 Currently reusing main rust compiler class and simply remove -Cllvm= argument if any (only for intel asm syntax). refs compiler-explorer#2683
GCC backend for rustc is still in a very early state. It is in the process of being merged in main rustc source: rust-lang/compiler-team#442 Currently reusing main rust compiler class and simply remove -Cllvm= argument if any (only for intel asm syntax). refs compiler-explorer#2683
Hello all, Nell Shamrell-Harrington from the Rust Foundation board here. The Foundation has reviewed this issue with its counsel and we agree with the conclusions about licensing in the rustc_codegen_gcc change proposal. Specifically, we agree that: (1) The proposed change will not impact the license of rustc except when it is built with the gcc backend, in which case GPLv3 will apply to the resulting binary. Distribution of that binary will be subject to the terms of GPLv3. In our review, we noticed a couple of related issues that we recommend addressing before the code is merged: (1) The rustc_codegen_gcc repo contains a folder of patches to libgccjit, a GPLv3-licensed work. Section 4 of GPLv3 requires the following when distributing modifications in source code form: |
Thanks! |
@nellshamrell Thanks for digging into this! Regarding issue (1): I think it'd be safer to just remove any GCC patches from the rustc_codegen_gcc repository, and keep those in a separate repository. (That separate repository still needs to follow all the requirements of the GPL, as outlined; I just think we should avoid having such patches in the Rust source repository.) Regarding issue (2), libgccjit isn't a runtime library and never gets linked into target binaries; it generates code that calls |
I'm the author/maintainer of libgccjit. For better or worse, the FSF holds copyright on libgccjit (FWIW, I used to be OK with this, but I've been reconsidering my views on the FSF lately ...but that's a whole other issue). libgccjit is a GPLv3 library, in particular, it's essentially a thin wrapper around GCC's implementation (but designed to work as a shared library rather than a command-line tool). Despite the name, it can also be run as an ahead-of-time compiler, which is how this project is using it.. As I understand it, any host code directly linking with libgccjit needs to comply with the GPLv3, but the target code generated by libgccjit isn't affected by the GPLv3 (but might link against the target libgcc runtime library, which has its own license); this is analogous to the classic usage of GCC as a command-line tool. My understanding is that the FSF is OK with GCC being used to develop code under other licenses (including proprietary), and GCC's license only affects that code in-as-much as it links to the target libgcc runtime library (which is under a different license). It might be worth having your counsel check that license. FWIW, I'm a Rust fanboy, and hope that this project succeeds; I have no problem with it myself. That said, I'm not a lawyer, and am not qualified to give legal advice. I don't speak for my employer (Red Hat), or for the FSF. |
@davidmalcolm Thanks so much for your kind and detailed response, David! |
GCC backend for rustc is still in a very early state. It is in the process of being merged in main rustc source: rust-lang/compiler-team#442 Currently reusing main rust compiler class and simply remove -Cllvm= argument if any (only for intel asm syntax). Disabling binary until the result is more friendly (currently binary are too big). refs compiler-explorer#2683
GCC backend for rustc is still in a very early state. It is in the process of being merged in main rustc source: rust-lang/compiler-team#442 Currently reusing main rust compiler class and simply remove -Cllvm= argument if any (only for intel asm syntax). Disabling binary until the result is more friendly (currently binary are too big). refs compiler-explorer#2683
@rustbot label -final-comment-period +major-change-accepted |
GCC backend for rustc is still in a very early state. It is in the process of being merged in main rustc source: rust-lang/compiler-team#442 Currently reusing main rust compiler class and simply remove -Cllvm= argument if any (only for intel asm syntax). Disabling binary until the result is more friendly (currently binary are too big). refs compiler-explorer#2683
GCC backend for rustc is still in a very early state. It is in the process of being merged in main rustc source: rust-lang/compiler-team#442 Currently reusing main rust compiler class and simply remove -Cllvm= argument if any (only for intel asm syntax). Disabling binary until the result is more friendly (currently binary are too big). refs compiler-explorer#2683
GCC backend for rustc is still in a very early state. It is in the process of being merged in main rustc source: rust-lang/compiler-team#442 Currently reusing main rust compiler class and simply remove -Cllvm= argument if any (only for intel asm syntax). Disabling binary until the result is more friendly (currently binary are too big). refs #2683
GCC backend for rustc is still in a very early state. It is in the process of being merged in main rustc source: rust-lang/compiler-team#442 Currently reusing main rust compiler class and simply remove -Cllvm= argument if any (only for intel asm syntax). Disabling binary until the result is more friendly (currently binary are too big). refs #2683
…mulacrum Libgccjit codegen This PR introduces a subtree for a gcc-based codegen backend to the repository, per decision in rust-lang/compiler-team#442. We do not yet expect to ship this backend on nightly or run tests in CI, but we do verify that the backend checks (i.e., `cargo check`) successfully. Work is expected to progress primarily in https://github.com/rust-lang/rustc_codegen_gcc, with semi-regular upstreaming, like with other subtrees.
…mulacrum Libgccjit codegen This PR introduces a subtree for a gcc-based codegen backend to the repository, per decision in rust-lang/compiler-team#442. We do not yet expect to ship this backend on nightly or run tests in CI, but we do verify that the backend checks (i.e., `cargo check`) successfully. Work is expected to progress primarily in https://github.com/rust-lang/rustc_codegen_gcc, with semi-regular upstreaming, like with other subtrees.
Proposal
rustc_codegen_gcc
is a new code generation backend for rustc using thelibgccjit
library from GCC. (Despite its name,libgccjit
works for ahead-of-time compilation as well.)rustc_codegen_gcc
will allow Rust to target the wider set of architectures that GCC supports. It'll also allow us to generate code optimized via GCC, which in some cases can provide better code generation.This MCP proposes incorporating
rustc_codegen_gcc
intorust-lang/rust
ascompiler/rustc_codegen_gcc
(usinggit subtree
), alongside the other code generation backends. This MCP also proposes gating CI onrustc_codegen_gcc
building, but not on it passing any tests.rustc_codegen_gcc
currently passes the entirecore
testsuite; work on the remainder of the testsuite is in progress.rustc_codegen_gcc
benefits from the existing infrastructure to annotate tests as requiring a specific backend, so that it doesn't attempt to pass LLVM-specific tests.If this MCP is accepted, we'll subsequently submit PRs adding it to
rust-lang/rust
and adding it to the build process. We'll also make a PR to the highfive bot, to automatically CC @antoyo on changes tocompiler/rustc_codegen_gcc
. In the future, we'll make a separate proposal to distributerustc_codegen_gcc
viarustup
.Licensing
rustc_codegen_gcc
uses the same license as rustc: dual MIT / Apache-2.0. Thelibgccjit
library thatrustc_codegen_gcc
depends on uses the same license as GCC: GPLv3-or-later. This won't affect users of rustc at all, and it won't affect distributors of rustc who do not build or distribute the GCC backend.Distributors of rustc (including the Rust project itself) who do choose to build or distribute the GCC backend will need to provide the full source for their distribution of rustc under a GPL-compatible Open Source license;
rustc
and all its dependencies are under GPL-compatible Open Source licenses, so in practice this just means that distributors ofrustc
who choose to build and distribute the GCC backend need to supply full source code. This does not seem like a practical issue, nor does it change rustc's normal permissive licensing policy, as anyone who wishes to use rustc under a permissive license may simply avoid building or distributing the GCC backend.We hope that in practice, Linux distributions will build and distribute the GCC backend once it passes enough of the testsuite to be widely useful, and especially once we have targets that depend on it. Other distributors of
rustc
may choose whether to build and distribute the GCC backend based on their needs.We will never make any portion of rustc other than
rustc_codegen_gcc
depend onlibgccjit
.Given the value of a GCC backend in expanding Rust's reach to more targets, and thus enabling the use of Rust in projects that need to continue supporting such targets, we believe this represents a reasonable step that will not in practice affect anyone's use, development, or distribution of rustc.
Authors
@antoyo is the primary author of
rustc_codegen_gcc
, and will continue to maintain it once merged.@joshtriplett helped with this MCP, and provided guidance and recommendations on licensing.
Mentors or Reviewers
Not sure who to put here.
Process
The main points of the Major Change Process are as follows:
@rustbot second
.-C flag
, then full team check-off is required.@rfcbot fcp merge
on either the MCP or the PR.You can read more about Major Change Proposals on forge.
Comments
The text was updated successfully, but these errors were encountered: