1 // Copyright 2017 The Fuchsia Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #pragma once 6 7 #include <zircon/compiler.h> 8 #include <zircon/sanitizer.h> 9 10 // NOTE: userboot includes memcpy, memmove, and memset source files 11 // directly, so it needs to be able to handle their #include's of this 12 // header. 13 14 #if __has_feature(address_sanitizer) 15 16 // In the sanitized build, the __asan_mem* names provided by the 17 // sanitizer runtime must have weak definitions in libc to satisfy 18 // its own references before the sanitizer runtime is loaded. 19 #define __asan_weak_alias(name) \ 20 __typeof(name) __asan_##name __attribute__((weak, alias(#name))); 21 22 #include <sanitizer/asan_interface.h> 23 24 void __asan_early_init(void) __attribute__((visibility("hidden"))); 25 26 #else // !__has_feature(address_sanitizer) 27 28 #define __asan_weak_alias(name) // Do nothing in unsanitized build. 29 30 #endif // __has_feature(address_sanitizer) 31