From bb2e2b7d7f7a081725c0b14b5f025620d4e25004 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 8 Dec 2016 17:23:53 -0800 Subject: [PATCH] Support arm_on_x86 properties Allow Android.bp files to set properties when an x86 device supports arm abis. Test: lunch aosp_fugu-userdebug && mmma -j frameworks/compile/libbcc Change-Id: Ic142a3f93175924a826dea9908b2e5183a486184 --- android/arch.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/android/arch.go b/android/arch.go index 0cd491638..a06173085 100644 --- a/android/arch.go +++ b/android/arch.go @@ -444,6 +444,8 @@ func createArchType(props reflect.Type) reflect.Type { "Android64", "Android32", "Not_windows", + "Arm_on_x86", + "Arm_on_x86_64", } for _, os := range osTypeList { targets = append(targets, os.Field) @@ -712,6 +714,17 @@ func (a *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) { 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) + } } } @@ -805,6 +818,16 @@ func decodeTargetProductVariables(config *config) (map[OsClass][]Target, error) return targets, nil } +// hasArmAbi returns true if arch has at least one arm ABI +func hasArmAbi(arch Arch) bool { + for _, abi := range arch.Abi { + if strings.HasPrefix(abi, "arm") { + return true + } + } + return false +} + type archConfig struct { arch string archVariant string