Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-add bootstrap attribute to libunwind for llvm-libunwind feature #62477

Merged
merged 1 commit into from
Jul 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/libunwind/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ fn main() {
println!("cargo:rerun-if-changed=build.rs");
let target = env::var("TARGET").expect("TARGET was not set");

if cfg!(feature = "llvm-libunwind") &&
// FIXME: the not(bootstrap) part is needed because of the issue addressed by #62286,
// and could be removed once that change is in beta.
if cfg!(all(not(bootstrap), feature = "llvm-libunwind")) &&
(target.contains("linux") ||
target.contains("fuchsia")) {
// Build the unwinding from libunwind C/C++ source code.
#[cfg(feature = "llvm-libunwind")]
#[cfg(all(not(bootstrap), feature = "llvm-libunwind"))]
llvm_libunwind::compile();
} else if target.contains("linux") {
if target.contains("musl") {
Expand Down Expand Up @@ -42,7 +44,7 @@ fn main() {
}
}

#[cfg(feature = "llvm-libunwind")]
#[cfg(all(not(bootstrap), feature = "llvm-libunwind"))]
mod llvm_libunwind {
use std::env;
use std::path::Path;
Expand Down
15 changes: 10 additions & 5 deletions src/libunwind/libunwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ pub enum _Unwind_Context {}

pub type _Unwind_Exception_Cleanup_Fn = extern "C" fn(unwind_code: _Unwind_Reason_Code,
exception: *mut _Unwind_Exception);
#[cfg_attr(feature = "llvm-libunwind",
#[cfg_attr(all(not(bootstrap), feature = "llvm-libunwind",
any(target_os = "fuchsia", target_os = "linux")),
link(name = "unwind", kind = "static"))]
extern "C" {
#[unwind(allowed)]
Expand All @@ -93,7 +94,8 @@ if #[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm
}
pub use _Unwind_Action::*;

#[cfg_attr(feature = "llvm-libunwind",
#[cfg_attr(all(not(bootstrap), feature = "llvm-libunwind",
any(target_os = "fuchsia", target_os = "linux")),
link(name = "unwind", kind = "static"))]
extern "C" {
pub fn _Unwind_GetGR(ctx: *mut _Unwind_Context, reg_index: c_int) -> _Unwind_Word;
Expand Down Expand Up @@ -148,7 +150,8 @@ if #[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm
pub const UNWIND_POINTER_REG: c_int = 12;
pub const UNWIND_IP_REG: c_int = 15;

#[cfg_attr(feature = "llvm-libunwind",
#[cfg_attr(all(not(bootstrap), feature = "llvm-libunwind",
any(target_os = "fuchsia", target_os = "linux")),
link(name = "unwind", kind = "static"))]
extern "C" {
fn _Unwind_VRS_Get(ctx: *mut _Unwind_Context,
Expand Down Expand Up @@ -212,7 +215,8 @@ if #[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm
cfg_if::cfg_if! {
if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] {
// Not 32-bit iOS
#[cfg_attr(feature = "llvm-libunwind",
#[cfg_attr(all(not(bootstrap), feature = "llvm-libunwind",
any(target_os = "fuchsia", target_os = "linux")),
link(name = "unwind", kind = "static"))]
extern "C" {
#[unwind(allowed)]
Expand All @@ -223,7 +227,8 @@ if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] {
}
} else {
// 32-bit iOS uses SjLj and does not provide _Unwind_Backtrace()
#[cfg_attr(feature = "llvm-libunwind",
#[cfg_attr(all(not(bootstrap), feature = "llvm-libunwind",
any(target_os = "fuchsia", target_os = "linux")),
link(name = "unwind", kind = "static"))]
extern "C" {
#[unwind(allowed)]
Expand Down