From eb63f76721fcc455457b67de7914224248801fd4 Mon Sep 17 00:00:00 2001 From: Yi Kong Date: Sat, 14 Sep 2019 01:39:53 -0700 Subject: [PATCH] Move strip.sh to use llvm-nm instead of GNU nm Also fix an issue with deps file introduced in ab5e5142. Now correctly depends on llvm-readelf insteaf of GNU readelf. Test: presubmit Change-Id: Id287e2844626c07917348a62820f8b5edbb22c3d --- scripts/strip.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/strip.sh b/scripts/strip.sh index 738f24d7d..f987d983e 100755 --- a/scripts/strip.sh +++ b/scripts/strip.sh @@ -82,8 +82,8 @@ do_strip_keep_mini_debug_info() { # and cannot process object files that are produced with the flag. Use # GNU objcopy instead for now. (b/141010852) "${CROSS_COMPILE}objcopy" --only-keep-debug "${infile}" "${outfile}.debug" - "${CROSS_COMPILE}nm" -D "${infile}" --format=posix --defined-only 2> /dev/null | 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" + "${CLANG_BIN}/llvm-nm" -D "${infile}" --format=posix --defined-only 2> /dev/null | awk '{ print $1 }' | sort >"${outfile}.dynsyms" + "${CLANG_BIN}/llvm-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" echo >> "${outfile}.keep_symbols" # Ensure that the keep_symbols file is not empty. "${CROSS_COMPILE}objcopy" --rename-section .debug_frame=saved_debug_frame "${outfile}.debug" "${outfile}.mini_debuginfo" @@ -196,10 +196,10 @@ mv "${outfile}.tmp" "${outfile}" cat < "${depsfile}" ${outfile}: \ ${infile} \ - ${CROSS_COMPILE}nm \ ${CROSS_COMPILE}objcopy \ - ${CROSS_COMPILE}readelf \ - ${CLANG_BIN}/llvm-strip \ - ${CLANG_BIN}/llvm-objcopy + ${CLANG_BIN}/llvm-nm \ + ${CLANG_BIN}/llvm-objcopy \ + ${CLANG_BIN}/llvm-readelf \ + ${CLANG_BIN}/llvm-strip EOF