[PATCH] D77638: [SanitizerCoverage] Add compiler-rt test for -fsanitize-coverage=inline-bool-flag
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 9 13:51:49 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2d39559d68aa: [SanitizerCoverage] Add compiler-rt test for -fsanitize-coverage=inline-bool… (authored by pratyai, committed by vitalybuka).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77638/new/
https://reviews.llvm.org/D77638
Files:
compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_inline_bool_flag.cpp
Index: compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_inline_bool_flag.cpp
===================================================================
--- /dev/null
+++ compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_inline_bool_flag.cpp
@@ -0,0 +1,42 @@
+// Tests -fsanitize-coverage=inline-bool-flag,pc-table
+//
+// REQUIRES: has_sancovcc,stable-runtime
+// UNSUPPORTED: i386-darwin
+//
+// RUN: %clangxx -O0 %s -fsanitize-coverage=inline-bool-flag,pc-table -o %t
+// RUN: %run %t 2>&1 | FileCheck %s
+// XFAIL: tsan
+
+#include <assert.h>
+#include <stdint.h>
+#include <stdio.h>
+
+const bool *first_flag;
+
+extern "C" void __sanitizer_cov_bool_flag_init(const bool *start,
+ const bool *end) {
+ printf("INIT: %p %p\n", start, end);
+ assert(end - start > 1);
+ first_flag = start;
+}
+
+uintptr_t FirstPC;
+uintptr_t FirstPCFlag;
+
+extern "C" void __sanitizer_cov_pcs_init(const uintptr_t *pcs_beg,
+ const uintptr_t *pcs_end) {
+ const uintptr_t *B = (const uintptr_t *)pcs_beg;
+ const uintptr_t *E = (const uintptr_t *)pcs_end;
+ assert(B + 1 < E);
+ FirstPC = B[0];
+ FirstPCFlag = B[1];
+}
+
+int main() {
+ assert(first_flag);
+ assert(*first_flag);
+ assert(FirstPC == (uintptr_t)&main);
+ assert(FirstPCFlag == 1);
+ fprintf(stderr, "PASS\n");
+ // CHECK: PASS
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77638.256397.patch
Type: text/x-patch
Size: 1404 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200409/21b11638/attachment.bin>
More information about the llvm-commits
mailing list