Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
c35ce3f
Don't generate bootstrap usage unless it's needed
jyn514 Sep 16, 2020
1d2290f
Update LLVM
Sep 16, 2020
ed6c7ef
Use enum for status of non-const ops
ecstatic-morse Sep 2, 2020
c3607bd
Use helper function for searching `allow_internal_unstable`
ecstatic-morse Sep 2, 2020
e4edc16
Give name to extra `Span` in `LiveDrop` error
ecstatic-morse Sep 2, 2020
81b3b66
Error if an unstable const eval feature is used in a stable const fn
ecstatic-morse Sep 3, 2020
1e1257b
Bless `miri-unleashed` tests
ecstatic-morse Sep 16, 2020
abc7167
Test that `const_precise_live_drops` can't be depended upon stably
ecstatic-morse Sep 16, 2020
7e24136
Pass --target to lint docs
Mark-Simulacrum Sep 16, 2020
bd4e0af
Build rustdoc for cross-compiled targets
Mark-Simulacrum Sep 16, 2020
012974d
use strip_prefix over starts_with and manual slicing based on pattern…
matthiaskrgr Sep 17, 2020
c946c40
Let backends define custom targets
khyperia Sep 17, 2020
48655c2
PR feedback
khyperia Sep 17, 2020
7b5d983
Remove redundant to_string
zzau13 Sep 17, 2020
76ec3f8
Move to intra doc links in core/src/future
poliorcetics Sep 17, 2020
643eb07
update Miri
RalfJung Sep 17, 2020
363aff0
Add test for x.py build cross-compilation
Mark-Simulacrum Sep 17, 2020
8e9ad31
Use intra-doc links
denisvasilik Sep 17, 2020
3323a26
Fixed some intra-docs links in library/core
Amjad50 Sep 17, 2020
878dfa6
Fixed intra-docs links in library/std/src/collections/hash/map.rs
Amjad50 Sep 17, 2020
f05b47c
Don't download/sync llvm-project submodule if download-ci-llvm is set
est31 Sep 18, 2020
28cfa97
Simplify panic_if_treat_err_as_bug avoiding allocations
zzau13 Sep 18, 2020
baafc71
Remove unused libc feature gate
est31 Sep 18, 2020
4c92b3d
Apply suggestions from code review
poliorcetics Sep 18, 2020
bdb039d
Use intra-doc links
denisvasilik Sep 18, 2020
f272896
Remove some unused features from alloc core and std
est31 Sep 18, 2020
0bc405e
Remove DeclareMethods
khyperia Sep 18, 2020
0810c3e
support panic=abort in Miri
RalfJung Sep 18, 2020
b9af3e3
bootstrap: move the version number to a plaintext file
pietroalbini Sep 18, 2020
2230d8d
Update library/alloc/src/collections/binary_heap.rs
denisvasilik Sep 18, 2020
ec7225f
Update library/alloc/src/collections/binary_heap.rs
denisvasilik Sep 18, 2020
62e0ee1
Update library/alloc/src/collections/binary_heap.rs
denisvasilik Sep 18, 2020
719c40c
Update library/alloc/src/collections/binary_heap.rs
denisvasilik Sep 18, 2020
25883aa
Add allocation information to undefined behaviour errors.
hameerabbasi Sep 18, 2020
0d0a3e1
Record `tcx.def_span` instead of `item.span` in crate metadata
Aaron1011 Sep 19, 2020
a78660f
Rollup merge of #76799 - Mark-Simulacrum:fix-cross-compile-dist, r=al…
Dylan-DPC Sep 19, 2020
7230377
Rollup merge of #76800 - jyn514:usage, r=Mark-Simulacrum
Dylan-DPC Sep 19, 2020
0505c85
Rollup merge of #76806 - jethrogb:jb/update-llvm, r=cuviper
Dylan-DPC Sep 19, 2020
4650fc8
Rollup merge of #76807 - ecstatic-morse:const-checking-staged-api, r=…
Dylan-DPC Sep 19, 2020
128a89b
Rollup merge of #76828 - matthiaskrgr:clippy_manual_strip, r=lcnr
Dylan-DPC Sep 19, 2020
1a84bd1
Rollup merge of #76832 - khyperia:backend_target_override, r=eddyb
Dylan-DPC Sep 19, 2020
ad09a16
Rollup merge of #76840 - poliorcetics:intra-doc-core-sync-and-future,…
Dylan-DPC Sep 19, 2020
833d585
Rollup merge of #76845 - Amjad50:fix-intra-docs-links, r=jyn514
Dylan-DPC Sep 19, 2020
c46efe5
Rollup merge of #76846 - botika:master, r=davidtwco
Dylan-DPC Sep 19, 2020
a18c53d
Rollup merge of #76848 - RalfJung:miri, r=RalfJung
Dylan-DPC Sep 19, 2020
672f648
Rollup merge of #76853 - denisvasilik:intra-doc-links-core-wake, r=jy…
Dylan-DPC Sep 19, 2020
7206bc3
Rollup merge of #76864 - est31:downloaded_llvm_no_clone_sources, r=Ma…
Dylan-DPC Sep 19, 2020
7e93aca
Rollup merge of #76866 - est31:master, r=lcnr
Dylan-DPC Sep 19, 2020
3c54c2d
Rollup merge of #76871 - RalfJung:miri-panic-abort, r=dtolnay
Dylan-DPC Sep 19, 2020
2f684d0
Rollup merge of #76872 - khyperia:remove_declare_methods, r=eddyb
Dylan-DPC Sep 19, 2020
a3d530b
Rollup merge of #76875 - denisvasilik:intra-doc-links-alloc-binary-he…
Dylan-DPC Sep 19, 2020
3f3ac16
Rollup merge of #76878 - pietroalbini:version, r=Mark-Simulacrum
Dylan-DPC Sep 19, 2020
34f9501
Rollup merge of #76881 - hameerabbasi:issue-53325, r=oli-obk
Dylan-DPC Sep 19, 2020
bb49eea
Rollup merge of #76898 - Aaron1011:fix/item-def-span, r=oli-obk
Dylan-DPC Sep 19, 2020
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
Prev Previous commit
Next Next commit
Let backends define custom targets
Add a target_override hook that takes priority over builtin targets.
  • Loading branch information
