Index: build/config/compiler/BUILD.gn |
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn |
index 01065487f8d2a5f555d6287e0c448ab81cf961fb..c04a109d2e7321c259bf067f5e06d4c0323ce798 100644 |
--- a/build/config/compiler/BUILD.gn |
+++ b/build/config/compiler/BUILD.gn |
@@ -78,6 +78,11 @@ declare_args() { |
# See: https://bugs.chromium.org/p/chromium/issues/detail?id=457359 |
fatal_linker_warnings = true |
+ # Build with C++ RTTI enabled. Chromium builds without RTTI by default, |
+ # but some sanitizers are known to require it, like CFI diagnostics |
+ # and UBsan variants. |
+ use_rtti = use_cfi_diag || is_ubsan_vptr || is_ubsan_security |
+ |
# AFDO (Automatic Feedback Directed Optimizer) is a form of profile-guided |
# optimization that GCC supports. It used by ChromeOS in their official |
# builds. To use it, set auto_profile_path to the path to a file containing |
@@ -1188,9 +1193,10 @@ config("rtti") { |
cflags_cc = [ "-frtti" ] |
} |
} |
+ |
config("no_rtti") { |
- # CFI diagnostics and UBsan vptr require RTTI. |
- if (!use_cfi_diag && !is_ubsan_vptr && !is_ubsan_security) { |
+ # Some sanitizer configs may require RTTI to be left enabled globally |
+ if (!use_rtti) { |
if (is_win) { |
cflags_cc = [ "/GR-" ] |
} else { |