Support multiple CrtBegin and CrtEnd files

Host bionic will use multiple files for CrtBegin, make CrtBegin and
CrtEnd Paths instead of OptionalPath.

Test: go test ./build/soong/cc/...
Change-Id: Ie2e954cd87808a903617696da443009f6173e312
This commit is contained in:
Colin Cross
2021-06-11 18:00:04 -07:00
parent 009f3df380
commit c465efd5d4
4 changed files with 20 additions and 21 deletions

View File

@@ -126,7 +126,7 @@ type Deps struct {
ReexportGeneratedHeaders []string
CrtBegin, CrtEnd string
CrtBegin, CrtEnd []string
// Used for host bionic
LinkerFlagsFile string
@@ -177,7 +177,7 @@ type PathDeps struct {
ReexportedDeps android.Paths
// Paths to crt*.o files
CrtBegin, CrtEnd android.OptionalPath
CrtBegin, CrtEnd android.Paths
// Path to the file container flags to use with the linker
LinkerFlagsFile android.OptionalPath
@@ -2246,13 +2246,13 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
crtVariations := GetCrtVariations(ctx, c)
actx.AddVariationDependencies(crtVariations, objDepTag, deps.ObjFiles...)
if deps.CrtBegin != "" {
for _, crt := range deps.CrtBegin {
actx.AddVariationDependencies(crtVariations, CrtBeginDepTag,
RewriteSnapshotLib(deps.CrtBegin, GetSnapshot(c, &snapshotInfo, actx).Objects))
RewriteSnapshotLib(crt, GetSnapshot(c, &snapshotInfo, actx).Objects))
}
if deps.CrtEnd != "" {
for _, crt := range deps.CrtEnd {
actx.AddVariationDependencies(crtVariations, CrtEndDepTag,
RewriteSnapshotLib(deps.CrtEnd, GetSnapshot(c, &snapshotInfo, actx).Objects))
RewriteSnapshotLib(crt, GetSnapshot(c, &snapshotInfo, actx).Objects))
}
if deps.LinkerFlagsFile != "" {
actx.AddDependency(c, linkerFlagsDepTag, deps.LinkerFlagsFile)
@@ -2878,9 +2878,9 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
case objDepTag:
depPaths.Objs.objFiles = append(depPaths.Objs.objFiles, linkFile.Path())
case CrtBeginDepTag:
depPaths.CrtBegin = linkFile
depPaths.CrtBegin = append(depPaths.CrtBegin, linkFile.Path())
case CrtEndDepTag:
depPaths.CrtEnd = linkFile
depPaths.CrtEnd = append(depPaths.CrtEnd, linkFile.Path())
case dynamicLinkerDepTag:
depPaths.DynamicLinker = linkFile
}