From 727ae51a0c02985580dc17c005805a24d4cf6970 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 13 Jun 2020 23:18:54 +0100 Subject: [PATCH] Fix JIT build on solaris/illumos thr_self to detect the proper thread identifier but all related typedef'd types conflict with the vtune part. --- ext/opcache/jit/zend_elf.c | 3 +++ ext/opcache/jit/zend_jit_perf_dump.c | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/ext/opcache/jit/zend_elf.c b/ext/opcache/jit/zend_elf.c index 7db7957bef..f8a1325db2 100644 --- a/ext/opcache/jit/zend_elf.c +++ b/ext/opcache/jit/zend_elf.c @@ -61,6 +61,9 @@ void zend_elf_load_symbols(void) return; } int fd = open(path, O_RDONLY); +#elif defined(__sun) + const char *path = getexecname(); + int fd = open(path, O_RDONLY); #else // To complete eventually for other ELF platforms. // Otherwise APPLE is Mach-O diff --git a/ext/opcache/jit/zend_jit_perf_dump.c b/ext/opcache/jit/zend_jit_perf_dump.c index 5ee7f36ef9..663f9ae1e0 100644 --- a/ext/opcache/jit/zend_jit_perf_dump.c +++ b/ext/opcache/jit/zend_jit_perf_dump.c @@ -31,6 +31,9 @@ # include #elif defined(__NetBSD__) # include +#elif defined(__sun) +// avoiding thread.h inclusion as it conflicts with vtunes types. +extern unsigned int thr_self(void); #endif #include "zend_elf.h" @@ -126,6 +129,9 @@ static void zend_jit_perf_jitdump_open(void) return; } fd = open(path, O_RDONLY); +#elif defined(__sun) + const char *path = getexecname(); + fd = open(path, O_RDONLY); #else fd = -1; #endif @@ -209,6 +215,8 @@ static void zend_jit_perf_jitdump_register(const char *name, void *start, size_t thread_id = getthrid(); #elif defined(__NetBSD__) thread_id = _lwp_self(); +#elif defined(__sun) + thread_id = thr_self(); #endif memset(&rec, 0, sizeof(rec)); -- 2.40.0