From 8fec83a8b965b5a2e32149c5d6ae38f98b46e6c7 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Fri, 9 Mar 2018 10:47:52 -0800 Subject: [PATCH] Use xz prebuilt Instead of whichever xz happens to be on the PATH. Bug: 36130900 Test: prebuilts/build-tools/build-prebuilts.sh Change-Id: Ic9b66062ca7947f0eca9d839c0864da492d4ef71 --- cc/builder.go | 5 +++-- scripts/strip.sh | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cc/builder.go b/cc/builder.go index 59a8cc8af..372c5317f 100644 --- a/cc/builder.go +++ b/cc/builder.go @@ -109,13 +109,14 @@ var ( "objcopyCmd", "prefix") _ = pctx.SourcePathVariable("stripPath", "build/soong/scripts/strip.sh") + _ = pctx.SourcePathVariable("xzCmd", "prebuilts/build-tools/${config.HostPrebuiltTag}/bin/xz") strip = pctx.AndroidStaticRule("strip", blueprint.RuleParams{ Depfile: "${out}.d", Deps: blueprint.DepsGCC, - Command: "CROSS_COMPILE=$crossCompile $stripPath ${args} -i ${in} -o ${out} -d ${out}.d", - CommandDeps: []string{"$stripPath"}, + Command: "CROSS_COMPILE=$crossCompile XZ=$xzCmd $stripPath ${args} -i ${in} -o ${out} -d ${out}.d", + CommandDeps: []string{"$stripPath", "$xzCmd"}, }, "args", "crossCompile") diff --git a/scripts/strip.sh b/scripts/strip.sh index 848fe8d42..ff8aaa03e 100755 --- a/scripts/strip.sh +++ b/scripts/strip.sh @@ -18,6 +18,7 @@ # Inputs: # Environment: # CROSS_COMPILE: prefix added to readelf, objcopy tools +# XZ: path to the xz binary # Arguments: # -i ${file}: input file (required) # -o ${file}: output file (required) @@ -58,7 +59,7 @@ do_strip_keep_mini_debug_info() { "${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" + "${XZ}" "${outfile}.mini_debuginfo" "${CROSS_COMPILE}objcopy" --add-section .gnu_debugdata="${outfile}.mini_debuginfo.xz" "${outfile}.tmp" else cp -f "${infile}" "${outfile}.tmp"