File tree 3 files changed +24
-1
lines changed
test/run-make/target-cpu-native
3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 14
14
15
15
#include " llvm/Support/CBindingWrapping.h"
16
16
#include " llvm/Support/FileSystem.h"
17
+ #include " llvm/Support/Host.h"
17
18
#include " llvm/Target/TargetLibraryInfo.h"
18
19
#include " llvm/Transforms/IPO/PassManagerBuilder.h"
19
20
@@ -83,6 +84,11 @@ LLVMRustCreateTargetMachine(const char *triple,
83
84
return NULL ;
84
85
}
85
86
87
+ StringRef real_cpu = cpu;
88
+ if (real_cpu == " native" ) {
89
+ real_cpu = sys::getHostCPUName ();
90
+ }
91
+
86
92
TargetOptions Options;
87
93
Options.PositionIndependentExecutable = PositionIndependentExecutable;
88
94
Options.NoFramePointerElim = NoFramePointerElim;
@@ -96,7 +102,7 @@ LLVMRustCreateTargetMachine(const char *triple,
96
102
}
97
103
98
104
TargetMachine *TM = TheTarget->createTargetMachine (Trip.getTriple (),
99
- cpu ,
105
+ real_cpu ,
100
106
feature,
101
107
Options,
102
108
RM,
Original file line number Diff line number Diff line change
1
+ -include ../tools.mk
2
+
3
+ all :
4
+ $(RUSTC ) foo.rs -C target-cpu=native
5
+ $(call RUN,foo)
Original file line number Diff line number Diff line change
1
+ // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ fn main ( ) {
12
+ }
You can’t perform that action at this time.
0 commit comments