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
diff --git a/cc/binary.go b/cc/binary.go
index 00fda06..04b912a 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -318,6 +318,10 @@
builderFlags := flagsToBuilderFlags(flags)
if binary.stripper.needsStrip(ctx) {
+ // b/80093681, GNU strip/objcopy bug.
+ // Use llvm-{strip,objcopy} when clang lld is used.
+ builderFlags.stripUseLlvmStrip =
+ flags.Clang && binary.baseLinker.useClangLld(ctx)
strippedOutputFile := outputFile
outputFile = android.PathForModuleOut(ctx, "unstripped", fileName)
binary.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)