Skip to content

Commit

Permalink
Lower the default dwarf version for android
Browse files Browse the repository at this point in the history
  • Loading branch information
ejjeong committed Feb 16, 2015
1 parent 4f14111 commit 194d96e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/librustc_back/target/aarch64_linux_android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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-\
Expand Down
1 change: 1 addition & 0 deletions src/librustc_back/target/arm_linux_androideabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 4 additions & 0 deletions src/librustc_back/target/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion src/librustc_trans/trans/debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 194d96e

Please sign in to comment.