summary refs log tree commit diff
path: root/compiler/rustc_llvm/build.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-11-13 21:28:54 +0100
committerGitHub <noreply@github.com>2023-11-13 21:28:54 +0100
commit03d6e7ade0352b35a3cd586b3384ed2960ebd030 (patch)
tree1f191fa0ed1ebcf7a651dd407b6ab2c37f6ace85 /compiler/rustc_llvm/build.rs
parent531cb83fcfaa7568e2475c11e4e13ff4d9e06c01 (diff)
parent855388e9a2de1ddb99e83004941fb78d5ec796e4 (diff)
downloadrust-03d6e7ade0352b35a3cd586b3384ed2960ebd030.tar.gz
rust-03d6e7ade0352b35a3cd586b3384ed2960ebd030.zip
Rollup merge of #114224 - inferiorhumanorgans:solaris-llvm-wrapper, r=cuviper
rustc_llvm: Link to libkstat on Solaris/SPARC

getHostCPUName calls into libkstat but as of
LLVM 16.0.6 libLLVMTargetParser is not explicitly
linked against libkstat causing builds to fail
due to undefined symbols.

See also: llvm/llvm-project#64186
Diffstat (limited to 'compiler/rustc_llvm/build.rs')
-rw-r--r--compiler/rustc_llvm/build.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs
index fe13162cd4a..ed1e8771323 100644
--- a/compiler/rustc_llvm/build.rs
+++ b/compiler/rustc_llvm/build.rs
@@ -242,6 +242,12 @@ fn main() {
         cmd.arg("--system-libs");
     }
 
+    // We need libkstat for getHostCPUName on SPARC builds.
+    // See also: https://github.com/llvm/llvm-project/issues/64186
+    if target.starts_with("sparcv9") && target.contains("solaris") {
+        println!("cargo:rustc-link-lib=kstat");
+    }
+
     if (target.starts_with("arm") && !target.contains("freebsd"))
         || target.starts_with("mips-")
         || target.starts_with("mipsel-")