Skip to content

Commit 7d947a0

Browse files
committed
Auto merge of #108792 - Amanieu:ohos, r=petrochenkov
Add OpenHarmony targets - `aarch64-unknown-linux-ohos` - `armv7-unknown-linux-ohos` Compiler team MCP: rust-lang/compiler-team#568
2 parents bcb1f92 + a78e289 commit 7d947a0

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

std/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
1515
panic_unwind = { path = "../panic_unwind", optional = true }
1616
panic_abort = { path = "../panic_abort" }
1717
core = { path = "../core" }
18-
libc = { version = "0.2.139", default-features = false, features = ['rustc-dep-of-std'] }
18+
libc = { version = "0.2.140", default-features = false, features = ['rustc-dep-of-std'] }
1919
compiler_builtins = { version = "0.1.87" }
2020
profiler_builtins = { path = "../profiler_builtins", optional = true }
2121
unwind = { path = "../unwind" }

std/src/sys/unix/os.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ pub fn set_errno(e: i32) {
115115
/// Gets a detailed string description for the given error number.
116116
pub fn error_string(errno: i32) -> String {
117117
extern "C" {
118-
#[cfg_attr(any(target_os = "linux", target_env = "newlib"), link_name = "__xpg_strerror_r")]
118+
#[cfg_attr(
119+
all(any(target_os = "linux", target_env = "newlib"), not(target_env = "ohos")),
120+
link_name = "__xpg_strerror_r"
121+
)]
119122
fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: libc::size_t) -> c_int;
120123
}
121124

unwind/src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,22 @@ cfg_if::cfg_if! {
5454
}
5555
}
5656

57+
// This is the same as musl except that we default to using the system libunwind
58+
// instead of libgcc.
59+
#[cfg(target_env = "ohos")]
60+
cfg_if::cfg_if! {
61+
if #[cfg(all(feature = "llvm-libunwind", feature = "system-llvm-libunwind"))] {
62+
compile_error!("`llvm-libunwind` and `system-llvm-libunwind` cannot be enabled at the same time");
63+
} else if #[cfg(feature = "llvm-libunwind")] {
64+
#[link(name = "unwind", kind = "static", modifiers = "-bundle")]
65+
extern "C" {}
66+
} else {
67+
#[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
68+
#[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
69+
extern "C" {}
70+
}
71+
}
72+
5773
#[cfg(target_os = "android")]
5874
cfg_if::cfg_if! {
5975
if #[cfg(feature = "llvm-libunwind")] {

0 commit comments

Comments
 (0)