• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
2// Copyright (C) 2014 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17cc_defaults {
18    name: "libc++abi_defaults",
19    vendor_available: true,
20    ramdisk_available: true,
21    recovery_available: true,
22    native_bridge_supported: true,
23    include_dirs: ["external/libcxx/include"],
24    local_include_dirs: ["include"],
25    export_include_dirs: ["include"],
26    cflags: [
27        "-Wall",
28        "-Werror",
29    ],
30    cppflags: [
31        "-std=c++14",
32        "-fexceptions",
33        "-Wextra",
34        "-Wno-unused-function",
35        "-Wno-implicit-fallthrough",
36        // src/cxa_demangle.cpp:2591 -Wimplicit-fallthrough
37    ],
38    sanitize: {
39        never: true,
40    },
41    stl: "none",
42    rtti: true,
43}
44
45cc_library_static {
46    name: "libc++demangle",
47    defaults: ["libc++abi_defaults"],
48    host_supported: false,
49    srcs: ["src/cxa_demangle.cpp"],
50    apex_available: [
51        "//apex_available:platform",
52        "//apex_available:anyapex",
53    ],
54    min_sdk_version: "apex_inherit",
55}
56
57cc_library_static {
58    name: "libc++abi",
59    defaults: ["libc++abi_defaults"],
60    host_supported: true,
61    srcs: [
62        "src/abort_message.cpp",
63        "src/cxa_aux_runtime.cpp",
64        "src/cxa_default_handlers.cpp",
65        "src/cxa_demangle.cpp",
66        "src/cxa_exception.cpp",
67        "src/cxa_exception_storage.cpp",
68        "src/cxa_guard.cpp",
69        "src/cxa_handlers.cpp",
70        "src/cxa_personality.cpp",
71        "src/cxa_thread_atexit.cpp",
72        "src/cxa_unexpected.cpp",
73        "src/cxa_vector.cpp",
74        "src/cxa_virtual.cpp",
75        "src/fallback_malloc.cpp",
76        "src/private_typeinfo.cpp",
77        "src/stdlib_exception.cpp",
78        "src/stdlib_new_delete.cpp",
79        "src/stdlib_stdexcept.cpp",
80        "src/stdlib_typeinfo.cpp",
81    ],
82    arch: {
83        arm: {
84            include_dirs: ["external/libunwind_llvm/include"],
85            cppflags: ["-DLIBCXXABI_USE_LLVM_UNWINDER=1"],
86        },
87        arm64: {
88            cppflags: ["-DLIBCXXABI_USE_LLVM_UNWINDER=0"],
89        },
90        mips: {
91            cppflags: ["-DLIBCXXABI_USE_LLVM_UNWINDER=0"],
92        },
93        mips64: {
94            cppflags: ["-DLIBCXXABI_USE_LLVM_UNWINDER=0"],
95        },
96        x86: {
97            cppflags: ["-DLIBCXXABI_USE_LLVM_UNWINDER=0"],
98        },
99        x86_64: {
100            cppflags: ["-DLIBCXXABI_USE_LLVM_UNWINDER=0"],
101        },
102    },
103    target: {
104        android: {
105            cppflags: ["-DHAVE___CXA_THREAD_ATEXIT_IMPL"],
106            // Packaged in libc++demangle for Android to reduce bloat.
107            exclude_srcs: ["src/cxa_demangle.cpp"],
108        },
109        darwin: {
110            // libcxxabi really doesn't like the non-LLVM assembler on Darwin
111            asflags: ["-integrated-as"],
112            cflags: [
113                "-integrated-as",
114                "-D_LIBCPP_DISABLE_AVAILABILITY",
115            ],
116            cppflags: ["-integrated-as"],
117        },
118        linux_bionic: {
119            cppflags: ["-DHAVE___CXA_THREAD_ATEXIT_IMPL"],
120            enabled: true,
121        },
122        windows: {
123            enabled: true,
124            cppflags: [
125                "-D_LIBCPP_HAS_THREAD_API_WIN32",
126                "-D_LIBCXXABI_BUILDING_LIBRARY",
127                "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
128                "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
129            ],
130            exclude_srcs: [
131                "src/cxa_thread_atexit.cpp",
132
133                // Building stdlib_new_delete.cpp in libcxxabi causes
134                // multiple-definition errors against definitions in
135                // libcxx/src/new.cpp on Windows.  This works on Linux and
136                // Android where the functions have 'weak' linkage and are
137                // discarded by the linker.
138                "src/stdlib_new_delete.cpp",
139            ],
140        },
141        windows_x86: {
142            cppflags: [
143                "-fsjlj-exceptions",
144            ],
145        },
146    },
147    apex_available: [
148        "//apex_available:platform",
149        "//apex_available:anyapex",
150    ],
151    min_sdk_version: "apex_inherit",
152}
153