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
//
// 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>
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;
}