Welcome to the rust_codegen_gcc project! This guide will help you get started as a contributor. The project aims to provide a GCC codegen backend for rustc, allowing Rust compilation on platforms unsupported by LLVM and potentially improving runtime performance through GCC's optimizations.
-
Install the required dependencies:
- rustup (follow instructions on the official website)
- DejaGnu (for running libgccjit test suite)
- Additional packages:
flex
,libmpfr-dev
,libgmp-dev
,libmpc3
,libmpc-dev
-
Clone and configure the repository:
git clone https://github.com/rust-lang/rust_codegen_gcc cd rust_codegen_gcc cp config.example.toml config.toml
-
Build the project:
./y.sh prepare # downloads and patches sysroot ./y.sh build --sysroot --release
To verify your setup:
# Run the full test suite
./y.sh test --release
# Test with a simple program
./y.sh cargo build --manifest-path tests/hello-world/Cargo.toml
- Matrix: Join our Matrix channel
- IRC: Join us on IRC
- GitHub Issues: For bug reports and feature discussions
We encourage new contributors to join our communication channels and introduce themselves. Feel free to ask questions about where to start or discuss potential contributions.
The project consists of several key components:
- The GCC backend integration through libgccjit
- Rust compiler interface
- Test infrastructure
To run a specific test:
- Individual test:
./y.sh test --test <test_name>
- libgccjit tests:
cd gcc-build/gcc make check-jit # For a specific test: make check-jit RUNTESTFLAGS="-v -v -v jit.exp=jit.dg/test-asm.cc"
The project provides several environment variables for debugging:
CG_GCCJIT_DUMP_MODULE
: Dumps a specific moduleCG_GCCJIT_DUMP_TO_FILE
: Creates C-like representationCG_GCCJIT_DUMP_RTL
: Shows Register Transfer Language output
Full list of debugging options can be found in the README.
- Look for issues labeled with
good-first-issue
orhelp-wanted
- Check the project roadmap for larger initiatives
- Consider improving documentation or tests
- Fork the repository and create a new branch
- Make your changes with clear commit messages
- Add tests for new functionality
- Update documentation as needed
- Submit a PR with a description of your changes
- Follow Rust standard coding conventions
- Ensure your code passes
rustfmt
andclippy
- Add comments explaining complex logic, especially in GCC interface code
- Rustc Dev Guide
- GCC Internals Documentation
- Project-specific documentation in the
doc/
directory:- Common errors
- Debugging GCC LTO
- Git subtree sync
- Sending patches to GCC
If you're stuck or unsure about anything:
- Check the existing documentation in the
doc/
directory - Ask in the IRC or Matrix channels
- Open a GitHub issue for technical problems
- Comment on the issue you're working on if you need guidance
Remember that all contributions, including documentation improvements, bug reports, and feature requests, are valuable to the project.