@@ -98,7 +98,7 @@ pub struct Library {
9898 pub frameworks : Vec < String > ,
9999 pub framework_paths : Vec < PathBuf > ,
100100 pub include_paths : Vec < PathBuf > ,
101- pub rpaths : Vec < PathBuf > ,
101+ pub ld_options : Vec < String > ,
102102 pub defines : HashMap < String , Option < String > > ,
103103 pub version : String ,
104104 _priv : ( ) ,
@@ -558,7 +558,7 @@ impl Library {
558558 libs : Vec :: new ( ) ,
559559 link_paths : Vec :: new ( ) ,
560560 include_paths : Vec :: new ( ) ,
561- rpaths : Vec :: new ( ) ,
561+ ld_options : Vec :: new ( ) ,
562562 frameworks : Vec :: new ( ) ,
563563 framework_paths : Vec :: new ( ) ,
564564 defines : HashMap :: new ( ) ,
@@ -669,16 +669,29 @@ impl Library {
669669 self . include_paths . push ( PathBuf :: from ( inc) ) ;
670670 }
671671 }
672- "-rpath" => {
673- if let Some ( rpath) = iter. next ( ) {
674- let meta = format ! ( "rustc-link-arg=-Wl,-rpath,{}" , rpath) ;
675- config. print_metadata ( & meta) ;
676- self . rpaths . push ( PathBuf :: from ( rpath) ) ;
677- }
678- }
679672 _ => ( ) ,
680673 }
681674 }
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+ }
685+ }
686+
687+ true
688+ } ) ;
689+
690+ while let Some ( option) = linker_options. next ( ) {
691+ let meta = format ! ( "rustc-link-arg={}" , option) ;
692+ config. print_metadata ( & meta) ;
693+ self . ld_options . push ( option. to_string ( ) ) ;
694+ }
682695 }
683696
684697 fn parse_modversion ( & mut self , output : & str ) {
0 commit comments