Skip to content

Commit

Permalink
[aarm64] Fix GetSharedLibraryAddresses
Browse files Browse the repository at this point in the history
This patch fixes a segmentation fault which occurs when using `--prof` flag on a Darwin ARM64 architecture.

ref: https://chromium-review.googlesource.com/c/v8/v8/+/2609413

related issue on node/v8: #36656
  • Loading branch information
matinzd committed Feb 8, 2021
1 parent b5563f6 commit 24d561a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions deps/v8/src/base/platform/platform-macos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ std::vector<OS::SharedLibraryAddress> 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<const mach_header_64*>(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);
Expand Down

0 comments on commit 24d561a

Please sign in to comment.