diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-09-27 22:00:17 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-09-27 22:00:17 +0200 |
| commit | 325b70890a4a9b4b14368cfdd87d0c161632cb30 (patch) | |
| tree | e3264a25c52d21f90be467a7800b89c302c9db7e /compiler/rustc_codegen_gcc/src/base.rs | |
| parent | a3f76a26e045a760bb1163b7eab36872985242d5 (diff) | |
| parent | 3187d32079b817522cc17413ec9185b130daf693 (diff) | |
| download | rust-325b70890a4a9b4b14368cfdd87d0c161632cb30.tar.gz rust-325b70890a4a9b4b14368cfdd87d0c161632cb30.zip | |
Merge commit '3187d32079b817522cc17413ec9185b130daf693' into subtree-update
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"); } |
