diff options
author | Colin Cross <ccross@android.com> | 2017-04-13 16:56:14 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2017-04-13 16:56:14 -0700 |
commit | 4247f0d0ed57d435862d90d69de922d477ceed3b (patch) | |
tree | 86e740990fa4443913641c44df38287213a8a93d | |
parent | 1b594092566cecca885be55dd663d633d7af0ec5 (diff) | |
download | build_soong-4247f0d0ed57d435862d90d69de922d477ceed3b.tar.gz build_soong-4247f0d0ed57d435862d90d69de922d477ceed3b.tar.bz2 build_soong-4247f0d0ed57d435862d90d69de922d477ceed3b.zip |
Enable arm_on_x86 mode when arm is a secondary arch
Enable arm_on_x86 mode whenever compiling for x86 on the device,
and either arm is listed as an ABI on the x86 arch, or arm exists
as a target arch.
Bug: 35286489
Test: examine bcc cflags
Change-Id: Iebd0e7b95f584d25773a60474c27425cac7a578e
-rw-r--r-- | android/arch.go | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/android/arch.go b/android/arch.go index f9697bc1..2d0515ff 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 |