blob: 91839cc154512cf4f4f4aee6c37e6beed37bc567 [file] [log] [blame]
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/c++/c++.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 (is_fuchsia || is_android) {
deps = [ "//buildtools/third_party/libunwind" ]
}
sources = [
"trunk/src/abort_message.cpp",
"trunk/src/cxa_aux_runtime.cpp",
"trunk/src/cxa_default_handlers.cpp",
"trunk/src/cxa_exception.cpp",
"trunk/src/cxa_exception_storage.cpp",
"trunk/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.
#"trunk/src/cxa_noexception.cpp",
"trunk/src/cxa_personality.cpp",
"trunk/src/cxa_vector.cpp",
"trunk/src/cxa_virtual.cpp",
"trunk/src/fallback_malloc.cpp",
"trunk/src/private_typeinfo.cpp",
"trunk/src/stdlib_exception.cpp",
"trunk/src/stdlib_stdexcept.cpp",
"trunk/src/stdlib_typeinfo.cpp",
]
if (!is_tsan) {
sources += [ "trunk/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 += [ "trunk/src/cxa_demangle.cpp" ]
}
if (is_fuchsia || (is_posix && !is_apple)) {
sources += [ "trunk/src/cxa_thread_atexit.cpp" ]
}
defines = [
"LIBCXXABI_SILENT_TERMINATE",
"_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS",
# TODO(crbug.com/1298070) _LIBCPP_CONSTINIT is defined in a libc++ revision
# more recent than the one currently used in Chromium.
"_LIBCPP_CONSTINIT=constinit",
]
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 = [ "../libc++/trunk/src" ]
}