[compiler-rt] r287833 - [test] Use a helper macro to refer to MAP_ANON (NFC)
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 23 14:23:42 PST 2016
Author: vedantk
Date: Wed Nov 23 16:23:42 2016
New Revision: 287833
URL: http://llvm.org/viewvc/llvm-project?rev=287833&view=rev
Log:
[test] Use a helper macro to refer to MAP_ANON (NFC)
Some of our internal bots use old SDK's which don't define MAP_ANON.
Use a helper macro to pass the right flag into mmap().
Modified:
compiler-rt/trunk/test/tsan/ignore_lib5.cc
Modified: compiler-rt/trunk/test/tsan/ignore_lib5.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/ignore_lib5.cc?rev=287833&r1=287832&r2=287833&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/ignore_lib5.cc (original)
+++ compiler-rt/trunk/test/tsan/ignore_lib5.cc Wed Nov 23 16:23:42 2016
@@ -27,14 +27,20 @@
# define MAP_32BIT 0
#endif
+#ifdef __APPLE__
+# define TSAN_MAP_ANON MAP_ANON
+#else
+# define TSAN_MAP_ANON MAP_ANONYMOUS
+#endif
+
void *thr(void *arg) {
// This thread creates lots of separate mappings in /proc/self/maps before
// the ignored library.
for (int i = 0; i < 10000; i++) {
if (i == 5000)
barrier_wait(&barrier);
- mmap(0, 4096, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE | MAP_32BIT, -1 , 0);
- mmap(0, 4096, PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_32BIT, -1 , 0);
+ mmap(0, 4096, PROT_READ, TSAN_MAP_ANON | MAP_PRIVATE | MAP_32BIT, -1 , 0);
+ mmap(0, 4096, PROT_WRITE, TSAN_MAP_ANON | MAP_PRIVATE | MAP_32BIT, -1 , 0);
}
return 0;
}
More information about the llvm-commits
mailing list