xref: /aosp_15_r20/external/webrtc/rtc_base/system/no_cfi_icall.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef RTC_BASE_SYSTEM_NO_CFI_ICALL_H_
12 #define RTC_BASE_SYSTEM_NO_CFI_ICALL_H_
13 
14 #include "rtc_base/sanitizer.h"
15 
16 // DISABLE_CFI_ICALL -- Disable Control Flow Integrity indirect call checks.
17 // Note that the same macro is defined in "base/compiler_specific.h".
18 // Only use this when building standalone WebRTC.
19 #if !defined(WEBRTC_CHROMIUM_BUILD)
20 #if !defined(DISABLE_CFI_ICALL)
21 #if defined(WEBRTC_WIN)
22 // Windows also needs __declspec(guard(nocf)).
23 #define DISABLE_CFI_ICALL RTC_NO_SANITIZE("cfi-icall") __declspec(guard(nocf))
24 #else
25 #define DISABLE_CFI_ICALL RTC_NO_SANITIZE("cfi-icall")
26 #endif  // defined(WEBRTC_WIN)
27 #endif  // !defined(DISABLE_CFI_ICALL)
28 #if !defined(DISABLE_CFI_ICALL)
29 #define DISABLE_CFI_ICALL
30 #endif
31 #endif  // !defined(WEBRTC_CHROMIUM_BUILD)
32 
33 #endif  // RTC_BASE_SYSTEM_NO_CFI_ICALL_H_
34