Skip to content

Commit 29d0bad

Browse files
committed
add sanity check about -Zgcc-ld and -Clinker-flavor=gcc:*
1 parent 41a6a18 commit 29d0bad

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

compiler/rustc_session/src/config.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2580,6 +2580,18 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
25802580
);
25812581
}
25822582

2583+
// Until the unstable flag is removed, ensure `-Zgcc-ld=lld` and `-Clinker-flavor=gcc:lld` have
2584+
// a matching linker choice.
2585+
if let Some(LinkerFlavorCli::Gcc { use_ld }) = &cg.linker_flavor {
2586+
if use_ld != "lld" && debugging_opts.gcc_ld == Some(LdImpl::Lld) {
2587+
early_error(
2588+
error_format,
2589+
"`-Zgcc-ld=lld` and `-Clinker-flavor` differ in their \
2590+
linker choice. The latter should be `-Clinker-flavor=gcc:lld`",
2591+
);
2592+
}
2593+
}
2594+
25832595
let prints = collect_print_requests(&mut cg, &mut debugging_opts, matches, error_format);
25842596

25852597
let cg = cg;

0 commit comments

Comments
 (0)