Skip to content

Commit 95a7c90

Browse files
committed
allow using the system-wide llvm-libunwind as the unwinder
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
1 parent b64793f commit 95a7c90

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

std/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ profiler = ["profiler_builtins"]
6161
compiler-builtins-c = ["alloc/compiler-builtins-c"]
6262
compiler-builtins-mem = ["alloc/compiler-builtins-mem"]
6363
llvm-libunwind = ["unwind/llvm-libunwind"]
64+
system-llvm-libunwind = ["unwind/system-llvm-libunwind"]
6465

6566
# Make panics and failed asserts immediately abort without formatting any message
6667
panic_immediate_abort = ["core/panic_immediate_abort"]

test/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ backtrace = ["std/backtrace"]
2727
compiler-builtins-c = ["std/compiler-builtins-c"]
2828
compiler-builtins-mem = ["std/compiler-builtins-mem"]
2929
llvm-libunwind = ["std/llvm-libunwind"]
30+
system-llvm-libunwind = ["std/system-llvm-libunwind"]
3031
panic-unwind = ["std/panic_unwind"]
3132
panic_immediate_abort = ["std/panic_immediate_abort"]
3233
profiler = ["std/profiler"]

unwind/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ cc = { version = "1.0.1" }
2323

2424
[features]
2525
llvm-libunwind = []
26+
system-llvm-libunwind = []

unwind/src/lib.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,24 @@ extern "C" {}
4545
// When building with crt-static, we get `gcc_eh` from the `libc` crate, since
4646
// glibc needs it, and needs it listed later on the linker command line. We
4747
// don't want to duplicate it here.
48-
#[cfg(all(target_os = "linux", target_env = "gnu", not(feature = "llvm-libunwind")))]
48+
#[cfg(all(
49+
target_os = "linux",
50+
target_env = "gnu",
51+
not(feature = "llvm-libunwind"),
52+
not(feature = "system-llvm-libunwind")
53+
))]
4954
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
5055
extern "C" {}
5156

57+
#[cfg(all(
58+
target_os = "linux",
59+
target_env = "gnu",
60+
not(feature = "llvm-libunwind"),
61+
feature = "system-llvm-libunwind"
62+
))]
63+
#[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
64+
extern "C" {}
65+
5266
#[cfg(target_os = "redox")]
5367
#[link(name = "gcc_eh", kind = "static-nobundle", cfg(target_feature = "crt-static"))]
5468
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]

0 commit comments

Comments
 (0)