Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Android ndk versions r23-beta3 and up #85806

Merged
merged 3 commits into from Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -655,9 +655,9 @@ dependencies = [

[[package]]
name = "compiler_builtins"
version = "0.1.43"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65af2dcae4779003dfa91aedc6ade7bdc7ba685944e50a8b4f9380df376a4466"
checksum = "787187ae221adfcda34b03006f1617099e4ae26b50e5a4db282496014ab75837"
dependencies = [
"cc",
"rustc-std-workspace-core",
Expand Down
2 changes: 1 addition & 1 deletion library/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ panic_unwind = { path = "../panic_unwind", optional = true }
panic_abort = { path = "../panic_abort" }
core = { path = "../core" }
libc = { version = "0.2.93", default-features = false, features = ['rustc-dep-of-std'] }
compiler_builtins = { version = "0.1.43" }
compiler_builtins = { version = "0.1.44" }
profiler_builtins = { path = "../profiler_builtins", optional = true }
unwind = { path = "../unwind" }
hashbrown = { version = "0.11", default-features = false, features = ['rustc-dep-of-std'] }
Expand Down
1 change: 0 additions & 1 deletion library/std/src/sys/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ cfg_if::cfg_if! {
if #[cfg(target_os = "android")] {
#[link(name = "dl")]
#[link(name = "log")]
#[link(name = "gcc")]
extern "C" {}
} else if #[cfg(target_os = "freebsd")] {
#[link(name = "execinfo")]
Expand Down
14 changes: 14 additions & 0 deletions library/unwind/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ fn main() {
// linking for Linux is handled in lib.rs
if target.contains("musl") {
llvm_libunwind::compile();
} else if target.contains("android") {
let build = cc::Build::new();

// Since ndk r23 beta 3 `libgcc` was replaced with `libunwind` thus
// check if we have `libunwind` available and if so use it. Otherwise
// fall back to `libgcc` to support older ndk versions.
let has_unwind =
build.is_flag_supported("-lunwind").expect("Unable to invoke compiler");

if has_unwind {
println!("cargo:rustc-link-lib=unwind");
} else {
println!("cargo:rustc-link-lib=gcc");
}
}
} else if target.contains("freebsd") {
println!("cargo:rustc-link-lib=gcc_s");
Expand Down