File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,22 @@ pub mod write {
186
186
}
187
187
} ;
188
188
189
+ let code_model = match sess. opts . cg . code_model . as_slice ( ) {
190
+ "default" => llvm:: CodeModelDefault ,
191
+ "small" => llvm:: CodeModelSmall ,
192
+ "kernel" => llvm:: CodeModelKernel ,
193
+ "medium" => llvm:: CodeModelMedium ,
194
+ "large" => llvm:: CodeModelLarge ,
195
+ _ => {
196
+ sess. err ( format ! ( "{} is not a valid code model" ,
197
+ sess. opts
198
+ . cg
199
+ . code_model) . as_slice ( ) ) ;
200
+ sess. abort_if_errors ( ) ;
201
+ return ;
202
+ }
203
+ } ;
204
+
189
205
let tm = sess. targ_cfg
190
206
. target_strs
191
207
. target_triple
@@ -195,7 +211,7 @@ pub mod write {
195
211
target_feature ( sess) . with_c_str ( |features| {
196
212
llvm:: LLVMRustCreateTargetMachine (
197
213
t, cpu, features,
198
- llvm :: CodeModelDefault ,
214
+ code_model ,
199
215
reloc_model,
200
216
opt_level,
201
217
true /* EnableSegstk */ ,
Original file line number Diff line number Diff line change @@ -334,6 +334,8 @@ cgoptions!(
334
334
"use an external assembler rather than LLVM's integrated one" ) ,
335
335
relocation_model: String = ( "pic" . to_string( ) , parse_string,
336
336
"choose the relocation model to use (llc -relocation-model for details)" ) ,
337
+ code_model: String = ( "default" . to_string( ) , parse_string,
338
+ "choose the code model to use (llc -code-model for details)" ) ,
337
339
metadata: Vec <String > = ( Vec :: new( ) , parse_list,
338
340
"metadata to mangle symbol names with" ) ,
339
341
extra_filename: String = ( "" . to_string( ) , parse_string,
You can’t perform that action at this time.
0 commit comments