]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #30175 - alexcrichton:less-c-code, r=brson
authorbors <bors@rust-lang.org>
Tue, 22 Dec 2015 07:23:16 +0000 (07:23 +0000)
committerbors <bors@rust-lang.org>
Tue, 22 Dec 2015 07:23:16 +0000 (07:23 +0000)
All these definitions can now be written in Rust, so do so!

mk/rt.mk
src/jemalloc
src/librustc_trans/back/msvc/mod.rs

index 92c7c506f187ac4435b93b38bfd1447f981e5859..9dbbcbebb979d34a870b47e63c2c1572267f8e27 100644 (file)
--- a/mk/rt.mk
+++ b/mk/rt.mk
@@ -126,12 +126,25 @@ define DEF_THIRD_PARTY_TARGETS
 
 # $(1) is the target triple
 
-ifeq ($$(CFG_WINDOWSY_$(1)), 1)
-  # This isn't necessarily a desired option, but it's harmless and works around
-  # what appears to be a mingw-w64 bug.
+ifeq ($$(CFG_WINDOWSY_$(1)),1)
+  # A bit of history here, this used to be --enable-lazy-lock added in #14006
+  # which was filed with jemalloc in jemalloc/jemalloc#83 which was also
+  # reported to MinGW: http://sourceforge.net/p/mingw-w64/bugs/395/
+  #
+  # When updating jemalloc to 4.0, however, it was found that binaries would
+  # exit with the status code STATUS_RESOURCE_NOT_OWNED indicating that a thread
+  # was unlocking a mutex it never locked. Disabling this "lazy lock" option
+  # seems to fix the issue, but it was enabled by default for MinGW targets in
+  # 13473c7 for jemalloc.
+  #
+  # As a result of all that, force disabling lazy lock on Windows, and after
+  # reading some code it at least *appears* that the initialization of mutexes
+  # is otherwise ok in jemalloc, so shouldn't cause problems hopefully...
   #
-  # https://sourceforge.net/p/mingw-w64/bugs/395/
-  JEMALLOC_ARGS_$(1) := --enable-lazy-lock
+  # tl;dr: make windows behave like other platforms by disabling lazy locking,
+  #        but requires passing an option due to a historical default with
+  #        jemalloc.
+  JEMALLOC_ARGS_$(1) := --disable-lazy-lock
 else ifeq ($(OSTYPE_$(1)), apple-ios)
   JEMALLOC_ARGS_$(1) := --disable-tls
 else ifeq ($(findstring android, $(OSTYPE_$(1))), android)
index e24a1a025a1f214e40eedafe3b9c7b1d69937922..f84e30927284b0c500ed3eaf09e8e159da20ddaf 160000 (submodule)
@@ -1 +1 @@
-Subproject commit e24a1a025a1f214e40eedafe3b9c7b1d69937922
+Subproject commit f84e30927284b0c500ed3eaf09e8e159da20ddaf
index 3b5b94381b372f08ab62067c996cf4136206c000..6f0baa86579e02438bfc494457ad03c666eb63e8 100644 (file)
@@ -152,8 +152,15 @@ fn get_ucrt_dir() -> Option<PathBuf> {
         }).and_then(|root| {
             fs::read_dir(Path::new(&root).join("Lib")).ok()
         }).and_then(|readdir| {
-            let mut dirs: Vec<_> = readdir.filter_map(|dir| dir.ok())
-                .map(|dir| dir.path()).collect();
+            let mut dirs: Vec<_> = readdir.filter_map(|dir| {
+                dir.ok()
+            }).map(|dir| {
+                dir.path()
+            }).filter(|dir| {
+                dir.components().last().and_then(|c| {
+                    c.as_os_str().to_str()
+                }).map(|c| c.starts_with("10.")).unwrap_or(false)
+            }).collect();
             dirs.sort();
             dirs.pop()
         })