]> git.lizzy.rs Git - rust.git/blobdiff - src/libprofiler_builtins/build.rs
Rollup merge of #70159 - alexcrichton:update-wasi, r=pietroalbini
[rust.git] / src / libprofiler_builtins / build.rs
index 04cd2efe00093d80a859bf56b64a553abdcd9be4..c990b289335046add121c2242ed4d4ea39a0a6d2 100644 (file)
@@ -21,7 +21,6 @@ fn main() {
         "InstrProfilingPlatformLinux.c",
         "InstrProfilingPlatformOther.c",
         "InstrProfilingPlatformWindows.c",
-        "InstrProfilingRuntime.cc",
         "InstrProfilingUtil.c",
         "InstrProfilingValue.c",
         "InstrProfilingWriter.c",
@@ -42,7 +41,6 @@ fn main() {
         cfg.flag("-fno-builtin");
         cfg.flag("-fvisibility=hidden");
         cfg.flag("-fomit-frame-pointer");
-        cfg.flag("-ffreestanding");
         cfg.define("VISIBILITY_HIDDEN", None);
         if !target.contains("windows") {
             cfg.define("COMPILER_RT_HAS_UNAME", Some("1"));
@@ -68,10 +66,17 @@ 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");
 }