Implement CodeModel
This commit is contained in:
parent
f7f9a3fb28
commit
f579dee206
13
src/base.rs
13
src/base.rs
@ -129,8 +129,19 @@ fn module_codegen(
|
||||
// NOTE: Rust relies on LLVM doing wrapping on overflow.
|
||||
context.add_command_line_option("-fwrapv");
|
||||
|
||||
if let Some(model) = tcx.sess.code_model() {
|
||||
use rustc_target::spec::CodeModel;
|
||||
|
||||
context.add_command_line_option(match model {
|
||||
CodeModel::Tiny => "-mcmodel=tiny",
|
||||
CodeModel::Small => "-mcmodel=small",
|
||||
CodeModel::Kernel => "-mcmodel=kernel",
|
||||
CodeModel::Medium => "-mcmodel=medium",
|
||||
CodeModel::Large => "-mcmodel=large",
|
||||
});
|
||||
}
|
||||
|
||||
if tcx.sess.relocation_model() == rustc_target::spec::RelocModel::Static {
|
||||
context.add_command_line_option("-mcmodel=kernel");
|
||||
context.add_command_line_option("-fno-pie");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user