aboutsummaryrefslogtreecommitdiffstats
path: root/cc/builder.go
diff options
context:
space:
mode:
Diffstat (limited to 'cc/builder.go')
-rw-r--r--cc/builder.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/cc/builder.go b/cc/builder.go
index ca8bc750..10c85087 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -101,6 +101,18 @@ var (
},
"objcopyCmd", "prefix")
+ stripPath = pctx.SourcePathVariable("stripPath", "build/soong/scripts/strip.sh")
+
+ strip = pctx.StaticRule("strip",
+ blueprint.RuleParams{
+ Depfile: "${out}.d",
+ Deps: blueprint.DepsGCC,
+ Command: "CROSS_COMPILE=$crossCompile $stripPath ${args} -i ${in} -o ${out} -d ${out}.d",
+ CommandDeps: []string{"$stripPath"},
+ Description: "strip $out",
+ },
+ "args", "crossCompile")
+
copyGccLibPath = pctx.SourcePathVariable("copyGccLibPath", "build/soong/scripts/copygcclib.sh")
copyGccLib = pctx.StaticRule("copyGccLib",
@@ -138,6 +150,10 @@ type builderFlags struct {
nocrt bool
toolchain Toolchain
clang bool
+
+ stripKeepSymbols bool
+ stripKeepMiniDebugInfo bool
+ stripAddGnuDebuglink bool
}
// Generate rules for compiling multiple .c, .cpp, or .S files to individual .o files
@@ -397,6 +413,32 @@ func TransformBinaryPrefixSymbols(ctx common.AndroidModuleContext, prefix string
})
}
+func TransformStrip(ctx common.AndroidModuleContext, inputFile common.Path,
+ outputFile common.WritablePath, flags builderFlags) {
+
+ crossCompile := gccCmd(flags.toolchain, "")
+ args := ""
+ if flags.stripAddGnuDebuglink {
+ args += " --add-gnu-debuglink"
+ }
+ if flags.stripKeepMiniDebugInfo {
+ args += " --keep-mini-debug-info"
+ }
+ if flags.stripKeepSymbols {
+ args += " --keep-symbols"
+ }
+
+ ctx.ModuleBuild(pctx, common.ModuleBuildParams{
+ Rule: strip,
+ Output: outputFile,
+ Input: inputFile,
+ Args: map[string]string{
+ "crossCompile": crossCompile,
+ "args": args,
+ },
+ })
+}
+
func CopyGccLib(ctx common.AndroidModuleContext, libName string,
flags builderFlags, outputFile common.WritablePath) {