File tree Expand file tree Collapse file tree 6 files changed +29
-11
lines changed Expand file tree Collapse file tree 6 files changed +29
-11
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,7 @@ CFG_PATH_MUNGE_arm-unknown-android := true
143
143
CFG_LDPATH_arm-unknown-android :=
144
144
CFG_RUN_arm-unknown-android =
145
145
CFG_RUN_TARG_arm-unknown-android =
146
+ RUSTC_FLAGS_arm-unknown-android :=--android-cross-path='$(CFG_ANDROID_CROSS_PATH ) '
146
147
147
148
# i686-pc-mingw32 configuration
148
149
CFG_LIB_NAME_i686-pc-mingw32 =$(1 ) .dll
Original file line number Diff line number Diff line change @@ -774,11 +774,18 @@ pub fn link_binary(sess: Session,
774
774
// instead of hard-coded gcc.
775
775
// For win32, there is no cc command,
776
776
// so we add a condition to make it use gcc.
777
- let cc_prog: ~str =
778
- if sess. targ_cfg . os == session:: os_android {
779
- ~"arm-linux-androideabi-g++"
780
- } else if sess.targ_cfg.os == session::os_win32 { ~" gcc" }
781
- else { ~"cc" } ;
777
+ let cc_prog: ~str = if sess. targ_cfg . os == session:: os_android {
778
+ match & sess. opts . android_cross_path {
779
+ & Some ( copy path) => {
780
+ fmt ! ( "%s/bin/arm-linux-androideabi-gcc" , path)
781
+ }
782
+ & None => {
783
+ sess. fatal ( ~"need Android NDK path for linking \
784
+ ( --android-cross-path) ")
785
+ }
786
+ }
787
+ } else if sess. targ_cfg . os == session:: os_win32 { ~"gcc" }
788
+ else { ~"cc" } ;
782
789
// The invocations of cc share some flags across platforms
783
790
784
791
let mut cc_args =
@@ -876,9 +883,7 @@ pub fn link_binary(sess: Session,
876
883
}
877
884
878
885
// Stack growth requires statically linking a __morestack function
879
- if sess. targ_cfg . os != session:: os_android {
880
886
cc_args. push ( ~"-lmorestack") ;
881
- }
882
887
883
888
// FIXME (#2397): At some point we want to rpath our guesses as to where
884
889
// extern libraries might live, based on the addl_lib_search_paths
Original file line number Diff line number Diff line change @@ -641,6 +641,8 @@ pub fn build_session_options(+binary: ~str,
641
641
.map(|s| Path(*s));
642
642
let cfg = parse_cfgspecs(getopts::opt_strs(matches, ~" cfg"));
643
643
let test = opt_present(matches, ~" test");
644
+ let android_cross_path = getopts::opt_maybe_str(
645
+ matches, ~" android-cross-path");
644
646
let sopts = @session::options {
645
647
crate_type: crate_type,
646
648
is_static: static,
@@ -660,7 +662,8 @@ pub fn build_session_options(+binary: ~str,
660
662
test: test,
661
663
parse_only: parse_only,
662
664
no_trans: no_trans,
663
- debugging_opts: debugging_opts
665
+ debugging_opts: debugging_opts,
666
+ android_cross_path: android_cross_path
664
667
};
665
668
return sopts;
666
669
}
@@ -764,6 +767,8 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
764
767
to compile for ( see
765
768
http: //sources. redhat . com /autobook/autobook/autobook_17. html
766
769
for detail) ", ~"TRIPLE ") ,
770
+ optopt ( ~"", ~"android-cross-path",
771
+ ~"The path to the Android NDK ", "PATH" ) ,
767
772
optmulti ( ~"W ", ~"warn",
768
773
~"Set lint warnings", ~"OPT ") ,
769
774
optmulti ( ~"A ", ~"allow",
Original file line number Diff line number Diff line change @@ -140,6 +140,7 @@ pub struct options {
140
140
parse_only : bool ,
141
141
no_trans : bool ,
142
142
debugging_opts : uint ,
143
+ android_cross_path : Option < ~str >
143
144
}
144
145
145
146
pub struct crate_metadata {
@@ -289,7 +290,8 @@ pub fn basic_options() -> @options {
289
290
test : false ,
290
291
parse_only : false ,
291
292
no_trans : false ,
292
- debugging_opts : 0 u
293
+ debugging_opts : 0 u,
294
+ android_cross_path : None
293
295
}
294
296
}
295
297
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ class cratemap {
49
49
case 0 : return NULL ;
50
50
case 1 : return m_annihilate_fn;
51
51
default : assert (false && " Unknown crate map version!" );
52
+ return NULL ; // Appease -Werror=return-type
52
53
}
53
54
}
54
55
@@ -57,6 +58,7 @@ class cratemap {
57
58
case 0 : return reinterpret_cast <const cratemap_v0 *>(this )->m_entries ;
58
59
case 1 : return m_entries;
59
60
default : assert (false && " Unknown crate map version!" );
61
+ return NULL ; // Appease -Werror=return-type
60
62
}
61
63
}
62
64
@@ -68,6 +70,7 @@ class cratemap {
68
70
case 1 :
69
71
return &m_children[1 ];
70
72
default : assert (false && " Unknown crate map version!" );
73
+ return NULL ; // Appease -Werror=return-type
71
74
}
72
75
}
73
76
Original file line number Diff line number Diff line change @@ -314,9 +314,11 @@ void update_log_settings(void* crate_map, char* settings) {
314
314
n_dirs, &n_matches);
315
315
316
316
if (n_matches < n_dirs) {
317
- printf (" warning: got %" PRIdPTR " RUST_LOG specs, "
317
+ // NOTE: Android compiler is complaining about format specifiers here
318
+ // and I don't understand why
319
+ /* printf("warning: got %" PRIdPTR " RUST_LOG specs, "
318
320
"enabled %" PRIdPTR " flags.",
319
- (uintptr_t )n_dirs, (uintptr_t )n_matches);
321
+ (uintptr_t)n_dirs, (uintptr_t)n_matches);*/
320
322
}
321
323
322
324
free (buffer);
You can’t perform that action at this time.
0 commit comments