From 1aa45b083e4a456d893183ce1a645fdad821fd8f Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 10 Feb 2022 10:33:10 -0800 Subject: [PATCH] Add musl_ and glibc_ properties Add musl_ and glibc_ properties similar to bionic_. Bug: 215802826 Test: m checkbuild Change-Id: Icfc42ad7b54ee1052f84a46b7c0acffb0a27b236 --- android/arch.go | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/android/arch.go b/android/arch.go index 96a4cbf09..a719cf3f5 100644 --- a/android/arch.go +++ b/android/arch.go @@ -917,7 +917,8 @@ func createArchPropTypeDesc(props reflect.Type) []archPropTypeDesc { for _, archType := range osArchTypeMap[os] { targets = append(targets, GetCompoundTargetField(os, archType)) - // Also add the special "linux_" and "bionic_" property structs. + // Also add the special "linux_", "bionic_" , "glibc_", and + // "musl_" property structs. if os.Linux() { target := "Linux_" + archType.Name if !InList(target, targets) { @@ -930,6 +931,18 @@ func createArchPropTypeDesc(props reflect.Type) []archPropTypeDesc { targets = append(targets, target) } } + if os == Linux { + target := "Glibc_" + archType.Name + if !InList(target, targets) { + targets = append(targets, target) + } + } + if os == LinuxMusl { + target := "Musl_" + archType.Name + if !InList(target, targets) { + targets = append(targets, target) + } + } } } @@ -1379,11 +1392,25 @@ func getArchProperties(ctx BaseMutatorContext, archProperties interface{}, arch result = append(result, osArchProperties) } + if os == Linux { + field := "Glibc_" + archType.Name + userFriendlyField := "target.glibc_" + "_" + archType.Name + if osArchProperties, ok := getChildPropertyStruct(ctx, targetProp, field, userFriendlyField); ok { + result = append(result, osArchProperties) + } + } + if os == LinuxMusl { + field := "Musl_" + archType.Name + userFriendlyField := "target.musl_" + "_" + archType.Name + if osArchProperties, ok := getChildPropertyStruct(ctx, targetProp, field, userFriendlyField); ok { + result = append(result, osArchProperties) + } + // Special case: to ease the transition from glibc to musl, apply linux_glibc // properties (which has historically mean host linux) to musl variants. - field := "Linux_glibc_" + archType.Name - userFriendlyField := "target.linux_glibc_" + archType.Name + field = "Linux_glibc_" + archType.Name + userFriendlyField = "target.linux_glibc_" + archType.Name if osArchProperties, ok := getChildPropertyStruct(ctx, targetProp, field, userFriendlyField); ok { result = append(result, osArchProperties) }