-
Notifications
You must be signed in to change notification settings - Fork 185
First contributions
Contributing to this project might appear daunting to some, here is a quick guide that will hopefully help newcomers.
It is usually easier for people to work on their own fork of the project. To do so you need to fork the repository and clone it locally on your computer. The first steps we advise are usually the same for everyone, you need to configure and compile the project.
The configure script will check that your computer has all required dependencies to compile the project. To configure the project, you need to create a directory somewhere that will hold all build artifacts. Note that the root directory of the project should not be used as GCC's build system doesn't really like this but you may create a directory within the project's tree.
mkdir $GCC_TOP_DIR/build && cd $GCC_TOP_DIR/build
This guide will assume you created a build
directory at the root of the project's directory.
../configure --disable-bootstrap --enable-multilib --enable-languages=rust
You may want to use some additional flags or specify the compiler (Yes, GCC can be compiled with clang!). Here is another example with some extra configuration:
../configure CC="ccache clang" CXX="ccache clang++" CFLAGS="-O0 -g" CXXFLAGS="-O0 -g" LD_FLAGS="-fuse-ld=mold" --disable-bootstrap --enable-multilib --enable-languages=rust
This configuration will require additional tools but may speedup your workflow.
-
ccache
to cache build artifacts. -
clang
because output is less convoluted and there are more warning. - Debug informations are enabled.
-
mold
is used instead ofld
for linking stage.
You may then build using make. You can specify the amount of jobs that should be used.
make -j32
The next step is usually to check wether the compiler works correctly and learn how to launch tests. This can be achieved with the following command.
make check-rust
Note that you can launch the tests on multiple jobs but the output will be a little bit messed up.
-
XFAIL
- Test is expected to fail -
XPASS
- -
FAIL
- Test failed -
PASS
- Test passed -
UNSUPPORTED
- Test is unsupported on this target
Tests are using the DejaGNU framework.
TODO: Add test sum + log location
Commits need to be properly formatted
The compiler driver is called gcc but the rust compiler is crab1
, the binary is located under $GCC_TOP_DIR/build/gcc/crab1
.
A few options are quite handy:
-
-frust-debug
prints a lot of debug information during the compilation -
-frust-dump-*
dumps various internal representations (AST/HIR/GENERIC/GIMPLE/...)
You may want to add a variable in your environment to avoid passing the experimental flag every time you invoke crab1
.
export GCCRS_INCOMPLETE_AND_EXPERIMENTAL_COMPILER_DO_NOT_USE=1