cleanup and fix compiling of libunwind
fix conditional compiling of llvm-libunwind feaure for musl target. update document of llvm-libunwind feature.
This commit is contained in:
@@ -37,9 +37,22 @@ cfg_if::cfg_if! {
|
||||
}
|
||||
|
||||
#[cfg(target_env = "musl")]
|
||||
#[link(name = "unwind", kind = "static", cfg(target_feature = "crt-static"))]
|
||||
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
|
||||
extern "C" {}
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(all(feature = "llvm-libunwind", feature = "system-llvm-libunwind"))] {
|
||||
compile_error!("`llvm-libunwind` and `system-llvm-libunwind` cannot be enabled at the same time");
|
||||
} else if #[cfg(feature = "llvm-libunwind")] {
|
||||
#[link(name = "unwind", kind = "static")]
|
||||
extern "C" {}
|
||||
} else if #[cfg(feature = "system-llvm-libunwind")] {
|
||||
#[link(name = "unwind", kind = "static-nobundle", cfg(target_feature = "crt-static"))]
|
||||
#[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
|
||||
extern "C" {}
|
||||
} else {
|
||||
#[link(name = "unwind", kind = "static", cfg(target_feature = "crt-static"))]
|
||||
#[link(name = "gcc_s", 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
|
||||
@@ -68,5 +81,5 @@ extern "C" {}
|
||||
extern "C" {}
|
||||
|
||||
#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
|
||||
#[link(name = "unwind", kind = "static-nobundle")]
|
||||
#[link(name = "unwind", kind = "static")]
|
||||
extern "C" {}
|
||||
|
||||
Reference in New Issue
Block a user