cc: export Stripper struct
The cc stripping logic can be reused for Rust. Export the Stripper
structure for that purpose. Extract the strip-related flags from
builderFlags into StripFlags. Add the method flagsToStripFlags
(similarly to flagsToBuilderFlags).
Add the helper method disableStripping on libraryDecorator.
Test: m
Bug: 153430439
Change-Id: I11aef1abb8d498a4c1672500a7398279edf7f548
diff --git a/cc/library.go b/cc/library.go
index 1c2b1ee..92853b5 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -336,7 +336,7 @@
tocFile android.OptionalPath
flagExporter
- stripper
+ stripper Stripper
// If we're used as a whole_static_lib, our missing dependencies need
// to be given
@@ -955,13 +955,14 @@
library.tocFile = android.OptionalPathForPath(tocFile)
TransformSharedObjectToToc(ctx, outputFile, tocFile, builderFlags)
- if library.stripper.needsStrip(ctx) {
+ stripFlags := flagsToStripFlags(flags)
+ if library.stripper.NeedsStrip(ctx) {
if ctx.Darwin() {
- builderFlags.stripUseGnuStrip = true
+ stripFlags.StripUseGnuStrip = true
}
strippedOutputFile := outputFile
outputFile = android.PathForModuleOut(ctx, "unstripped", fileName)
- library.stripper.stripExecutableOrSharedLib(ctx, outputFile, strippedOutputFile, builderFlags)
+ library.stripper.StripExecutableOrSharedLib(ctx, outputFile, strippedOutputFile, stripFlags)
}
library.unstrippedOutputFile = outputFile
@@ -976,10 +977,10 @@
versionedOutputFile := android.PathForModuleOut(ctx, "versioned", fileName)
library.distFile = versionedOutputFile
- if library.stripper.needsStrip(ctx) {
+ if library.stripper.NeedsStrip(ctx) {
out := android.PathForModuleOut(ctx, "versioned-stripped", fileName)
library.distFile = out
- library.stripper.stripExecutableOrSharedLib(ctx, versionedOutputFile, out, builderFlags)
+ library.stripper.StripExecutableOrSharedLib(ctx, versionedOutputFile, out, stripFlags)
}
library.injectVersionSymbol(ctx, outputFile, versionedOutputFile)
@@ -1027,6 +1028,10 @@
return library.unstrippedOutputFile
}
+func (library *libraryDecorator) disableStripping() {
+ library.stripper.StripProperties.Strip.None = BoolPtr(true)
+}
+
func (library *libraryDecorator) nativeCoverage() bool {
if library.header() || library.buildStubs() {
return false