]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cc
Import Intel Processor Trace decoder library from
[FreeBSD/FreeBSD.git] / contrib / compiler-rt / lib / asan / asan_interceptors_memintrinsics.cc
1 //===-- asan_interceptors_memintrinsics.cc --------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===---------------------------------------------------------------------===//
9 //
10 // This file is a part of AddressSanitizer, an address sanity checker.
11 //
12 // ASan versions of memcpy, memmove, and memset.
13 //===---------------------------------------------------------------------===//
14
15 #include "asan_interceptors_memintrinsics.h"
16 #include "asan_report.h"
17 #include "asan_stack.h"
18 #include "asan_suppressions.h"
19
20 using namespace __asan;  // NOLINT
21
22 void *__asan_memcpy(void *to, const void *from, uptr size) {
23   ASAN_MEMCPY_IMPL(nullptr, to, from, size);
24 }
25
26 void *__asan_memset(void *block, int c, uptr size) {
27   ASAN_MEMSET_IMPL(nullptr, block, c, size);
28 }
29
30 void *__asan_memmove(void *to, const void *from, uptr size) {
31   ASAN_MEMMOVE_IMPL(nullptr, to, from, size);
32 }
33
34 #if SANITIZER_FUCHSIA
35
36 // Fuchsia doesn't use sanitizer_common_interceptors.inc, but the only
37 // things there it wants are these three.  Just define them as aliases
38 // here rather than repeating the contents.
39
40 decltype(memcpy) memcpy[[gnu::alias("__asan_memcpy")]];
41 decltype(memmove) memmove[[gnu::alias("__asan_memmove")]];
42 decltype(memset) memset[[gnu::alias("__asan_memset")]];
43
44 #endif  // SANITIZER_FUCHSIA