Rename is_builder_target
to is_host_target
This commit is contained in:
parent
2907ab5bf9
commit
3c01dfe2ae
8 changed files with 18 additions and 19 deletions
|
@ -229,7 +229,7 @@ impl Step for Std {
|
||||||
// The LLD wrappers and `rust-lld` are self-contained linking components that can be
|
// The LLD wrappers and `rust-lld` are self-contained linking components that can be
|
||||||
// necessary to link the stdlib on some targets. We'll also need to copy these binaries to
|
// necessary to link the stdlib on some targets. We'll also need to copy these binaries to
|
||||||
// the `stage0-sysroot` to ensure the linker is found when bootstrapping on such a target.
|
// the `stage0-sysroot` to ensure the linker is found when bootstrapping on such a target.
|
||||||
if compiler.stage == 0 && builder.config.is_builder_target(compiler.host) {
|
if compiler.stage == 0 && builder.config.is_host_target(compiler.host) {
|
||||||
trace!(
|
trace!(
|
||||||
"(build == host) copying linking components to `stage0-sysroot` for bootstrapping"
|
"(build == host) copying linking components to `stage0-sysroot` for bootstrapping"
|
||||||
);
|
);
|
||||||
|
@ -2182,7 +2182,7 @@ impl Step for Assemble {
|
||||||
debug!("copying codegen backends to sysroot");
|
debug!("copying codegen backends to sysroot");
|
||||||
copy_codegen_backends_to_sysroot(builder, build_compiler, target_compiler);
|
copy_codegen_backends_to_sysroot(builder, build_compiler, target_compiler);
|
||||||
|
|
||||||
if builder.config.lld_enabled {
|
if builder.config.lld_enabled && !builder.config.is_system_llvm(target_compiler.host) {
|
||||||
builder.ensure(crate::core::build_steps::tool::LldWrapper {
|
builder.ensure(crate::core::build_steps::tool::LldWrapper {
|
||||||
build_compiler,
|
build_compiler,
|
||||||
target_compiler,
|
target_compiler,
|
||||||
|
@ -2533,7 +2533,7 @@ pub fn strip_debug(builder: &Builder<'_>, target: TargetSelection, path: &Path)
|
||||||
// `strip -g` is both available and will fix the issue, i.e. on a x64 linux host that is not
|
// `strip -g` is both available and will fix the issue, i.e. on a x64 linux host that is not
|
||||||
// cross-compiling. Expand this to other appropriate targets in the future.
|
// cross-compiling. Expand this to other appropriate targets in the future.
|
||||||
if target != "x86_64-unknown-linux-gnu"
|
if target != "x86_64-unknown-linux-gnu"
|
||||||
|| !builder.config.is_builder_target(target)
|
|| !builder.config.is_host_target(target)
|
||||||
|| !path.exists()
|
|| !path.exists()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -612,7 +612,7 @@ impl Step for DebuggerScripts {
|
||||||
fn skip_host_target_lib(builder: &Builder<'_>, compiler: Compiler) -> bool {
|
fn skip_host_target_lib(builder: &Builder<'_>, compiler: Compiler) -> bool {
|
||||||
// The only true set of target libraries came from the build triple, so
|
// The only true set of target libraries came from the build triple, so
|
||||||
// let's reduce redundant work by only producing archives from that host.
|
// let's reduce redundant work by only producing archives from that host.
|
||||||
if !builder.config.is_builder_target(compiler.host) {
|
if !builder.config.is_host_target(compiler.host) {
|
||||||
builder.info("\tskipping, not a build host");
|
builder.info("\tskipping, not a build host");
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
|
@ -671,8 +671,7 @@ fn copy_target_libs(
|
||||||
&self_contained_dst.join(path.file_name().unwrap()),
|
&self_contained_dst.join(path.file_name().unwrap()),
|
||||||
FileType::NativeLibrary,
|
FileType::NativeLibrary,
|
||||||
);
|
);
|
||||||
} else if dependency_type == DependencyType::Target
|
} else if dependency_type == DependencyType::Target || builder.config.is_host_target(target)
|
||||||
|| builder.config.is_builder_target(target)
|
|
||||||
{
|
{
|
||||||
builder.copy_link(&path, &dst.join(path.file_name().unwrap()), FileType::NativeLibrary);
|
builder.copy_link(&path, &dst.join(path.file_name().unwrap()), FileType::NativeLibrary);
|
||||||
}
|
}
|
||||||
|
@ -826,7 +825,7 @@ impl Step for Analysis {
|
||||||
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
|
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
|
||||||
let compiler = self.compiler;
|
let compiler = self.compiler;
|
||||||
let target = self.target;
|
let target = self.target;
|
||||||
if !builder.config.is_builder_target(compiler.host) {
|
if !builder.config.is_host_target(compiler.host) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -485,7 +485,7 @@ impl Step for Llvm {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://llvm.org/docs/HowToCrossCompileLLVM.html
|
// https://llvm.org/docs/HowToCrossCompileLLVM.html
|
||||||
if !builder.config.is_builder_target(target) {
|
if !builder.config.is_host_target(target) {
|
||||||
let LlvmResult { llvm_config, .. } =
|
let LlvmResult { llvm_config, .. } =
|
||||||
builder.ensure(Llvm { target: builder.config.build });
|
builder.ensure(Llvm { target: builder.config.build });
|
||||||
if !builder.config.dry_run() {
|
if !builder.config.dry_run() {
|
||||||
|
@ -637,7 +637,7 @@ fn configure_cmake(
|
||||||
}
|
}
|
||||||
cfg.target(&target.triple).host(&builder.config.build.triple);
|
cfg.target(&target.triple).host(&builder.config.build.triple);
|
||||||
|
|
||||||
if !builder.config.is_builder_target(target) {
|
if !builder.config.is_host_target(target) {
|
||||||
cfg.define("CMAKE_CROSSCOMPILING", "True");
|
cfg.define("CMAKE_CROSSCOMPILING", "True");
|
||||||
|
|
||||||
// NOTE: Ideally, we wouldn't have to do this, and `cmake-rs` would just handle it for us.
|
// NOTE: Ideally, we wouldn't have to do this, and `cmake-rs` would just handle it for us.
|
||||||
|
@ -1098,7 +1098,7 @@ impl Step for Lld {
|
||||||
.define("LLVM_CMAKE_DIR", llvm_cmake_dir)
|
.define("LLVM_CMAKE_DIR", llvm_cmake_dir)
|
||||||
.define("LLVM_INCLUDE_TESTS", "OFF");
|
.define("LLVM_INCLUDE_TESTS", "OFF");
|
||||||
|
|
||||||
if !builder.config.is_builder_target(target) {
|
if !builder.config.is_host_target(target) {
|
||||||
// Use the host llvm-tblgen binary.
|
// Use the host llvm-tblgen binary.
|
||||||
cfg.define(
|
cfg.define(
|
||||||
"LLVM_TABLEGEN_EXE",
|
"LLVM_TABLEGEN_EXE",
|
||||||
|
|
|
@ -2668,7 +2668,7 @@ impl Step for Crate {
|
||||||
cargo
|
cargo
|
||||||
} else {
|
} else {
|
||||||
// Also prepare a sysroot for the target.
|
// Also prepare a sysroot for the target.
|
||||||
if !builder.config.is_builder_target(target) {
|
if !builder.config.is_host_target(target) {
|
||||||
builder.ensure(compile::Std::new(compiler, target).force_recompile(true));
|
builder.ensure(compile::Std::new(compiler, target).force_recompile(true));
|
||||||
builder.ensure(RemoteCopyLibs { compiler, target });
|
builder.ensure(RemoteCopyLibs { compiler, target });
|
||||||
}
|
}
|
||||||
|
|
|
@ -1107,8 +1107,8 @@ fn test_is_builder_target() {
|
||||||
let build = Build::new(config);
|
let build = Build::new(config);
|
||||||
let builder = Builder::new(&build);
|
let builder = Builder::new(&build);
|
||||||
|
|
||||||
assert!(builder.is_builder_target(target1));
|
assert!(builder.config.is_host_target(target1));
|
||||||
assert!(!builder.is_builder_target(target2));
|
assert!(!builder.config.is_host_target(target2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3234,8 +3234,8 @@ impl Config {
|
||||||
Some(commit.to_string())
|
Some(commit.to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if the given target is the same as the builder target.
|
/// Checks if the given target is the same as the host target.
|
||||||
pub fn is_builder_target(&self, target: TargetSelection) -> bool {
|
pub fn is_host_target(&self, target: TargetSelection) -> bool {
|
||||||
self.build == target
|
self.build == target
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3246,7 +3246,7 @@ impl Config {
|
||||||
pub fn is_system_llvm(&self, target: TargetSelection) -> bool {
|
pub fn is_system_llvm(&self, target: TargetSelection) -> bool {
|
||||||
match self.target_config.get(&target) {
|
match self.target_config.get(&target) {
|
||||||
Some(Target { llvm_config: Some(_), .. }) => {
|
Some(Target { llvm_config: Some(_), .. }) => {
|
||||||
let ci_llvm = self.llvm_from_ci && self.is_builder_target(target);
|
let ci_llvm = self.llvm_from_ci && self.is_host_target(target);
|
||||||
!ci_llvm
|
!ci_llvm
|
||||||
}
|
}
|
||||||
// We're building from the in-tree src/llvm-project sources.
|
// We're building from the in-tree src/llvm-project sources.
|
||||||
|
|
|
@ -325,7 +325,7 @@ than building it.
|
||||||
if target.contains("musl") && !target.contains("unikraft") {
|
if target.contains("musl") && !target.contains("unikraft") {
|
||||||
// If this is a native target (host is also musl) and no musl-root is given,
|
// If this is a native target (host is also musl) and no musl-root is given,
|
||||||
// fall back to the system toolchain in /usr before giving up
|
// fall back to the system toolchain in /usr before giving up
|
||||||
if build.musl_root(*target).is_none() && build.config.is_builder_target(*target) {
|
if build.musl_root(*target).is_none() && build.config.is_host_target(*target) {
|
||||||
let target = build.config.target_config.entry(*target).or_default();
|
let target = build.config.target_config.entry(*target).or_default();
|
||||||
target.musl_root = Some("/usr".into());
|
target.musl_root = Some("/usr".into());
|
||||||
}
|
}
|
||||||
|
|
|
@ -803,7 +803,7 @@ impl Build {
|
||||||
/// Note that if LLVM is configured externally then the directory returned
|
/// Note that if LLVM is configured externally then the directory returned
|
||||||
/// will likely be empty.
|
/// will likely be empty.
|
||||||
fn llvm_out(&self, target: TargetSelection) -> PathBuf {
|
fn llvm_out(&self, target: TargetSelection) -> PathBuf {
|
||||||
if self.config.llvm_from_ci && self.config.is_builder_target(target) {
|
if self.config.llvm_from_ci && self.config.is_host_target(target) {
|
||||||
self.config.ci_llvm_root()
|
self.config.ci_llvm_root()
|
||||||
} else {
|
} else {
|
||||||
self.out.join(target).join("llvm")
|
self.out.join(target).join("llvm")
|
||||||
|
@ -1325,7 +1325,7 @@ Executed at: {executed_at}"#,
|
||||||
// need to use CXX compiler as linker to resolve the exception functions
|
// need to use CXX compiler as linker to resolve the exception functions
|
||||||
// that are only existed in CXX libraries
|
// that are only existed in CXX libraries
|
||||||
Some(self.cxx.borrow()[&target].path().into())
|
Some(self.cxx.borrow()[&target].path().into())
|
||||||
} else if !self.config.is_builder_target(target)
|
} else if !self.config.is_host_target(target)
|
||||||
&& helpers::use_host_linker(target)
|
&& helpers::use_host_linker(target)
|
||||||
&& !target.is_msvc()
|
&& !target.is_msvc()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue