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
diff --git a/common/arch.go b/common/arch.go
index 02212ad..830a2ce 100644
--- a/common/arch.go
+++ b/common/arch.go
@@ -104,6 +104,8 @@
 	Target struct {
 		Host        interface{}
 		Android     interface{}
+		Android64   interface{}
+		Android32   interface{}
 		Linux       interface{}
 		Darwin      interface{}
 		Windows     interface{}
@@ -404,6 +406,28 @@
 				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
 		}