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
This commit is contained in:
Thiébaud Weksteen
2020-08-19 14:53:01 +02:00
parent 3806fc0943
commit d458745f15
12 changed files with 82 additions and 69 deletions

View File

@@ -349,13 +349,6 @@ type builderFlags struct {
groupStaticLibs bool
stripKeepSymbols bool
stripKeepSymbolsList string
stripKeepSymbolsAndDebugFrame bool
stripKeepMiniDebugInfo bool
stripAddGnuDebuglink bool
stripUseGnuStrip bool
proto android.ProtoFlags
protoC bool
protoOptionsFile bool
@@ -363,6 +356,16 @@ type builderFlags struct {
yacc *YaccProperties
}
type StripFlags struct {
Toolchain config.Toolchain
StripKeepSymbols bool
StripKeepSymbolsList string
StripKeepSymbolsAndDebugFrame bool
StripKeepMiniDebugInfo bool
StripAddGnuDebuglink bool
StripUseGnuStrip bool
}
type Objects struct {
objFiles android.Paths
tidyFiles android.Paths
@@ -939,26 +942,26 @@ func TransformBinaryPrefixSymbols(ctx android.ModuleContext, prefix string, inpu
}
func TransformStrip(ctx android.ModuleContext, inputFile android.Path,
outputFile android.WritablePath, flags builderFlags) {
outputFile android.WritablePath, flags StripFlags) {
crossCompile := gccCmd(flags.toolchain, "")
crossCompile := gccCmd(flags.Toolchain, "")
args := ""
if flags.stripAddGnuDebuglink {
if flags.StripAddGnuDebuglink {
args += " --add-gnu-debuglink"
}
if flags.stripKeepMiniDebugInfo {
if flags.StripKeepMiniDebugInfo {
args += " --keep-mini-debug-info"
}
if flags.stripKeepSymbols {
if flags.StripKeepSymbols {
args += " --keep-symbols"
}
if flags.stripKeepSymbolsList != "" {
args += " -k" + flags.stripKeepSymbolsList
if flags.StripKeepSymbolsList != "" {
args += " -k" + flags.StripKeepSymbolsList
}
if flags.stripKeepSymbolsAndDebugFrame {
if flags.StripKeepSymbolsAndDebugFrame {
args += " --keep-symbols-and-debug-frame"
}
if flags.stripUseGnuStrip {
if flags.StripUseGnuStrip {
args += " --use-gnu-strip"
}