Skip to content

Commit 3c01dfe

Browse files
committed
Rename is_builder_target to is_host_target
1 parent 2907ab5 commit 3c01dfe

File tree

8 files changed

+18
-19
lines changed

8 files changed

+18
-19
lines changed

Diff for: src/bootstrap/src/core/build_steps/compile.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ impl Step for Std {
229229
// The LLD wrappers and `rust-lld` are self-contained linking components that can be
230230
// necessary to link the stdlib on some targets. We'll also need to copy these binaries to
231231
// the `stage0-sysroot` to ensure the linker is found when bootstrapping on such a target.
232-
if compiler.stage == 0 && builder.config.is_builder_target(compiler.host) {
232+
if compiler.stage == 0 && builder.config.is_host_target(compiler.host) {
233233
trace!(
234234
"(build == host) copying linking components to `stage0-sysroot` for bootstrapping"
235235
);
@@ -2182,7 +2182,7 @@ impl Step for Assemble {
21822182
debug!("copying codegen backends to sysroot");
21832183
copy_codegen_backends_to_sysroot(builder, build_compiler, target_compiler);
21842184

2185-
if builder.config.lld_enabled {
2185+
if builder.config.lld_enabled && !builder.config.is_system_llvm(target_compiler.host) {
21862186
builder.ensure(crate::core::build_steps::tool::LldWrapper {
21872187
build_compiler,
21882188
target_compiler,
@@ -2533,7 +2533,7 @@ pub fn strip_debug(builder: &Builder<'_>, target: TargetSelection, path: &Path)
25332533
// `strip -g` is both available and will fix the issue, i.e. on a x64 linux host that is not
25342534
// cross-compiling. Expand this to other appropriate targets in the future.
25352535
if target != "x86_64-unknown-linux-gnu"
2536-
|| !builder.config.is_builder_target(target)
2536+
|| !builder.config.is_host_target(target)
25372537
|| !path.exists()
25382538
{
25392539
return;

Diff for: src/bootstrap/src/core/build_steps/dist.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ impl Step for DebuggerScripts {
612612
fn skip_host_target_lib(builder: &Builder<'_>, compiler: Compiler) -> bool {
613613
// The only true set of target libraries came from the build triple, so
614614
// let's reduce redundant work by only producing archives from that host.
615-
if !builder.config.is_builder_target(compiler.host) {
615+
if !builder.config.is_host_target(compiler.host) {
616616
builder.info("\tskipping, not a build host");
617617
true
618618
} else {
@@ -671,8 +671,7 @@ fn copy_target_libs(
671671
&self_contained_dst.join(path.file_name().unwrap()),
672672
FileType::NativeLibrary,
673673
);
674-
} else if dependency_type == DependencyType::Target
675-
|| builder.config.is_builder_target(target)
674+
} else if dependency_type == DependencyType::Target || builder.config.is_host_target(target)
676675
{
677676
builder.copy_link(&path, &dst.join(path.file_name().unwrap()), FileType::NativeLibrary);
678677
}
@@ -826,7 +825,7 @@ impl Step for Analysis {
826825
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
827826
let compiler = self.compiler;
828827
let target = self.target;
829-
if !builder.config.is_builder_target(compiler.host) {
828+
if !builder.config.is_host_target(compiler.host) {
830829
return None;
831830
}
832831

Diff for: src/bootstrap/src/core/build_steps/llvm.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ impl Step for Llvm {
485485
}
486486

487487
// https://llvm.org/docs/HowToCrossCompileLLVM.html
488-
if !builder.config.is_builder_target(target) {
488+
if !builder.config.is_host_target(target) {
489489
let LlvmResult { llvm_config, .. } =
490490
builder.ensure(Llvm { target: builder.config.build });
491491
if !builder.config.dry_run() {
@@ -637,7 +637,7 @@ fn configure_cmake(
637637
}
638638
cfg.target(&target.triple).host(&builder.config.build.triple);
639639

640-
if !builder.config.is_builder_target(target) {
640+
if !builder.config.is_host_target(target) {
641641
cfg.define("CMAKE_CROSSCOMPILING", "True");
642642

643643
// 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 {
10981098
.define("LLVM_CMAKE_DIR", llvm_cmake_dir)
10991099
.define("LLVM_INCLUDE_TESTS", "OFF");
11001100

1101-
if !builder.config.is_builder_target(target) {
1101+
if !builder.config.is_host_target(target) {
11021102
// Use the host llvm-tblgen binary.
11031103
cfg.define(
11041104
"LLVM_TABLEGEN_EXE",

Diff for: src/bootstrap/src/core/build_steps/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2668,7 +2668,7 @@ impl Step for Crate {
26682668
cargo
26692669
} else {
26702670
// Also prepare a sysroot for the target.
2671-
if !builder.config.is_builder_target(target) {
2671+
if !builder.config.is_host_target(target) {
26722672
builder.ensure(compile::Std::new(compiler, target).force_recompile(true));
26732673
builder.ensure(RemoteCopyLibs { compiler, target });
26742674
}

Diff for: src/bootstrap/src/core/builder/tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1107,8 +1107,8 @@ fn test_is_builder_target() {
11071107
let build = Build::new(config);
11081108
let builder = Builder::new(&build);
11091109

1110-
assert!(builder.is_builder_target(target1));
1111-
assert!(!builder.is_builder_target(target2));
1110+
assert!(builder.config.is_host_target(target1));
1111+
assert!(!builder.config.is_host_target(target2));
11121112
}
11131113
}
11141114

Diff for: src/bootstrap/src/core/config/config.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3234,8 +3234,8 @@ impl Config {
32343234
Some(commit.to_string())
32353235
}
32363236

3237-
/// Checks if the given target is the same as the builder target.
3238-
pub fn is_builder_target(&self, target: TargetSelection) -> bool {
3237+
/// Checks if the given target is the same as the host target.
3238+
pub fn is_host_target(&self, target: TargetSelection) -> bool {
32393239
self.build == target
32403240
}
32413241

@@ -3246,7 +3246,7 @@ impl Config {
32463246
pub fn is_system_llvm(&self, target: TargetSelection) -> bool {
32473247
match self.target_config.get(&target) {
32483248
Some(Target { llvm_config: Some(_), .. }) => {
3249-
let ci_llvm = self.llvm_from_ci && self.is_builder_target(target);
3249+
let ci_llvm = self.llvm_from_ci && self.is_host_target(target);
32503250
!ci_llvm
32513251
}
32523252
// We're building from the in-tree src/llvm-project sources.

Diff for: src/bootstrap/src/core/sanity.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ than building it.
325325
if target.contains("musl") && !target.contains("unikraft") {
326326
// If this is a native target (host is also musl) and no musl-root is given,
327327
// fall back to the system toolchain in /usr before giving up
328-
if build.musl_root(*target).is_none() && build.config.is_builder_target(*target) {
328+
if build.musl_root(*target).is_none() && build.config.is_host_target(*target) {
329329
let target = build.config.target_config.entry(*target).or_default();
330330
target.musl_root = Some("/usr".into());
331331
}

Diff for: src/bootstrap/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ impl Build {
803803
/// Note that if LLVM is configured externally then the directory returned
804804
/// will likely be empty.
805805
fn llvm_out(&self, target: TargetSelection) -> PathBuf {
806-
if self.config.llvm_from_ci && self.config.is_builder_target(target) {
806+
if self.config.llvm_from_ci && self.config.is_host_target(target) {
807807
self.config.ci_llvm_root()
808808
} else {
809809
self.out.join(target).join("llvm")
@@ -1325,7 +1325,7 @@ Executed at: {executed_at}"#,
13251325
// need to use CXX compiler as linker to resolve the exception functions
13261326
// that are only existed in CXX libraries
13271327
Some(self.cxx.borrow()[&target].path().into())
1328-
} else if !self.config.is_builder_target(target)
1328+
} else if !self.config.is_host_target(target)
13291329
&& helpers::use_host_linker(target)
13301330
&& !target.is_msvc()
13311331
{

0 commit comments

Comments
 (0)