1
Fork 0

Let backends define custom targets

Add a target_override hook that takes priority over builtin targets.
This commit is contained in:
khyperia 2020-09-17 12:01:12 +02:00
parent 95386b656e
commit c946c40d9d
6 changed files with 27 additions and 11 deletions

View file

@ -15,6 +15,7 @@ use rustc_session::{
};
use rustc_span::symbol::Symbol;
use rustc_target::abi::LayoutOf;
use rustc_target::spec::Target;
pub use rustc_data_structures::sync::MetadataRef;
@ -54,6 +55,10 @@ pub trait CodegenBackend {
fn print_passes(&self) {}
fn print_version(&self) {}
/// If this plugin provides additional builtin targets, provide them here.
/// Be careful: this is called *before* init() is called.
fn target_override(&self, opts: &config::Options) -> Option<Target>;
fn metadata_loader(&self) -> Box<MetadataLoaderDyn>;
fn provide(&self, _providers: &mut Providers);
fn provide_extern(&self, _providers: &mut Providers);