Rust GCC backend: Why and how

GCC modularity, GPL, and LLVM

  • Several comments note GCC’s lack of a clean, modular codegen interface 20+ years after LLVM, calling it “intentional” to prevent proprietary backends and plugin ecosystems.
  • Older statements are cited where GCC leadership explicitly wanted tight front/back-end coupling to avoid GPL workarounds (e.g., using GCC frontends with proprietary backends).
  • Some argue this led directly to LLVM’s success under a permissive license: better modularity plus fewer ideological constraints.
  • Others say Stallman’s influence has waned and today’s GCC architecture is more about technical tradeoffs, ongoing decoupling work, and limited resources, not pure ideology.
  • There’s debate whether sacrificing technical cleanliness to enforce copyleft is justified, with sharp disagreement over whether this protects or harms “software freedom.”

Rust GCC backend and libgccjit

  • libgccjit is described as a usable but awkward interface: more like driving GCC through a high-level “remote control” than true internal integration, compared to LLVM’s library-like design.
  • Analogies (e.g., “SLIP over MIDI”) emphasize that it works but is clunky and lacks features one wants when deeply integrating a new frontend like Rust.

Rust, licensing politics, and ecosystem control

  • Some view Rust’s LLVM-based toolchain and GitHub-centric ecosystem as “GPL-hostile” and too dependent on large corporations (Microsoft, Google, etc.), worrying about long‑term control.
  • Others counter that Rust and LLVM are still free software, GPL crates exist, and most modern developers simply default to permissive licenses out of apathy, not malice.
  • A strong strand argues that if Rust is going to be widely used in core free software (e.g., the Linux stack), a GCC backend is valuable to keep the toolchain within a GPL’d, community-controlled compiler.

Rust adoption vs resistance

  • One commenter explicitly doesn’t want Rust entering existing projects they hack on; for them, Rust code (even open source) feels “equivalent to proprietary” because they refuse to learn it.
  • This triggers pushback: others say Rust increases their ability to modify software, and that disliking or refusing to learn a language doesn’t make it less free.
  • A long subthread digs into deeper objections: opposition to:
    • Package managers and dependency-heavy ecosystems (Cargo/crates).
    • Pervasive ad-hoc polymorphism via traits.
    • Ownership semantics as a foundational model.
  • Responses acknowledge these are fundamental design choices; Rust is unlikely to change there, but they’re subjective tradeoffs rather than clear defects.

Parsing, frontends, and compiler theory

  • Discussion branches into how modern compilers parse code:
    • Many major compilers (Clang, rustc, modern GCC frontends, Python, Ruby) now use hand-written recursive descent parsers for better error messages, context handling, and performance.
    • Classic tools like flex/bison are less common in “big” languages but still used (e.g., Nix), often with poor error messages.
    • C++ is highlighted as fundamentally requiring type information for disambiguation, making conventional LR/LL parser generators a poor fit.
  • Several note that academic compiler courses overemphasize parsing theory relative to the “rest of the owl” (type systems, IRs, optimization, codegen), which dominate real-world complexity in languages like Rust.

Safety-critical and redundancy motivations

  • A key practical reason for a second independent Rust compiler backend is safety certification: two diverse toolchains allow each to be certified at a lower individual criticality while cross-checking each other.
  • rustc (via Ferrocene) is already undergoing qualification, but industry still desires a truly independent implementation (not just another LLVM frontend or rustc fork).

Miscellaneous points

  • Some readers want the article’s author to publish a much deeper write-up on GCC passes and Rust lowering internals.
  • There’s a plea for Rust projects—especially small ones—to distribute binaries so users aren’t forced to build from source.
  • A question about whether a GCC backend could outperform LLVM remains unanswered in the thread; performance expectations are left unclear.