diff options
Diffstat (limited to 'cc/builder.go')
| -rw-r--r-- | cc/builder.go | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/cc/builder.go b/cc/builder.go index f4f85962d..ed1bad2f4 100644 --- a/cc/builder.go +++ b/cc/builder.go @@ -34,6 +34,8 @@ import ( "android/soong/remoteexec" ) +//go:generate go run ../../blueprint/gobtools/codegen/gob_gen.go + const ( objectExtension = ".o" staticLibraryExtension = ".a" @@ -43,7 +45,7 @@ var ( pctx = android.NewPackageContext("android/soong/cc") // Rule to invoke gcc with given command, flags, and dependencies. Outputs a .d depfile. - cc = pctx.AndroidRemoteStaticRule("cc", android.RemoteRuleSupports{Goma: true, RBE: true}, + cc = pctx.AndroidRemoteStaticRule("cc", android.RemoteRuleSupports{RBE: true}, blueprint.RuleParams{ Depfile: "${out}.d", Deps: blueprint.DepsGCC, @@ -304,8 +306,10 @@ var ( sAbiDiff = pctx.RuleFunc("sAbiDiff", func(ctx android.PackageRuleContext) blueprint.RuleParams { commandStr := "($sAbiDiffer ${extraFlags} -lib ${libName} -arch ${arch} -o ${out} -new ${in} -old ${referenceDump})" - commandStr += "|| (echo '${errorMessage}'" - commandStr += " && (mkdir -p $$DIST_DIR/abidiffs && cp ${out} $$DIST_DIR/abidiffs/)" + commandStr += "|| (echo 'First 50 lines of abidiff:'" + commandStr += " && head -n 50 ${out}" + commandStr += " && echo '${errorMessage}'" + commandStr += " && (test -n \"$$DIST_DIR\" && mkdir -p $$DIST_DIR/abidiffs && cp ${out} ${in} $$DIST_DIR/abidiffs/)" commandStr += " && exit 1)" return blueprint.RuleParams{ Command: commandStr, @@ -345,6 +349,13 @@ var ( }, "cFlags") + // Rule to generate the elf mapping textproto file from the symbols file. + elfSymbolsToProto = pctx.AndroidStaticRule("elf_symbols_to_proto", blueprint.RuleParams{ + Command: `${symbols_map} -elf $in -write_if_changed $out`, + Restat: true, + CommandDeps: []string{"${symbols_map}"}, + }) + // Function pointer for producting staticlibs from rlibs. Corresponds to // rust.TransformRlibstoStaticlib(), initialized in soong-rust (rust/builder.go init()) // @@ -370,6 +381,8 @@ func init() { pctx.StaticVariable("relPwd", PwdPrefix()) pctx.HostBinToolVariable("SoongZipCmd", "soong_zip") + + pctx.HostBinToolVariable("symbols_map", "symbols_map") } // builderFlags contains various types of command line flags (and settings) for use in building @@ -440,6 +453,7 @@ type StripFlags struct { } // Objects is a collection of file paths corresponding to outputs for C++ related build statements. +// @auto-generate: gob type Objects struct { objFiles android.Paths tidyFiles android.Paths @@ -471,6 +485,17 @@ func (a Objects) Append(b Objects) Objects { } } +func (a Objects) Dedup() Objects { + return Objects{ + objFiles: android.FirstUniquePaths(a.objFiles), + tidyFiles: android.FirstUniquePaths(a.tidyFiles), + tidyDepFiles: android.FirstUniquePaths(a.tidyDepFiles), + coverageFiles: android.FirstUniquePaths(a.coverageFiles), + sAbiDumpFiles: android.FirstUniquePaths(a.sAbiDumpFiles), + kytheFiles: android.FirstUniquePaths(a.kytheFiles), + } +} + // Generate rules for compiling multiple .c, .cpp, or .S files to individual .o files func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles, noTidySrcs, timeoutTidySrcs android.Paths, flags builderFlags, pathDeps android.Paths, cFlagsDeps android.Paths, sharedFlags *SharedFlags) Objects { @@ -508,7 +533,7 @@ func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles, no coverageFiles = make(android.Paths, 0, len(srcObjFiles)) } var kytheFiles android.Paths - if flags.emitXrefs && ctx.Module() == ctx.PrimaryModule() { + if flags.emitXrefs && ctx.IsPrimaryModule(ctx.Module()) { kytheFiles = make(android.Paths, 0, len(srcObjFiles)) } @@ -685,7 +710,7 @@ func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles, no }) // Register post-process build statements (such as for tidy or kythe). - if emitXref && ctx.Module() == ctx.PrimaryModule() { + if emitXref && ctx.IsPrimaryModule(ctx.Module()) { kytheFile := android.ObjPathWithExt(ctx, subdir, srcFile, "kzip") ctx.Build(pctx, android.BuildParams{ Rule: kytheExtract, |
