Skip to content

Commit ac28923

Browse files
committed
Fix build with llvm-libunwind
This was broken by rust-lang#62376 Since rust-lang#62286 is not in beta yet, we cannot remove those not(bootstrap) Signed-off-by: Marc-Antoine Perennou <[email protected]>
1 parent f119bf2 commit ac28923

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/libunwind/build.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ fn main() {
44
println!("cargo:rerun-if-changed=build.rs");
55
let target = env::var("TARGET").expect("TARGET was not set");
66

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

45-
#[cfg(feature = "llvm-libunwind")]
47+
#[cfg(all(not(bootstrap), feature = "llvm-libunwind"))]
4648
mod llvm_libunwind {
4749
use std::env;
4850
use std::path::Path;

src/libunwind/libunwind.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub enum _Unwind_Context {}
6767

6868
pub type _Unwind_Exception_Cleanup_Fn = extern "C" fn(unwind_code: _Unwind_Reason_Code,
6969
exception: *mut _Unwind_Exception);
70-
#[cfg_attr(feature = "llvm-libunwind",
70+
#[cfg_attr(all(not(bootstrap), feature = "llvm-libunwind"),
7171
link(name = "unwind", kind = "static"))]
7272
extern "C" {
7373
#[unwind(allowed)]
@@ -93,7 +93,7 @@ if #[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm
9393
}
9494
pub use _Unwind_Action::*;
9595

96-
#[cfg_attr(feature = "llvm-libunwind",
96+
#[cfg_attr(all(not(bootstrap), feature = "llvm-libunwind"),
9797
link(name = "unwind", kind = "static"))]
9898
extern "C" {
9999
pub fn _Unwind_GetGR(ctx: *mut _Unwind_Context, reg_index: c_int) -> _Unwind_Word;
@@ -148,7 +148,7 @@ if #[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm
148148
pub const UNWIND_POINTER_REG: c_int = 12;
149149
pub const UNWIND_IP_REG: c_int = 15;
150150

151-
#[cfg_attr(feature = "llvm-libunwind",
151+
#[cfg_attr(all(not(bootstrap), feature = "llvm-libunwind"),
152152
link(name = "unwind", kind = "static"))]
153153
extern "C" {
154154
fn _Unwind_VRS_Get(ctx: *mut _Unwind_Context,
@@ -212,7 +212,7 @@ if #[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm
212212
cfg_if::cfg_if! {
213213
if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] {
214214
// Not 32-bit iOS
215-
#[cfg_attr(feature = "llvm-libunwind",
215+
#[cfg_attr(all(not(bootstrap), feature = "llvm-libunwind"),
216216
link(name = "unwind", kind = "static"))]
217217
extern "C" {
218218
#[unwind(allowed)]
@@ -223,7 +223,7 @@ if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] {
223223
}
224224
} else {
225225
// 32-bit iOS uses SjLj and does not provide _Unwind_Backtrace()
226-
#[cfg_attr(feature = "llvm-libunwind",
226+
#[cfg_attr(all(not(bootstrap), feature = "llvm-libunwind"),
227227
link(name = "unwind", kind = "static"))]
228228
extern "C" {
229229
#[unwind(allowed)]

0 commit comments

Comments
 (0)