From a0119f8754fa22c34feed4c7422344a55ce408bd Mon Sep 17 00:00:00 2001 From: Yi Kong Date: Tue, 3 Sep 2019 13:44:54 -0700 Subject: [PATCH] Create libgcc_stripped with llvm-objcopy llvm-objcopy now implements '--regex' option, which allows it to replace GNU objcopy for creating libgcc_stripped archieve. Test: build Bug: 131631155 Change-Id: Ie1733ac8e9b3765f7652a562406dcedb4735cc1a --- Android.bp | 2 -- scripts/strip.sh | 18 +++++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Android.bp b/Android.bp index d63921a63..537b58b46 100644 --- a/Android.bp +++ b/Android.bp @@ -602,7 +602,6 @@ toolchain_library { "__gnu_unwind_execute", "__gnu_unwind_frame", ], - use_gnu_strip: true, }, }, arm64: { @@ -650,7 +649,6 @@ toolchain_library { "__register_frame_info_table_bases", "__register_frame_table", ], - use_gnu_strip: true, }, } diff --git a/scripts/strip.sh b/scripts/strip.sh index 4a1ed3f0e..43627469e 100755 --- a/scripts/strip.sh +++ b/scripts/strip.sh @@ -84,17 +84,17 @@ do_strip_keep_symbols() { } do_strip_keep_symbol_list() { - if [ -z "${use_gnu_strip}" ]; then - echo "do_strip_keep_symbol_list does not work with llvm-objcopy" - echo "http://b/131631155" - usage - fi - echo "${symbols_to_keep}" | tr ',' '\n' > "${outfile}.symbolList" - KEEP_SYMBOLS="-w --strip-unneeded-symbol=* --keep-symbols=" - KEEP_SYMBOLS+="${outfile}.symbolList" - "${CROSS_COMPILE}objcopy" "${infile}" "${outfile}.tmp" ${KEEP_SYMBOLS} + if [ -z "${use_gnu_strip}" ]; then + KEEP_SYMBOLS="--strip-unneeded-symbol=.* --keep-symbols=" + KEEP_SYMBOLS+="${outfile}.symbolList" + "${CLANG_BIN}/llvm-objcopy" --regex "${infile}" "${outfile}.tmp" ${KEEP_SYMBOLS} + else + KEEP_SYMBOLS="--strip-unneeded-symbol=* --keep-symbols=" + KEEP_SYMBOLS+="${outfile}.symbolList" + "${CROSS_COMPILE}objcopy" -w "${infile}" "${outfile}.tmp" ${KEEP_SYMBOLS} + fi } do_strip_keep_mini_debug_info() {