Skip to content

Commit 560e65c

Browse files
authored
Merge pull request rust-lang#427 from GuillaumeGomez/config-file
Switch to `config.toml` instead of `gcc-path`
2 parents 357cae8 + de9d1b6 commit 560e65c

File tree

18 files changed

+227
-90
lines changed

18 files changed

+227
-90
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ jobs:
5555
- name: Setup path to libgccjit
5656
run: |
5757
sudo dpkg --force-overwrite -i gcc-13.deb
58-
echo /usr/lib/ > gcc_path
58+
echo 'gcc-path = "/usr/lib/"' > config.toml
5959
6060
- name: Set env
6161
run: |
62-
echo "LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
63-
echo "LD_LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
6462
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
63+
echo "LIBRARY_PATH=/usr/lib" >> $GITHUB_ENV
64+
echo "LD_LIBRARY_PATH=/usr/lib" >> $GITHUB_ENV
6565
6666
#- name: Cache rust repository
6767
## We only clone the rust repository for rustc tests

.github/workflows/failures.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ jobs:
5252

5353
- name: Setup path to libgccjit
5454
if: matrix.libgccjit_version.gcc == 'libgccjit12.so'
55-
run: echo /usr/lib/gcc/x86_64-linux-gnu/12 > gcc_path
55+
run: |
56+
echo 'gcc-path = "/usr/lib/gcc/x86_64-linux-gnu/12"' > config.toml
57+
echo "LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12" >> $GITHUB_ENV
58+
echo "LD_LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12" >> $GITHUB_ENV
5659
5760
- name: Download artifact
5861
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
@@ -62,12 +65,12 @@ jobs:
6265
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
6366
run: |
6467
sudo dpkg --force-overwrite -i gcc-13.deb
65-
echo /usr/lib/ > gcc_path
68+
echo 'gcc-path = "/usr/lib"' > config.toml
69+
echo "LIBRARY_PATH=/usr/lib" >> $GITHUB_ENV
70+
echo "LD_LIBRARY_PATH=/usr/lib" >> $GITHUB_ENV
6671
6772
- name: Set env
6873
run: |
69-
echo "LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
70-
echo "LD_LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
7174
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
7275
7376
#- name: Cache rust repository

.github/workflows/gcc12.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ jobs:
4747
run: sudo apt-get install ninja-build ripgrep llvm-14-tools libgccjit-12-dev
4848

4949
- name: Setup path to libgccjit
50-
run: echo /usr/lib/gcc/x86_64-linux-gnu/12 > gcc_path
50+
run: echo 'gcc-path = "/usr/lib/gcc/x86_64-linux-gnu/12"' > config.toml
5151

5252
- name: Set env
5353
run: |
54-
echo "LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
55-
echo "LD_LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
5654
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
55+
echo "LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12" >> $GITHUB_ENV
56+
echo "LD_LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12" >> $GITHUB_ENV
5757
5858
#- name: Cache rust repository
5959
## We only clone the rust repository for rustc tests

.github/workflows/m68k.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ jobs:
6565
- name: Setup path to libgccjit
6666
run: |
6767
sudo dpkg -i gcc-m68k-13.deb
68-
echo /usr/lib/ > gcc_path
68+
echo 'gcc-path = "/usr/lib/"' > config.toml
6969
7070
- name: Set env
7171
run: |
72-
echo "LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
73-
echo "LD_LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
7472
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
73+
echo "LIBRARY_PATH=/usr/lib" >> $GITHUB_ENV
74+
echo "LD_LIBRARY_PATH=/usr/lib" >> $GITHUB_ENV
7575
7676
#- name: Cache rust repository
7777
## We only clone the rust repository for rustc tests

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ jobs:
4242
- name: Setup path to libgccjit
4343
run: |
4444
sudo dpkg --force-overwrite -i gcc-13.deb
45-
echo /usr/lib/ > gcc_path
45+
echo 'gcc-path = "/usr/lib/"' > config.toml
4646
4747
- name: Set env
4848
run: |
49-
echo "LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
50-
echo "LD_LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
5149
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
50+
echo "LIBRARY_PATH=/usr/lib" >> $GITHUB_ENV
51+
echo "LD_LIBRARY_PATH=/usr/lib" >> $GITHUB_ENV
5252
5353
- name: Build
5454
run: |

