about summary refs log tree commit diff
path: root/src/rustllvm/ExecutionEngineWrapper.cpp
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-06-26 09:30:35 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-06-27 19:45:24 -0700
commit10b103af48368c5df644fa61dc417a36083922c8 (patch)
tree538dbf67a23dbd8297576319f4bb0011bb633a65 /src/rustllvm/ExecutionEngineWrapper.cpp
parent87909582374be91bc5affdd2e74e265077a6e571 (diff)
downloadrust-10b103af48368c5df644fa61dc417a36083922c8.tar.gz
rust-10b103af48368c5df644fa61dc417a36083922c8.zip
std: Fix Windows XP compatibility
This commit enables executables linked against the standard library to run on
Windows XP. There are two main components of this commit:

* APIs not available on XP are shimmed to have a fallback implementation and use
  runtime detection to determine if they are available.
* Mutexes on Windows were reimplemented to use critical sections on XP where
  rwlocks are not available.

The APIs which are not available on XP are:

* SetFileInformationByHandle - this is just used by `File::truncate` and that
  function just returns an error now.
* SetThreadStackGuarantee - this is used by the stack overflow support on
  windows, but if this isn't available then it's just ignored (it seems
  non-critical).
* All condition variable APIs are missing - the shims added for these apis
  simply always panic for now. We may eventually provide a fallback
  implementation, but for now the standard library does not rely on condition
  variables for normal use.
* RWLocks, like condition variables, are missing entirely. The same story for
  condition variables is taken here. These APIs are all now panicking stubs as
  the standard library doesn't rely on RWLocks for normal use.

Currently, as an optimization, we use SRWLOCKs for the standard `sync::Mutex`
implementation on Windows, which is indeed required for normal operation of the
standard library. To allow the standard library to run on XP, this commit
reimplements mutexes on Windows to use SRWLOCK instances *if available* and
otherwise a CriticalSection is used (with some checking for recursive
locking).

With all these changes put together, a 32-bit MSVC-built executable can run on
Windows XP and print "hello world"

Closes #12842
Closes #19992
Closes #24776
Diffstat (limited to 'src/rustllvm/ExecutionEngineWrapper.cpp')
0 files changed, 0 insertions, 0 deletions