From fc09f4a24e22988cb89650b1d5b1f3716cf5c893 Mon Sep 17 00:00:00 2001 From: Nikos Nikoleris Date: Sat, 1 Dec 2018 14:52:23 +0000 Subject: [PATCH] base: Fix fiber compilation issue for Mac OS Mac OS has deprecated the use of ucontext and at the moment we are using a workaround to enable it. A side-effect is that the code is marked as _POSIX_C_SOURCE and consequently requires the code to be also marked as _DARWIN_C_SOURCE to include the definition of MAP_ANONYMOUS. Change-Id: I65550d11a0a21cd36d832a7de6320e7e3f332a9d Signed-off-by: Nikos Nikoleris Reviewed-on: https://gem5-review.googlesource.com/c/14817 Reviewed-by: Gabe Black Maintainer: Gabe Black --- src/base/fiber.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/base/fiber.cc b/src/base/fiber.cc index af63216da..177459aaa 100644 --- a/src/base/fiber.cc +++ b/src/base/fiber.cc @@ -33,6 +33,14 @@ #include #endif +// Mac OS requires _DARWIN_C_SOURCE if _POSIX_C_SOURCE is defined, +// otherwise it will mask the definition of MAP_ANONYMOUS. +// _POSIX_C_SOURCE is already defined by including in +// base/fiber.hh +#if defined(__APPLE__) && defined(__MACH__) +#define _DARWIN_C_SOURCE +#endif + #include #include -- 2.30.2