diff options
| author | bors <bors@rust-lang.org> | 2024-09-14 07:07:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-09-14 07:07:30 +0000 |
| commit | 583f358e940574f3de235b1c7bf90353c68a7f08 (patch) | |
| tree | 3eb940125a277d2f3b0e6eaf9a84c1efed1cbf63 /compiler/rustc_codegen_llvm/src/context.rs | |
| parent | 20862e4653ece8bad3a263431e602cbf25982e44 (diff) | |
| parent | 94d49917ad3a88efffa3ad0e2d2dd95e1f866997 (diff) | |
| download | rust-583f358e940574f3de235b1c7bf90353c68a7f08.tar.gz rust-583f358e940574f3de235b1c7bf90353c68a7f08.zip | |
Auto merge of #3885 - rust-lang:rustup-2024-09-14, r=RalfJung
Automatic Rustup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/context.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/context.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index 01aae24ab56..73c2c15717f 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -27,7 +27,7 @@ use rustc_span::source_map::Spanned; use rustc_span::{Span, DUMMY_SP}; use rustc_target::abi::call::FnAbi; use rustc_target::abi::{HasDataLayout, TargetDataLayout, VariantIdx}; -use rustc_target::spec::{HasTargetSpec, RelocModel, Target, TlsModel}; +use rustc_target::spec::{HasTargetSpec, RelocModel, SmallDataThresholdSupport, Target, TlsModel}; use smallvec::SmallVec; use crate::back::write::to_llvm_code_model; @@ -387,6 +387,24 @@ pub(crate) unsafe fn create_module<'ll>( } } + match (sess.opts.unstable_opts.small_data_threshold, sess.target.small_data_threshold_support()) + { + // Set up the small-data optimization limit for architectures that use + // an LLVM module flag to control this. + (Some(threshold), SmallDataThresholdSupport::LlvmModuleFlag(flag)) => { + let flag = SmallCStr::new(flag.as_ref()); + unsafe { + llvm::LLVMRustAddModuleFlagU32( + llmod, + llvm::LLVMModFlagBehavior::Error, + flag.as_c_str().as_ptr(), + threshold as u32, + ) + } + } + _ => (), + }; + // Insert `llvm.ident` metadata. // // On the wasm targets it will get hooked up to the "producer" sections |
