File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -129,8 +129,19 @@ pub fn compile_codegen_unit(
129
129
// NOTE: Rust relies on LLVM doing wrapping on overflow.
130
130
context. add_command_line_option ( "-fwrapv" ) ;
131
131
132
+ if let Some ( model) = tcx. sess . code_model ( ) {
133
+ use rustc_target:: spec:: CodeModel ;
134
+
135
+ context. add_command_line_option ( match model {
136
+ CodeModel :: Tiny => "-mcmodel=tiny" ,
137
+ CodeModel :: Small => "-mcmodel=small" ,
138
+ CodeModel :: Kernel => "-mcmodel=kernel" ,
139
+ CodeModel :: Medium => "-mcmodel=medium" ,
140
+ CodeModel :: Large => "-mcmodel=large" ,
141
+ } ) ;
142
+ }
143
+
132
144
if tcx. sess . relocation_model ( ) == rustc_target:: spec:: RelocModel :: Static {
133
- context. add_command_line_option ( "-mcmodel=kernel" ) ;
134
145
context. add_command_line_option ( "-fno-pie" ) ;
135
146
}
136
147
You can’t perform that action at this time.
0 commit comments