diff options
| author | Josh Stone <jistone@redhat.com> | 2023-07-25 13:11:50 -0700 |
|---|---|---|
| committer | Josh Stone <jistone@redhat.com> | 2023-07-25 13:11:50 -0700 |
| commit | d0b58f40a0e669897fafb614299d2a989997eda7 (patch) | |
| tree | c436a1ee295548f2eaf25aeb24bad27939401a01 /library/profiler_builtins | |
| parent | 4fc6b33474680ba57e10d56371c2c3df91788e26 (diff) | |
| download | rust-d0b58f40a0e669897fafb614299d2a989997eda7.tar.gz rust-d0b58f40a0e669897fafb614299d2a989997eda7.zip | |
Allow using external builds of the compiler-rt profile lib
This changes the bootstrap config `target.*.profiler` from a plain bool to also allow a string, which will be used as a path to the pre-built profiling runtime for that target. Then `profiler_builtins/build.rs` reads that in a `LLVM_PROFILER_RT_LIB` environment variable.
Diffstat (limited to 'library/profiler_builtins')
| -rw-r--r-- | library/profiler_builtins/build.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/library/profiler_builtins/build.rs b/library/profiler_builtins/build.rs index 1b1f11798d7..d14d0b82229 100644 --- a/library/profiler_builtins/build.rs +++ b/library/profiler_builtins/build.rs @@ -6,6 +6,12 @@ use std::env; use std::path::Path; fn main() { + println!("cargo:rerun-if-env-changed=LLVM_PROFILER_RT_LIB"); + if let Ok(rt) = env::var("LLVM_PROFILER_RT_LIB") { + println!("cargo:rustc-link-lib=static:+verbatim={rt}"); + return; + } + let target = env::var("TARGET").expect("TARGET was not set"); let cfg = &mut cc::Build::new(); |
