Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 28 additions & 21 deletions src/bootstrap/src/core/build_steps/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2231,30 +2231,37 @@ impl Step for FileCheck {
};

// There is a LLVM config set, take filecheck from it
// Note: because `download-ci-llvm` currently overrides `llvm-config`, when the LLVM is
// downloaded, we go through this branch. Ideally, this should be changed so that
// `download-ci-llvm` doesn't override the config.
if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {
let llvm_bindir = command(s).arg("--bindir").run_capture_stdout(builder).stdout();
let filecheck = Path::new(llvm_bindir.trim()).join(exe("FileCheck", self.target));
let filecheck = if filecheck.exists() {
filecheck
} else {
// On Fedora the system LLVM installs FileCheck in the
// llvm subdirectory of the libdir.
let llvm_libdir = command(s).arg("--libdir").run_capture_stdout(builder).stdout();
let lib_filecheck =
Path::new(llvm_libdir.trim()).join("llvm").join(exe("FileCheck", self.target));
if lib_filecheck.exists() {
lib_filecheck
} else {
// Return the most normal file name, even though
// it doesn't exist, so that any error message
// refers to that.
if let Some(llvm_config) = target_config.and_then(|c| c.llvm_config.as_ref()) {
// We can only execute llvm-config if we're on the same host target
return if builder.is_host_target(self.target) {
let llvm_bindir =
command(llvm_config).arg("--bindir").run_capture_stdout(builder).stdout();
let filecheck = Path::new(llvm_bindir.trim()).join(exe("FileCheck", self.target));

if filecheck.exists() {
filecheck
} else {
// On Fedora the system LLVM installs FileCheck in the
// llvm subdirectory of the libdir.
let llvm_libdir =
command(llvm_config).arg("--libdir").run_capture_stdout(builder).stdout();
let lib_filecheck = Path::new(llvm_libdir.trim())
.join("llvm")
.join(exe("FileCheck", self.target));
if lib_filecheck.exists() {
lib_filecheck
} else {
// Return the most normal file name, even though
// it doesn't exist, so that any error message
// refers to that.
filecheck
}
}
} else {
// In other cases, just guess that Filecheck is available in the same directory
// as the llvm-config
llvm_config.parent().unwrap().join(exe("FileCheck", self.target))
};
return filecheck;
}
// Here we take the filecheck from LLVM directly
let llvm_output = builder.ensure(Llvm { target: self.target });
Expand Down
5 changes: 0 additions & 5 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1008,11 +1008,6 @@ impl Config {
target.llvm_has_rust_patches = Some(patches);
}
if let Some(ref s) = target_llvm_filecheck {
if target_llvm_config.is_none() {
panic!(
"You must also configure `llvm-config` when setting `llvm-filecheck` for target {triple}",
);
}
target.llvm_filecheck = Some(src.join(s));
}
target.llvm_libunwind = target_llvm_libunwind.as_ref().map(|v| {
Expand Down
Loading