You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(rustc_codegen_nvvm): parameterize build.rs over LlvmFlavor
Collapse the per-LLVM duplication in the build script into a single
`LlvmFlavor` struct with two const instances (LLVM7, LLVM19). One
`find_llvm_config`, `find_llvm_as`, `configure_libintrinsics`, and
`rustc_llvm_build` now drive both toolchain paths;
`required_major_llvm_version`, `find_llvm_config_llvm7`,
`find_llvm_config_llvm19`, and `find_llvm_as_llvm19` are gone.
Functional changes that fall out of the refactor:
- Prebuilt LLVM download now works for the `llvm19` feature too, gated on
`USE_PREBUILT_LLVM=1` or as an automatic fallback when no LLVM 19
toolchain is found locally. New `PREBUILT_LLVM_URL_LLVM19` points at
the `llvm-19.1.7` release tag.
- Prebuilt download now supports `linux-x86_64` and `linux-aarch64` in
addition to `windows-x86_64`. The "currently disabled because of
segfaults" note on Linux x86_64 is gone — the prebuild repos that
produce these archives have been refactored to fix the underlying
issue.
- `PREBUILT_LLVM_URL_LLVM7` retagged to lowercase `llvm-7.1.0/` to match
the new release-tag scheme used by the prebuild repos.
- `libintrinsics.bc` is no longer checked in; both LLVM versions now
assemble `libintrinsics.ll` on the fly using the `llvm-as` that ships
next to the resolved `llvm-config`. Removes the only remaining
version-specific branch and means the LLVM 7 path can no longer drift
silently when the `.ll` changes.
The LLVM 7 candidate-search behavior is also slightly stricter:
previously `LLVM_CONFIG` only had to literally start with "7" (matching
7, 70, 700...) and a mismatched env var skipped straight to download;
now major-version match is exact and PATH `llvm-config` is tried as a
fallback before downloading. `USE_PREBUILT_LLVM=1` still forces direct
download.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
// Ask llvm-config where its install tree lives rather than deriving lexically.
96
+
// Lexical derivation breaks when llvm-config is exposed via a single symlink
97
+
// into /usr/bin/ but the rest of the toolchain stays in the install prefix
98
+
// (e.g. /usr/bin/llvm-config -> /opt/llvm-7/bin/llvm-config, with /opt/llvm-7/bin
99
+
// off PATH). It also handles source-built toolchains where tool names are
100
+
// unsuffixed (`llvm-as`) versus apt-packaged ones (`llvm-as-19`).
101
+
let output = Command::new(llvm_config).arg("--bindir").output().ok()?;
102
+
if !output.status.success(){
103
+
returnNone;
104
+
}
105
+
let bindir = String::from_utf8(output.stdout).ok()?.trim().to_string();
106
+
Some(PathBuf::from(bindir).join(tool_prefix))
75
107
}
76
108
77
109
fntarget_to_llvm_prebuilt(target:&str) -> String{
78
110
let base = match target {
79
111
"x86_64-pc-windows-msvc" => "windows-x86_64",
80
-
// NOTE(RDambrosio016): currently disabled because of weird issues with segfaults and building the C++ shim
81
-
// "x86_64-unknown-linux-gnu" => "linux-x86_64",
112
+
"x86_64-unknown-linux-gnu" => "linux-x86_64",
113
+
"aarch64-unknown-linux-gnu" => "linux-aarch64",
82
114
_ => panic!(
83
-
"Unsupported target with no matching prebuilt LLVM: `{target}`, install LLVM and set LLVM_CONFIG"
115
+
"Unsupported target with no matching prebuilt LLVM: `{target}`, install LLVM and set LLVM_CONFIG (or LLVM_CONFIG_19 when the `llvm19` feature is enabled)"
0 commit comments