Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion compiler/rustc_interface/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ use rustc_ast as ast;
use rustc_attr_parsing::{ShouldEmit, validate_attr};
use rustc_codegen_ssa::back::archive::ArArchiveBuilderBuilder;
use rustc_codegen_ssa::back::link::link_binary;
use rustc_codegen_ssa::target_features::{self, cfg_target_feature};
use rustc_codegen_ssa::traits::CodegenBackend;
use rustc_codegen_ssa::{CodegenResults, CrateInfo};
use rustc_codegen_ssa::{CodegenResults, CrateInfo, TargetConfig};
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::jobserver::Proxy;
use rustc_data_structures::sync;
Expand Down Expand Up @@ -354,6 +355,33 @@ impl CodegenBackend for DummyCodegenBackend {
"dummy"
}

fn target_config(&self, sess: &Session) -> TargetConfig {
let (target_features, unstable_target_features) = cfg_target_feature(sess, |feature| {
// This is a standin for the list of features a backend is expected to enable.
// It would be better to parse target.features instead and handle implied features,
// but target.features is a list of LLVM target features, not Rust target features.
// The dummy backend doesn't know the mapping between LLVM and Rust target features.
sess.target.abi_required_features().required.contains(&feature)
});

// To report warnings about unknown features
target_features::flag_to_backend_features::<0>(
sess,
true,
|_| Default::default(),
|_, _| {},
);

TargetConfig {
target_features,
unstable_target_features,
has_reliable_f16: true,
has_reliable_f16_math: true,
has_reliable_f128: true,
has_reliable_f128_math: true,
}
}

fn supported_crate_types(&self, _sess: &Session) -> Vec<CrateType> {
// This includes bin despite failing on the link step to ensure that you
// can still get the frontend handling for binaries. For all library
Expand Down
Loading