diff options
| author | bors <bors@rust-lang.org> | 2024-10-03 06:20:27 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-10-03 06:20:27 +0000 |
| commit | bf71d65980c7005aa30f6f057aaa2e681b703400 (patch) | |
| tree | 44a406e1ded013292644eee72c9921c76fb4f706 /compiler/rustc_codegen_gcc/src/base.rs | |
| parent | 52aa98a994f84e02bae6a7573b8c81bb8add2b98 (diff) | |
| parent | 9b35886adfe5da4163e95508f586dc071eec4d0f (diff) | |
Auto merge of #3935 - RalfJung:rustup, r=RalfJung
Rustup
Diffstat (limited to 'compiler/rustc_codegen_gcc/src/base.rs')
| -rw-r--r-- | compiler/rustc_codegen_gcc/src/base.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_gcc/src/base.rs b/compiler/rustc_codegen_gcc/src/base.rs index 9836e654f37..18aa32754e1 100644 --- a/compiler/rustc_codegen_gcc/src/base.rs +++ b/compiler/rustc_codegen_gcc/src/base.rs @@ -128,8 +128,19 @@ pub fn compile_codegen_unit( // 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"); } |
