Nikos Nikoleris has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/14817

Change subject: base: Fix fiber compilation issue for Mac OS
......................................................................

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 <sys/mman.h> 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 <[email protected]>
---
M src/base/fiber.cc
1 file changed, 8 insertions(+), 0 deletions(-)



diff --git a/src/base/fiber.cc b/src/base/fiber.cc
index af63216..177459a 100644
--- a/src/base/fiber.cc
+++ b/src/base/fiber.cc
@@ -33,6 +33,14 @@
 #include <valgrind/valgrind.h>
 #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 <ucontext.h> in
+// base/fiber.hh
+#if defined(__APPLE__) && defined(__MACH__)
+#define _DARWIN_C_SOURCE
+#endif
+
 #include <sys/mman.h>
 #include <unistd.h>


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/14817
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I65550d11a0a21cd36d832a7de6320e7e3f332a9d
Gerrit-Change-Number: 14817
Gerrit-PatchSet: 1
Gerrit-Owner: Nikos Nikoleris <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to