Skip to content

Commit 42df98f

Browse files
committed
add sfix or full tools and sanitizer
1 parent b8063ae commit 42df98f

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

src/bootstrap/src/core/build_steps/llvm.rs

+13
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,10 @@ fn configure_cmake(
805805
cflags.push(s);
806806
}
807807

808+
if target.contains("ohos") {
809+
cflags.push(" -D_LINUX_SYSINFO_H");
810+
}
811+
808812
if builder.config.llvm_clang_cl.is_some() {
809813
cflags.push(format!(" --target={target}"));
810814
}
@@ -825,6 +829,11 @@ fn configure_cmake(
825829
cxxflags.push(" ");
826830
cxxflags.push(s);
827831
}
832+
833+
if target.contains("ohos") {
834+
cxxflags.push(" -D_LINUX_SYSINFO_H");
835+
}
836+
828837
if builder.config.llvm_clang_cl.is_some() {
829838
cxxflags.push(format!(" --target={target}"));
830839
}
@@ -1201,6 +1210,10 @@ impl Step for Sanitizers {
12011210
cfg.define("COMPILER_RT_USE_LIBCXX", "OFF");
12021211
cfg.define("LLVM_CONFIG_PATH", &llvm_config);
12031212

1213+
if target.contains("ohos") {
1214+
cfg.define("COMPILER_RT_USE_BUILTINS_LIBRARY", "ON");
1215+
}
1216+
12041217
// On Darwin targets the sanitizer runtimes are build as universal binaries.
12051218
// Unfortunately sccache currently lacks support to build them successfully.
12061219
// Disable compiler launcher on Darwin targets to avoid potential issues.

src/tools/miri/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ getrandom = { version = "0.3", features = ["std"] }
2222
rand = "0.9"
2323
smallvec = { version = "1.7", features = ["drain_filter"] }
2424
aes = { version = "0.8.3", features = ["hazmat"] }
25-
measureme = "11"
25+
measureme = "12.0.1"
2626
chrono = { version = "0.4.38", default-features = false }
2727
chrono-tz = "0.10"
2828
directories = "5"

src/tools/rust-analyzer/crates/profile/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ cfg-if = "1.0.0"
1717
libc.workspace = true
1818
jemalloc-ctl = { version = "0.5.0", package = "tikv-jemalloc-ctl", optional = true }
1919

20-
[target.'cfg(target_os = "linux")'.dependencies]
20+
[target.'cfg(all(target_os = "linux", not(target_env = "ohos")))'.dependencies]
2121
perf-event = "=0.4.7"
2222

2323
[target.'cfg(windows)'.dependencies]

src/tools/rust-analyzer/crates/profile/src/stop_watch.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::MemoryUsage;
1111

1212
pub struct StopWatch {
1313
time: Instant,
14-
#[cfg(target_os = "linux")]
14+
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
1515
counter: Option<perf_event::Counter>,
1616
memory: MemoryUsage,
1717
}
@@ -24,7 +24,7 @@ pub struct StopWatchSpan {
2424

2525
impl StopWatch {
2626
pub fn start() -> StopWatch {
27-
#[cfg(target_os = "linux")]
27+
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
2828
let counter = {
2929
// When debugging rust-analyzer using rr, the perf-related syscalls cause it to abort.
3030
// We allow disabling perf by setting the env var `RA_DISABLE_PERF`.
@@ -51,7 +51,7 @@ impl StopWatch {
5151
let time = Instant::now();
5252
StopWatch {
5353
time,
54-
#[cfg(target_os = "linux")]
54+
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
5555
counter,
5656
memory,
5757
}
@@ -60,10 +60,12 @@ impl StopWatch {
6060
pub fn elapsed(&mut self) -> StopWatchSpan {
6161
let time = self.time.elapsed();
6262

63-
#[cfg(target_os = "linux")]
63+
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
6464
let instructions = self.counter.as_mut().and_then(|it| {
6565
it.read().map_err(|err| eprintln!("Failed to read perf counter: {err}")).ok()
6666
});
67+
#[cfg(all(target_os = "linux", target_env = "ohos"))]
68+
let instructions = None;
6769
#[cfg(not(target_os = "linux"))]
6870
let instructions = None;
6971

0 commit comments

Comments
 (0)