-
Notifications
You must be signed in to change notification settings - Fork 70
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
improve doc for new contributors #586
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,92 @@ | ||||||
# Contributing to rust_codegen_gcc | ||||||
|
||||||
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. | ||||||
|
||||||
## Getting Started | ||||||
|
||||||
### Setting Up Your Development Environment | ||||||
|
||||||
For detailed setup instructions including dependencies, build steps, and initial testing, please refer to our [README](https://github.com/rust-lang/rustc_codegen_gcc/blob/master/Readme.md). The README contains the most up-to-date information on: | ||||||
|
||||||
- Required dependencies and system packages | ||||||
- Repository setup and configuration | ||||||
- Build process | ||||||
- Basic test verification | ||||||
|
||||||
Once you've completed the setup process outlined in the README, you can proceed with the contributor-specific information below. | ||||||
|
||||||
## Communication Channels | ||||||
|
||||||
- Matrix: Join our [Matrix channel](https://matrix.to/#/#rustc_codegen_gcc:matrix.org) | ||||||
- IRC: Join us on [IRC](https://web.libera.chat/#rustc_codegen_gcc) | ||||||
- 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. | ||||||
|
||||||
## Understanding Core Concepts | ||||||
|
||||||
### Common Development Tasks | ||||||
|
||||||
#### Running Specific Tests | ||||||
To run specific tests, use appropriate flags such as: | ||||||
- `./y.sh test --test-libcore` | ||||||
- `./y.sh test --std-tests` | ||||||
|
||||||
Additional test running options: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make it clearer, please specify that the following runs the tests of |
||||||
```bash | ||||||
# 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" | ||||||
``` | ||||||
|
||||||
#### Debugging Tools | ||||||
The project provides several environment variables for debugging: | ||||||
- `CG_GCCJIT_DUMP_GIMPLE`: Most commonly used debug dump | ||||||
- `CG_RUSTFLAGS`: Additional Rust compiler flags | ||||||
- `CG_GCCJIT_DUMP_MODULE`: Dumps a specific module | ||||||
- `CG_GCCJIT_DUMP_TO_FILE`: Creates C-like representation | ||||||
|
||||||
Full list of debugging options can be found in the README. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a link to the section in the README. |
||||||
|
||||||
## Making Contributions | ||||||
|
||||||
### Finding Issues to Work On | ||||||
1. Look for issues labeled with `good-first-issue` or `help-wanted` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
and please also make those a link. |
||||||
2. Check the [progress report](https://blog.antoyo.xyz/rustc_codegen_gcc-progress-report-34#state_of_rustc_codegen_gcc) for larger initiatives | ||||||
3. Consider improving documentation or investigate [failing tests](https://github.com/rust-lang/rustc_codegen_gcc/tree/master/tests)(except failing-ui-tests12.txt) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
### Pull Request Process | ||||||
1. Fork the repository and create a new branch | ||||||
2. Make your changes with clear commit messages | ||||||
3. Add tests for new functionality | ||||||
4. Update documentation as needed | ||||||
5. Submit a PR with a description of your changes | ||||||
|
||||||
### Code Style Guidelines | ||||||
- Follow Rust standard coding conventions | ||||||
- Ensure your code passes `rustfmt` and `clippy` | ||||||
- Add comments explaining complex logic, especially in GCC interface code | ||||||
|
||||||
## Additional Resources | ||||||
|
||||||
- [Rustc Dev Guide](https://rustc-dev-guide.rust-lang.org/) | ||||||
- [GCC Internals Documentation](https://gcc.gnu.org/onlinedocs/gccint/) | ||||||
- Project-specific documentation in the `doc/` directory: | ||||||
- [Common errors](./doc/errors.md) | ||||||
- [Debugging GCC LTO](./doc/debugging-gcc-lto.md) | ||||||
- [Debugging libgccjit](./doc/debugging-libgccjit.md) | ||||||
- [Git subtree sync](./doc/subtree.md) | ||||||
- [List of useful commands](./doc/tips.md) | ||||||
- [Send a patch to GCC](./doc/sending-gcc-patch.md) | ||||||
|
||||||
## Getting Help | ||||||
|
||||||
If you're stuck or unsure about anything: | ||||||
1. Check the existing documentation in the `doc/` directory | ||||||
2. Ask in the IRC or Matrix channels | ||||||
3. Open a GitHub issue for technical problems | ||||||
4. 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. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,22 +12,35 @@ This is a GCC codegen for rustc, which means it can be loaded by the existing ru | |
The primary goal of this project is to be able to compile Rust code on platforms unsupported by LLVM. | ||
A secondary goal is to check if using the gcc backend will provide any run-time speed improvement for the programs compiled using rustc. | ||
|
||
### Dependencies | ||
|
||
**rustup:** Follow the instructions on the official [website](https://www.rust-lang.org/tools/install) | ||
|
||
**DejaGnu:** Consider to install DejaGnu which is necessary for running the libgccjit test suite. [website](https://www.gnu.org/software/dejagnu/#downloading) | ||
|
||
|
||
## Getting Started | ||
|
||
## Building | ||
Note: **This requires a patched libgccjit in order to work. | ||
You need to use my [fork of gcc](https://github.com/antoyo/gcc) which already includes these patches.** | ||
Comment on lines
+17
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make this clearer, perhaps mention that the default example config download libgccjit from the CI so this will use the fork automatically. |
||
|
||
**This requires a patched libgccjit in order to work. | ||
You need to use my [fork of gcc](https://github.com/rust-lang/gcc) which already includes these patches.** | ||
|
||
```bash | ||
$ cp config.example.toml config.toml | ||
``` | ||
### Dependencies | ||
- rustup: follow instructions on the [official website](https://rustup.rs) | ||
- consider to install DejaGnu which is necessary for running the libgccjit test suite. [website](https://www.gnu.org/software/dejagnu/#downloading) | ||
- additional packages: `flex`, `libmpfr-dev`, `libgmp-dev`, `libmpc3`, `libmpc-dev` | ||
|
||
### Quick start | ||
1. Clone and configure the repository: | ||
```bash | ||
git clone https://github.com/rust-lang/rust_codegen_gcc | ||
cd rust_codegen_gcc | ||
cp config.example.toml config.toml | ||
``` | ||
|
||
2. Build and test: | ||
```bash | ||
./y.sh prepare # downloads and patches sysroot | ||
./y.sh build --sysroot --release | ||
|
||
# Verify setup with a simple test | ||
./y.sh cargo build --manifest-path tests/hello-world/Cargo.toml | ||
|
||
# Run full test suite (expect ~100 failing UI tests) | ||
./y.sh test --release | ||
``` | ||
|
||
If don't need to test GCC patches you wrote in our GCC fork, then the default configuration should | ||
be all you need. You can update the `rustc_codegen_gcc` without worrying about GCC. | ||
|
@@ -40,7 +53,7 @@ to do a few more things. | |
To build it (most of these instructions come from [here](https://gcc.gnu.org/onlinedocs/jit/internals/index.html), so don't hesitate to take a look there if you encounter an issue): | ||
|
||
```bash | ||
$ git clone https://github.com/rust-lang/gcc | ||
$ git clone https://github.com/antoyo/gcc | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please revert this change as the main repo is now under |
||
$ sudo apt install flex libmpfr-dev libgmp-dev libmpc3 libmpc-dev | ||
$ mkdir gcc-build gcc-install | ||
$ cd gcc-build | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also mention how to run the tests in this directory.