rustc, cargo-llvm-cov: enable profiler runtime on Darwin
Enable the LLVM profiler runtime on macOS by passing `--enable-profiler` to rustc's configure. This allows cargo-llvm-cov and other coverage tools to work on Darwin platforms. The profiler is explicitly disabled for wasm and bpf targets which don't support it.
This commit is contained in:
@@ -93,7 +93,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
CobaltCause
|
||||
];
|
||||
|
||||
# The profiler runtime is (currently) disabled on non-Linux platforms
|
||||
broken = !(stdenv.hostPlatform.isLinux && !stdenv.targetPlatform.isRedox);
|
||||
broken = stdenv.targetPlatform.isRedox;
|
||||
};
|
||||
})
|
||||
|
||||
@@ -240,6 +240,15 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
++ optionals (stdenv.targetPlatform.isLinux && !(stdenv.targetPlatform.useLLVM or false)) [
|
||||
"--enable-profiler" # build libprofiler_builtins
|
||||
]
|
||||
++ optionals stdenv.targetPlatform.isDarwin [
|
||||
# potentially other llvm targets work with the same fix?
|
||||
"--enable-profiler" # build libprofiler_builtins
|
||||
# Disable profiler for targets that don't support it
|
||||
"--set=target.wasm32-unknown-unknown.profiler=false"
|
||||
"--set=target.wasm32v1-none.profiler=false"
|
||||
"--set=target.bpfel-unknown-none.profiler=false"
|
||||
"--set=target.bpfeb-unknown-none.profiler=false"
|
||||
]
|
||||
++ optionals stdenv.buildPlatform.isMusl [
|
||||
"${setBuild}.musl-root=${pkgsBuildBuild.targetPackages.stdenv.cc.libc}"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user