Fix binaries and symlinks for prefer32
Track the primary architecture selected for each class based on the
module's multilib setting and the global config. Fixes building
binaries with multlib set to first and DevicePrefer32BitExecutables set,
and fixes symlinks to binaries with multilib set to prefer32.
Bug: 31452121
Test: mmma -j art HOST_PREFER_32_BIT=true
Change-Id: I75094df42f3273f6d613e4058eaa565957174c28
diff --git a/android/module.go b/android/module.go
index 8c48bd3..d3f2383 100644
--- a/android/module.go
+++ b/android/module.go
@@ -57,6 +57,7 @@
type androidBaseContext interface {
Target() Target
+ TargetPrimary() bool
Arch() Arch
Os() OsType
Host() bool
@@ -145,7 +146,8 @@
Required []string
// Set by TargetMutator
- CompileTarget Target `blueprint:"mutated"`
+ CompileTarget Target `blueprint:"mutated"`
+ CompilePrimary bool `blueprint:"mutated"`
// Set by InitAndroidModule
HostOrDeviceSupported HostOrDeviceSupported `blueprint:"mutated"`
@@ -282,14 +284,19 @@
return a
}
-func (a *ModuleBase) SetTarget(target Target) {
+func (a *ModuleBase) SetTarget(target Target, primary bool) {
a.commonProperties.CompileTarget = target
+ a.commonProperties.CompilePrimary = primary
}
func (a *ModuleBase) Target() Target {
return a.commonProperties.CompileTarget
}
+func (a *ModuleBase) TargetPrimary() bool {
+ return a.commonProperties.CompilePrimary
+}
+
func (a *ModuleBase) Os() OsType {
return a.Target().Os
}
@@ -420,8 +427,9 @@
func (a *ModuleBase) androidBaseContextFactory(ctx blueprint.BaseModuleContext) androidBaseContextImpl {
return androidBaseContextImpl{
- target: a.commonProperties.CompileTarget,
- config: ctx.Config().(Config),
+ target: a.commonProperties.CompileTarget,
+ targetPrimary: a.commonProperties.CompilePrimary,
+ config: ctx.Config().(Config),
}
}
@@ -454,9 +462,10 @@
}
type androidBaseContextImpl struct {
- target Target
- debug bool
- config Config
+ target Target
+ targetPrimary bool
+ debug bool
+ config Config
}
type androidModuleContext struct {
@@ -536,6 +545,10 @@
return a.target
}
+func (a *androidBaseContextImpl) TargetPrimary() bool {
+ return a.targetPrimary
+}
+
func (a *androidBaseContextImpl) Arch() Arch {
return a.target.Arch
}