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 10
10
11
11
//! A helper class for dealing with static archives
12
12
13
+ use back:: link:: { get_ar_prog} ;
13
14
use driver:: session:: Session ;
14
15
use metadata:: filesearch;
15
16
use lib:: llvm:: { ArchiveRef , llvm} ;
@@ -37,14 +38,7 @@ pub struct ArchiveRO {
37
38
38
39
fn run_ar ( sess : Session , args : & str , cwd : Option < & Path > ,
39
40
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) ;
48
42
49
43
let mut args = ~[ args. to_owned ( ) ] ;
50
44
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 {
736
736
}
737
737
}
738
738
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
+
739
755
/// Perform the linkage portion of the compilation phase. This will generate all
740
756
/// of the requested outputs for this compilation session.
741
757
pub fn link_binary ( sess : Session ,
You can’t perform that action at this time.
0 commit comments