From f8209413f152aba93520e9f0426b2d69d7058497 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 26 Mar 2015 14:44:26 -0700 Subject: [PATCH] Support target: { android64: {...}} for linker The linker and a few other executables and libraries need to know if they are a 32-bit process running on a 64-bit host. Add android64 and android32 target types to set custom cflags. Change-Id: I142378e2d5be17a87ff761257dacc1734b093048 --- common/arch.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/common/arch.go b/common/arch.go index 02212ade8..830a2ce7a 100644 --- a/common/arch.go +++ b/common/arch.go @@ -104,6 +104,8 @@ type archProperties struct { Target struct { Host interface{} Android interface{} + Android64 interface{} + Android32 interface{} Linux interface{} Darwin interface{} Windows interface{} @@ -404,6 +406,28 @@ func (a *AndroidModuleBase) setArchProperties(ctx blueprint.EarlyMutatorContext, reflect.ValueOf(a.archProperties[i].Target).FieldByName("Not_windows").Elem().Elem()) } + // Handle 64-bit device properties in the form: + // target { + // android64 { + // key: value, + // }, + // android32 { + // key: value, + // }, + // }, + // WARNING: this is probably not what you want to use in your blueprints file, it selects + // options for all targets on a device that supports 64-bit binaries, not just the targets + // that are being compiled for 64-bit. Its expected use case is binaries like linker and + // debuggerd that need to know when they are a 32-bit process running on a 64-bit device + if hod.Device() { + if true /* && target_is_64_bit */ { + extendProperties(ctx, "target", "android64", generalPropsValue, + reflect.ValueOf(a.archProperties[i].Target).FieldByName("Android64").Elem().Elem()) + } else { + extendProperties(ctx, "target", "android32", generalPropsValue, + reflect.ValueOf(a.archProperties[i].Target).FieldByName("Android32").Elem().Elem()) + } + } if ctx.Failed() { return }