Use llvm-{objcopy,strip} when clang lld is used.

* Pass LLVM_{OBJCOPY,STRIP} to makefile rules.
* strip.sh is used only in soong-only mode.
  It will use llvm-strip and  and llvm-objcopy
  when --use-llvm-strip is given.
  Keep flags of strip.sh in alphabetic order.
* Tested build/soong/scripts/build-ndk-prebuilts.sh
  by adding "UseClangLld": true, to soong.variables file.

Bug: 80093681
Test: build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: I612267304eea434c7a33cc086b27b577d5f64094
This commit is contained in:
Chih-Hung Hsieh
2018-06-04 10:37:43 -07:00
parent 38462a6881
commit 30485c920c
5 changed files with 72 additions and 14 deletions

View File

@@ -117,7 +117,7 @@ var (
blueprint.RuleParams{
Depfile: "${out}.d",
Deps: blueprint.DepsGCC,
Command: "CROSS_COMPILE=$crossCompile XZ=$xzCmd $stripPath ${args} -i ${in} -o ${out} -d ${out}.d",
Command: "CROSS_COMPILE=$crossCompile XZ=$xzCmd CLANG_BIN=${config.ClangBin} $stripPath ${args} -i ${in} -o ${out} -d ${out}.d",
CommandDeps: []string{"$stripPath", "$xzCmd"},
},
"args", "crossCompile")
@@ -266,6 +266,7 @@ type builderFlags struct {
stripKeepSymbols bool
stripKeepMiniDebugInfo bool
stripAddGnuDebuglink bool
stripUseLlvmStrip bool
}
type Objects struct {
@@ -822,6 +823,9 @@ func TransformStrip(ctx android.ModuleContext, inputFile android.Path,
if flags.stripKeepSymbols {
args += " --keep-symbols"
}
if flags.stripUseLlvmStrip {
args += " --use-llvm-strip"
}
ctx.Build(pctx, android.BuildParams{
Rule: strip,