rustc_session: Add a helper function for obtaining staticlib prefix and suffix

This commit is contained in:
Vadim Petrochenkov
2025-03-25 00:00:10 +03:00
parent 27e95f95e6
commit 7c55782e0c
5 changed files with 24 additions and 24 deletions

View File

@@ -1494,11 +1494,7 @@ fn print_native_static_libs(
| NativeLibKind::Unspecified => {
let verbatim = lib.verbatim;
if sess.target.is_like_msvc {
let (prefix, suffix) = if verbatim {
("", "")
} else {
(&*sess.target.staticlib_prefix, &*sess.target.staticlib_suffix)
};
let (prefix, suffix) = sess.staticlib_components(verbatim);
Some(format!("{prefix}{name}{suffix}"))
} else if sess.target.linker_flavor.is_gnu() {
Some(format!("-l{}{}", if verbatim { ":" } else { "" }, name))