Auto merge of #51590 - bjorn3:codegen_llvm_extract, r=alexcrichton

Mostly fix metadata_only backend and extract some code out of rustc_codegen_llvm

Removes dependency on the `ar` crate and removes the `llvm.enabled` config option in favour of setting `rust.codegen-backends` to `[]`.
This commit is contained in:
bors 2018-07-08 00:52:36 +00:00
commit 9342f293e9
15 changed files with 30 additions and 110 deletions

View file

@ -4,6 +4,6 @@ all:
/bin/echo || exit 0 # This test requires /bin/echo to exist
$(RUSTC) the_backend.rs --crate-name the_backend --crate-type dylib \
-o $(TMPDIR)/the_backend.dylib
$(RUSTC) some_crate.rs --crate-name some_crate --crate-type bin -o $(TMPDIR)/some_crate \
$(RUSTC) some_crate.rs --crate-name some_crate --crate-type lib -o $(TMPDIR)/some_crate \
-Z codegen-backend=$(TMPDIR)/the_backend.dylib -Z unstable-options
grep -x "This has been \"compiled\" successfully." $(TMPDIR)/some_crate

View file

@ -8,6 +8,5 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
::std::process::exit(1);
}
#![feature(no_core)]
#![no_core]

View file

@ -63,7 +63,7 @@ impl CodegenBackend for TheBackend {
let crate_name = ongoing_codegen.downcast::<Symbol>()
.expect("in join_codegen_and_link: ongoing_codegen is not a Symbol");
for &crate_type in sess.opts.crate_types.iter() {
if crate_type != CrateType::CrateTypeExecutable {
if crate_type != CrateType::CrateTypeRlib {
sess.fatal(&format!("Crate type is {:?}", crate_type));
}
let output_name =