khyperia committed Sep 17, 2020
commit c946c40d9d47328fc1a08919dec174a77c12fd6b
5 changes: 5 additions & 0 deletions compiler/rustc_codegen_llvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use rustc_serialize::json;
use rustc_session::config::{self, OptLevel, OutputFilenames, PrintRequest};
use rustc_session::Session;
use rustc_span::symbol::Symbol;
use rustc_target::spec::Target;

use std::any::Any;
use std::ffi::CStr;
Expand Down Expand Up @@ -244,6 +245,10 @@ impl CodegenBackend for LlvmCodegenBackend {
target_features(sess)
}

fn target_override(&self, _opts: &config::Options) -> Option<Target> {
None
}

fn metadata_loader(&self) -> Box<MetadataLoaderDyn> {
Box::new(metadata::LlvmMetadataLoader)
}
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_codegen_ssa/src/traits/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_interface/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ fn mk_session(matches: getopts::Matches) -> (Session, CfgSpecs) {
DiagnosticOutput::Default,
Default::default(),
None,
None,
);
(sess, cfg)
}
Expand Down
15 changes: 9 additions & 6 deletions compiler/rustc_interface/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,21 @@ pub fn create_session(
lint_caps: FxHashMap<lint::LintId, lint::Level>,
descriptions: Registry,
) -> (Lrc<Session>, Lrc<Box<dyn CodegenBackend>>) {
let codegen_backend = get_codegen_backend(sopts.debugging_opts.codegen_backend.as_deref());
// target_override is documented to be called before init(), so this is okay
let target_override = codegen_backend.target_override(&sopts);

let mut sess = session::build_session(
sopts,
input_path,
descriptions,
diagnostic_output,
lint_caps,
file_loader,
target_override,
);

let codegen_backend = get_codegen_backend(&sess);
codegen_backend.init(&sess);

let mut cfg = config::build_configuration(&sess, config::to_crate_config(cfg));
add_configuration(&mut cfg, &mut sess, &*codegen_backend);
Expand Down Expand Up @@ -219,13 +224,13 @@ fn load_backend_from_dylib(path: &Path) -> fn() -> Box<dyn CodegenBackend> {
}
}

pub fn get_codegen_backend(sess: &Session) -> Box<dyn CodegenBackend> {
pub fn get_codegen_backend(codegen_name: Option<&str>) -> Box<dyn CodegenBackend> {
static INIT: Once = Once::new();

static mut LOAD: fn() -> Box<dyn CodegenBackend> = || unreachable!();

INIT.call_once(|| {
let codegen_name = sess.opts.debugging_opts.codegen_backend.as_deref().unwrap_or("llvm");
let codegen_name = codegen_name.unwrap_or("llvm");
let backend = match codegen_name {
filename if filename.contains('.') => load_backend_from_dylib(filename.as_ref()),
codegen_name => get_builtin_codegen_backend(codegen_name),
Expand All @@ -235,9 +240,7 @@ pub fn get_codegen_backend(sess: &Session) -> Box<dyn CodegenBackend> {
LOAD = backend;
}
});
let backend = unsafe { LOAD() };
backend.init(sess);
backend
unsafe { LOAD() }
}

// This is used for rustdoc, but it uses similar machinery to codegen backend
Expand Down
9 changes: 5 additions & 4 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,10 +818,11 @@ pub fn build_configuration(sess: &Session, mut user_cfg: CrateConfig) -> CrateCo
user_cfg
}

pub fn build_target_config(opts: &Options, error_format: ErrorOutputType) -> Config {
let target = Target::search(&opts.target_triple).unwrap_or_else(|e| {
pub fn build_target_config(opts: &Options, target_override: Option<Target>) -> Config {
let target_result = target_override.map_or_else(|| Target::search(&opts.target_triple), Ok);
let target = target_result.unwrap_or_else(|e| {
early_error(
error_format,
opts.error_format,
&format!(
"Error loading target specification: {}. \
Use `--print target-list` for a list of built-in targets",
Expand All @@ -835,7 +836,7 @@ pub fn build_target_config(opts: &Options, error_format: ErrorOutputType) -> Con
"32" => 32,
"64" => 64,
w => early_error(
error_format,
opts.error_format,
&format!(
"target specification was invalid: \
unrecognized target-pointer-width {}",
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_session/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,7 @@ pub fn build_session(
diagnostics_output: DiagnosticOutput,
driver_lint_caps: FxHashMap<lint::LintId, lint::Level>,
file_loader: Option<Box<dyn FileLoader + Send + Sync + 'static>>,
target_override: Option<Target>,
) -> Session {
// FIXME: This is not general enough to make the warning lint completely override
// normal diagnostic warnings, since the warning lint can also be denied and changed
Expand All @@ -1253,7 +1254,7 @@ pub fn build_session(
DiagnosticOutput::Raw(write) => Some(write),
};

let target_cfg = config::build_target_config(&sopts, sopts.error_format);
let target_cfg = config::build_target_config(&sopts, target_override);
let host_triple = TargetTriple::from_triple(config::host_triple());
let host = Target::search(&host_triple).unwrap_or_else(|e| {
early_error(sopts.error_format, &format!("Error loading host specification: {}", e))
Expand Down