From b2d2eaa3afe7b329948fd373083b85571fda4d7c Mon Sep 17 00:00:00 2001 From: klzgrad Date: Sat, 30 Nov 2019 21:52:42 +0800 Subject: [PATCH] libc++: Disable exceptions and RTTI Except on Mac, where disabling exceptions doesn't work. --- src/buildtools/third_party/libc++/BUILD.gn | 4 ---- src/buildtools/third_party/libc++abi/BUILD.gn | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/buildtools/third_party/libc++/BUILD.gn b/src/buildtools/third_party/libc++/BUILD.gn index 301d2fd1dc..05b1de23b6 100644 --- a/src/buildtools/third_party/libc++/BUILD.gn +++ b/src/buildtools/third_party/libc++/BUILD.gn @@ -109,8 +109,6 @@ target(_libcxx_target_type, "libc++") { } configs -= [ "//build/config/compiler:chromium_code", - "//build/config/compiler:no_exceptions", - "//build/config/compiler:no_rtti", "//build/config/coverage:default_coverage", ] if (is_android && libcxx_is_shared) { @@ -122,8 +120,6 @@ target(_libcxx_target_type, "libc++") { configs += [ ":config", "//build/config/compiler:no_chromium_code", - "//build/config/compiler:exceptions", - "//build/config/compiler:rtti", "//build/config/sanitizers:sanitizer_options_link_helper", ] if (libcxx_is_shared && !is_win) { diff --git a/src/buildtools/third_party/libc++abi/BUILD.gn b/src/buildtools/third_party/libc++abi/BUILD.gn index 8ab7584c91..78c413535f 100644 --- a/src/buildtools/third_party/libc++abi/BUILD.gn +++ b/src/buildtools/third_party/libc++abi/BUILD.gn @@ -92,4 +92,23 @@ source_set("libc++abi") { # We had to copy refstring.h into libc++abi for the relative path to work, # but the copy includes more stuff from libc++'s internal headers. include_dirs = [ "../libc++/trunk/src/include" ] + if (!is_mac) { + sources -= [ + "trunk/src/cxa_exception.cpp", + "trunk/src/cxa_personality.cpp", + "trunk/src/private_typeinfo.cpp", + ] + sources += [ + "trunk/src/cxa_noexception.cpp", + ] + defines += [ "_LIBCXXABI_NO_EXCEPTIONS" ] + configs -= [ + "//build/config/compiler:exceptions", + "//build/config/compiler:rtti", + ] + configs += [ + "//build/config/compiler:no_exceptions", + "//build/config/compiler:no_rtti", + ] + } }