]> git.lizzy.rs Git - rust.git/commit
rustc: Load the `rustc_trans` crate at runtime
authorAlex Crichton <alex@alexcrichton.com>
Mon, 22 Jan 2018 15:29:24 +0000 (07:29 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Sun, 28 Jan 2018 03:16:21 +0000 (19:16 -0800)
commit884715c65420141dc06753f242a224462b120109
treea965ef66c12ca076d0f0d08a0ae9bbea302167d6
parentbacb5c58dfdde7c35e99b2b0d8171238cc33cf6c
rustc: Load the `rustc_trans` crate at runtime

Building on the work of # 45684 this commit updates the compiler to
unconditionally load the `rustc_trans` crate at runtime instead of linking to it
at compile time. The end goal of this work is to implement # 46819 where rustc
will have multiple backends available to it to load.

This commit starts off by removing the `extern crate rustc_trans` from the
driver. This involved moving some miscellaneous functionality into the
`TransCrate` trait and also required an implementation of how to locate and load
the trans backend. This ended up being a little tricky because the sysroot isn't
always the right location (for example `--sysroot` arguments) so some extra code
was added as well to probe a directory relative to the current dll (the
rustc_driver dll).

Rustbuild has been updated accordingly as well to have a separate compilation
invocation for the `rustc_trans` crate and assembly it accordingly into the
sysroot. Finally, the distribution logic for the `rustc` package was also
updated to slurp up the trans backends folder.

A number of assorted fallout changes were included here as well to ensure tests
pass and such, and they should all be commented inline.
33 files changed:
src/Cargo.lock
src/Cargo.toml
src/bootstrap/check.rs
src/bootstrap/compile.rs
src/bootstrap/dist.rs
src/bootstrap/doc.rs
src/bootstrap/lib.rs
src/bootstrap/native.rs
src/bootstrap/test.rs
src/librustc/Cargo.toml
src/librustc_driver/Cargo.toml
src/librustc_driver/lib.rs
src/librustc_driver/pretty.rs
src/librustc_llvm/Cargo.toml
src/librustc_llvm/build.rs
src/librustc_metadata/dynamic_lib.rs
src/librustc_trans/Cargo.toml
src/librustc_trans/lib.rs
src/librustc_trans_utils/trans_crate.rs
src/librustdoc/core.rs
src/librustdoc/lib.rs
src/librustdoc/test.rs
src/rustc/Cargo.toml
src/test/run-make/hotplug_codegen_backend/the_backend.rs
src/test/run-make/issue-19371/foo.rs
src/test/run-make/llvm-pass/Makefile
src/test/run-make/llvm-pass/plugin.rs
src/test/run-pass-fulldeps/create-dir-all-bare.rs
src/test/run-pass-fulldeps/issue-15149.rs
src/test/run-pass-fulldeps/rename-directory.rs
src/test/run-pass-fulldeps/stdio-from.rs
src/test/run-pass-fulldeps/switch-stdout.rs
src/tools/compiletest/src/main.rs