diff --git a/android/arch.go b/android/arch.go index f9697bc15..2d0515ffa 100644 --- a/android/arch.go +++ b/android/arch.go @@ -716,17 +716,19 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) { prefix := "target.android32" a.appendProperties(ctx, genProps, targetProp, field, prefix) } - } - if arch.ArchType == X86 && hasArmAbi(arch) { - field := "Arm_on_x86" - prefix := "target.arm_on_x86" - a.appendProperties(ctx, genProps, targetProp, field, prefix) - } - if arch.ArchType == X86_64 && hasArmAbi(arch) { - field := "Arm_on_x86_64" - prefix := "target.arm_on_x86_64" - a.appendProperties(ctx, genProps, targetProp, field, prefix) + if arch.ArchType == X86 && (hasArmAbi(arch) || + hasArmAndroidArch(ctx.AConfig().Targets[Device])) { + field := "Arm_on_x86" + prefix := "target.arm_on_x86" + a.appendProperties(ctx, genProps, targetProp, field, prefix) + } + if arch.ArchType == X86_64 && (hasArmAbi(arch) || + hasArmAndroidArch(ctx.AConfig().Targets[Device])) { + field := "Arm_on_x86_64" + prefix := "target.arm_on_x86_64" + a.appendProperties(ctx, genProps, targetProp, field, prefix) + } } } } @@ -835,6 +837,16 @@ func hasArmAbi(arch Arch) bool { return false } +// hasArmArch returns true if targets has at least arm Android arch +func hasArmAndroidArch(targets []Target) bool { + for _, target := range targets { + if target.Os == Android && target.Arch.ArchType == Arm { + return true + } + } + return false +} + type archConfig struct { arch string archVariant string