@@ -7,14 +7,14 @@ fn main() {
7
7
// FIXME: the not(bootstrap) part is needed because of the issue addressed by #62286,
8
8
// and could be removed once that change is in beta.
9
9
if cfg ! ( all( not( bootstrap) , feature = "llvm-libunwind" ) ) &&
10
- ( target. contains ( "linux" ) ||
10
+ ( target. contains ( "linux" ) && !target . contains ( "musl" ) ||
11
11
target. contains ( "fuchsia" ) ) {
12
12
// Build the unwinding from libunwind C/C++ source code.
13
- #[ cfg( all( not( bootstrap) , feature = "llvm-libunwind" ) ) ]
14
13
llvm_libunwind:: compile ( ) ;
15
14
} else if target. contains ( "linux" ) {
16
15
if target. contains ( "musl" ) {
17
- // musl is handled in lib.rs
16
+ // linking for musl is handled in lib.rs
17
+ llvm_libunwind:: compile ( ) ;
18
18
} else if !target. contains ( "android" ) {
19
19
println ! ( "cargo:rustc-link-lib=gcc_s" ) ;
20
20
}
@@ -46,7 +46,6 @@ fn main() {
46
46
}
47
47
}
48
48
49
- #[ cfg( all( not( bootstrap) , feature = "llvm-libunwind" ) ) ]
50
49
mod llvm_libunwind {
51
50
use std:: env;
52
51
use std:: path:: Path ;
@@ -98,6 +97,12 @@ mod llvm_libunwind {
98
97
cfg. file ( root. join ( "src" ) . join ( src) ) ;
99
98
}
100
99
100
+ if target_env == "musl" {
101
+ // linking for musl is handled in lib.rs
102
+ cfg. cargo_metadata ( false ) ;
103
+ println ! ( "cargo:rustc-link-search=native={}" , env:: var( "OUT_DIR" ) . unwrap( ) ) ;
104
+ }
105
+
101
106
cfg. compile ( "unwind" ) ;
102
107
}
103
108
}
0 commit comments