diff options
author | Victor Khimenko <khim@google.com> | 2018-03-21 20:30:54 +0100 |
---|---|---|
committer | Victor Khimenko <khim@google.com> | 2018-03-27 20:06:00 +0200 |
commit | b11219db8707f2420685f79c39768546737fc463 (patch) | |
tree | 3ce48bda1213aea8a47e1af22fd7987ebfe1a4a4 | |
parent | f65a99cee1a7ba7dce59a3a83c0526a2c3ef83d9 (diff) | |
download | build_soong-b11219db8707f2420685f79c39768546737fc463.tar.gz build_soong-b11219db8707f2420685f79c39768546737fc463.tar.bz2 build_soong-b11219db8707f2420685f79c39768546737fc463.zip |
Make arm_on_x86 symmetric
We only define arm_on_x86 in the x86 code, but sometimes arm code needs
to know that it's working in the emulated mode, too.
Test: CtsRsCppTestCases
Bug: b/75971275
Change-Id: I99564fbe9aeb284e2f11ffb593b18536a7755ea5
(cherry picked from commit 5eb8ec1e72990ed73bc5986bb85b8209673ccb0b)
-rw-r--r-- | android/arch.go | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/android/arch.go b/android/arch.go index 6ab184f3..fd80eecd 100644 --- a/android/arch.go +++ b/android/arch.go @@ -784,14 +784,18 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) { a.appendProperties(ctx, genProps, targetProp, field, prefix) } - if arch.ArchType == X86 && (hasArmAbi(arch) || - hasArmAndroidArch(ctx.Config().Targets[Device])) { + if (arch.ArchType == X86 && (hasArmAbi(arch) || + hasArmAndroidArch(ctx.Config().Targets[Device]))) || + (arch.ArchType == Arm && + hasX86AndroidArch(ctx.Config().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.Config().Targets[Device])) { + if (arch.ArchType == X86_64 && (hasArmAbi(arch) || + hasArmAndroidArch(ctx.Config().Targets[Device]))) || + (arch.ArchType == Arm && + hasX8664AndroidArch(ctx.Config().Targets[Device])) { field := "Arm_on_x86_64" prefix := "target.arm_on_x86_64" a.appendProperties(ctx, genProps, targetProp, field, prefix) @@ -914,6 +918,26 @@ func hasArmAndroidArch(targets []Target) bool { return false } +// hasX86Arch returns true if targets has at least x86 Android arch +func hasX86AndroidArch(targets []Target) bool { + for _, target := range targets { + if target.Os == Android && target.Arch.ArchType == X86 { + return true + } + } + return false +} + +// hasX8664Arch returns true if targets has at least x86_64 Android arch +func hasX8664AndroidArch(targets []Target) bool { + for _, target := range targets { + if target.Os == Android && target.Arch.ArchType == X86_64 { + return true + } + } + return false +} + type archConfig struct { arch string archVariant string |