diff options
author | 2022-01-27 21:39:18 +0000 | |
---|---|---|
committer | 2022-01-27 21:39:18 +0000 | |
commit | 6bf833f4286a19dea4087ebe5abfc724e8a10be7 (patch) | |
tree | 7b756f65a3aaa56ce473658b54f28dcb5cd1b3f5 /rust/rust.go | |
parent | 1785fcb171071f97409aba4cde4fcfba39644ddb (diff) | |
parent | e32f09312019d7dea38b058cbc23dd0ea1186cf8 (diff) |
Merge changes from topic "musl_rust"
* changes:
Support building rust modules against musl libc
Support genrules as CrtBegin and CrtEnd in rust
Support multiple crtbegin and crtend dependencies
Diffstat (limited to 'rust/rust.go')
-rw-r--r-- | rust/rust.go | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/rust/rust.go b/rust/rust.go index 0f7b76823..018d1dd27 100644 --- a/rust/rust.go +++ b/rust/rust.go @@ -394,7 +394,7 @@ type Deps struct { DataLibs []string DataBins []string - CrtBegin, CrtEnd string + CrtBegin, CrtEnd []string } type PathDeps struct { @@ -421,8 +421,8 @@ type PathDeps struct { depGeneratedHeaders android.Paths depSystemIncludePaths android.Paths - CrtBegin android.OptionalPath - CrtEnd android.OptionalPath + CrtBegin android.Paths + CrtEnd android.Paths // Paths to generated source files SrcDeps android.Paths @@ -1224,9 +1224,9 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps { depPaths.depSystemIncludePaths = append(depPaths.depSystemIncludePaths, exportedInfo.SystemIncludeDirs...) depPaths.depGeneratedHeaders = append(depPaths.depGeneratedHeaders, exportedInfo.GeneratedHeaders...) case depTag == cc.CrtBeginDepTag: - depPaths.CrtBegin = linkObject + depPaths.CrtBegin = append(depPaths.CrtBegin, linkObject.Path()) case depTag == cc.CrtEndDepTag: - depPaths.CrtEnd = linkObject + depPaths.CrtEnd = append(depPaths.CrtEnd, linkObject.Path()) } // Make sure these dependencies are propagated @@ -1234,6 +1234,13 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps { lib.exportLinkDirs(linkPath) lib.exportLinkObjects(linkObject.String()) } + } else { + switch { + case depTag == cc.CrtBeginDepTag: + depPaths.CrtBegin = append(depPaths.CrtBegin, android.OutputFileForModule(ctx, dep, "")) + case depTag == cc.CrtEndDepTag: + depPaths.CrtEnd = append(depPaths.CrtEnd, android.OutputFileForModule(ctx, dep, "")) + } } if srcDep, ok := dep.(android.SourceFileProducer); ok { @@ -1432,13 +1439,13 @@ func (mod *Module) DepsMutator(actx android.BottomUpMutatorContext) { actx.AddVariationDependencies(nil, cc.HeaderDepTag(), deps.HeaderLibs...) crtVariations := cc.GetCrtVariations(ctx, mod) - if deps.CrtBegin != "" { + for _, crt := range deps.CrtBegin { actx.AddVariationDependencies(crtVariations, cc.CrtBeginDepTag, - cc.RewriteSnapshotLib(deps.CrtBegin, cc.GetSnapshot(mod, &snapshotInfo, actx).Objects)) + cc.RewriteSnapshotLib(crt, cc.GetSnapshot(mod, &snapshotInfo, actx).Objects)) } - if deps.CrtEnd != "" { + for _, crt := range deps.CrtEnd { actx.AddVariationDependencies(crtVariations, cc.CrtEndDepTag, - cc.RewriteSnapshotLib(deps.CrtEnd, cc.GetSnapshot(mod, &snapshotInfo, actx).Objects)) + cc.RewriteSnapshotLib(crt, cc.GetSnapshot(mod, &snapshotInfo, actx).Objects)) } if mod.sourceProvider != nil { |