From 84d455e08e4129f7d1b3c68d62cbb129458619ec 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. PR-URL: https://github.com/nodejs/node/pull/42657 Reviewed-By: Darshan Sen Reviewed-By: Richard Lau Reviewed-By: Jiawen Geng Reviewed-By: Michael Dawson --- common.gypi | 2 +- deps/v8/src/base/platform/platform-posix.cc | 19 ------------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/common.gypi b/common.gypi index 95176802398..70006682bcb 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.3', + 'v8_embedder_string': '-node.4', ##### 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 d37b6219d41..cb95c863501 100644 --- a/deps/v8/src/base/platform/platform-posix.cc +++ b/deps/v8/src/base/platform/platform-posix.cc @@ -618,26 +618,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", 0); - } - if (fd == -1) { - 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