about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Collingbourne <pcc@google.com>2023-11-01 18:43:04 -0700
committerPeter Collingbourne <pcc@google.com>2023-11-02 18:06:35 -0700
commit654288bbb7a923658fbafc3f25b93091ed0f61c1 (patch)
treea6603bd9c836a78518bd1c5dbd06bc65c94aed66
parent722b3eeb72b6bca6c38bbcbda57179f073f23431 (diff)
downloadrust-654288bbb7a923658fbafc3f25b93091ed0f61c1.tar.gz
rust-654288bbb7a923658fbafc3f25b93091ed0f61c1.zip
Remove obsolete support for linking unwinder on Android
Linking libgcc is no longer supported (see #103673), so remove the
related link attributes and the check in unwind's build.rs. The check
was the last remaining significant piece of logic in build.rs, so
remove build.rs as well.
-rw-r--r--Cargo.lock1
-rw-r--r--library/unwind/Cargo.toml3
-rw-r--r--library/unwind/build.rs25
-rw-r--r--library/unwind/src/lib.rs6
4 files changed, 1 insertions, 34 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 93845578293..7f195422f6d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5929,7 +5929,6 @@ dependencies = [
 name = "unwind"
 version = "0.0.0"
 dependencies = [
- "cc",
  "cfg-if",
  "compiler_builtins",
  "core",
diff --git a/library/unwind/Cargo.toml b/library/unwind/Cargo.toml
index eab2717c452..9aa552ed81a 100644
--- a/library/unwind/Cargo.toml
+++ b/library/unwind/Cargo.toml
@@ -19,9 +19,6 @@ libc = { version = "0.2.79", features = ['rustc-dep-of-std'], default-features =
 compiler_builtins = "0.1.0"
 cfg-if = "1.0"
 
-[build-dependencies]
-cc = "1.0.76"
-
 [features]
 
 # Only applies for Linux and Fuchsia targets
diff --git a/library/unwind/build.rs b/library/unwind/build.rs
deleted file mode 100644
index 5c3c02fb6ad..00000000000
--- a/library/unwind/build.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-use std::env;
-
-fn main() {
-    println!("cargo:rerun-if-changed=build.rs");
-    println!("cargo:rerun-if-env-changed=CARGO_CFG_MIRI");
-
-    if env::var_os("CARGO_CFG_MIRI").is_some() {
-        // Miri doesn't need the linker flags or a libunwind build.
-        return;
-    }
-
-    let target = env::var("TARGET").expect("TARGET was not set");
-    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-cfg=feature=\"system-llvm-libunwind\"");
-        }
-    }
-}
diff --git a/library/unwind/src/lib.rs b/library/unwind/src/lib.rs
index e86408a9ed2..335bded71c1 100644
--- a/library/unwind/src/lib.rs
+++ b/library/unwind/src/lib.rs
@@ -76,14 +76,10 @@ cfg_if::cfg_if! {
 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")] {
+    } else {
         #[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`.