pub type _Unwind_Exception_Cleanup_Fn =
extern "C" fn(unwind_code: _Unwind_Reason_Code, exception: *mut _Unwind_Exception);
+
+// FIXME: The `#[link]` attributes on `extern "C"` block marks those symbols declared in
+// the block are reexported in dylib build of libstd. This is needed when build rustc with
+// feature `llvm-libunwind', as no other cdylib will provided those _Unwind_* symbols.
+// However the `link` attribute is duplicated multiple times and does not just export symbol,
+// a better way to manually export symbol would be another attribute like `#[export]`.
+// See the logic in function rustc_codegen_ssa::src::back::exported_symbols, module
+// rustc_codegen_ssa::src::back::symbol_export, rustc_middle::middle::exported_symbols
+// and RFC 2841
#[cfg_attr(
all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")),
- link(name = "unwind", kind = "static")
+ link(name = "unwind", kind = "static", modifiers = "-bundle")
)]
extern "C-unwind" {
pub fn _Unwind_Resume(exception: *mut _Unwind_Exception) -> !;
}
pub use _Unwind_Action::*;
- #[cfg_attr(all(feature = "llvm-libunwind",
- any(target_os = "fuchsia", target_os = "linux")),
- link(name = "unwind", kind = "static"))]
+ #[cfg_attr(
+ all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")),
+ link(name = "unwind", kind = "static", modifiers = "-bundle")
+ )]
extern "C" {
pub fn _Unwind_GetGR(ctx: *mut _Unwind_Context, reg_index: c_int) -> _Unwind_Word;
pub fn _Unwind_SetGR(ctx: *mut _Unwind_Context, reg_index: c_int, value: _Unwind_Word);
pub const UNWIND_SP_REG: c_int = 13;
pub const UNWIND_IP_REG: c_int = 15;
- #[cfg_attr(all(feature = "llvm-libunwind",
- any(target_os = "fuchsia", target_os = "linux")),
- link(name = "unwind", kind = "static"))]
+ #[cfg_attr(
+ all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")),
+ link(name = "unwind", kind = "static", modifiers = "-bundle")
+ )]
extern "C" {
fn _Unwind_VRS_Get(ctx: *mut _Unwind_Context,
regclass: _Unwind_VRS_RegClass,
cfg_if::cfg_if! {
if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] {
// Not 32-bit iOS
- #[cfg_attr(all(feature = "llvm-libunwind",
- any(target_os = "fuchsia", target_os = "linux")),
- link(name = "unwind", kind = "static"))]
+ #[cfg_attr(
+ all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")),
+ link(name = "unwind", kind = "static", modifiers = "-bundle")
+ )]
extern "C-unwind" {
pub fn _Unwind_RaiseException(exception: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
}
}
} else {
// 32-bit iOS uses SjLj and does not provide _Unwind_Backtrace()
- #[cfg_attr(all(feature = "llvm-libunwind",
- any(target_os = "fuchsia", target_os = "linux")),
- link(name = "unwind", kind = "static"))]
extern "C-unwind" {
pub fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
}