From c6a7751fa7ad31702e389128c4d970324d0aa2cd Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 4 Jan 2020 00:19:37 +0100 Subject: [PATCH] Handle changed InstrProfilingRuntime path --- src/libprofiler_builtins/build.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libprofiler_builtins/build.rs b/src/libprofiler_builtins/build.rs index 852b7aac3590..8adcff67800f 100644 --- a/src/libprofiler_builtins/build.rs +++ b/src/libprofiler_builtins/build.rs @@ -21,7 +21,6 @@ fn main() { "InstrProfilingPlatformLinux.c", "InstrProfilingPlatformOther.c", "InstrProfilingPlatformWindows.c", - "InstrProfilingRuntime.cc", "InstrProfilingUtil.c", "InstrProfilingValue.c", "InstrProfilingWriter.c", @@ -68,10 +67,16 @@ fn main() { 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");