aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-04-13 16:19:00 -0700
committerColin Cross <ccross@android.com>2017-04-13 16:19:34 -0700
commit1b594092566cecca885be55dd663d633d7af0ec5 (patch)
tree815aa1674e13663257f24d9881c38809a94817fd /scripts
parentce87b801ead58c18d2b9f41dfc87863d8d711417 (diff)
downloadbuild_soong-1b594092566cecca885be55dd663d633d7af0ec5.tar.gz
build_soong-1b594092566cecca885be55dd663d633d7af0ec5.tar.bz2
build_soong-1b594092566cecca885be55dd663d633d7af0ec5.zip
Make mini-debug-info stripping pass on already stripped binaries
Prebuilts may already be stripped. Instead of requiring every stripped prebuilt to be annotated with LOCAL_STRIP_MODULE := false, just make the default (mini-debug-info) pass through already-stripped modules without failing. Bug: 36793128 Test: manual Change-Id: I9aec008a867eb7df0fbba82b6dd36605dcbf6b9f
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/strip.sh26
1 files changed, 14 insertions, 12 deletions
diff --git a/scripts/strip.sh b/scripts/strip.sh
index 82249422..b9ff7413 100755
--- a/scripts/strip.sh
+++ b/scripts/strip.sh
@@ -35,18 +35,20 @@ do_strip_keep_symbols() {
}
do_strip_keep_mini_debug_info() {
- "${CROSS_COMPILE}nm" -D "${infile}" --format=posix --defined-only | awk '{ print $$1 }' | sort >"${outfile}.dynsyms"
- "${CROSS_COMPILE}nm" "${infile}" --format=posix --defined-only | awk '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D") print $$1 }' | sort > "${outfile}.funcsyms"
- comm -13 "${outfile}.dynsyms" "${outfile}.funcsyms" > "${outfile}.keep_symbols"
- "${CROSS_COMPILE}objcopy" --only-keep-debug "${infile}" "${outfile}.debug"
- "${CROSS_COMPILE}objcopy" --rename-section .debug_frame=saved_debug_frame "${outfile}.debug" "${outfile}.mini_debuginfo"
- "${CROSS_COMPILE}objcopy" -S --remove-section .gdb_index --remove-section .comment --keep-symbols="${outfile}.keep_symbols" "${outfile}.mini_debuginfo"
- "${CROSS_COMPILE}objcopy" --rename-section saved_debug_frame=.debug_frame "${outfile}.mini_debuginfo"
- "${CROSS_COMPILE}strip" --strip-all -R .comment "${infile}" -o "${outfile}.tmp"
- rm -f "${outfile}.mini_debuginfo.xz"
- xz "${outfile}.mini_debuginfo"
- "${CROSS_COMPILE}objcopy" --add-section .gnu_debugdata="${outfile}.mini_debuginfo.xz" "${outfile}.tmp"
- rm -f "${outfile}.dynsyms" "${outfile}.funcsyms" "${outfile}.keep_symbols" "${outfile}.debug" "${outfile}.mini_debuginfo.xz"
+ rm -f "${outfile}.dynsyms" "${outfile}.funcsyms" "${outfile}.keep_symbols" "${outfile}.debug" "${outfile}.mini_debuginfo" "${outfile}.mini_debuginfo.xz"
+ if "${CROSS_COMPILE}strip" --strip-all -R .comment "${infile}" -o "${outfile}.tmp"; then
+ "${CROSS_COMPILE}objcopy" --only-keep-debug "${infile}" "${outfile}.debug"
+ "${CROSS_COMPILE}nm" -D "${infile}" --format=posix --defined-only | awk '{ print $$1 }' | sort >"${outfile}.dynsyms"
+ "${CROSS_COMPILE}nm" "${infile}" --format=posix --defined-only | awk '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D") print $$1 }' | sort > "${outfile}.funcsyms"
+ comm -13 "${outfile}.dynsyms" "${outfile}.funcsyms" > "${outfile}.keep_symbols"
+ "${CROSS_COMPILE}objcopy" --rename-section .debug_frame=saved_debug_frame "${outfile}.debug" "${outfile}.mini_debuginfo"
+ "${CROSS_COMPILE}objcopy" -S --remove-section .gdb_index --remove-section .comment --keep-symbols="${outfile}.keep_symbols" "${outfile}.mini_debuginfo"
+ "${CROSS_COMPILE}objcopy" --rename-section saved_debug_frame=.debug_frame "${outfile}.mini_debuginfo"
+ xz "${outfile}.mini_debuginfo"
+ "${CROSS_COMPILE}objcopy" --add-section .gnu_debugdata="${outfile}.mini_debuginfo.xz" "${outfile}.tmp"
+ else
+ cp -f "${infile}" "${outfile}.tmp"
+ fi
}
do_add_gnu_debuglink() {