Commit c39e7c7c by Nicolas Capens Committed by Nicolas Capens

Retry mmap() without MAP_JIT on older macOS

The MAP_JIT flag is only supported on macOS 10.14 and higher, so mmap() may fail on older ones. Bug: chromium:985816 Change-Id: If0e12d61b7f243d804e0213a43160e7b3db106d3 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/34511Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 0a94b958
......@@ -247,6 +247,13 @@ void *allocateExecutable(size_t bytes)
if(mapping == MAP_FAILED)
{
// Retry without MAP_JIT (for older macOS versions).
mapping = mmap(nullptr, length, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
}
if(mapping == MAP_FAILED)
{
mapping = nullptr;
}
#else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment