summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2020-06-20 16:45:01 +0000
committerDmitry Stogov <dmitry@zend.com>2020-06-22 09:28:58 +0300
commitec80b781dbd1978653b2e20d6b99ed61e65e646f (patch)
tree98e622e2b8ecdf7fdfea21ab5a3bef8331513913
parent56aebbec8b1b8bfda369071c3d3fb7ec225584ef (diff)
downloadphp-git-ec80b781dbd1978653b2e20d6b99ed61e65e646f.tar.gz
Haiku opcache jit build update
-rw-r--r--ext/opcache/jit/zend_elf.c17
-rw-r--r--ext/opcache/jit/zend_jit_perf_dump.c17
2 files changed, 34 insertions, 0 deletions
diff --git a/ext/opcache/jit/zend_elf.c b/ext/opcache/jit/zend_elf.c
index f8a1325db2..2618f5a488 100644
--- a/ext/opcache/jit/zend_elf.c
+++ b/ext/opcache/jit/zend_elf.c
@@ -21,6 +21,8 @@
#include <sys/stat.h>
#if defined(__FreeBSD__)
#include <sys/sysctl.h>
+#elif defined(__HAIKU__)
+#include <kernel/image.h>
#endif
#include <fcntl.h>
#include <unistd.h>
@@ -64,6 +66,21 @@ void zend_elf_load_symbols(void)
#elif defined(__sun)
const char *path = getexecname();
int fd = open(path, O_RDONLY);
+#elif defined(__HAIKU__)
+ image_info ii;
+ int32_t ic = 0;
+
+ while (get_next_image_info(0, &ic, &ii) == B_OK) {
+ if (ii.type == B_APP_IMAGE) {
+ break;
+ }
+ }
+
+ if (ii.type != B_APP_IMAGE) {
+ return;
+ }
+
+ int fd = open(ii.name, 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 e61c492895..94feba1f07 100644
--- a/ext/opcache/jit/zend_jit_perf_dump.c
+++ b/ext/opcache/jit/zend_jit_perf_dump.c
@@ -35,6 +35,8 @@
#elif defined(__sun)
// avoiding thread.h inclusion as it conflicts with vtunes types.
extern unsigned int thr_self(void);
+#elif defined(__HAIKU__)
+#include <kernel/image.h>
#endif
#include "zend_elf.h"
@@ -133,6 +135,21 @@ static void zend_jit_perf_jitdump_open(void)
#elif defined(__sun)
const char *path = getexecname();
fd = open(path, O_RDONLY);
+#elif defined(__HAIKU__)
+ image_info ii;
+ int32_t ic = 0;
+
+ while (get_next_image_info(0, &ic, &ii) == B_OK) {
+ if (ii.type == B_APP_IMAGE) {
+ break;
+ }
+ }
+
+ if (ii.type != B_APP_IMAGE) {
+ return;
+ }
+
+ fd = open(ii.name, O_RDONLY);
#else
fd = -1;
#endif