File tree 4 files changed +9
-1
lines changed
4 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ use target::Target;
13
13
pub fn target ( ) -> Target {
14
14
let mut base = super :: linux_base:: opts ( ) ;
15
15
base. pre_link_args . push ( "-Wl,--allow-multiple-definition" . to_string ( ) ) ;
16
+ base. is_like_android = true ;
16
17
base. position_independent_executables = true ;
17
18
Target {
18
19
data_layout : "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ pub fn target() -> Target {
16
16
// Many of the symbols defined in compiler-rt are also defined in libgcc. Android
17
17
// linker doesn't like that by default.
18
18
base. pre_link_args . push ( "-Wl,--allow-multiple-definition" . to_string ( ) ) ;
19
+ base. is_like_android = true ;
19
20
// FIXME #17437 (and #17448): Android doesn't support position dependent executables anymore.
20
21
base. position_independent_executables = false ;
21
22
Original file line number Diff line number Diff line change @@ -158,6 +158,9 @@ pub struct TargetOptions {
158
158
/// only realy used for figuring out how to find libraries, since Windows uses its own
159
159
/// library naming convention. Defaults to false.
160
160
pub is_like_windows : bool ,
161
+ /// Whether the target toolchain is like Android's. Only useful for compiling against Android.
162
+ /// Defaults to false.
163
+ pub is_like_android : bool ,
161
164
/// Whether the linker support GNU-like arguments such as -O. Defaults to false.
162
165
pub linker_is_gnu : bool ,
163
166
/// Whether the linker support rpaths or not. Defaults to false.
@@ -197,6 +200,7 @@ impl Default for TargetOptions {
197
200
staticlib_suffix : ".a" . to_string ( ) ,
198
201
is_like_osx : false ,
199
202
is_like_windows : false ,
203
+ is_like_android : false ,
200
204
linker_is_gnu : false ,
201
205
has_rpath : false ,
202
206
no_compiler_rt : false ,
Original file line number Diff line number Diff line change @@ -736,7 +736,9 @@ pub fn finalize(cx: &CrateContext) {
736
736
// instruct LLVM to emit an older version of dwarf, however,
737
737
// for OS X to understand. For more info see #11352
738
738
// This can be overridden using --llvm-opts -dwarf-version,N.
739
- if cx. sess ( ) . target . target . options . is_like_osx {
739
+ // Android has the same issue (#22398)
740
+ if cx. sess ( ) . target . target . options . is_like_osx ||
741
+ cx. sess ( ) . target . target . options . is_like_android {
740
742
llvm:: LLVMRustAddModuleFlag ( cx. llmod ( ) ,
741
743
"Dwarf Version\0 " . as_ptr ( ) as * const _ ,
742
744
2 )
You can’t perform that action at this time.
0 commit comments