Skip to content

Commit 8d80814

Browse files
committed
add sanity check about -Zgcc-ld and -Clinker-flavor=gcc:*
1 parent 045cb0a commit 8d80814

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

compiler/rustc_session/src/config.rs

+12
Original file line numberDiff line numberDiff line change
@@ -2442,6 +2442,18 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
24422442
);
24432443
}
24442444

2445+
// Until the unstable flag is removed, ensure `-Zgcc-ld=lld` and `-Clinker-flavor=gcc:lld` have
2446+
// a matching linker choice.
2447+
if let Some(LinkerFlavorCli::Gcc { use_ld }) = &cg.linker_flavor {
2448+
if use_ld != "lld" && unstable_opts.gcc_ld == Some(LdImpl::Lld) {
2449+
early_error(
2450+
error_format,
2451+
"`-Zgcc-ld=lld` and `-Clinker-flavor` differ in their \
2452+
linker choice. The latter should be `-Clinker-flavor=gcc:lld`",
2453+
);
2454+
}
2455+
}
2456+
24452457
let prints = collect_print_requests(&mut cg, &mut unstable_opts, matches, error_format);
24462458

24472459
let cg = cg;

0 commit comments

Comments
 (0)