1 import("//clang/runtimes.gni")
5 libcxxabi_enable_exceptions = true
7 # Build libc++abi with definitions for operator new/delete.
8 libcxxabi_enable_new_delete_definitions = true
10 # Build libcxxabi as a shared library.
11 libcxxabi_enable_shared = true
13 # Build libcxxabi as a static library.
14 libcxxabi_enable_static = true
16 # Do not export any symbols from the static library.
17 libcxxabi_hermetic_static_library = true
21 # Make `gn format` not collapse this, for sync_source_lists_from_cmake.py.
22 "../include/cxxabi.h",
27 "cxa_aux_runtime.cpp",
28 "cxa_default_handlers.cpp",
30 "cxa_exception_storage.cpp",
37 "stdlib_exception.cpp",
38 "stdlib_stdexcept.cpp",
39 "stdlib_typeinfo.cpp",
43 "fallback_malloc.cpp",
44 "private_typeinfo.cpp",
46 if (libcxxabi_enable_new_delete_definitions) {
47 cxxabi_sources += [ "stdlib_new_delete.cpp" ]
49 if (libcxxabi_enable_exceptions) {
52 "cxa_personality.cpp",
55 cxxabi_sources += [ "cxa_noexception.cpp" ]
57 if (target_os == "linux" || target_os == "fuchsia") {
58 cxxabi_sources += [ "cxa_thread_atexit.cpp" ]
61 config("cxxabi_config") {
63 "//libcxxabi/include",
65 # Some files depend on libc++ internals.
73 "_LIBCXXABI_BUILDING_LIBRARY",
74 "_LIBCPP_BUILDING_LIBRARY",
76 if (target_os == "win") {
77 defines += [ "_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS" ]
81 if (libcxxabi_enable_shared) {
82 shared_library("cxxabi_shared") {
83 output_dir = runtimes_dir
84 output_name = "c++abi"
85 if (target_os == "linux" || target_os == "mac") {
87 ldflags = [ "-nostdlib++" ]
93 sources = cxxabi_sources
94 public = cxxabi_headers
96 "//compiler-rt/lib/builtins",
98 "//libunwind/src:unwind_shared",
100 configs += [ ":cxxabi_config" ]
102 "//llvm/utils/gn/build:no_exceptions",
103 "//llvm/utils/gn/build:no_rtti",
108 if (libcxxabi_enable_static) {
109 static_library("cxxabi_static") {
110 output_dir = runtimes_dir
111 output_name = "c++abi"
112 complete_static_lib = true
113 configs -= [ "//llvm/utils/gn/build:thin_archive" ]
114 sources = cxxabi_sources
115 public = cxxabi_headers
116 if (libcxxabi_hermetic_static_library) {
117 cflags = [ "-fvisibility=hidden" ]
118 if (libcxxabi_enable_new_delete_definitions) {
119 cflags_cc = [ "-fvisibility-global-new-delete-hidden" ]
122 "_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
123 "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
127 "//compiler-rt/lib/builtins",
129 "//libunwind/src:unwind_static",
131 configs += [ ":cxxabi_config" ]
133 "//llvm/utils/gn/build:no_exceptions",
134 "//llvm/utils/gn/build:no_rtti",
141 if (libcxxabi_enable_shared) {
142 deps += [ ":cxxabi_shared" ]
144 if (libcxxabi_enable_static) {
145 deps += [ ":cxxabi_static" ]