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 Oct 28, 2024
1 parent f1e5b36 commit 675f447
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 @@ -1096,6 +1096,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 @@ -1649,7 +1653,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 675f447

Please sign in to comment.