Allow strip.sh --keep-mini-debug-info to work on non-elf files

strip.sh --keep-mini-debug-info matches the default for Make, and
is currently used on lots of files that are not elf files.  For
now, just make the behavior match Make and skip files when
strip --strip-all fails.

Bug: 113936524
Test: m checkbuild
Change-Id: I3648c914c0fd7cc9b68aa93fd3cb0b77504d42f6
This commit is contained in:
Colin Cross
2018-09-05 13:14:09 -07:00
parent f843290eb8
commit 02b04bb299

View File

@@ -71,12 +71,13 @@ do_strip_keep_symbols() {
do_strip_keep_mini_debug_info() {
rm -f "${outfile}.dynsyms" "${outfile}.funcsyms" "${outfile}.keep_symbols" "${outfile}.debug" "${outfile}.mini_debuginfo" "${outfile}.mini_debuginfo.xz"
local fail=
if [ ! -z "${use_llvm_strip}" ]; then
"${CLANG_BIN}/llvm-strip" --strip-all -keep=.ARM.attributes -remove-section=.comment "${infile}" "${outfile}.tmp"
"${CLANG_BIN}/llvm-strip" --strip-all -keep=.ARM.attributes -remove-section=.comment "${infile}" "${outfile}.tmp" || fail=true
else
"${CROSS_COMPILE}strip" --strip-all -R .comment "${infile}" -o "${outfile}.tmp"
"${CROSS_COMPILE}strip" --strip-all -R .comment "${infile}" -o "${outfile}.tmp" || fail=true
fi
if [ "$?" == "0" ]; then
if [ -z $fail ]; then
# Current prebult llvm-objcopy does not support the following flags:
# --only-keep-debug --rename-section --keep-symbols
# For the following use cases, ${CROSS_COMPILE}objcopy does fine with lld linked files,