mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-15 20:45:45 +03:00
68db72d8cd
All musl targets except mips[el] assume static linking by default. This can be confusing https://users.rust-lang.org/t/static-cross-compiled-binaries-arent-really-static/6084 When the musl/mips[el] targets was [added](https://github.com/rust-lang/rust/pull/31298), dynamic linking was chosen because of binary size concerns, and probably also because libunwind [didn't](https://users.rust-lang.org/t/static-cross-compiled-binaries-arent-really-static/6084/8) supported mips. Now that we have `crt-static` target-feature (the user can choose dynamic link for musl targets), and libunwind [6.0](https://github.com/llvm-mirror/libunwind/commits/release_60) add support to mips, we do not need to assume dynamic linking.
42 lines
1.2 KiB
Rust
42 lines
1.2 KiB
Rust
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
|
// file at the top-level directory of this distribution and at
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
// option. This file may not be copied, modified, or distributed
|
|
// except according to those terms.
|
|
|
|
#![no_std]
|
|
#![unstable(feature = "panic_unwind", issue = "32837")]
|
|
#![deny(warnings)]
|
|
|
|
#![feature(cfg_target_vendor)]
|
|
#![feature(link_cfg)]
|
|
#![feature(staged_api)]
|
|
#![feature(unwind_attributes)]
|
|
#![feature(static_nobundle)]
|
|
|
|
#![cfg_attr(not(target_env = "msvc"), feature(libc))]
|
|
|
|
#[macro_use]
|
|
mod macros;
|
|
|
|
cfg_if! {
|
|
if #[cfg(target_env = "msvc")] {
|
|
// no extra unwinder support needed
|
|
} else if #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] {
|
|
// no unwinder on the system!
|
|
} else {
|
|
extern crate libc;
|
|
mod libunwind;
|
|
pub use libunwind::*;
|
|
}
|
|
}
|
|
|
|
#[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 {}
|