Keep the debug_frame for some arm32 art libs.
For these libs:
- libart.so
- libartbase.so
- libdexfile.so
- libprofile.so
Newer clangs have become much better at optimizing code, and the
arm exidx unwind information is insufficient to properly unwind. Do not
remove the debug_frame when stripping. It is not that big in these
libraries, and it only adds about 350,000 bytes in total.
Bug: 145790995
Test: Ran this with new clang: art/test/run-test --always-clean --chroot /data/local/art-test-chroot -O --prebuild --compact-dex-level fast --interpreter --no-relocate --runtime-option -Xcheck:jni 137-cfi
Test: Verified that the shared libraries built for arm64, x86, x86_64 versions
Test: do not contain a .debug_frame but do contain symbol tables.
Change-Id: I67c39333dc5fb3c7cb84324852682225ba5ad33e
diff --git a/libartbase/Android.bp b/libartbase/Android.bp
index d8cf123..0728669 100644
--- a/libartbase/Android.bp
+++ b/libartbase/Android.bp
@@ -165,17 +165,15 @@
art_cc_library {
name: "libartbase",
- defaults: ["libartbase_defaults"],
+ defaults: [
+ "libartbase_defaults",
+ "libart_nativeunwind_defaults",
+ ],
visibility: [
// TODO(b/133140750): Clean this up.
"//packages/modules/NetworkStack/tests:__subpackages__",
],
- // Leave the symbols in the shared library so that stack unwinders can
- // produce meaningful name resolution.
- strip: {
- keep_symbols: true,
- },
shared_libs: [
"libbase",
"libziparchive",
diff --git a/libdexfile/Android.bp b/libdexfile/Android.bp
index a08f89f..2249d0a 100644
--- a/libdexfile/Android.bp
+++ b/libdexfile/Android.bp
@@ -140,12 +140,10 @@
art_cc_library {
name: "libdexfile",
- defaults: ["libdexfile_defaults"],
- // Leave the symbols in the shared library so that stack unwinders can
- // produce meaningful name resolution.
- strip: {
- keep_symbols: true,
- },
+ defaults: [
+ "libdexfile_defaults",
+ "libart_nativeunwind_defaults",
+ ],
target: {
android: {
shared_libs: [
diff --git a/libprofile/Android.bp b/libprofile/Android.bp
index 11b6576..1742a97 100644
--- a/libprofile/Android.bp
+++ b/libprofile/Android.bp
@@ -97,12 +97,10 @@
art_cc_library {
name: "libprofile",
- defaults: ["libprofile_defaults"],
- // Leave the symbols in the shared library so that stack unwinders can
- // produce meaningful name resolution.
- strip: {
- keep_symbols: true,
- },
+ defaults: [
+ "libprofile_defaults",
+ "libart_nativeunwind_defaults",
+ ],
shared_libs: [
"libbase",
"libziparchive",
diff --git a/runtime/Android.bp b/runtime/Android.bp
index 0546c69..01e2dc6 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -23,6 +23,40 @@
"-Wl,--keep-unique,__dex_debug_register_code",
]
+// These are defaults for native shared libaries that are expected to be
+// in stack traces often.
+libart_cc_defaults {
+ name: "libart_nativeunwind_defaults",
+ arch: {
+ arm: {
+ // Arm 32 bit does not produce complete exidx unwind information
+ // so keep the .debug_frame which is relatively small and does
+ // include needed unwind information.
+ // See b/132992102 and b/145790995 for details.
+ strip: {
+ keep_symbols_and_debug_frame: true,
+ },
+ },
+ // For all other architectures, leave the symbols in the shared library
+ // so that stack unwinders can produce meaningful name resolution.
+ arm64: {
+ strip: {
+ keep_symbols: true,
+ },
+ },
+ x86: {
+ strip: {
+ keep_symbols: true,
+ },
+ },
+ x86_64: {
+ strip: {
+ keep_symbols: true,
+ },
+ },
+ },
+}
+
libart_cc_defaults {
name: "libart_defaults",
defaults: ["art_defaults"],
@@ -517,12 +551,10 @@
art_cc_library {
name: "libart",
- defaults: ["libart_defaults"],
- // Leave the symbols in the shared library so that stack unwinders can
- // produce meaningful name resolution.
- strip: {
- keep_symbols: true,
- },
+ defaults: [
+ "libart_defaults",
+ "libart_nativeunwind_defaults",
+ ],
whole_static_libs: [
],
static_libs: [