From ee02aed756a02600a6366d490ea2185ab3d9a7b7 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 15 Apr 2022 15:16:02 -0700 Subject: [PATCH] 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 --- cc/prebuilt.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cc/prebuilt.go b/cc/prebuilt.go index 598031914..1f9c3fe51 100644 --- a/cc/prebuilt.go +++ b/cc/prebuilt.go @@ -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 }