File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 1010
1111//! A helper class for dealing with static archives
1212
13+ use back:: link:: { get_ar_prog} ;
1314use driver:: session:: Session ;
1415use metadata:: filesearch;
1516use lib:: llvm:: { ArchiveRef , llvm} ;
@@ -37,14 +38,7 @@ pub struct ArchiveRO {
3738
3839fn run_ar ( sess : Session , args : & str , cwd : Option < & Path > ,
3940 paths : & [ & Path ] ) -> ProcessOutput {
40- let ar = if sess. opts . target_triple == ~"arm-linux-androideabi" {
41- match sess. opts . android_cross_path {
42- Some ( ref path) => * path + "/bin/" + "arm-linux-androideabi-ar" ,
43- None => ~"arm-linux-androideabi-ar"
44- }
45- } else {
46- sess. opts . ar . clone ( ) . unwrap_or_else ( || ~"ar")
47- } ;
41+ let ar = get_ar_prog ( sess) ;
4842
4943 let mut args = ~[ args. to_owned ( ) ] ;
5044 let mut paths = paths. iter ( ) . map ( |p| p. as_str ( ) . unwrap ( ) . to_owned ( ) ) ;
Original file line number Diff line number Diff line change @@ -736,6 +736,22 @@ pub fn get_cc_prog(sess: Session) -> ~str {
736736 }
737737}
738738
739+ pub fn get_ar_prog ( sess : Session ) -> ~str {
740+ match sess. targ_cfg . os {
741+ abi:: OsAndroid => match sess. opts . android_cross_path {
742+ Some ( ref path) => format ! ( "{}/bin/arm-linux-androideabi-ar" , * path) ,
743+ None => {
744+ sess. fatal ( "need Android NDK path for linking \
745+ (--android-cross-path)")
746+ }
747+ } ,
748+ _ => match sess. opts . ar {
749+ Some ( ref ar) => format ! ( "{}" , * ar) ,
750+ None => ~"ar"
751+ } ,
752+ }
753+ }
754+
739755/// Perform the linkage portion of the compilation phase. This will generate all
740756/// of the requested outputs for this compilation session.
741757pub fn link_binary ( sess : Session ,
You can’t perform that action at this time.
0 commit comments