[compiler-rt] r337440 - [Xray] Fix allocator build, MAP_NORESERVE flag is not always supported

David Carlier via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 18 22:08:59 PDT 2018


Author: devnexen
Date: Wed Jul 18 22:08:59 2018
New Revision: 337440

URL: http://llvm.org/viewvc/llvm-project?rev=337440&view=rev
Log:
[Xray] Fix allocator build, MAP_NORESERVE flag is not always supported

MAP_NORESERVE is not supported or a no-op on BSD.

Reviewers: dberris

Reviewed By: dberris

Differential Revision: https://reviews.llvm.org/D49494

Modified:
    compiler-rt/trunk/lib/xray/xray_allocator.h

Modified: compiler-rt/trunk/lib/xray/xray_allocator.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_allocator.h?rev=337440&r1=337439&r2=337440&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_allocator.h (original)
+++ compiler-rt/trunk/lib/xray/xray_allocator.h Wed Jul 18 22:08:59 2018
@@ -20,11 +20,16 @@
 #include "sanitizer_common/sanitizer_internal_defs.h"
 #include "sanitizer_common/sanitizer_mutex.h"
 #include "sanitizer_common/sanitizer_posix.h"
-#include "sys/mman.h"
 #include "xray_utils.h"
+#include <sys/mman.h>
 #include <cstddef>
 #include <cstdint>
 
+#ifndef MAP_NORESERVE
+// no-op on NetBSD (at least), unsupported flag on FreeBSD basically because unneeded
+#define MAP_NORESERVE 0
+#endif
+
 namespace __xray {
 
 /// The Allocator type hands out fixed-sized chunks of memory that are




More information about the llvm-commits mailing list