Skip to content

Commit

Permalink
don't pass -L .../auxiliary unless it exists
Browse files Browse the repository at this point in the history
this avoids warnings from macOS ld
  • Loading branch information
jyn authored and jyn514 committed Sep 9, 2024
1 parent 6b77d59 commit 56b8c94
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1778,6 +1778,10 @@ impl<'test> TestCx<'test> {
self.config.target.contains("vxworks") && !self.is_vxworks_pure_static()
}

fn has_aux_dir(&self) -> bool {
!self.props.aux_builds.is_empty() || !self.props.aux_crates.is_empty()
}

fn aux_output_dir(&self) -> PathBuf {
let aux_dir = self.aux_output_dir_name();

Expand Down Expand Up @@ -2324,7 +2328,11 @@ impl<'test> TestCx<'test> {
}

if let LinkToAux::Yes = link_to_aux {
rustc.arg("-L").arg(self.aux_output_dir_name());
// if we pass an `-L` argument to a directory that doesn't exist,
// macOS ld emits warnings which disrupt the .stderr files
if self.has_aux_dir() {
rustc.arg("-L").arg(self.aux_output_dir_name());
}
}

rustc.args(&self.props.compile_flags);
Expand Down

0 comments on commit 56b8c94

Please sign in to comment.