summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2019-08-21 17:35:33 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-08-21 17:35:33 -0700
commit7620b304ac4d831c32280cd5422f5f78fa71d8b8 (patch)
tree38cde15dbf7655c858ee9812716e5b47bc144622
parent955523e0b37efddb4b1c0976ea2aab739875bcef (diff)
parent8920c61b6bfd666e1c45c1f2b8a2ebc3400db648 (diff)
downloadlibcxxabi-7620b304ac4d831c32280cd5422f5f78fa71d8b8.tar.gz
Move the demangler into its own library. am: 8144d214ae
am: 8920c61b6b Change-Id: I45e3c761ac4b96b6d19efcada37f5709f6ead946
-rw-r--r--Android.bp61
-rw-r--r--src/cxa_default_handlers.cpp4
2 files changed, 41 insertions, 24 deletions
diff --git a/Android.bp b/Android.bp
index 157963d..cb14814 100644
--- a/Android.bp
+++ b/Android.bp
@@ -14,12 +14,44 @@
// limitations under the License.
//
-cc_library_static {
- name: "libc++abi",
- host_supported: true,
+cc_defaults {
+ name: "libc++abi_defaults",
vendor_available: true,
recovery_available: true,
native_bridge_supported: true,
+ include_dirs: ["external/libcxx/include"],
+ local_include_dirs: ["include"],
+ export_include_dirs: ["include"],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+ cppflags: [
+ "-std=c++14",
+ "-fexceptions",
+ "-Wextra",
+ "-Wno-unused-function",
+ "-Wno-implicit-fallthrough",
+ // src/cxa_demangle.cpp:2591 -Wimplicit-fallthrough
+ ],
+ sanitize: {
+ never: true,
+ },
+ stl: "none",
+ rtti: true,
+}
+
+cc_library_static {
+ name: "libc++demangle",
+ defaults: ["libc++abi_defaults"],
+ host_supported: false,
+ srcs: ["src/cxa_demangle.cpp"],
+}
+
+cc_library_static {
+ name: "libc++abi",
+ defaults: ["libc++abi_defaults"],
+ host_supported: true,
srcs: [
"src/abort_message.cpp",
"src/cxa_aux_runtime.cpp",
@@ -41,26 +73,6 @@ cc_library_static {
"src/stdlib_stdexcept.cpp",
"src/stdlib_typeinfo.cpp",
],
- include_dirs: ["external/libcxx/include"],
- local_include_dirs: ["include"],
- export_include_dirs: ["include"],
- cflags: [
- "-Wall",
- "-Werror",
- ],
- cppflags: [
- "-std=c++14",
- "-fexceptions",
- "-Wextra",
- "-Wno-unused-function",
- "-Wno-implicit-fallthrough",
- // src/cxa_demangle.cpp:2591 -Wimplicit-fallthrough
- ],
- sanitize: {
- never: true,
- },
- stl: "none",
- rtti: true,
arch: {
arm: {
include_dirs: ["external/libunwind_llvm/include"],
@@ -85,6 +97,8 @@ cc_library_static {
target: {
android: {
cppflags: ["-DHAVE___CXA_THREAD_ATEXIT_IMPL"],
+ // Packaged in libc++demangle for Android to reduce bloat.
+ exclude_srcs: ["src/cxa_demangle.cpp"],
},
darwin: {
// libcxxabi really doesn't like the non-LLVM assembler on Darwin
@@ -121,5 +135,4 @@ cc_library_static {
],
}
},
-
}
diff --git a/src/cxa_default_handlers.cpp b/src/cxa_default_handlers.cpp
index f00e959..3dbde8d 100644
--- a/src/cxa_default_handlers.cpp
+++ b/src/cxa_default_handlers.cpp
@@ -45,6 +45,7 @@ static void demangling_terminate_handler()
exception_header + 1;
const __shim_type_info* thrown_type =
static_cast<const __shim_type_info*>(exception_header->exceptionType);
+#if !defined(__ANDROID__)
// Try to get demangled name of thrown_type
int status;
char buf[1024];
@@ -52,6 +53,9 @@ static void demangling_terminate_handler()
const char* name = __cxa_demangle(thrown_type->name(), buf, &len, &status);
if (status != 0)
name = thrown_type->name();
+#else
+ const char* name = thrown_type->name();
+#endif
// If the uncaught exception can be caught with std::exception&
const __shim_type_info* catch_type =
static_cast<const __shim_type_info*>(&typeid(std::exception));