aboutsummaryrefslogtreecommitdiff
path: root/cc/builder.go
diff options
context:
space:
mode:
authormosimchah <mosimchah@gmail.com>2025-12-02 09:27:38 -0500
committermosimchah <mosimchah@gmail.com>2025-12-02 09:27:38 -0500
commitc7bade461dc55726f62997d13a48582f7c4b4655 (patch)
treeea0588da76060a2038f54f67efd046ca77634b10 /cc/builder.go
parent0f5414d19317805e8bbbe7c4db5f0fd78769bad5 (diff)
parent89d78cff8b00d3b20a90074635c3fe5a2ee49474 (diff)
Merge branch 'lineage-23.1' of https://github.com/LineageOS/android_build_soong into HEADw16.1
* 'lineage-23.1' of https://github.com/LineageOS/android_build_soong: (528 commits) Revert "install_symlink: Make symlink target configurable" Reapply "Clear as much of cc.Module as possible after GenerateBuildActions" Revert "rust: config: Fix missing CPU variant LD flags in Rust" Rename build-flag in outdir Revert^4 "cipd: Default CIPD proxy server to on, add opt-out" Convert check-vintf-all to phony with actions Create a partial implementation of check-vintf-all for soong-only Configure RBE rust pool based on build variant Revert^3 "Add sdk version check to arr" Add jdk.internal.invoke to the allowlist Make droid always depend on symbols zip Import Device and Odm skus Don't install gob_gen in Soong Remove bazel reference from run_integration_tests.sh Fix bootstrap_test.sh Don't panic in aconfig libraries when AllowMissingDependencies is set Avoid returning nil paths from PathForModuleSrc Revert "Flag controled clang version" Rework module target dependencies on required deps Revert^2 "Add sdk version check to arr" ... Change-Id: I6e9a63fa14fda917a42e426e5dcebbad7f67e1de
Diffstat (limited to 'cc/builder.go')
-rw-r--r--cc/builder.go35
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,