1//===-- asan_interceptors_memintrinsics.cpp -------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===---------------------------------------------------------------------===//
8//
9// This file is a part of AddressSanitizer, an address sanity checker.
10//
11// ASan versions of memcpy, memmove, and memset.
12//===---------------------------------------------------------------------===//
13
14#include "asan_interceptors_memintrinsics.h"
15#include "asan_report.h"
16#include "asan_stack.h"
17#include "asan_suppressions.h"
18
19using namespace __asan;
20
21void *__asan_memcpy(void *to, const void *from, uptr size) {
22  ASAN_MEMCPY_IMPL(nullptr, to, from, size);
23}
24
25void *__asan_memset(void *block, int c, uptr size) {
26  ASAN_MEMSET_IMPL(nullptr, block, c, size);
27}
28
29void *__asan_memmove(void *to, const void *from, uptr size) {
30  ASAN_MEMMOVE_IMPL(nullptr, to, from, size);
31}
32
33#if SANITIZER_FUCHSIA || SANITIZER_RTEMS
34
35// Fuchsia and RTEMS don't use sanitizer_common_interceptors.inc, but
36// the only things there it wants are these three.  Just define them
37// as aliases here rather than repeating the contents.
38
39extern "C" decltype(__asan_memcpy) memcpy[[gnu::alias("__asan_memcpy")]];
40extern "C" decltype(__asan_memmove) memmove[[gnu::alias("__asan_memmove")]];
41extern "C" decltype(__asan_memset) memset[[gnu::alias("__asan_memset")]];
42
43#endif  // SANITIZER_FUCHSIA || SANITIZER_RTEMS
44