Add implicit outputs to link actions
Change-Id: I9b6ae97f5bbfe8f9c4b9c089544a768982794f32
Bug: b/154733231
Test: Built the failing action with / without this change
diff --git a/cc/builder.go b/cc/builder.go
index a16d51f..2bedd9c 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -71,10 +71,10 @@
ExecStrategy: "${config.RECXXLinksExecStrategy}",
Inputs: []string{"${out}.rsp"},
RSPFile: "${out}.rsp",
- OutputFiles: []string{"${out}"},
+ OutputFiles: []string{"${out}", "$implicitOutputs"},
ToolchainInputs: []string{"$ldCmd"},
Platform: map[string]string{remoteexec.PoolKey: "${config.RECXXLinksPool}"},
- }, []string{"ldCmd", "crtBegin", "libFlags", "crtEnd", "ldFlags", "extraLibFlags"}, nil)
+ }, []string{"ldCmd", "crtBegin", "libFlags", "crtEnd", "ldFlags", "extraLibFlags"}, []string{"implicitOutputs"})
partialLd, partialLdRE = remoteexec.StaticRules(pctx, "partialLd",
blueprint.RuleParams{
@@ -83,13 +83,12 @@
Command: "$reTemplate$ldCmd -fuse-ld=lld -nostdlib -no-pie -Wl,-r ${in} -o ${out} ${ldFlags}",
CommandDeps: []string{"$ldCmd"},
}, &remoteexec.REParams{
- Labels: map[string]string{"type": "link", "tool": "clang"},
- ExecStrategy: "${config.RECXXLinksExecStrategy}",
- Inputs: []string{"$inCommaList"},
- OutputFiles: []string{"${out}"},
+ Labels: map[string]string{"type": "link", "tool": "clang"},
+ ExecStrategy: "${config.RECXXLinksExecStrategy}", Inputs: []string{"$inCommaList"},
+ OutputFiles: []string{"${out}", "$implicitOutputs"},
ToolchainInputs: []string{"$ldCmd"},
Platform: map[string]string{remoteexec.PoolKey: "${config.RECXXLinksPool}"},
- }, []string{"ldCmd", "ldFlags"}, []string{"inCommaList"})
+ }, []string{"ldCmd", "ldFlags"}, []string{"inCommaList", "implicitOutputs"})
ar = pctx.AndroidStaticRule("ar",
blueprint.RuleParams{
@@ -676,8 +675,17 @@
}
rule := ld
+ args := map[string]string{
+ "ldCmd": ldCmd,
+ "crtBegin": crtBegin.String(),
+ "libFlags": strings.Join(libFlagsList, " "),
+ "extraLibFlags": flags.extraLibFlags,
+ "ldFlags": flags.globalLdFlags + " " + flags.localLdFlags,
+ "crtEnd": crtEnd.String(),
+ }
if ctx.Config().IsEnvTrue("RBE_CXX_LINKS") {
rule = ldRE
+ args["implicitOutputs"] = strings.Join(implicitOutputs.Strings(), ",")
}
ctx.Build(pctx, android.BuildParams{
@@ -687,14 +695,7 @@
ImplicitOutputs: implicitOutputs,
Inputs: objFiles,
Implicits: deps,
- Args: map[string]string{
- "ldCmd": ldCmd,
- "crtBegin": crtBegin.String(),
- "libFlags": strings.Join(libFlagsList, " "),
- "extraLibFlags": flags.extraLibFlags,
- "ldFlags": flags.globalLdFlags + " " + flags.localLdFlags,
- "crtEnd": crtEnd.String(),
- },
+ Args: args,
})
}