@@ -98,7 +98,7 @@ pub struct Library {
98
98
pub frameworks : Vec < String > ,
99
99
pub framework_paths : Vec < PathBuf > ,
100
100
pub include_paths : Vec < PathBuf > ,
101
- pub ld_options : Vec < String > ,
101
+ pub ld_options : Vec < Vec < String > > ,
102
102
pub defines : HashMap < String , Option < String > > ,
103
103
pub version : String ,
104
104
_priv : ( ) ,
@@ -673,24 +673,29 @@ impl Library {
673
673
}
674
674
}
675
675
676
- let mut linker_options = words
677
- . iter ( )
678
- . filter ( |arg| arg. starts_with ( "-Wl," ) )
679
- . filter ( |arg| {
680
- let option = & arg[ 4 ..] ;
681
- for handled in & [ "-framework" , "-isystem" , "-iquote" , "-idirafter" ] {
682
- if option. starts_with ( handled) {
683
- return false ;
684
- }
676
+ let mut linker_options = words. iter ( ) . filter ( |arg| arg. starts_with ( "-Wl," ) ) ;
677
+ while let Some ( option) = linker_options. next ( ) {
678
+ let mut pop = false ;
679
+ let mut ld_option = vec ! [ ] ;
680
+ for subopt in option[ 4 ..] . split ( ',' ) {
681
+ if pop {
682
+ pop = false ;
683
+ continue ;
684
+ }
685
+
686
+ if matches ! ( subopt, "-framework" | "-isystem" | "-iquote" | "idirafter" ) {
687
+ pop = true ;
688
+ continue ;
685
689
}
686
690
687
- true
688
- } ) ;
691
+ ld_option . push ( subopt ) ;
692
+ }
689
693
690
- while let Some ( option) = linker_options. next ( ) {
691
- let meta = format ! ( "rustc-link-arg={}" , option) ;
694
+ let meta = format ! ( "rustc-link-arg=-Wl,{}" , ld_option. join( "," ) ) ;
692
695
config. print_metadata ( & meta) ;
693
- self . ld_options . push ( option. to_string ( ) ) ;
696
+
697
+ self . ld_options
698
+ . push ( ld_option. into_iter ( ) . map ( String :: from) . collect ( ) ) ;
694
699
}
695
700
}
696
701
0 commit comments