# Copyright 2015 The Chromium Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import("//build/config/android/config.gni") import("//build/config/c++/c++.gni") import("//build/config/unwind.gni") source_set("libc++abi") { if (export_libcxxabi_from_executables) { visibility = [ "//build/config:executable_deps" ] } else { visibility = [ "//buildtools/third_party/libc++" ] } # Fuchsia builds don't link against any libraries that provide stack # unwinding symbols, unlike Linux does with glibc (same applies for Android). # Build and link against libunwind manually to get this functionality. if (use_custom_libunwind) { deps = [ "//buildtools/third_party/libunwind" ] } # TODO(crbug.com/40273848): Move this build file to third_party/libc++/BUILD.gn once submodule migration is done sources = [ "//third_party/libc++abi/src/src/abort_message.cpp", "//third_party/libc++abi/src/src/cxa_aux_runtime.cpp", "//third_party/libc++abi/src/src/cxa_default_handlers.cpp", "//third_party/libc++abi/src/src/cxa_exception.cpp", "//third_party/libc++abi/src/src/cxa_exception_storage.cpp", "//third_party/libc++abi/src/src/cxa_handlers.cpp", # This file is supposed to be used in fno-exception builds of # libc++abi. We build lib++/libc++abi with exceptions enabled. #"//third_party/libc++abi/src/src/cxa_noexception.cpp", "//third_party/libc++abi/src/src/cxa_personality.cpp", "//third_party/libc++abi/src/src/cxa_vector.cpp", "//third_party/libc++abi/src/src/cxa_virtual.cpp", "//third_party/libc++abi/src/src/fallback_malloc.cpp", "//third_party/libc++abi/src/src/private_typeinfo.cpp", "//third_party/libc++abi/src/src/stdlib_exception.cpp", "//third_party/libc++abi/src/src/stdlib_stdexcept.cpp", "//third_party/libc++abi/src/src/stdlib_typeinfo.cpp", ] if (!is_tsan) { sources += [ "//third_party/libc++abi/src/src/cxa_guard.cpp" ] } # See the comment in cxa_demangle_stub.cc for why we don't use LLVM's # demangler on android. # TODO(thakis): Switch to building with LIBCXXABI_NON_DEMANGLING_TERMINATE # defined instead. if (is_android) { sources += [ "cxa_demangle_stub.cc" ] } else { sources += [ "//third_party/libc++abi/src/src/cxa_demangle.cpp" ] } defines = [ "LIBCXXABI_SILENT_TERMINATE" ] if (is_fuchsia || (is_posix && !is_apple)) { sources += [ "//third_party/libc++abi/src/src/cxa_thread_atexit.cpp" ] # Android's bionic libc added support for '__cxa_thread_atexit_impl' as of # API level 23. if (is_android && ((!android_64bit_target_cpu && android32_ndk_api_level >= 23) || (android_64bit_target_cpu && android64_ndk_api_level >= 23))) { defines += [ "HAVE___CXA_THREAD_ATEXIT_IMPL" ] } } configs -= [ "//build/config/compiler:chromium_code", "//build/config/compiler:no_exceptions", "//build/config/compiler:no_rtti", "//build/config/coverage:default_coverage", ] configs += [ "//build/config/compiler:no_chromium_code", "//build/config/compiler:exceptions", "//build/config/compiler:rtti", "//buildtools/third_party/libc++:config", ] # private_typeinfo.cpp implements __dynamic_cast(), which is the runtime # bit that implements dynamic_cast<>(). But ubsan's vptr check inserts # dynamic_cast<>()s, which leads to infinite recursion. So make sure we don't # pass -fsanitize=vptr. configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ] configs += [ "//build/config/sanitizers:default_sanitizer_flags_but_ubsan_vptr" ] if (export_libcxxabi_from_executables || libcxx_is_shared) { configs -= [ "//build/config/gcc:symbol_visibility_hidden" ] configs += [ "//build/config/gcc:symbol_visibility_default" ] } # libc++abi depends on libc++ internals. include_dirs = [ "//third_party/libc++/src/src" ] if (use_libcxx_modules) { configs -= [ "//build/config/compiler:libcxx_module" ] } }