diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs
index caa2740408..52738a47f7 100644
--- a/compiler/rustc_llvm/build.rs
+++ b/compiler/rustc_llvm/build.rs
@@ -300,6 +300,7 @@
     // Libstdc++ depends on pthread which Rust doesn't link on MinGW
     // since nothing else requires it.
     if target.contains("windows-gnu") {
+        println!("cargo:rustc-link-lib=static-nobundle=ffi");
         println!("cargo:rustc-link-lib=static-nobundle=pthread");
     }
 }
-- 
2.12.0
