From 8957d4677aa794c230577f234071af0dadb88f7b Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 4 Jan 2021 19:30:34 +0100 Subject: [PATCH] [aarm64] 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} --- AUTHORS | 1 + src/base/platform/platform-macos.cc | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/AUTHORS b/AUTHORS index 7cef9fe1c5..42a9f29d89 100644 --- a/AUTHORS +++ b/AUTHORS @@ -60,6 +60,7 @@ Andreas Anyuru Andrew Paprocki Andrei Kashcha Anna Henningsen +Antoine du Hamel Anton Bikineev Bangfu Tao Daniel Shelton diff --git a/src/base/platform/platform-macos.cc b/src/base/platform/platform-macos.cc index 3f1638ec0d..1b1f4c4ce8 100644 --- a/src/base/platform/platform-macos.cc +++ b/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);