Skip to content

Commit

Permalink
Merge pull request #4932 from tianon/arm64-fallback
Browse files Browse the repository at this point in the history
Allow arm64 to fallback to arm (v8, v7, v6, v5)
  • Loading branch information
fuweid committed Jan 14, 2021
2 parents cb76f53 + 4073aaa commit 66fec3b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
12 changes: 12 additions & 0 deletions platforms/compare.go
Expand Up @@ -57,6 +57,18 @@ func platformVector(platform specs.Platform) []specs.Platform {
})
}
}
case "arm64":
variant := platform.Variant
if variant == "" {
variant = "v8"
}
vector = append(vector, platformVector(specs.Platform{
Architecture: "arm",
OS: platform.OS,
OSVersion: platform.OSVersion,
OSFeatures: platform.OSFeatures,
Variant: variant,
})...)
}

return vector
Expand Down
10 changes: 5 additions & 5 deletions platforms/compare_test.go
Expand Up @@ -166,17 +166,17 @@ func TestOnly(t *testing.T) {
platform: "linux/arm64",
matches: map[bool][]string{
true: {
"linux/arm",
"linux/arm/v5",
"linux/arm/v6",
"linux/arm/v7",
"linux/arm/v8",
"linux/arm64",
"linux/arm64/v8",
},
false: {
"linux/amd64",
"linux/arm",
"linux/arm/v4",
"linux/arm/v5",
"linux/arm/v6",
"linux/arm/v7",
"linux/arm/v8",
"linux/arm/v9",
"linux/arm64/v9",
"windows/amd64",
Expand Down
7 changes: 1 addition & 6 deletions platforms/cpuinfo.go
Expand Up @@ -107,12 +107,7 @@ func getCPUVariant() string {

switch strings.ToLower(variant) {
case "8", "aarch64":
// special case: if running a 32-bit userspace on aarch64, the variant should be "v7"
if runtime.GOARCH == "arm" {
variant = "v7"
} else {
variant = "v8"
}
variant = "v8"
case "7", "7m", "?(12)", "?(13)", "?(14)", "?(15)", "?(16)", "?(17)":
variant = "v7"
case "6", "6tej":
Expand Down

0 comments on commit 66fec3b

Please sign in to comment.