[dfsan] Rename and fix an internal test issue for mmap+calloc
The linker suggests using -Wl,-z,notext.
Replaced assert by exit also fixed this.
After renaming, interceptor.c would be used to test interceptors in general by D101204.
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D101649
diff --git a/compiler-rt/test/dfsan/interceptors.c b/compiler-rt/test/dfsan/mmap_at_init.c
similarity index 85%
rename from compiler-rt/test/dfsan/interceptors.c
rename to compiler-rt/test/dfsan/mmap_at_init.c
index d096138..913602e 100644
--- a/compiler-rt/test/dfsan/interceptors.c
+++ b/compiler-rt/test/dfsan/mmap_at_init.c
@@ -6,9 +6,7 @@
//
// Tests that calling mmap() during during dfsan initialization works.
-#include <assert.h>
#include <sanitizer/dfsan_interface.h>
-#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
@@ -23,7 +21,9 @@
Size = (Size + PageSize - 1) & ~(PageSize - 1); // Round up to PageSize.
void *Ret = mmap(NULL, Size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
- assert(Ret != MAP_FAILED);
+ // Use assert may cause link errors that require -Wl,-z,notext.
+ // Do not know the root cause yet.
+ if (Ret == MAP_FAILED) exit(-1);
return Ret;
}