about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/builder.rs
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2022-06-26 13:15:03 +0900
committerGitHub <noreply@github.com>2022-06-26 13:15:03 +0900
commitfba8dfd75f9182a0793284c3d6766132c9965421 (patch)
treeb515e950192f1afb4048d30cdee51fe9ca7d21a9 /compiler/rustc_codegen_llvm/src/builder.rs
parentc3b2291dc31a7e3f00c93e186ea380ba15bf75e0 (diff)
parent418b1fa77af366b3784c35d88927ec7f4d869dea (diff)
downloadrust-fba8dfd75f9182a0793284c3d6766132c9965421.tar.gz
rust-fba8dfd75f9182a0793284c3d6766132c9965421.zip
Rollup merge of #98513 - ehuss:rebuild-llvm-download, r=Mark-Simulacrum
Fix LLVM rebuild with download-ci-llvm.

This fixes an issue where updating a local checkout that includes a change in `src/version` causes a linking failure.

The cause is that the `rustc_llvm` build script uses `rerun-if-changed` of `llvm-config` to know if it needs to rerun. Cargo only compares the timestamp of the last time the build script to the file. However, extracting the tar files retains the timestamps in the tarball which may be some time in the past. Since `src/version` is included in the LLVM `.so` filename, `rustc` attempts to load the wrong shared library since the `rustc_llvm` build script doesn't rerun.

https://github.com/rust-lang/cargo/issues/10791 contains a more detailed explanation.

The solution here is a hack which updates the timestamp of `llvm-config` to the current time when it is extracted.

This is a bit of a hack, but seems to be the best solution I can think of until https://github.com/rust-lang/cargo/issues/10791 is fixed. There are likely several other situations where this is a problem (such as using system LLVM), and this isn't really a complete fix.

Note that apple platforms are not directly affected by this problem because they don't have a version in the dylib filename.

How to test this:

1. On a linux host, enable download-ci-llvm
2. Check out 7036449c774860a5b348dbbe01c20704c557382e (the commit just before the last version bump)
3. `./x.py build library/std`
4. Check out 5f015a24f99f52ea9b67beb420aff24f82acf1af (the commit that bumped the version)
5. `./x.py build library/std`

Fixes #98495
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/builder.rs')
0 files changed, 0 insertions, 0 deletions