@@ -98,6 +98,7 @@ pub struct Library {
9898 pub frameworks : Vec < String > ,
9999 pub framework_paths : Vec < PathBuf > ,
100100 pub include_paths : Vec < PathBuf > ,
101+ pub ld_args : Vec < Vec < String > > ,
101102 pub defines : HashMap < String , Option < String > > ,
102103 pub version : String ,
103104 _priv : ( ) ,
@@ -557,6 +558,7 @@ impl Library {
557558 libs : Vec :: new ( ) ,
558559 link_paths : Vec :: new ( ) ,
559560 include_paths : Vec :: new ( ) ,
561+ ld_args : Vec :: new ( ) ,
560562 frameworks : Vec :: new ( ) ,
561563 framework_paths : Vec :: new ( ) ,
562564 defines : HashMap :: new ( ) ,
@@ -670,6 +672,31 @@ impl Library {
670672 _ => ( ) ,
671673 }
672674 }
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+ }
673700 }
674701
675702 fn parse_modversion ( & mut self , output : & str ) {
0 commit comments