Add -Z small-data-threshold
This flag allows specifying the threshold size above which LLVM should not consider placing small objects in a .sdata or .sbss section. Support is indicated in the target options via the small-data-threshold-support target option, which can indicate either an LLVM argument or an LLVM module flag. To avoid duplicate specifications in a large number of targets, the default value for support is DefaultForArch, which is translated to a concrete value according to the target's architecture.
This commit is contained in:
parent
33855f80d4
commit
3810386bbe
10 changed files with 241 additions and 4 deletions
|
@ -14,7 +14,7 @@ use rustc_middle::bug;
|
|||
use rustc_session::config::{PrintKind, PrintRequest};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_target::spec::{MergeFunctions, PanicStrategy};
|
||||
use rustc_target::spec::{MergeFunctions, PanicStrategy, SmallDataThresholdSupport};
|
||||
use rustc_target::target_features::{RUSTC_SPECIAL_FEATURES, RUSTC_SPECIFIC_FEATURES};
|
||||
|
||||
use crate::back::write::create_informational_target_machine;
|
||||
|
@ -125,6 +125,18 @@ unsafe fn configure_llvm(sess: &Session) {
|
|||
for arg in sess_args {
|
||||
add(&(*arg), true);
|
||||
}
|
||||
|
||||
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 argument to control this.
|
||||
(Some(threshold), SmallDataThresholdSupport::LlvmArg(arg)) => {
|
||||
add(&format!("--{arg}={threshold}"), false)
|
||||
}
|
||||
_ => (),
|
||||
};
|
||||
}
|
||||
|
||||
if sess.opts.unstable_opts.llvm_time_trace {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue