File tree 2 files changed +35
-1
lines changed
2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -1894,7 +1894,10 @@ impl Build {
1894
1894
// Target flags
1895
1895
match cmd. family {
1896
1896
ToolFamily :: Clang => {
1897
- if !( target. contains ( "android" ) && cmd. has_internal_target_arg ) {
1897
+ if !cmd. has_internal_target_arg
1898
+ && !( target. contains ( "android" )
1899
+ && android_clang_compiler_uses_target_arg_internally ( & cmd. path ) )
1900
+ {
1898
1901
if target. contains ( "darwin" ) {
1899
1902
if let Some ( arch) =
1900
1903
map_darwin_target_from_rust_to_compiler_architecture ( target)
Original file line number Diff line number Diff line change @@ -617,3 +617,34 @@ fn compile_intermediates() {
617
617
assert ! ( intermediates[ 1 ] . display( ) . to_string( ) . contains( "x86_64" ) ) ;
618
618
assert ! ( intermediates[ 2 ] . display( ) . to_string( ) . contains( "x86_64" ) ) ;
619
619
}
620
+
621
+ #[ test]
622
+ fn clang_android ( ) {
623
+ let target = "arm-linux-androideabi" ;
624
+
625
+ // On Windows, we don't use the Android NDK shims for Clang, so verify that
626
+ // we use "clang" and set the target correctly.
627
+ {
628
+ let test = Test :: new ( ) ;
629
+ test. shim ( "clang" ) . shim ( "llvm-ar" ) ;
630
+ test. gcc ( )
631
+ . target ( target)
632
+ . host ( "x86_64-pc-windows-msvc" )
633
+ . file ( "foo.c" )
634
+ . compile ( "foo" ) ;
635
+ test. cmd ( 0 ) . must_have ( "--target=arm-linux-androideabi" ) ;
636
+ }
637
+
638
+ // On non-Windows, we do use the shims, so make sure that we use the shim
639
+ // and don't set the target.
640
+ {
641
+ let test = Test :: new ( ) ;
642
+ test. shim ( "arm-linux-androideabi-clang" ) . shim ( "llvm-ar" ) ;
643
+ test. gcc ( )
644
+ . target ( target)
645
+ . host ( "x86_64-unknown-linux-gnu" )
646
+ . file ( "foo.c" )
647
+ . compile ( "foo" ) ;
648
+ test. cmd ( 0 ) . must_not_have ( "--target=arm-linux-androideabi" ) ;
649
+ }
650
+ }
You can’t perform that action at this time.
0 commit comments