Skip to content

Commit 26bf168

Browse files
committed
Handle changed InstrProfilingRuntime path
1 parent b2da2a1 commit 26bf168

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/libprofiler_builtins/build.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ fn main() {
2121
"InstrProfilingPlatformLinux.c",
2222
"InstrProfilingPlatformOther.c",
2323
"InstrProfilingPlatformWindows.c",
24-
"InstrProfilingRuntime.cc",
2524
"InstrProfilingUtil.c",
2625
"InstrProfilingValue.c",
2726
"InstrProfilingWriter.c",
@@ -68,10 +67,16 @@ fn main() {
6867
let root = env::var_os("RUST_COMPILER_RT_ROOT").unwrap();
6968
let root = Path::new(&root);
7069

70+
let src_root = root.join("lib").join("profile");
7171
for src in profile_sources {
72-
cfg.file(root.join("lib").join("profile").join(src));
72+
cfg.file(src_root.join(src));
7373
}
7474

75+
// The file was renamed in LLVM 10.
76+
let old_runtime_path = src_root.join("InstrProfilingRuntime.cc");
77+
let new_runtime_path = src_root.join("InstrProfilingRuntime.cpp");
78+
cfg.file(if old_runtime_path.exists() { old_runtime_path } else { new_runtime_path });
79+
7580
cfg.include(root.join("include"));
7681
cfg.warnings(false);
7782
cfg.compile("profiler-rt");

0 commit comments

Comments
 (0)