Support multiple crtbegin and crtend dependencies am: fe605e14ee
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1959699 Change-Id: I8565370140a3c295063cb168c4829448699d09c3
This commit is contained in:
commit
592ba33d9c
4 changed files with 18 additions and 19 deletions
|
@ -95,11 +95,11 @@ func (binary *binaryDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps {
|
|||
if ctx.toolchain().Bionic() {
|
||||
deps = bionicDeps(ctx, deps, Bool(binary.Properties.Static_executable))
|
||||
if Bool(binary.Properties.Static_executable) {
|
||||
deps.CrtBegin = "crtbegin_static"
|
||||
deps.CrtBegin = []string{"crtbegin_static"}
|
||||
} else {
|
||||
deps.CrtBegin = "crtbegin_dynamic"
|
||||
deps.CrtBegin = []string{"libc_musl_crtbegin_dynamic"}
|
||||
}
|
||||
deps.CrtEnd = "crtend_android"
|
||||
deps.CrtEnd = []string{"libc_musl_crtend"}
|
||||
}
|
||||
|
||||
return deps
|
||||
|
|
|
@ -247,9 +247,8 @@ func transformSrctoCrate(ctx ModuleContext, main android.Path, deps PathDeps, fl
|
|||
implicits = append(implicits, deps.srcProviderFiles...)
|
||||
implicits = append(implicits, deps.AfdoProfiles...)
|
||||
|
||||
if deps.CrtBegin.Valid() {
|
||||
implicits = append(implicits, deps.CrtBegin.Path(), deps.CrtEnd.Path())
|
||||
}
|
||||
implicits = append(implicits, deps.CrtBegin...)
|
||||
implicits = append(implicits, deps.CrtEnd...)
|
||||
|
||||
if len(deps.SrcDeps) > 0 {
|
||||
moduleGenDir := ctx.RustModule().compiler.CargoOutDir()
|
||||
|
@ -319,8 +318,8 @@ func transformSrctoCrate(ctx ModuleContext, main android.Path, deps PathDeps, fl
|
|||
"rustcFlags": strings.Join(rustcFlags, " "),
|
||||
"linkFlags": strings.Join(linkFlags, " "),
|
||||
"libFlags": strings.Join(libFlags, " "),
|
||||
"crtBegin": deps.CrtBegin.String(),
|
||||
"crtEnd": deps.CrtEnd.String(),
|
||||
"crtBegin": strings.Join(deps.CrtBegin.Strings(), " "),
|
||||
"crtEnd": strings.Join(deps.CrtEnd.Strings(), " "),
|
||||
"envVars": strings.Join(envVars, " "),
|
||||
},
|
||||
})
|
||||
|
|
|
@ -428,8 +428,8 @@ func (library *libraryDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps {
|
|||
|
||||
if ctx.toolchain().Bionic() && (library.dylib() || library.shared()) {
|
||||
deps = bionicDeps(ctx, deps, false)
|
||||
deps.CrtBegin = "crtbegin_so"
|
||||
deps.CrtEnd = "crtend_so"
|
||||
deps.CrtBegin = []string{"crtbegin_so"}
|
||||
deps.CrtEnd = []string{"crtend_so"}
|
||||
}
|
||||
|
||||
return deps
|
||||
|
|
18
rust/rust.go
18
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
|
||||
|
@ -1432,13 +1432,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 {
|
||||
|
|
Loading…
Reference in a new issue