From 0fcdc46af752e68da161e5f3eaf78184368813dc Mon Sep 17 00:00:00 2001 From: Andrew Savage Date: Wed, 13 Sep 2023 13:58:12 -0700 Subject: [PATCH] Revert "Remove raspi-2 -fno-exception hack. (#1490)" (#1544) This reverts commit 4a5738d6c9db44c1bc8f14edfd275e7a0ce3f3a6. Seems to be causing many raspi tests to fail. b/219073252 --- build/config/compiler/BUILD.gn | 3 +++ starboard/nplb/BUILD.gn | 6 +++++- .../platform_configuration/configuration.gni | 3 +++ third_party/llvm-project/libcxxabi/BUILD.gn | 16 ++++++---------- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 36702d95671d..f58c6f8b01a7 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -1899,8 +1899,11 @@ config("no_exceptions") { defines = [ "_HAS_EXCEPTIONS=0" ] } } else { + # This hack ensures raspi does not compile anything with -fno-exceptions. + if (!defined(enable_exceptions_override) || !enable_exceptions_override) { cflags_cc = [ "-fno-exceptions" ] cflags_objcc = cflags_cc + } } } diff --git a/starboard/nplb/BUILD.gn b/starboard/nplb/BUILD.gn index ddb3e379aff8..5ee200fe3281 100644 --- a/starboard/nplb/BUILD.gn +++ b/starboard/nplb/BUILD.gn @@ -231,7 +231,11 @@ target(gtest_target_type, "nplb") { "window_get_size_test.cc", ] - configs += [ "//starboard/build/config:starboard_implementation" ] + configs += [ + "//build/config/compiler:exceptions", + "//starboard/build/config:starboard_implementation", + ] + configs -= [ "//build/config/compiler:no_exceptions" ] deps = [ "//starboard", diff --git a/starboard/raspi/shared/platform_configuration/configuration.gni b/starboard/raspi/shared/platform_configuration/configuration.gni index d29f8820ce4f..b1e053e8db04 100644 --- a/starboard/raspi/shared/platform_configuration/configuration.gni +++ b/starboard/raspi/shared/platform_configuration/configuration.gni @@ -37,6 +37,9 @@ if (current_toolchain == default_toolchain && speed_config_path = "//starboard/raspi/shared/platform_configuration:speed" size_config_path = "//starboard/raspi/shared/platform_configuration:size" + # TODO(b/219073252): Enable -fno-exceptions and don't mix it with -fexceptions. + enable_exceptions_override = true + v8_enable_webassembly = true is_raspi = true diff --git a/third_party/llvm-project/libcxxabi/BUILD.gn b/third_party/llvm-project/libcxxabi/BUILD.gn index bb1ccb7fd78d..9142fa43f4f7 100644 --- a/third_party/llvm-project/libcxxabi/BUILD.gn +++ b/third_party/llvm-project/libcxxabi/BUILD.gn @@ -23,6 +23,7 @@ config("cxxabi_config") { "-std=c++17", "-nostdinc++", "-fPIC", + "-fexceptions", "-frtti", "-Werror=return-type", "-fvisibility-inlines-hidden", @@ -64,19 +65,11 @@ static_library("cxxabi") { "src/cxa_aux_runtime.cpp", "src/cxa_default_handlers.cpp", "src/cxa_demangle.cpp", - - # Requires exception support - #"src/cxa_exception.cpp", - + "src/cxa_exception.cpp", "src/cxa_exception_storage.cpp", - "src/cxa_guard.cpp", "src/cxa_handlers.cpp", - "src/cxa_noexception.cpp", - - # Requires exception support - #"src/cxa_personality.cpp", - + "src/cxa_personality.cpp", "src/cxa_vector.cpp", "src/cxa_virtual.cpp", "src/fallback_malloc.cpp", @@ -86,6 +79,9 @@ static_library("cxxabi") { "src/stdlib_stdexcept.cpp", "src/stdlib_typeinfo.cpp", + # src/cxa_noexception.cpp is omitted because this file breaks the build and + # we utilize exception handling. + # src/cxa_thread_atexit.cpp is unneeded. It introduces # "__cxa_thread_atexit_impl" as an API leak. ]