@@ -98,6 +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_args : Vec < Vec < String > > ,
101
102
pub defines : HashMap < String , Option < String > > ,
102
103
pub version : String ,
103
104
_priv : ( ) ,
@@ -557,6 +558,7 @@ impl Library {
557
558
libs : Vec :: new ( ) ,
558
559
link_paths : Vec :: new ( ) ,
559
560
include_paths : Vec :: new ( ) ,
561
+ ld_args : Vec :: new ( ) ,
560
562
frameworks : Vec :: new ( ) ,
561
563
framework_paths : Vec :: new ( ) ,
562
564
defines : HashMap :: new ( ) ,
@@ -670,6 +672,31 @@ impl Library {
670
672
_ => ( ) ,
671
673
}
672
674
}
675
+
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 subopt == "-framework" {
687
+ pop = true ;
688
+ continue ;
689
+ }
690
+
691
+ ld_option. push ( subopt) ;
692
+ }
693
+
694
+ let meta = format ! ( "rustc-link-arg=-Wl,{}" , ld_option. join( "," ) ) ;
695
+ config. print_metadata ( & meta) ;
696
+
697
+ self . ld_args
698
+ . push ( ld_option. into_iter ( ) . map ( String :: from) . collect ( ) ) ;
699
+ }
673
700
}
674
701
675
702
fn parse_modversion ( & mut self , output : & str ) {
0 commit comments