diff --git a/src/lj_alloc.c b/src/lj_alloc.c
index 7c7ec67..bdf27d9 100644
--- a/src/lj_alloc.c
+++ b/src/lj_alloc.c
@@ -194,7 +194,7 @@ static LJ_AINLINE void *CALL_MMAP(size_t size)
   return ptr;
 }
 
-#elif LJ_TARGET_OSX || LJ_TARGET_PS4 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun__)
+#elif LJ_TARGET_OSX || LJ_TARGET_PS4 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun__) || defined(__HAIKU__)
 
 /* OSX and FreeBSD mmap() use a naive first-fit linear search.
 ** That's perfect for us. Except that -pagezero_size must be set for OSX,
diff --git a/src/lj_arch.h b/src/lj_arch.h
index d3a9d57..e551ac5 100644
--- a/src/lj_arch.h
+++ b/src/lj_arch.h
@@ -70,6 +70,8 @@
        defined(__NetBSD__) || defined(__OpenBSD__) || \
        defined(__DragonFly__)) && !defined(__ORBIS__)
 #define LUAJIT_OS	LUAJIT_OS_BSD
+#elif defined(__HAIKU__)
+#define LUAJIT_OS  LUAJIT_OS_POSIX
 #elif (defined(__sun__) && defined(__svr4__)) || defined(__CYGWIN__)
 #define LUAJIT_OS	LUAJIT_OS_POSIX
 #else
