How to build rustc with custom-built LLVM?

Hi,

I have a locally built LLVM version that I want to link against rustc(nightly). LLVM is built with debug mode and assertion turned on. This is my bootstrap.toml:

change-id = "ignore"

[target.x86_64-unknown-linux-gnu]
llvm-config = "/home/lee/dev/llvm-project/build/bin/llvm-config"

[llvm]
download-ci-llvm = false
link-shared = false

[build]
extended = true

[rust]
channel = "nightly"

Whenever I run the following command, it throws an error "No such file or directory (os error 2)" (/home/lee/dev/rust/src/llvm-project). However, if I clone an in-tree llvm directory, it will try to compile rust/src/llvm-project, but not use my custom-built LLVM.

# working directory: /home/lee/dev/rust
./x.py build test --stage 2

I aim to see the performance change when compiling Rust with my updated LLVM patch. Not sure if there's a better way to do this. Any pointer is appreciated, thanks!

The default config still uses the in-tree src/llvm-project for optimized-compiler-builtins on all channels but "dev". You can turn that off in either [build] or the specific [target.{triple}] section, but make sure you're consistent about that when comparing builds.

1 Like