aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wailes <chriswailes@google.com>2024-05-09 16:01:16 -0700
committerChris Wailes <chriswailes@google.com>2024-05-09 16:01:16 -0700
commit1219dfba4a9a98bff94ec295593b6a1a00ad420c (patch)
tree55b8c6062332d17eea24d6236b91176a626ecd09
parentaf55c153b1e5638e0f3ae607f99a4b95dcea5a73 (diff)
downloadlibm-1219dfba4a9a98bff94ec295593b6a1a00ad420c.tar.gz
Ensure crate is compiled with std for panic handler
This CL adds a patch to use `extern crate std` to ensure that a panic handler is available when the crate is compiled as a dylib. Test: m rust Bug: 333887339 Change-Id: Ic444ca6b5bca12047a23aefe4df323b406a2ca5a
-rw-r--r--patches/std.patch14
-rw-r--r--src/lib.rs3
2 files changed, 17 insertions, 0 deletions
diff --git a/patches/std.patch b/patches/std.patch
new file mode 100644
index 0000000..76b5c02
--- /dev/null
+++ b/patches/std.patch
@@ -0,0 +1,14 @@
+diff --git a/src/lib.rs b/src/lib.rs
+index 4a17d3a..5493509 100644
+--- a/src/lib.rs
++++ b/src/lib.rs
+@@ -12,6 +12,9 @@
+ #![allow(clippy::eq_op)]
+ #![allow(clippy::assign_op_pattern)]
+
++#[cfg(android_dylib)]
++extern crate std;
++
+ mod libm_helper;
+ mod math;
+
diff --git a/src/lib.rs b/src/lib.rs
index 4a17d3a..5493509 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -12,6 +12,9 @@
#![allow(clippy::eq_op)]
#![allow(clippy::assign_op_pattern)]
+#[cfg(android_dylib)]
+extern crate std;
+
mod libm_helper;
mod math;