Use llvm-{strip,objcopy} by default
... except for Darwin Mach-O, as it is not supported by llvm-strip.
Test: m checkbuild
Bug: 119221035
Change-Id: I021637b6dd3530bff1f563f2ec7c2168e1083b7e
diff --git a/cc/binary.go b/cc/binary.go
index a8eb641..4794815 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -317,9 +317,9 @@
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 = binary.baseLinker.useClangLld(ctx)
+ if ctx.Darwin() {
+ builderFlags.stripUseGnuStrip = true
+ }
strippedOutputFile := outputFile
outputFile = android.PathForModuleOut(ctx, "unstripped", fileName)
binary.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
diff --git a/cc/builder.go b/cc/builder.go
index 645b3c2..6e24d56 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -255,7 +255,7 @@
stripKeepSymbols bool
stripKeepMiniDebugInfo bool
stripAddGnuDebuglink bool
- stripUseLlvmStrip bool
+ stripUseGnuStrip bool
protoDeps android.Paths
protoFlags string
@@ -821,8 +821,8 @@
if flags.stripKeepSymbols {
args += " --keep-symbols"
}
- if flags.stripUseLlvmStrip {
- args += " --use-llvm-strip"
+ if flags.stripUseGnuStrip {
+ args += " --use-gnu-strip"
}
ctx.Build(pctx, android.BuildParams{
diff --git a/cc/library.go b/cc/library.go
index 13acfae..d716ffa 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -686,9 +686,9 @@
TransformSharedObjectToToc(ctx, outputFile, tocFile, builderFlags)
if library.stripper.needsStrip(ctx) {
- // b/80093681, GNU strip/objcopy bug.
- // Use llvm-{strip,objcopy} when clang lld is used.
- builderFlags.stripUseLlvmStrip = library.baseLinker.useClangLld(ctx)
+ if ctx.Darwin() {
+ builderFlags.stripUseGnuStrip = true
+ }
strippedOutputFile := outputFile
outputFile = android.PathForModuleOut(ctx, "unstripped", fileName)
library.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)