Merge "Revert "Use --dependency-file when linking elf files.""

This commit is contained in:
Colin Cross 2022-06-03 16:53:54 +00:00 committed by Gerrit Code Review
commit b914e7f8c6

View file

@ -855,24 +855,13 @@ func transformObjToDynamicBinary(ctx android.ModuleContext,
deps = append(deps, crtBegin...)
deps = append(deps, crtEnd...)
var depFile android.WritablePath
var depFileLdFlags string
depsType := blueprint.DepsNone
if !ctx.Windows() && !ctx.Darwin() {
// lld only supports --dependency-file for elf files
depFile = outputFile.ReplaceExtension(ctx, "d")
depFileLdFlags = " -Wl,--dependency-file=" + depFile.String()
depsType = blueprint.DepsGCC
implicitOutputs = append(implicitOutputs, depFile)
}
rule := ld
args := map[string]string{
"ldCmd": ldCmd,
"crtBegin": strings.Join(crtBegin.Strings(), " "),
"libFlags": strings.Join(libFlagsList, " "),
"extraLibFlags": flags.extraLibFlags,
"ldFlags": flags.globalLdFlags + " " + flags.localLdFlags + depFileLdFlags,
"ldFlags": flags.globalLdFlags + " " + flags.localLdFlags,
"crtEnd": strings.Join(crtEnd.Strings(), " "),
}
if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_CXX_LINKS") {
@ -883,8 +872,6 @@ func transformObjToDynamicBinary(ctx android.ModuleContext,
ctx.Build(pctx, android.BuildParams{
Rule: rule,
Deps: depsType,
Depfile: depFile,
Description: "link " + outputFile.Base(),
Output: outputFile,
ImplicitOutputs: implicitOutputs,
@ -1041,33 +1028,18 @@ func transformObjsToObj(ctx android.ModuleContext, objFiles android.Paths,
ldCmd := "${config.ClangBin}/clang++"
var implicitOutputs android.WritablePaths
var depFile android.WritablePath
var depFileLdFlags string
depsType := blueprint.DepsNone
if !ctx.Windows() && !ctx.Darwin() {
// lld only supports --dependency-file for elf files
depFile = outputFile.ReplaceExtension(ctx, "d")
depFileLdFlags = " -Wl,--dependency-file=" + depFile.String()
depsType = blueprint.DepsGCC
implicitOutputs = append(implicitOutputs, depFile)
}
rule := partialLd
args := map[string]string{
"ldCmd": ldCmd,
"ldFlags": flags.globalLdFlags + " " + flags.localLdFlags + depFileLdFlags,
"ldFlags": flags.globalLdFlags + " " + flags.localLdFlags,
}
if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_CXX_LINKS") {
rule = partialLdRE
args["inCommaList"] = strings.Join(objFiles.Strings(), ",")
args["implicitInputs"] = strings.Join(deps.Strings(), ",")
args["implicitOutputs"] = strings.Join(implicitOutputs.Strings(), ",")
}
ctx.Build(pctx, android.BuildParams{
Rule: rule,
Deps: depsType,
Depfile: depFile,
Description: "link " + outputFile.Base(),
Output: outputFile,
Inputs: objFiles,