From d55b26178da3986cc693ddcdfaca12d0abd891d7 Mon Sep 17 00:00:00 2001 From: ijl Date: Mon, 10 Jun 2024 13:26:07 +0000 Subject: [PATCH] unwinding --- .github/workflows/artifact.yaml | 2 +- Cargo.lock | 17 +++++++++++++++++ Cargo.toml | 4 ++++ src/lib.rs | 3 +++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/artifact.yaml b/.github/workflows/artifact.yaml index bb668905..591ba840 100644 --- a/.github/workflows/artifact.yaml +++ b/.github/workflows/artifact.yaml @@ -169,7 +169,7 @@ jobs: rustup-components: rust-src target: ${{ matrix.platform.target }} manylinux: musllinux_1_2 - args: --release --strip --out=dist --features=no-panic,unstable-simd,yyjson -i python${{ matrix.python.version }} + args: --release --strip --out=dist --features=no-panic,unstable-simd,unwind,yyjson -i python${{ matrix.python.version }} - name: QEMU if: matrix.platform.arch != 'x86_64' diff --git a/Cargo.lock b/Cargo.lock index 2f13efc5..b44ec58b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -141,6 +141,12 @@ dependencies = [ "wasi", ] +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + [[package]] name = "half" version = "2.4.1" @@ -222,6 +228,7 @@ dependencies = [ "serde_json", "simdutf8", "smallvec", + "unwinding", "version_check", ] @@ -359,6 +366,16 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unwinding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37a19a21a537f635c16c7576f22d0f2f7d63353c1337ad4ce0d8001c7952a25b" +dependencies = [ + "gimli", + "libc", +] + [[package]] name = "version_check" version = "0.9.4" diff --git a/Cargo.toml b/Cargo.toml index f52de6a1..b27946cb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,6 +43,9 @@ no-panic = [ "ryu/no-panic", ] +# Avoid bundling libgcc on musl. +unwind = ["unwinding"] + # Build yyjson as a backend and panic if it fails. The default is to attempt # to build and on failure fall back to another backend. yyjson = [] @@ -71,6 +74,7 @@ serde = { version = "1", default-features = false } serde_json = { version = "1", default-features = false, features = ["std", "float_roundtrip"] } simdutf8 = { version = "0.1", default-features = false, features = ["std", "aarch64_neon"] } smallvec = { version = "^1.11", default-features = false, features = ["union", "write"] } +unwinding = { version = "0.2", features = ["unwinder"], optional = true } [build-dependencies] cc = { version = "1" } diff --git a/src/lib.rs b/src/lib.rs index 0f501828..febf6c10 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,6 +23,9 @@ #![allow(clippy::upper_case_acronyms)] #![allow(clippy::zero_prefixed_literal)] +#[cfg(feature = "unwind")] +extern crate unwinding; + #[macro_use] mod util;