Keep .debug_frame on arm 32.
The arm exidx unwind information can be sparse and clang is producing
functions that cannot be properly represented. The .debug_frame includes
extra unwind information that covers the cases that are not complete, so
do not remove it. For example, the __strchr_chk function has a push
in the middle of the function, so any crash before that instruction will
not unwind properly.
This does increase the size of libc.so, but only by about 80,000 bytes.
Bug: 132992102
Test: Verified the .debug_frame exists in libc.so only for arm32.
Test: Used the unwind_reg_info to verify that __str_chk gets proper
Test: unwind info. Also use unwind_reg_info on some assembler functions
Test: to make sure that there is no overlapping information.
Change-Id: If9a6de15b3adf08a93c4563da8c89846e4dd059b
diff --git a/libc/Android.bp b/libc/Android.bp
index 1da7262..57d4039 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -1582,12 +1582,6 @@
"tz_version", // Version metadata for tzdata to help debugging.
],
- // Leave the symbols in the shared library so that stack unwinders can produce
- // meaningful name resolution.
- strip: {
- keep_symbols: true,
- },
-
// Do not pack libc.so relocations; see http://b/20645321 for details.
pack_relocations: false,
@@ -1628,9 +1622,23 @@
static: {
srcs: [":libc_sources_static_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 for details.
+ strip: {
+ keep_symbols_and_debug_frame: true,
+ },
},
arm64: {
version_script: ":libc.arm64.map",
+
+ // Leave the symbols in the shared library so that stack unwinders can produce
+ // meaningful name resolution.
+ strip: {
+ keep_symbols: true,
+ },
},
x86: {
// TODO: This is to work around b/24465209. Remove after root cause is fixed.
@@ -1638,9 +1646,21 @@
ldflags: ["-Wl,--hash-style=both"],
version_script: ":libc.x86.map",
+
+ // Leave the symbols in the shared library so that stack unwinders can produce
+ // meaningful name resolution.
+ strip: {
+ keep_symbols: true,
+ },
},
x86_64: {
version_script: ":libc.x86_64.map",
+
+ // Leave the symbols in the shared library so that stack unwinders can produce
+ // meaningful name resolution.
+ strip: {
+ keep_symbols: true,
+ },
},
},