summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2020-06-13 23:18:54 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-06-16 11:18:50 +0200
commit727ae51a0c02985580dc17c005805a24d4cf6970 (patch)
tree8b824b60db988ccc8aa33a35b8e6182b7e71b4e7
parent8b822afb0cdbc60c29ef5b9bcb0793d66ee3d40d (diff)
downloadphp-git-727ae51a0c02985580dc17c005805a24d4cf6970.tar.gz
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.
-rw-r--r--ext/opcache/jit/zend_elf.c3
-rw-r--r--ext/opcache/jit/zend_jit_perf_dump.c8
2 files changed, 11 insertions, 0 deletions
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 <sys/sysctl.h>
#elif defined(__NetBSD__)
# include <lwp.h>
+#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));