Skip to content

Commit 7204c26

Browse files
committed
---
yaml --- r: 148866 b: refs/heads/try2 c: b5f1979 h: refs/heads/master v: v3
1 parent 8fc8dbb commit 7204c26

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: b00147a99b289b11a210d9fc841b8aca3e59ce0e
8+
refs/heads/try2: b5f19795adda1bb2daca891e97bca8c7638916e2
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/back/link.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,32 @@ pub mod write {
9898
use lib;
9999
use syntax::abi;
100100
use util::common::time;
101+
use syntax::abi;
101102

102103
use std::c_str::ToCStr;
103104
use std::libc::{c_uint, c_int};
104105
use std::path::Path;
105106
use std::run;
106107
use std::str;
107108

109+
// On android, we by default compile for armv7 processors. This enables
110+
// things like double word CAS instructions (rather than emulating them)
111+
// which are *far* more efficient. This is obviously undesirable in some
112+
// cases, so if any sort of target feature is specified we don't append v7
113+
// to the feature list.
114+
fn target_feature<'a>(sess: &'a Session) -> &'a str {
115+
match sess.targ_cfg.os {
116+
abi::OsAndroid => {
117+
if "" == sess.opts.target_feature {
118+
"+v7"
119+
} else {
120+
sess.opts.target_feature.as_slice()
121+
}
122+
}
123+
_ => sess.opts.target_feature.as_slice()
124+
}
125+
}
126+
108127
pub fn run_passes(sess: Session,
109128
trans: &CrateTranslation,
110129
output_type: OutputType,
@@ -136,7 +155,7 @@ pub mod write {
136155

137156
let tm = sess.targ_cfg.target_strs.target_triple.with_c_str(|T| {
138157
sess.opts.target_cpu.with_c_str(|CPU| {
139-
sess.opts.target_feature.with_c_str(|Features| {
158+
target_feature(&sess).with_c_str(|Features| {
140159
llvm::LLVMRustCreateTargetMachine(
141160
T, CPU, Features,
142161
lib::llvm::CodeModelDefault,

0 commit comments

Comments
 (0)