From 87a6325fbe4315f3f24555797f216e96539a9397 Mon Sep 17 00:00:00 2001 From: Jianzhou Zhao Date: Fri, 30 Apr 2021 17:18:05 +0000 Subject: [PATCH] [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 --- compiler-rt/test/dfsan/{interceptors.c => mmap_at_init.c} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename compiler-rt/test/dfsan/{interceptors.c => mmap_at_init.c} (86%) diff --git a/compiler-rt/test/dfsan/interceptors.c b/compiler-rt/test/dfsan/mmap_at_init.c similarity index 86% 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 #include -#include #include #include @@ -23,7 +21,9 @@ void *calloc(size_t Num, size_t Size) { 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; } -- 2.7.4