Lower the default dwarf version for android

This commit is contained in:
Eunji Jeong 2015-02-16 17:48:50 +09:00
parent 4f1411197b
commit 194d96e5c3
4 changed files with 9 additions and 1 deletions

View File

@ -13,6 +13,7 @@ use target::Target;
pub fn target() -> Target {
let mut base = super::linux_base::opts();
base.pre_link_args.push("-Wl,--allow-multiple-definition".to_string());
base.is_like_android = true;
base.position_independent_executables = true;
Target {
data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\

View File

@ -16,6 +16,7 @@ pub fn target() -> Target {
// Many of the symbols defined in compiler-rt are also defined in libgcc. Android
// linker doesn't like that by default.
base.pre_link_args.push("-Wl,--allow-multiple-definition".to_string());
base.is_like_android = true;
// FIXME #17437 (and #17448): Android doesn't support position dependent executables anymore.
base.position_independent_executables = false;

View File

@ -158,6 +158,9 @@ pub struct TargetOptions {
/// only realy used for figuring out how to find libraries, since Windows uses its own
/// library naming convention. Defaults to false.
pub is_like_windows: bool,
/// Whether the target toolchain is like Android's. Only useful for compiling against Android.
/// Defaults to false.
pub is_like_android: bool,
/// Whether the linker support GNU-like arguments such as -O. Defaults to false.
pub linker_is_gnu: bool,
/// Whether the linker support rpaths or not. Defaults to false.
@ -197,6 +200,7 @@ impl Default for TargetOptions {
staticlib_suffix: ".a".to_string(),
is_like_osx: false,
is_like_windows: false,
is_like_android: false,
linker_is_gnu: false,
has_rpath: false,
no_compiler_rt: false,

View File

@ -736,7 +736,9 @@ pub fn finalize(cx: &CrateContext) {
// instruct LLVM to emit an older version of dwarf, however,
// for OS X to understand. For more info see #11352
// This can be overridden using --llvm-opts -dwarf-version,N.
if cx.sess().target.target.options.is_like_osx {
// Android has the same issue (#22398)
if cx.sess().target.target.options.is_like_osx ||
cx.sess().target.target.options.is_like_android {
llvm::LLVMRustAddModuleFlag(cx.llmod(),
"Dwarf Version\0".as_ptr() as *const _,
2)