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
This commit is contained in:
Alex Zepeda 2023-07-28 02:14:45 -07:00
parent 03a57254b5
commit 103b2df63b

View File

@ -241,6 +241,11 @@ fn main() {
cmd.arg("--system-libs");
}
// We need libkstat for getHostCPUName on SPARC builds.
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-")