From 1a07ddf31f6a861cf46c87494cacd3af1f8e6e1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Fri, 18 Mar 2022 14:20:00 +0100 Subject: [PATCH] deps: make V8 compilable with older glibc Remove call to `memfd_create`. The function that references it is only used for V8 testing. --- common.gypi | 2 +- deps/v8/src/base/platform/platform-posix.cc | 18 ------------------ 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/common.gypi b/common.gypi index 2d510e24109263..a879c4f93d8d45 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.6', + 'v8_embedder_string': '-node.7', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/base/platform/platform-posix.cc b/deps/v8/src/base/platform/platform-posix.cc index 280d7f88f83736..664ed301c87baa 100644 --- a/deps/v8/src/base/platform/platform-posix.cc +++ b/deps/v8/src/base/platform/platform-posix.cc @@ -581,25 +581,7 @@ void OS::FreeAddressSpaceReservation(AddressSpaceReservation reservation) { // Need to disable CFI_ICALL due to the indirect call to memfd_create. DISABLE_CFI_ICALL PlatformSharedMemoryHandle OS::CreateSharedMemoryHandleForTesting(size_t size) { -#if V8_OS_LINUX && !V8_OS_ANDROID - // Use memfd_create if available, otherwise mkstemp. - using memfd_create_t = int (*)(const char*, unsigned int); - memfd_create_t memfd_create = - reinterpret_cast(dlsym(RTLD_DEFAULT, "memfd_create")); - int fd = -1; - if (memfd_create) { - fd = memfd_create("V8MemFDForTesting", MFD_CLOEXEC); - } else { - char filename[] = "/tmp/v8_tmp_file_for_testing_XXXXXX"; - fd = mkstemp(filename); - if (fd != -1) CHECK_EQ(0, unlink(filename)); - } - if (fd == -1) return kInvalidSharedMemoryHandle; - CHECK_EQ(0, ftruncate(fd, size)); - return SharedMemoryHandleFromFileDescriptor(fd); -#else return kInvalidSharedMemoryHandle; -#endif } // static