summaryrefslogtreecommitdiff
path: root/test/hwasan
diff options
context:
space:
mode:
authorAlex Shlyapnikov <alekseys@google.com>2018-04-18 22:05:18 +0000
committerAlex Shlyapnikov <alekseys@google.com>2018-04-18 22:05:18 +0000
commit966e647410278bca805517c888d36a60a3c056b6 (patch)
treea90f6af07b09adcea8c0300b583c925985033504 /test/hwasan
parent1d9edeabe5ccbf2b62bcdb10ebcd176cb6f284ea (diff)
[HWASan] Add "N" suffix to generic __hwasan_load/store.
Summary: "N" suffix is added by the instrumentation and interface functions are expected to be exported from the library as __hwasan_loadN* and __hwasan_storeN*. Reviewers: eugenis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D45739 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@330297 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/hwasan')
-rw-r--r--test/hwasan/TestCases/check-interface.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/hwasan/TestCases/check-interface.cc b/test/hwasan/TestCases/check-interface.cc
new file mode 100644
index 000000000..7ad911480
--- /dev/null
+++ b/test/hwasan/TestCases/check-interface.cc
@@ -0,0 +1,22 @@
+// RUN: %clangxx_hwasan -mllvm -hwasan-instrument-with-calls=1 -O0 %s -o %t
+// RUN: %clangxx_hwasan -mllvm -hwasan-instrument-with-calls=1 -O0 %s -o %t -fsanitize-recover=hwaddress
+
+// REQUIRES: stable-runtime
+
+// Utilizes all flavors of __hwasan_load/store interface functions to verify
+// that the instrumentation and the interface provided by HWASan do match.
+// In case of a discrepancy, this test fails to link.
+
+#include <sanitizer/hwasan_interface.h>
+
+#define F(T) void f_##T(T *a, T *b) { *a = *b; }
+
+F(uint8_t)
+F(uint16_t)
+F(uint32_t)
+F(uint64_t)
+
+typedef unsigned V32 __attribute__((__vector_size__(32)));
+F(V32)
+
+int main() {}