Copy prebuilt objects to the intermediates directory

Copy prebuilt objects to the intermediate directory so that their
output file name matches the module name.  This simplifies using
the clang crt objects, whose input names vary by architecture,
in the musl sysroot genrule.

Bug: 216192129
Test: m checkbuild
Change-Id: I467d699f718e2cc5c6bf0a5c35820dedd51c5930
This commit is contained in:
Colin Cross
2022-04-15 15:16:02 -07:00
parent 5e7455996e
commit ee02aed756

View File

@@ -510,7 +510,16 @@ var _ prebuiltLinkerInterface = (*prebuiltObjectLinker)(nil)
func (p *prebuiltObjectLinker) link(ctx ModuleContext,
flags Flags, deps PathDeps, objs Objects) android.Path {
if len(p.properties.Srcs) > 0 {
return p.Prebuilt.SingleSourcePath(ctx)
// Copy objects to a name matching the final installed name
in := p.Prebuilt.SingleSourcePath(ctx)
outputFile := android.PathForModuleOut(ctx, ctx.ModuleName()+".o")
ctx.Build(pctx, android.BuildParams{
Rule: android.CpExecutable,
Description: "prebuilt",
Output: outputFile,
Input: in,
})
return outputFile
}
return nil
}