Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forward linker option to lint-docs #129957

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/bootstrap/src/core/build_steps/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,9 @@ impl Step for RustcBook {
cmd.arg("--rustc");
cmd.arg(&rustc);
cmd.arg("--rustc-target").arg(self.target.rustc_target_arg());
if let Some(target_linker) = builder.linker(self.target) {
cmd.arg("--rustc-linker").arg(target_linker);
}
if builder.is_verbose() {
cmd.arg("--verbose");
}
Expand Down
5 changes: 5 additions & 0 deletions src/tools/lint-docs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ pub struct LintExtractor<'a> {
pub rustc_path: &'a Path,
/// The target arch to build the docs for.
pub rustc_target: &'a str,
/// The target linker overriding `rustc`'s default
pub rustc_linker: Option<&'a str>,
/// Verbose output.
pub verbose: bool,
/// Validate the style and the code example.
Expand Down Expand Up @@ -459,6 +461,9 @@ impl<'a> LintExtractor<'a> {
}
cmd.arg("--error-format=json");
cmd.arg("--target").arg(self.rustc_target);
if let Some(target_linker) = self.rustc_linker {
cmd.arg(format!("-Clinker={target_linker}"));
}
if options.contains(&"test") {
cmd.arg("--test");
}
Expand Down
8 changes: 8 additions & 0 deletions src/tools/lint-docs/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ fn doit() -> Result<(), Box<dyn Error>> {
let mut out_path = None;
let mut rustc_path = None;
let mut rustc_target = None;
let mut rustc_linker = None;
let mut verbose = false;
let mut validate = false;
while let Some(arg) = args.next() {
Expand Down Expand Up @@ -55,6 +56,12 @@ fn doit() -> Result<(), Box<dyn Error>> {
None => return Err("--rustc-target requires a value".into()),
};
}
"--rustc-linker" => {
rustc_linker = match args.next() {
Some(s) => Some(s),
None => return Err("--rustc-linker requires a value".into()),
};
}
"-v" | "--verbose" => verbose = true,
"--validate" => validate = true,
s => return Err(format!("unexpected argument `{}`", s).into()),
Expand All @@ -77,6 +84,7 @@ fn doit() -> Result<(), Box<dyn Error>> {
out_path: &out_path.unwrap(),
rustc_path: &rustc_path.unwrap(),
rustc_target: &rustc_target.unwrap(),
rustc_linker: rustc_linker.as_deref(),
verbose,
validate,
};
Expand Down
Loading