BUILD.gn 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # Copyright 2015 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. import("//build/config/c++/c++.gni")
  5. source_set("libc++abi") {
  6. if (export_libcxxabi_from_executables) {
  7. visibility = [ "//build/config:executable_deps" ]
  8. } else {
  9. visibility = [ "//buildtools/third_party/libc++" ]
  10. }
  11. # Fuchsia builds don't link against any libraries that provide stack
  12. # unwinding symbols, unlike Linux does with glibc (same applies for Android).
  13. # Build and link against libunwind manually to get this functionality.
  14. if (is_fuchsia || is_android) {
  15. deps = [ "//buildtools/third_party/libunwind" ]
  16. }
  17. sources = [
  18. "trunk/src/abort_message.cpp",
  19. "trunk/src/cxa_aux_runtime.cpp",
  20. "trunk/src/cxa_default_handlers.cpp",
  21. "trunk/src/cxa_exception.cpp",
  22. "trunk/src/cxa_exception_storage.cpp",
  23. "trunk/src/cxa_handlers.cpp",
  24. # This file is supposed to be used in fno-exception builds of
  25. # libc++abi. We build lib++/libc++abi with exceptions enabled.
  26. #"trunk/src/cxa_noexception.cpp",
  27. "trunk/src/cxa_personality.cpp",
  28. "trunk/src/cxa_vector.cpp",
  29. "trunk/src/cxa_virtual.cpp",
  30. "trunk/src/fallback_malloc.cpp",
  31. "trunk/src/private_typeinfo.cpp",
  32. "trunk/src/stdlib_exception.cpp",
  33. "trunk/src/stdlib_stdexcept.cpp",
  34. "trunk/src/stdlib_typeinfo.cpp",
  35. ]
  36. if (!is_tsan) {
  37. sources += [ "trunk/src/cxa_guard.cpp" ]
  38. }
  39. # See the comment in cxa_demangle_stub.cc for why we don't use LLVM's
  40. # demangler on android.
  41. # TODO(thakis): Switch to building with LIBCXXABI_NON_DEMANGLING_TERMINATE
  42. # defined instead.
  43. if (is_android) {
  44. sources += [ "cxa_demangle_stub.cc" ]
  45. } else {
  46. sources += [ "trunk/src/cxa_demangle.cpp" ]
  47. }
  48. if (is_fuchsia || (is_posix && !is_apple)) {
  49. sources += [ "trunk/src/cxa_thread_atexit.cpp" ]
  50. }
  51. defines = [
  52. "LIBCXXABI_SILENT_TERMINATE",
  53. # TODO(crbug.com/1298070) _LIBCPP_CONSTINIT is defined in a libc++ revision
  54. # more recent than the one currently used in Chromium.
  55. "_LIBCPP_CONSTINIT=constinit",
  56. ]
  57. configs -= [
  58. "//build/config/compiler:chromium_code",
  59. "//build/config/compiler:no_exceptions",
  60. "//build/config/compiler:no_rtti",
  61. "//build/config/coverage:default_coverage",
  62. ]
  63. configs += [
  64. "//build/config/compiler:no_chromium_code",
  65. "//build/config/compiler:exceptions",
  66. "//build/config/compiler:rtti",
  67. "//buildtools/third_party/libc++:config",
  68. ]
  69. # private_typeinfo.cpp implements __dynamic_cast(), which is the runtime
  70. # bit that implements dynamic_cast<>(). But ubsan's vptr check inserts
  71. # dynamic_cast<>()s, which leads to infinite recursion. So make sure we don't
  72. # pass -fsanitize=vptr.
  73. configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ]
  74. configs +=
  75. [ "//build/config/sanitizers:default_sanitizer_flags_but_ubsan_vptr" ]
  76. if (export_libcxxabi_from_executables || libcxx_is_shared) {
  77. configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
  78. configs += [ "//build/config/gcc:symbol_visibility_default" ]
  79. }
  80. # libc++abi depends on libc++ internals.
  81. include_dirs = [ "../libc++/trunk/src" ]
  82. }