Skip to content

Commit 4f6764a

Browse files
seritoolsmbilker
authored andcommitted
Skip adding unicows-wrapped libraries in order to properly support adding unicows.lib before them
1 parent 28f9568 commit 4f6764a

File tree

1 file changed

+15
-0
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+15
-0
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2388,6 +2388,11 @@ fn collect_natvis_visualizers(
23882388
visualizer_paths
23892389
}
23902390

2391+
const UNICOWS_LIBS: &[&str] = &[
2392+
"kernel32", "advapi32", "user32", "gdi32", "shell32", "comdlg32", "version", "mpr", "rasapi32",
2393+
"winmm", "winspool", "vfw32", "secur32", "oleacc", "oledlg", "sensapi",
2394+
];
2395+
23912396
fn add_native_libs_from_crate(
23922397
cmd: &mut dyn Linker,
23932398
sess: &Session,
@@ -2400,6 +2405,8 @@ fn add_native_libs_from_crate(
24002405
link_static: bool,
24012406
link_dynamic: bool,
24022407
) {
2408+
let is_target_oldpc = sess.target.vendor == "rust9x";
2409+
24032410
if !sess.opts.unstable_opts.link_native_libraries {
24042411
// If `-Zlink-native-libraries=false` is set, then the assumption is that an
24052412
// external build system already has the native dependencies defined, and it
@@ -2434,7 +2441,15 @@ fn add_native_libs_from_crate(
24342441
};
24352442

24362443
let name = lib.name.as_str();
2444+
2445+
if is_target_oldpc && UNICOWS_LIBS.contains(&name.as_str()) {
2446+
// skip adding unicows-wrapped libraries in order to properly support adding
2447+
// `unicows.lib` before them
2448+
continue;
2449+
}
2450+
24372451
let verbatim = lib.verbatim;
2452+
24382453
match lib.kind {
24392454
NativeLibKind::Static { bundle, whole_archive } => {
24402455
if link_static {

0 commit comments

Comments
 (0)