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(
129129 // NOTE: Rust relies on LLVM doing wrapping on overflow.
130130 context. add_command_line_option ( "-fwrapv" ) ;
131131
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+
132144 if tcx. sess . relocation_model ( ) == rustc_target:: spec:: RelocModel :: Static {
133- context. add_command_line_option ( "-mcmodel=kernel" ) ;
134145 context. add_command_line_option ( "-fno-pie" ) ;
135146 }
136147
You can’t perform that action at this time.
0 commit comments