From 33c76602fe49dd290e6ccde72f207504002a9fb2 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 4 Jan 2021 19:30:34 +0100 Subject: [PATCH] deps: cherry-pick 8957d4677aa794c230577f234071af0 from V8 upstream Original commit message: Fix GetSharedLibraryAddresses This patch fixes a segmentation fault which occurs when using `--prof` flag on a Darwin ARM64 architecture. See https://github.com/nodejs/node/issues/36656 Change-Id: Idc3ce6c8fd8a24f76f1b356f629e37340045b51e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2609413 Reviewed-by: Ulan Degenbaev Reviewed-by: Michael Lippautz Commit-Queue: Ulan Degenbaev Cr-Commit-Position: refs/heads/master@{#72886} Refs: https://github.com/v8/v8/commit/8957d4677aa794c230577f234071af0dadb88f7b Fixes: https://github.com/nodejs/node/issues/36656 --- common.gypi | 2 +- deps/v8/AUTHORS | 1 + deps/v8/src/base/platform/platform-macos.cc | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common.gypi b/common.gypi index 3d030895b087e0..374ded1c426dae 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.22', + 'v8_embedder_string': '-node.23', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/AUTHORS b/deps/v8/AUTHORS index 72e450430c0bcb..5dba6abe9b5546 100644 --- a/deps/v8/AUTHORS +++ b/deps/v8/AUTHORS @@ -61,6 +61,7 @@ Andreas Anyuru Andrew Paprocki Andrei Kashcha Anna Henningsen +Antoine du Hamel Anton Bikineev Bangfu Tao Daniel Shelton diff --git a/deps/v8/src/base/platform/platform-macos.cc b/deps/v8/src/base/platform/platform-macos.cc index 3f1638ec0d50d6..1b1f4c4ce8a2c3 100644 --- a/deps/v8/src/base/platform/platform-macos.cc +++ b/deps/v8/src/base/platform/platform-macos.cc @@ -49,14 +49,14 @@ std::vector OS::GetSharedLibraryAddresses() { for (unsigned int i = 0; i < images_count; ++i) { const mach_header* header = _dyld_get_image_header(i); if (header == nullptr) continue; -#if V8_HOST_ARCH_X64 +#if V8_HOST_ARCH_I32 + unsigned int size; + char* code_ptr = getsectdatafromheader(header, SEG_TEXT, SECT_TEXT, &size); +#else uint64_t size; char* code_ptr = getsectdatafromheader_64( reinterpret_cast(header), SEG_TEXT, SECT_TEXT, &size); -#else - unsigned int size; - char* code_ptr = getsectdatafromheader(header, SEG_TEXT, SECT_TEXT, &size); #endif if (code_ptr == nullptr) continue; const intptr_t slide = _dyld_get_image_vmaddr_slide(i);