Merge "Propagate flags necessary for a prebuilt of the Bionic linker." am: a6a224586b am: 7ba2203249

Change-Id: Iefeade1282ad4c0a2598cd36e56f8c5210d515ed
This commit is contained in:
Martin Stjernholm
2020-06-01 10:18:28 +00:00
committed by Automerger Merge Worker
2 changed files with 111 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ import (
"android/soong/android"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
)
func init() {
@@ -65,7 +66,15 @@ func (mt *binarySdkMemberType) IsInstance(module android.Module) bool {
}
func (mt *binarySdkMemberType) AddPrebuiltModule(ctx android.SdkMemberContext, member android.SdkMember) android.BpModule {
return ctx.SnapshotBuilder().AddPrebuiltModule(member, "cc_prebuilt_binary")
pbm := ctx.SnapshotBuilder().AddPrebuiltModule(member, "cc_prebuilt_binary")
ccModule := member.Variants()[0].(*Module)
if stl := ccModule.stl.Properties.Stl; stl != nil {
pbm.AddProperty("stl", proptools.String(stl))
}
return pbm
}
func (mt *binarySdkMemberType) CreateVariantPropertiesStruct() android.SdkMemberProperties {
@@ -105,6 +114,10 @@ type nativeBinaryInfoProperties struct {
//
// This field is exported as its contents may not be arch specific.
SystemSharedLibs []string
// Arch specific flags.
StaticExecutable bool
Nocrt bool
}
func (p *nativeBinaryInfoProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
@@ -113,6 +126,10 @@ func (p *nativeBinaryInfoProperties) PopulateFromVariant(ctx android.SdkMemberCo
p.archType = ccModule.Target().Arch.ArchType.String()
p.outputFile = getRequiredMemberOutputFile(ctx, ccModule)
binaryLinker := ccModule.linker.(*binaryDecorator)
p.StaticExecutable = binaryLinker.static()
p.Nocrt = Bool(binaryLinker.baseLinker.Properties.Nocrt)
if ccModule.linker != nil {
specifiedDeps := specifiedDeps{}
specifiedDeps = ccModule.linker.linkerSpecifiedDeps(specifiedDeps)
@@ -143,4 +160,11 @@ func (p *nativeBinaryInfoProperties) AddToPropertySet(ctx android.SdkMemberConte
if p.SystemSharedLibs != nil {
propertySet.AddPropertyWithTag("system_shared_libs", p.SystemSharedLibs, builder.SdkMemberReferencePropertyTag(false))
}
if p.StaticExecutable {
propertySet.AddProperty("static_executable", p.StaticExecutable)
}
if p.Nocrt {
propertySet.AddProperty("nocrt", p.Nocrt)
}
}