Skip to content

Commit 3eb04fd

Browse files
committed
add support for extend rust tools and sanitizer
1 parent 4dab55b commit 3eb04fd

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,9 @@ fn configure_cmake(
813813
cflags.push(" ");
814814
cflags.push(s);
815815
}
816-
816+
if target.contains("ohos") {
817+
cflags.push(" -D_LINUX_SYSINFO_H");
818+
}
817819
if builder.config.llvm_clang_cl.is_some() {
818820
cflags.push(format!(" --target={target}"));
819821
}
@@ -834,6 +836,9 @@ fn configure_cmake(
834836
cxxflags.push(" ");
835837
cxxflags.push(s);
836838
}
839+
if target.contains("ohos") {
840+
cxxflags.push(" -D_LINUX_SYSINFO_H");
841+
}
837842
if builder.config.llvm_clang_cl.is_some() {
838843
cxxflags.push(format!(" --target={target}"));
839844
}
@@ -1220,6 +1225,10 @@ impl Step for Sanitizers {
12201225
cfg.define("COMPILER_RT_USE_LIBCXX", "OFF");
12211226
cfg.define("LLVM_CONFIG_PATH", &llvm_config);
12221227

1228+
if self.target.contains("ohos") {
1229+
cfg.define("COMPILER_RT_USE_BUILTINS_LIBRARY", "ON");
1230+
}
1231+
12231232
// On Darwin targets the sanitizer runtimes are build as universal binaries.
12241233
// Unfortunately sccache currently lacks support to build them successfully.
12251234
// Disable compiler launcher on Darwin targets to avoid potential issues.

src/ci/docker/host-x86_64/dist-ohos/Dockerfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ ENV \
6060

6161
ENV RUST_CONFIGURE_ARGS \
6262
--enable-profiler \
63-
--disable-docs
63+
--disable-docs \
64+
--tools=cargo,clippy,rustdocs,rustfmt,rust-analyzer,rust-analyzer-proc-macro-srv,analysis,src,wasm-component-ld \
65+
--enable-extended \
66+
--enable-sanitizers
6467

6568
ENV SCRIPT python3 ../x.py dist --host=$TARGETS --target $TARGETS
6669

src/doc/rustc/src/platform-support/openharmony.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# `*-unknown-linux-ohos`
22

3-
**Tier: 2**
3+
**Tier: 2 (with Host Tools)**
44

55
* aarch64-unknown-linux-ohos
66
* armv7-unknown-linux-ohos
@@ -18,6 +18,17 @@ system.
1818
- Amanieu d'Antras ([@Amanieu](https://github.com/Amanieu))
1919
- Lu Binglun ([@lubinglun](https://github.com/lubinglun))
2020

21+
## Requirements
22+
23+
All the ohos targets of Tier 2 with host tools support all extended rust tools.
24+
(exclude `miri`, the support of `miri` will be added soon)
25+
26+
### Host toolchain
27+
28+
The targets require a reasonably up-to-date OpenHarmony SDK on the host.
29+
30+
The targets support `cargo`, which require [ohos-openssl](https://github.com/ohos-rs/ohos-openssl).
31+
2132
## Setup
2233

2334
The OpenHarmony SDK doesn't currently support Rust compilation directly, so

0 commit comments

Comments
 (0)