xref: /openbsd-src/gnu/llvm/compiler-rt/lib/ubsan/ubsan_win_weak_interception.cpp (revision 3cab2bb3f667058bece8e38b12449a63a9d73c4b)
1*3cab2bb3Spatrick //===-- ubsan_win_weak_interception.cpp -----------------------------------===//
2*3cab2bb3Spatrick //
3*3cab2bb3Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*3cab2bb3Spatrick // See https://llvm.org/LICENSE.txt for license information.
5*3cab2bb3Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*3cab2bb3Spatrick //
7*3cab2bb3Spatrick //===----------------------------------------------------------------------===//
8*3cab2bb3Spatrick // This module should be included in Ubsan when it is implemented as a shared
9*3cab2bb3Spatrick // library on Windows (dll), in order to delegate the calls of weak functions to
10*3cab2bb3Spatrick // the implementation in the main executable when a strong definition is
11*3cab2bb3Spatrick // provided.
12*3cab2bb3Spatrick //===----------------------------------------------------------------------===//
13*3cab2bb3Spatrick #ifdef SANITIZER_DYNAMIC
14*3cab2bb3Spatrick #include "sanitizer_common/sanitizer_win_weak_interception.h"
15*3cab2bb3Spatrick #include "ubsan_flags.h"
16*3cab2bb3Spatrick #include "ubsan_monitor.h"
17*3cab2bb3Spatrick // Check if strong definitions for weak functions are present in the main
18*3cab2bb3Spatrick // executable. If that is the case, override dll functions to point to strong
19*3cab2bb3Spatrick // implementations.
20*3cab2bb3Spatrick #define INTERFACE_FUNCTION(Name)
21*3cab2bb3Spatrick #define INTERFACE_WEAK_FUNCTION(Name) INTERCEPT_SANITIZER_WEAK_FUNCTION(Name)
22*3cab2bb3Spatrick #include "ubsan_interface.inc"
23*3cab2bb3Spatrick #endif // SANITIZER_DYNAMIC
24