.github/workflows/stdarch.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ jobs:
5656
- name: Setup path to libgccjit
5757
run: |
5858
sudo dpkg --force-overwrite -i gcc-13.deb
59-
echo /usr/lib/ > gcc_path
59+
echo 'gcc-path = "/usr/lib/"' > config.toml
6060
6161
- name: Set env
6262
run: |
63-
echo "LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
64-
echo "LD_LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
6563
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
64+
echo "LIBRARY_PATH=/usr/lib" >> $GITHUB_ENV
65+
echo "LD_LIBRARY_PATH=/usr/lib" >> $GITHUB_ENV
6666
6767
- name: Build
6868
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ tools/llvmint-2
2828
# The `llvm` folder is generated by the `tools/generate_intrinsics.py` script to update intrinsics.
2929
llvm
3030
build_system/target
31+
config.toml

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ tempfile = "3.7.1"
3737
[dev-dependencies]
3838
lang_tester = "0.3.9"
3939
tempfile = "3.1.0"
40+
boml = "0.3.1"
4041

4142
[profile.dev]
4243
# By compiling dependencies with optimizations, performing tests gets much faster.

Readme.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,27 @@ $ make check-jit
4949
$ make check-jit RUNTESTFLAGS="-v -v -v jit.exp=jit.dg/test-asm.cc"
5050
```
5151

52-
**Put the path to your custom build of libgccjit in the file `gcc_path`.**
52+
**Put the path to your custom build of libgccjit in the file `config.toml`.**
53+
54+
If you followed the instructions exactly as written (ie, you have created a `gcc-build` folder
55+
where gcc is built), the only thing you need to do is:
56+
57+
```bash
58+
$ cp config.example.toml config.toml
59+
```
60+
61+
But if you did something different, you also need to set the `gcc-path` value in `config.toml` with
62+
the result of this command:
5363

5464
```bash
55-
$ dirname $(readlink -f `find . -name libgccjit.so`) > gcc_path
65+
$ dirname $(readlink -f `find . -name libgccjit.so`)
5666
```
5767

5868
Then you can run commands like this:
5969

6070
```bash
6171
$ ./y.sh prepare # download and patch sysroot src and install hyperfine for benchmarking
62-
$ LIBRARY_PATH=$(cat gcc_path) LD_LIBRARY_PATH=$(cat gcc_path) ./y.sh build --release --features master
72+
$ ./y.sh build --release --features master
6373
```
6474

6575
To run the tests:
@@ -100,7 +110,7 @@ error: failed to copy bitcode to object file: No such file or directory (os erro
100110
> You should prefer using the Cargo method.
101111
102112
```bash
103-
$ LIBRARY_PATH=$(cat gcc_path) LD_LIBRARY_PATH=$(cat gcc_path) rustc +$(cat $CG_GCCJIT_DIR/rust-toolchain | grep 'channel' | cut -d '=' -f 2 | sed 's/"//g' | sed 's/ //g') -Cpanic=abort -Zcodegen-backend=$CG_GCCJIT_DIR/target/release/librustc_codegen_gcc.so --sysroot $CG_GCCJIT_DIR/build_sysroot/sysroot my_crate.rs
113+
$ LIBRARY_PATH="[gcc-path value]" LD_LIBRARY_PATH="[gcc-path value]" rustc +$(cat $CG_GCCJIT_DIR/rust-toolchain | grep 'channel' | cut -d '=' -f 2 | sed 's/"//g' | sed 's/ //g') -Cpanic=abort -Zcodegen-backend=$CG_GCCJIT_DIR/target/release/librustc_codegen_gcc.so --sysroot $CG_GCCJIT_DIR/build_sysroot/sysroot my_crate.rs
104114
```
105115

106116
## Env vars
@@ -322,7 +332,7 @@ generate it in [gimple.md](./doc/gimple.md).
322332
#### Configuring rustc_codegen_gcc
323333

324334
* Run `./y.sh prepare --cross` so that the sysroot is patched for the cross-compiling case.
325-
* Set the path to the cross-compiling libgccjit in `gcc_path`.
335+
* Set the path to the cross-compiling libgccjit in `gcc-path` (in `config.toml`).
326336
* Make sure you have the linker for your target (for instance `m68k-unknown-linux-gnu-gcc`) in your `$PATH`. Currently, the linker name is hardcoded as being `$TARGET-gcc`. Specify the target when building the sysroot: `./y.sh build --target-triple m68k-unknown-linux-gnu`.
327337
* Build your project by specifying the target: `OVERWRITE_TARGET_TRIPLE=m68k-unknown-linux-gnu ../y.sh cargo build --target m68k-unknown-linux-gnu`.
328338

@@ -338,4 +348,4 @@ If you get the following error:
338348
/usr/bin/ld: unrecognised emulation mode: m68kelf
339349
```
340350

341-
Make sure you set `gcc_path` to the install directory.
351+
Make sure you set `gcc-path` (in `config.toml`) to the install directory.

0 commit comments

Comments
 (0)