summaryrefslogtreecommitdiff
path: root/test/asan/TestCases/Linux/coverage-direct-large.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/asan/TestCases/Linux/coverage-direct-large.cc')
-rw-r--r--test/asan/TestCases/Linux/coverage-direct-large.cc24
1 files changed, 22 insertions, 2 deletions
diff --git a/test/asan/TestCases/Linux/coverage-direct-large.cc b/test/asan/TestCases/Linux/coverage-direct-large.cc
index 78aa68621ad1a..25c950e0bb300 100644
--- a/test/asan/TestCases/Linux/coverage-direct-large.cc
+++ b/test/asan/TestCases/Linux/coverage-direct-large.cc
@@ -1,7 +1,9 @@
// Test for direct coverage writing with lots of data.
// Current implementation maps output file in chunks of 64K. This test overflows
// 1 chunk.
-// RUN: %clangxx_asan -fsanitize-coverage=1 -O0 %s -o %t
+
+// RUN: %clangxx_asan -fsanitize-coverage=1 -O0 -DSHARED %s -shared -o %T/libcoverage_direct_large_test_1.so -fPIC
+// RUN: %clangxx_asan -fsanitize-coverage=1 -O0 -DSO_DIR=\"%T\" %s %libdl -o %t
// RUN: rm -rf %T/coverage-direct-large
@@ -34,12 +36,30 @@
F3(Q, x##0) F3(Q, x##1) F3(Q, x##2) F3(Q, x##3) F3(Q, x##4) F3(Q, x##5) \
F3(Q, x##6) F3(Q, x##7) F3(Q, x##8) F3(Q, x##9)
-#define DECL(x) __attribute__((noinline)) void x() {}
+#define DECL(x) __attribute__((noinline)) static void x() {}
#define CALL(x) x();
F4(DECL, f)
+#ifdef SHARED
+extern "C" void so_entry() {
+ F4(CALL, f)
+}
+#else
+
+#include <assert.h>
+#include <dlfcn.h>
int main(void) {
F4(CALL, f)
+
+ void *handle1 =
+ dlopen(SO_DIR "/libcoverage_direct_large_test_1.so", RTLD_LAZY);
+ assert(handle1);
+ void (*so_entry)() = (void (*)())dlsym(handle1, "so_entry");
+ assert(so_entry);
+ so_entry();
+
return 0;
}
+
+#endif // SHARED