Commit 7d63260e authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

[test][wasm][arm64] Fix JumpTablePatchingStress

This test attempted to call mprotect to switch memory permissions,
which returns an error on MacOS on arm64. The workaround is simple:
don't call mprotect, rely on MacOS-specific permission switching.

See also https://chromium-review.googlesource.com/c/v8/v8/+/2679688
for a related fix in non-test code.

Drive-by: fix host arch detection in gm.py when building on M1 Macs.

Bug: v8:11657
Change-Id: I9b59ee8f2279e28f7561ac071df27508211741f3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2831877Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74030}
parent 5afff2b9
......@@ -156,8 +156,14 @@ void CompileJumpTableThunk(Address thunk, Address jump_target) {
__ Ret();
FlushInstructionCache(thunk, kThunkBufferSize);
#if defined(V8_OS_MACOSX) && defined(V8_HOST_ARCH_ARM64)
// MacOS on arm64 refuses {mprotect} calls to toggle permissions of RWX
// memory. Simply do nothing here, and rely on
// {SwitchMemoryPermissionsToExecutable} in the JumpTableRunner.
#else
CHECK(SetPermissions(GetPlatformPageAllocator(), thunk, kThunkBufferSize,
v8::PageAllocator::kReadExecute));
#endif
}
class JumpTableRunner : public v8::base::Thread {
......
......@@ -262,10 +262,10 @@ class Config(object):
cpu = "arm"
elif self.arch == "android_arm64":
cpu = "arm64"
elif self.arch == "arm64" and _GetMachine() == "aarch64":
elif self.arch == "arm64" and _GetMachine() in ("aarch64", "arm64"):
# arm64 build host:
cpu = "arm64"
elif self.arch == "arm" and _GetMachine() == "aarch64":
elif self.arch == "arm" and _GetMachine() in ("aarch64", "arm64"):
cpu = "arm"
elif "64" in self.arch or self.arch == "s390x":
# Native x64 or simulator build.
......@@ -291,7 +291,8 @@ class Config(object):
def GetSpecialCompiler(self):
if _GetMachine() == "aarch64":
# We have no prebuilt Clang for arm64. Use the system Clang instead.
# We have no prebuilt Clang for arm64 on Linux, so use the system Clang
# instead.
return ["clang_base_path = \"/usr\"", "clang_use_chrome_plugins = false"]
return []
......
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