From ccae01cbce8aeaba03e782759807d5b5fc4991f1 Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Wed, 18 May 2022 17:18:49 +0100 Subject: [PATCH] [compiler-rt] Fix Mmap on FreeBSD AArch64 On FreeBSD AArch64 safestack needs to use __syscall to handle 64 bit arguments Reviewed by: MaskRay, vitalybuka Differential Revision: https://reviews.llvm.org/D125901 --- compiler-rt/lib/safestack/safestack_platform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler-rt/lib/safestack/safestack_platform.h b/compiler-rt/lib/safestack/safestack_platform.h index 81e4c2645ce2..2b1fc139baa9 100644 --- a/compiler-rt/lib/safestack/safestack_platform.h +++ b/compiler-rt/lib/safestack/safestack_platform.h @@ -94,7 +94,7 @@ inline void *Mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset) { #if SANITIZER_NETBSD return __mmap(addr, length, prot, flags, fd, 0, offset); -#elif defined(__x86_64__) && (SANITIZER_FREEBSD) +#elif SANITIZER_FREEBSD && (defined(__aarch64__) || defined(__x86_64__)) return (void *)__syscall(SYS_mmap, addr, length, prot, flags, fd, offset); #else return (void *)syscall(SYS_mmap, addr, length, prot, flags, fd, offset);