X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibprofiler_builtins%2Fbuild.rs;h=8adcff67800fe2dc757395c6c0589f0b2f1ecbb9;hb=80a65bcaf2f2b8a5c659b21b32b42bc300338a0e;hp=775f84535fbf25b9e17a7561a1f0ec3358703d0b;hpb=21caaba2bcf69c9003827b114ebcb86bb6740aa5;p=rust.git diff --git a/src/libprofiler_builtins/build.rs b/src/libprofiler_builtins/build.rs index 775f84535fb..8adcff67800 100644 --- a/src/libprofiler_builtins/build.rs +++ b/src/libprofiler_builtins/build.rs @@ -9,21 +9,22 @@ fn main() { let target = env::var("TARGET").expect("TARGET was not set"); let cfg = &mut cc::Build::new(); - let mut profile_sources = vec!["GCDAProfiling.c", - "InstrProfiling.c", - "InstrProfilingBuffer.c", - "InstrProfilingFile.c", - "InstrProfilingMerge.c", - "InstrProfilingMergeFile.c", - "InstrProfilingNameVar.c", - "InstrProfilingPlatformDarwin.c", - "InstrProfilingPlatformLinux.c", - "InstrProfilingPlatformOther.c", - "InstrProfilingPlatformWindows.c", - "InstrProfilingRuntime.cc", - "InstrProfilingUtil.c", - "InstrProfilingValue.c", - "InstrProfilingWriter.c"]; + let mut profile_sources = vec![ + "GCDAProfiling.c", + "InstrProfiling.c", + "InstrProfilingBuffer.c", + "InstrProfilingFile.c", + "InstrProfilingMerge.c", + "InstrProfilingMergeFile.c", + "InstrProfilingNameVar.c", + "InstrProfilingPlatformDarwin.c", + "InstrProfilingPlatformLinux.c", + "InstrProfilingPlatformOther.c", + "InstrProfilingPlatformWindows.c", + "InstrProfilingUtil.c", + "InstrProfilingValue.c", + "InstrProfilingWriter.c", + ]; if target.contains("msvc") { // Don't pull in extra libraries on MSVC @@ -56,19 +57,27 @@ fn main() { // This should be a pretty good heuristic for when to set // COMPILER_RT_HAS_ATOMICS - if env::var_os("CARGO_CFG_TARGET_HAS_ATOMIC").map(|features| { - features.to_string_lossy().to_lowercase().contains("cas") - }).unwrap_or(false) { + if env::var_os("CARGO_CFG_TARGET_HAS_ATOMIC") + .map(|features| features.to_string_lossy().to_lowercase().contains("cas")) + .unwrap_or(false) + { cfg.define("COMPILER_RT_HAS_ATOMICS", Some("1")); } let root = env::var_os("RUST_COMPILER_RT_ROOT").unwrap(); let root = Path::new(&root); + let src_root = root.join("lib").join("profile"); for src in profile_sources { - cfg.file(root.join("lib").join("profile").join(src)); + cfg.file(src_root.join(src)); } + // The file was renamed in LLVM 10. + let old_runtime_path = src_root.join("InstrProfilingRuntime.cc"); + let new_runtime_path = src_root.join("InstrProfilingRuntime.cpp"); + cfg.file(if old_runtime_path.exists() { old_runtime_path } else { new_runtime_path }); + + cfg.include(root.join("include")); cfg.warnings(false); cfg.compile("profiler-rt"); }