The CRT provided with the Windows SDK compiler doesn't import free from crtdll.obj, so we don't try to build our own private CRT import library.
This means that when we enable jemalloc, we pass MOZ_UTILS_LDFLAGS directly to NSPR/NSS via DLLFLAGS. However there are two problems with this:
In NSPR this doesn't work at all, since NSPR doesn't know what EXPAND_LIBNAME_PATH or LIBXUL_DIST are, and so the $(call EXPAND_LIBNAME_PATH,mozutils,$(LIBXUL_DIST)/lib) simply gets ignored.
For NSS the mozilla/security/manager/Makefile.in exports DLLFLAGS into the environment. This does seem to correctly expand it. However for some reason some (or all?) of the DLLs still end up linking to the CRT free instead.
Created attachment 569095 [details] [diff] [review]
I found that inserting the lib using -DEFAULTLIB (which resembles the way we do it for broken crtdll.obj builds) does ensure that NSS links correctly, although we then have to port the fix to comm-central because for some reason its copy of the broken DLLFLAGS confuses NSS again.
Pushed changeset 204bd66034e2 to mozilla-central.
Pushed changeset 16efbe29a2a2 to comm-central.