linker: Report linker flavors incompatible with the current target

Previously they would be reported as link time errors about unknown linker options
This commit is contained in:
Vadim Petrochenkov 2023-04-25 15:48:53 +03:00
parent 2013ccc218
commit b0ce4164f0
7 changed files with 51 additions and 2 deletions

View file

@ -1675,6 +1675,13 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
if sess.opts.unstable_opts.instrument_xray.is_some() && !sess.target.options.supports_xray {
sess.emit_err(errors::InstrumentationNotSupported { us: "XRay".to_string() });
}
if let Some(flavor) = sess.opts.cg.linker_flavor {
if let Some(compatible_list) = sess.target.linker_flavor.check_compatibility(flavor) {
let flavor = flavor.desc();
sess.emit_err(errors::IncompatibleLinkerFlavor { flavor, compatible_list });
}
}
}
/// Holds data on the current incremental compilation session, if there is one.