[Darwin] Fix OS version checks inside simulators
authorJulian Lettner <julian.lettner@apple.com>
Fri, 24 Jul 2020 18:24:34 +0000 (11:24 -0700)
committerJulian Lettner <julian.lettner@apple.com>
Tue, 28 Jul 2020 16:27:48 +0000 (09:27 -0700)
commit3fb0de820796cc6e322c8378713d375d9870a353
treec4b660e40bb6868418813c307ec8236f2703e195
parent8b2fcc42b895575d46dbd9252df566938cf68a69
[Darwin] Fix OS version checks inside simulators

compiler-rt checks OS versions by querying the Darwin kernel version.
This is not necessarily correct inside the simulators if the simulator
runtime is not aligned with the host macOS.  Let's instead check the
`SIMULATOR_RUNTIME_VERSION` env var.

rdar://63031937

Reviewed By: delcypher

Differential Revision: https://reviews.llvm.org/D83977
compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
compiler-rt/lib/sanitizer_common/tests/sanitizer_mac_test.cpp