@@ -7,14 +7,14 @@ fn main() {
77 // FIXME: the not(bootstrap) part is needed because of the issue addressed by #62286,
88 // and could be removed once that change is in beta.
99 if cfg ! ( all( not( bootstrap) , feature = "llvm-libunwind" ) ) &&
10- ( target. contains ( "linux" ) ||
10+ ( target. contains ( "linux" ) && !target . contains ( "musl" ) ||
1111 target. contains ( "fuchsia" ) ) {
1212 // Build the unwinding from libunwind C/C++ source code.
13- #[ cfg( all( not( bootstrap) , feature = "llvm-libunwind" ) ) ]
1413 llvm_libunwind:: compile ( ) ;
1514 } else if target. contains ( "linux" ) {
1615 if target. contains ( "musl" ) {
17- // musl is handled in lib.rs
16+ // linking for musl is handled in lib.rs
17+ llvm_libunwind:: compile ( ) ;
1818 } else if !target. contains ( "android" ) {
1919 println ! ( "cargo:rustc-link-lib=gcc_s" ) ;
2020 }
@@ -46,7 +46,6 @@ fn main() {
4646 }
4747}
4848
49- #[ cfg( all( not( bootstrap) , feature = "llvm-libunwind" ) ) ]
5049mod llvm_libunwind {
5150 use std:: env;
5251 use std:: path:: Path ;
@@ -98,6 +97,12 @@ mod llvm_libunwind {
9897 cfg. file ( root. join ( "src" ) . join ( src) ) ;
9998 }
10099
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+
101106 cfg. compile ( "unwind" ) ;
102107 }
103108}
0 commit comments