]> git.lizzy.rs Git - rust.git/commitdiff
Document the mingw -lmsvcrt hack better
authorSegev Finer <segev208@gmail.com>
Tue, 16 Jan 2018 23:18:04 +0000 (01:18 +0200)
committerGitHub <noreply@github.com>
Tue, 16 Jan 2018 23:18:04 +0000 (01:18 +0200)
src/librustc_back/target/windows_base.rs

index 7a901dc913f94963cb2c2d5abd50e7705ed75e66..cc40b8b0529836440b766579f87f76f5e3ee0530 100644 (file)
@@ -59,7 +59,15 @@ pub fn opts() -> TargetOptions {
         "-lmingw32".to_string(),
         "-lgcc".to_string(), // alas, mingw* libraries above depend on libgcc
         "-lmsvcrt".to_string(),
-        "-lmsvcrt".to_string(), // mingw is insane...?
+        // mingw's msvcrt is a weird hybrid import library and static library.
+        // And it seems that the linker fails to use import symbols from msvcrt
+        // that are required from functions in msvcrt in certain cases. For example
+        // `_fmode` that is used by an implementation of `__p__fmode` in x86_64.
+        // Listing the library twice seems to fix that, and seems to also be done
+        // by mingw's gcc (Though not sure if it's done on purpose, or by mistake).
+        //
+        // See https://github.com/rust-lang/rust/pull/47483
+        "-lmsvcrt".to_string(),
         "-luser32".to_string(),
         "-lkernel32".to_string(),
     ]);