mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-13 15:33:53 +00:00
Review fixes
This commit is contained in:
parent
4750e9de47
commit
53031b264e
@ -30,7 +30,8 @@ use crate::utils::cache::{Interned, INTERNER};
|
||||
use crate::utils::exec::BootstrapCommand;
|
||||
use crate::utils::helpers::{
|
||||
self, add_link_lib_path, add_rustdoc_cargo_linker_args, dylib_path, dylib_path_var,
|
||||
linker_args, output, t, target_supports_cranelift_backend, up_to_date, LldThreads,
|
||||
linker_args, linker_flags, output, t, target_supports_cranelift_backend, up_to_date,
|
||||
LldThreads,
|
||||
};
|
||||
use crate::utils::render_tests::{add_flags_and_try_run_tests, try_run_tests};
|
||||
use crate::{envify, CLang, DocTests, GitRepo, Mode};
|
||||
@ -1746,14 +1747,14 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
|
||||
|
||||
let mut hostflags = flags.clone();
|
||||
hostflags.push(format!("-Lnative={}", builder.test_helpers_out(compiler.host).display()));
|
||||
hostflags.extend(linker_args(builder, compiler.host, LldThreads::No));
|
||||
hostflags.extend(linker_flags(builder, compiler.host, LldThreads::No));
|
||||
for flag in hostflags {
|
||||
cmd.arg("--host-rustcflags").arg(flag);
|
||||
}
|
||||
|
||||
let mut targetflags = flags;
|
||||
targetflags.push(format!("-Lnative={}", builder.test_helpers_out(target).display()));
|
||||
targetflags.extend(linker_args(builder, compiler.host, LldThreads::No));
|
||||
targetflags.extend(linker_flags(builder, compiler.host, LldThreads::No));
|
||||
for flag in targetflags {
|
||||
cmd.arg("--target-rustcflags").arg(flag);
|
||||
}
|
||||
|
@ -19,10 +19,8 @@ use crate::core::build_steps::{check, clean, compile, dist, doc, install, run, s
|
||||
use crate::core::config::flags::{Color, Subcommand};
|
||||
use crate::core::config::{DryRun, SplitDebuginfo, TargetSelection};
|
||||
use crate::utils::cache::{Cache, Interned, INTERNER};
|
||||
use crate::utils::helpers::{
|
||||
self, add_dylib_path, add_link_lib_path, exe, linker_args, linker_flags,
|
||||
};
|
||||
use crate::utils::helpers::{libdir, output, t, LldThreads};
|
||||
use crate::utils::helpers::{self, add_dylib_path, add_link_lib_path, exe, linker_args};
|
||||
use crate::utils::helpers::{libdir, linker_flags, output, t, LldThreads};
|
||||
use crate::Crate;
|
||||
use crate::EXTRA_CHECK_CFGS;
|
||||
use crate::{Build, CLang, DocTests, GitRepo, Mode};
|
||||
@ -1675,9 +1673,9 @@ impl<'a> Builder<'a> {
|
||||
rustflags.arg(&format!("-Zstack-protector={stack_protector}"));
|
||||
}
|
||||
|
||||
linker_args(self, compiler.host, LldThreads::Yes).into_iter().for_each(|flag| {
|
||||
hostflags.arg(flag);
|
||||
});
|
||||
for arg in linker_args(self, compiler.host, LldThreads::Yes) {
|
||||
hostflags.arg(&arg);
|
||||
}
|
||||
|
||||
if let Some(target_linker) = self.linker(target) {
|
||||
let target = crate::envify(&target.triple);
|
||||
@ -1685,12 +1683,12 @@ impl<'a> Builder<'a> {
|
||||
}
|
||||
// We want to set -Clinker using Cargo, therefore we only call `linker_flags` and not
|
||||
// `linker_args` here.
|
||||
linker_flags(self, target, LldThreads::Yes).into_iter().for_each(|flag| {
|
||||
for flag in linker_flags(self, target, LldThreads::Yes) {
|
||||
rustflags.arg(&flag);
|
||||
});
|
||||
linker_args(self, target, LldThreads::Yes).into_iter().for_each(|flag| {
|
||||
rustdocflags.arg(&flag);
|
||||
});
|
||||
}
|
||||
for arg in linker_args(self, target, LldThreads::Yes) {
|
||||
rustdocflags.arg(&arg);
|
||||
}
|
||||
|
||||
if !(["build", "check", "clippy", "fix", "rustc"].contains(&cmd)) && want_rustdoc {
|
||||
cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(compiler));
|
||||
|
@ -111,12 +111,12 @@ impl Display for DebuginfoLevel {
|
||||
///
|
||||
/// It is configured depending on the target:
|
||||
/// 1) Everything except MSVC
|
||||
/// - Self-contained: -Clinker-flavor=gnu-lld-cc -Clink-self-contained=+linker
|
||||
/// - External: -Clinker-flavor=gnu-lld-cc
|
||||
/// - Self-contained: `-Clinker-flavor=gnu-lld-cc -Clink-self-contained=+linker`
|
||||
/// - External: `-Clinker-flavor=gnu-lld-cc`
|
||||
/// 2) MSVC
|
||||
/// - Self-contained: -Clinker=<path to rust-lld>
|
||||
/// - External: -Clinker=lld
|
||||
#[derive(Default, Clone)]
|
||||
/// - Self-contained: `-Clinker=<path to rust-lld>`
|
||||
/// - External: `-Clinker=lld`
|
||||
#[derive(Default, Copy, Clone)]
|
||||
pub enum LldMode {
|
||||
/// Do not use LLD
|
||||
#[default]
|
||||
|
@ -378,6 +378,7 @@ fn absolute_unix(path: &Path) -> io::Result<PathBuf> {
|
||||
|
||||
#[cfg(windows)]
|
||||
fn absolute_windows(path: &std::path::Path) -> std::io::Result<std::path::PathBuf> {
|
||||
use std::ffi::OsString;
|
||||
use std::io::Error;
|
||||
use std::os::windows::ffi::{OsStrExt, OsStringExt};
|
||||
use std::ptr::null_mut;
|
||||
@ -526,7 +527,7 @@ pub fn linker_flags(
|
||||
if matches!(lld_threads, LldThreads::No) {
|
||||
args.push(format!(
|
||||
"-Clink-arg=-Wl,{}",
|
||||
lld_flag_no_threads(builder.config.lld_mode.clone(), target.is_msvc())
|
||||
lld_flag_no_threads(builder.config.lld_mode, target.is_msvc())
|
||||
));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user