3 ms·
What role (if any) does GCC play in Rust? I understand that Rust relies on LLVM. If the industry continues to move more and more to Rust then will GCC begin t
by VWWHFSfQ 6y ago
What role (if any) does GCC play in Rust? I understand that Rust relies on LLVM. If the industry continues to move more and more to Rust then will GCC begin to lose relevance? Or will the GCC developers add a Rust ~~backend~~ frontend? Has there been any movement toward that anyway?
There are many gaps in my understanding of Rust with regard to LLVM and GCC.
- klysm 6y agoI’m not sure about GCC, but a significant amount of work has gone into a cranelift based backend for rust (https://github.com/bjorn3/rustc_codegen_cranelift https://github.com/bjorn3/rustc_codegen_cranelift).
- steveklabnik 6y agohttps://users.rust-lang.org/t/call-for-help-implementing-an-independent-rust-frontend-for-gcc/32163/ https://users.rust-lang.org/t/call-for-help-implementing-an-...
- konschubert 6y agoWouldn’t you need to add a RUST frontend?
- VWWHFSfQ 6y agoah right
- redrobein 6y ago> There are many gaps in my understanding of Rust with regard to LLVM and GCC. The rust compiler generates some intermediate code (LLVM IR) that's fed into LLVM, which optimizes and turns it into machine code. You can check out what this looks like in the rust playground. Getting GCC to compile rust would be a matter of getting the rust compiler to generate GCC IR. Cranelift (built with rust) is an alternative to LLVM with it's own IR. The cranelift backend for rust should help future projects that want to do something similar, I guess.
- orangeshark 6y agoThere was a rust frontend for GCC[0]. Will need a lot to work though. [0]: https://gcc.gnu.org/wiki/RustFrontEnd https://gcc.gnu.org/wiki/RustFrontEnd
- fsloth 6y ago"will GCC begin to lose relevance" Systems programming is not web where they change the framework and 'script flavour every six months. Systems programs live for decades - and hence their critical infrastructure like GCC will as well. C will be with us at least 3 decades more. Longer if Linux kernel will use it still.
- Jyaif 6y ago> then will GCC begin to lose relevance? That has already began. For example all the popular browsers (Chrome and all the derivatives, FF, Safari) moved away from GCC.