| # Copyright 2023 The Cobalt Authors. All Rights Reserved. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| config("cxxabi_dependents_config") { |
| defines = [ "LIBCXXABI_USE_LLVM_UNWINDER" ] |
| } |
| |
| config("cxxabi_config") { |
| cflags = [ "-nostdinc" ] |
| |
| cflags_cc = [ |
| "-std=c++17", |
| "-nostdinc++", |
| "-fPIC", |
| "-fexceptions", |
| "-frtti", |
| "-Werror=return-type", |
| "-fvisibility-inlines-hidden", |
| "-fms-compatibility-version=19.00", |
| "-funwind-tables", |
| "-Wall", |
| "-Wextra", |
| "-Wwrite-strings", |
| "-Wshorten-64-to-32", |
| "-Wno-error", |
| "-Wno-unused-command-line-argument", |
| ] |
| |
| defines = [ |
| # This macro is used to re-enable the `set_unexpected`, `get_unexpected`, and |
| # `unexpected` functions, which were removed in C++17. |
| "_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS", |
| |
| "_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION", |
| |
| "_LIBCPP_HAS_MUSL_LIBC", |
| "_LIBCPP_HAS_THREAD_API_EXTERNAL", |
| |
| # Let the library headers know they are currently being used to build the |
| # library. |
| "_LIBCXXABI_BUILDING_LIBRARY", |
| "_LIBCPP_BUILDING_LIBRARY", |
| ] |
| |
| include_dirs = [ |
| "include", |
| "//third_party/llvm-project/libcxx/src", |
| ] |
| } |
| |
| static_library("cxxabi") { |
| sources = [ |
| "src/abort_message.cpp", |
| "src/cxa_aux_runtime.cpp", |
| "src/cxa_default_handlers.cpp", |
| "src/cxa_demangle.cpp", |
| "src/cxa_exception.cpp", |
| "src/cxa_exception_storage.cpp", |
| "src/cxa_guard.cpp", |
| "src/cxa_handlers.cpp", |
| "src/cxa_personality.cpp", |
| "src/cxa_vector.cpp", |
| "src/cxa_virtual.cpp", |
| "src/fallback_malloc.cpp", |
| "src/private_typeinfo.cpp", |
| "src/stdlib_exception.cpp", |
| "src/stdlib_new_delete.cpp", |
| "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. |
| ] |
| |
| configs += [ ":cxxabi_config" ] |
| all_dependent_configs = [ ":cxxabi_dependents_config" ] |
| |
| deps = [ "//third_party/musl:c" ] |
| } |