Rollup merge of #99421 - Bryanskiy:android-crt-static, r=petrochenkov
add crt-static for android
This commit is contained in:
commit
6737549aaf
@ -2142,9 +2142,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.126"
|
||||
version = "0.2.129"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
|
||||
checksum = "64de3cc433455c14174d42e554d4027ee631c4d046d43e3ecc6efc4636cdc7a7"
|
||||
dependencies = [
|
||||
"rustc-std-workspace-core",
|
||||
]
|
||||
|
@ -10,6 +10,6 @@ pub fn opts() -> TargetOptions {
|
||||
// for context. (At that time, there was no `-C force-unwind-tables`, so the only solution
|
||||
// was to always emit `uwtable`).
|
||||
base.default_uwtable = true;
|
||||
base.crt_static_respected = false;
|
||||
base.crt_static_respected = true;
|
||||
base
|
||||
}
|
||||
|
@ -246,6 +246,7 @@
|
||||
#![cfg_attr(bootstrap, feature(let_chains))]
|
||||
#![feature(let_else)]
|
||||
#![feature(linkage)]
|
||||
#![feature(link_cfg)]
|
||||
#![feature(min_specialization)]
|
||||
#![feature(must_not_suspend)]
|
||||
#![feature(needs_panic_runtime)]
|
||||
|
@ -295,8 +295,10 @@ pub fn abort_internal() -> ! {
|
||||
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(target_os = "android")] {
|
||||
#[link(name = "dl")]
|
||||
#[link(name = "log")]
|
||||
#[link(name = "dl", kind = "static", modifiers = "-bundle",
|
||||
cfg(target_feature = "crt-static"))]
|
||||
#[link(name = "dl", cfg(not(target_feature = "crt-static")))]
|
||||
#[link(name = "log", cfg(not(target_feature = "crt-static")))]
|
||||
extern "C" {}
|
||||
} else if #[cfg(target_os = "freebsd")] {
|
||||
#[link(name = "execinfo")]
|
||||
|
@ -13,13 +13,8 @@ fn main() {
|
||||
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");
|
||||
println!("cargo:rustc-cfg=feature=\"system-llvm-libunwind\"");
|
||||
}
|
||||
|
||||
// Android's unwinding library depends on dl_iterate_phdr in `libdl`.
|
||||
println!("cargo:rustc-link-lib=dl");
|
||||
} else if target.contains("freebsd") {
|
||||
println!("cargo:rustc-link-lib=gcc_s");
|
||||
} else if target.contains("netbsd") {
|
||||
|
@ -55,6 +55,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "llvm-libunwind")] {
|
||||
compile_error!("`llvm-libunwind` is not supported for Android targets");
|
||||
} else if #[cfg(feature = "system-llvm-libunwind")] {
|
||||
#[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
|
||||
#[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
|
||||
extern "C" {}
|
||||
} else {
|
||||
#[link(name = "gcc", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
|
||||
#[link(name = "gcc", cfg(not(target_feature = "crt-static")))]
|
||||
extern "C" {}
|
||||
}
|
||||
}
|
||||
// Android's unwinding library depends on dl_iterate_phdr in `libdl`.
|
||||
#[cfg(target_os = "android")]
|
||||
#[link(name = "dl", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
|
||||
#[link(name = "dl", cfg(not(target_feature = "crt-static")))]
|
||||
extern "C" {}
|
||||
|
||||
// When building with crt-static, we get `gcc_eh` from the `libc` crate, since
|
||||
// glibc needs it, and needs it listed later on the linker command line. We
|
||||
// don't want to duplicate it here.
|
||||
|
Loading…
Reference in New Issue
Block a user