xref: /freebsd/contrib/llvm-project/compiler-rt/lib/asan/asan_init_version.h (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric //===-- asan_init_version.h -------------------------------------*- C++ -*-===//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric //
9*0b57cec5SDimitry Andric // This file is a part of AddressSanitizer, an address sanity checker.
10*0b57cec5SDimitry Andric //
11*0b57cec5SDimitry Andric // This header defines a versioned __asan_init function to be called at the
12*0b57cec5SDimitry Andric // startup of the instrumented program.
13*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
14*0b57cec5SDimitry Andric #ifndef ASAN_INIT_VERSION_H
15*0b57cec5SDimitry Andric #define ASAN_INIT_VERSION_H
16*0b57cec5SDimitry Andric 
17*0b57cec5SDimitry Andric #include "sanitizer_common/sanitizer_platform.h"
18*0b57cec5SDimitry Andric 
19*0b57cec5SDimitry Andric extern "C" {
20*0b57cec5SDimitry Andric   // Every time the ASan ABI changes we also change the version number in the
21*0b57cec5SDimitry Andric   // __asan_init function name.  Objects built with incompatible ASan ABI
22*0b57cec5SDimitry Andric   // versions will not link with run-time.
23*0b57cec5SDimitry Andric   //
24*0b57cec5SDimitry Andric   // Changes between ABI versions:
25*0b57cec5SDimitry Andric   // v1=>v2: added 'module_name' to __asan_global
26*0b57cec5SDimitry Andric   // v2=>v3: stack frame description (created by the compiler)
27*0b57cec5SDimitry Andric   //         contains the function PC as the 3rd field (see
28*0b57cec5SDimitry Andric   //         DescribeAddressIfStack)
29*0b57cec5SDimitry Andric   // v3=>v4: added '__asan_global_source_location' to __asan_global
30*0b57cec5SDimitry Andric   // v4=>v5: changed the semantics and format of __asan_stack_malloc_ and
31*0b57cec5SDimitry Andric   //         __asan_stack_free_ functions
32*0b57cec5SDimitry Andric   // v5=>v6: changed the name of the version check symbol
33*0b57cec5SDimitry Andric   // v6=>v7: added 'odr_indicator' to __asan_global
34*0b57cec5SDimitry Andric   // v7=>v8: added '__asan_(un)register_image_globals' functions for dead
35*0b57cec5SDimitry Andric   //         stripping support on Mach-O platforms
36*0b57cec5SDimitry Andric #if SANITIZER_WORDSIZE == 32 && SANITIZER_ANDROID
37*0b57cec5SDimitry Andric   // v8=>v9: 32-bit Android switched to dynamic shadow
38*0b57cec5SDimitry Andric   #define __asan_version_mismatch_check __asan_version_mismatch_check_v9
39*0b57cec5SDimitry Andric #else
40*0b57cec5SDimitry Andric   #define __asan_version_mismatch_check __asan_version_mismatch_check_v8
41*0b57cec5SDimitry Andric #endif
42*0b57cec5SDimitry Andric }
43*0b57cec5SDimitry Andric 
44*0b57cec5SDimitry Andric #endif  // ASAN_INIT_VERSION_H
45