We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f7f9a3f commit f579deeCopy full SHA for f579dee
src/base.rs
@@ -129,8 +129,19 @@ pub fn compile_codegen_unit(
129
// NOTE: Rust relies on LLVM doing wrapping on overflow.
130
context.add_command_line_option("-fwrapv");
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
144
if tcx.sess.relocation_model() == rustc_target::spec::RelocModel::Static {
- context.add_command_line_option("-mcmodel=kernel");
145
context.add_command_line_option("-fno-pie");
146
}
147
0 commit comments