linux_bionic_arm64 is added when Host_bionic_arm64 is true

linux_bionic_arm64 is the new host target using Bionic as libc.  This
change adds a new Soong config Host_bionic_arm64 that enables the
target.

This change also amends firstTarget() function to handle the case when
the available targets for an OS have different arch families. In that
case, first target is selected for each of the arch family. This is
needed in the (rare) care when both linux_bionic_x86_64 and
linux_bionic_arm64 targets are enabled.

Bug: 159685774
Test: add "Host_bionic_arm64": true to out/soong/soong.config and run
./build/soong/soong_ui.bash --make-mode --skip-make
out/soong/host/linux_bionic-arm64/bin/aarch64-linux-bionic/crosvm

Change-Id: I0885e49379f6ee216c6e82adbb1230655171a7a5
This commit is contained in:
Jiyong Park 2020-09-17 19:09:58 +09:00
parent 1613e5541f
commit 2210198129
2 changed files with 18 additions and 5 deletions

View file

@ -1553,6 +1553,9 @@ func decodeTargetProductVariables(config *config) (map[OsType][]Target, error) {
if Bool(config.Host_bionic) {
addTarget(LinuxBionic, "x86_64", nil, nil, nil, NativeBridgeDisabled, nil, nil)
}
if Bool(config.Host_bionic_arm64) {
addTarget(LinuxBionic, "arm64", nil, nil, nil, NativeBridgeDisabled, nil, nil)
}
if String(variables.CrossHost) != "" {
crossHostOs := osByName(*variables.CrossHost)
@ -1793,13 +1796,22 @@ func getCommonTargets(targets []Target) []Target {
}
func firstTarget(targets []Target, filters ...string) []Target {
// find the first target from each OS
var ret []Target
hasHost := false
set := make(map[OsType]bool)
for _, filter := range filters {
buildTargets := filterMultilibTargets(targets, filter)
if len(buildTargets) > 0 {
return buildTargets[:1]
for _, t := range buildTargets {
if _, found := set[t.Os]; !found {
hasHost = hasHost || (t.Os.Class == Host)
set[t.Os] = true
ret = append(ret, t)
}
}
return nil
}
return ret
}
// Use the module multilib setting to select one or more targets from a target list

View file

@ -48,6 +48,7 @@ const productVariablesFileName = "soong.variables"
type FileConfigurableOptions struct {
Mega_device *bool `json:",omitempty"`
Host_bionic *bool `json:",omitempty"`
Host_bionic_arm64 *bool `json:",omitempty"`
}
func (f *FileConfigurableOptions) SetDefaultConfig() {