Merge "Revert "Revert "Build support for 32-bit armv8-a"""

This commit is contained in:
Isaac Chen 2017-08-25 01:55:56 +00:00 committed by Gerrit Code Review
commit cd3d542187
1 changed files with 25 additions and 5 deletions

View File

@ -102,6 +102,11 @@ var (
"-mfloat-abi=softfp", "-mfloat-abi=softfp",
"-mfpu=neon", "-mfpu=neon",
}, },
"armv8-a": []string{
"-march=armv8-a",
"-mfloat-abi=softfp",
"-mfpu=neon-fp-armv8",
},
} }
armCpuVariantCflags = map[string][]string{ armCpuVariantCflags = map[string][]string{
@ -174,6 +179,7 @@ func init() {
"armv5te", "armv5te",
"armv7-a", "armv7-a",
"armv7-a-neon", "armv7-a-neon",
"armv8-a",
"cortex-a7", "cortex-a7",
"cortex-a8", "cortex-a8",
"cortex-a9", "cortex-a9",
@ -188,12 +194,19 @@ func init() {
"denver") "denver")
android.RegisterArchVariantFeatures(android.Arm, "armv7-a-neon", "neon") android.RegisterArchVariantFeatures(android.Arm, "armv7-a-neon", "neon")
android.RegisterArchVariantFeatures(android.Arm, "armv8-a", "neon")
// Krait and Kryo targets are not supported by GCC, but are supported by Clang, // Krait and Kryo targets are not supported by GCC, but are supported by Clang,
// so override the definitions when building modules with Clang. // so override the definitions when building modules with Clang.
replaceFirst(armClangCpuVariantCflags["krait"], "-mcpu=cortex-a15", "-mcpu=krait") replaceFirst(armClangCpuVariantCflags["krait"], "-mcpu=cortex-a15", "-mcpu=krait")
replaceFirst(armClangCpuVariantCflags["kryo"], "-mcpu=cortex-a15", "-mcpu=krait") replaceFirst(armClangCpuVariantCflags["kryo"], "-mcpu=cortex-a15", "-mcpu=krait")
// The reason we use "-march=armv8-a+crc", instead of "-march=armv8-a", for
// gcc is the latter would conflict with any specified/supported -mcpu!
// All armv8-a cores supported by gcc 4.9 support crc, so it's safe
// to add +crc. Besides, the use of gcc is only for legacy code.
replaceFirst(armArchVariantCflags["armv8-a"], "-march=armv8-a", "-march=armv8-a+crc")
pctx.StaticVariable("armGccVersion", armGccVersion) pctx.StaticVariable("armGccVersion", armGccVersion)
pctx.SourcePathVariable("ArmGccRoot", pctx.SourcePathVariable("ArmGccRoot",
@ -215,6 +228,7 @@ func init() {
pctx.StaticVariable("ArmArmv5TECflags", strings.Join(armArchVariantCflags["armv5te"], " ")) pctx.StaticVariable("ArmArmv5TECflags", strings.Join(armArchVariantCflags["armv5te"], " "))
pctx.StaticVariable("ArmArmv7ACflags", strings.Join(armArchVariantCflags["armv7-a"], " ")) pctx.StaticVariable("ArmArmv7ACflags", strings.Join(armArchVariantCflags["armv7-a"], " "))
pctx.StaticVariable("ArmArmv7ANeonCflags", strings.Join(armArchVariantCflags["armv7-a-neon"], " ")) pctx.StaticVariable("ArmArmv7ANeonCflags", strings.Join(armArchVariantCflags["armv7-a-neon"], " "))
pctx.StaticVariable("ArmArmv8ACflags", strings.Join(armArchVariantCflags["armv8-a"], " "))
// Cpu variant cflags // Cpu variant cflags
pctx.StaticVariable("ArmGenericCflags", strings.Join(armCpuVariantCflags[""], " ")) pctx.StaticVariable("ArmGenericCflags", strings.Join(armCpuVariantCflags[""], " "))
@ -242,6 +256,8 @@ func init() {
strings.Join(armClangArchVariantCflags["armv7-a"], " ")) strings.Join(armClangArchVariantCflags["armv7-a"], " "))
pctx.StaticVariable("ArmClangArmv7ANeonCflags", pctx.StaticVariable("ArmClangArmv7ANeonCflags",
strings.Join(armClangArchVariantCflags["armv7-a-neon"], " ")) strings.Join(armClangArchVariantCflags["armv7-a-neon"], " "))
pctx.StaticVariable("ArmClangArmv8ACflags",
strings.Join(armClangArchVariantCflags["armv8-a"], " "))
// Clang cpu variant cflags // Clang cpu variant cflags
pctx.StaticVariable("ArmClangGenericCflags", pctx.StaticVariable("ArmClangGenericCflags",
@ -265,6 +281,7 @@ var (
"armv5te": "${config.ArmArmv5TECflags}", "armv5te": "${config.ArmArmv5TECflags}",
"armv7-a": "${config.ArmArmv7ACflags}", "armv7-a": "${config.ArmArmv7ACflags}",
"armv7-a-neon": "${config.ArmArmv7ANeonCflags}", "armv7-a-neon": "${config.ArmArmv7ANeonCflags}",
"armv8-a": "${config.ArmArmv8ACflags}",
} }
armCpuVariantCflagsVar = map[string]string{ armCpuVariantCflagsVar = map[string]string{
@ -286,6 +303,7 @@ var (
"armv5te": "${config.ArmClangArmv5TECflags}", "armv5te": "${config.ArmClangArmv5TECflags}",
"armv7-a": "${config.ArmClangArmv7ACflags}", "armv7-a": "${config.ArmClangArmv7ACflags}",
"armv7-a-neon": "${config.ArmClangArmv7ANeonCflags}", "armv7-a-neon": "${config.ArmClangArmv7ANeonCflags}",
"armv8-a": "${config.ArmClangArmv8ACflags}",
} }
armClangCpuVariantCflagsVar = map[string]string{ armClangCpuVariantCflagsVar = map[string]string{
@ -402,6 +420,11 @@ func armToolchainFactory(arch android.Arch) Toolchain {
toolchainClangCflags[0] = "${config.ArmToolchainClangCflags}" toolchainClangCflags[0] = "${config.ArmToolchainClangCflags}"
toolchainClangCflags[1] = armClangArchVariantCflagsVar[arch.ArchVariant] toolchainClangCflags[1] = armClangArchVariantCflagsVar[arch.ArchVariant]
toolchainCflags = append(toolchainCflags,
variantOrDefault(armCpuVariantCflagsVar, arch.CpuVariant))
toolchainClangCflags = append(toolchainClangCflags,
variantOrDefault(armClangCpuVariantCflagsVar, arch.CpuVariant))
switch arch.ArchVariant { switch arch.ArchVariant {
case "armv7-a-neon": case "armv7-a-neon":
switch arch.CpuVariant { switch arch.CpuVariant {
@ -411,15 +434,12 @@ func armToolchainFactory(arch android.Arch) Toolchain {
default: default:
fixCortexA8 = "-Wl,--no-fix-cortex-a8" fixCortexA8 = "-Wl,--no-fix-cortex-a8"
} }
toolchainCflags = append(toolchainCflags,
variantOrDefault(armCpuVariantCflagsVar, arch.CpuVariant))
toolchainClangCflags = append(toolchainClangCflags,
variantOrDefault(armClangCpuVariantCflagsVar, arch.CpuVariant))
case "armv7-a": case "armv7-a":
fixCortexA8 = "-Wl,--fix-cortex-a8" fixCortexA8 = "-Wl,--fix-cortex-a8"
case "armv5te": case "armv5te":
// Nothing extra for armv5te // Nothing extra for armv5te
case "armv8-a":
// Nothing extra for armv8-a
default: default:
panic(fmt.Sprintf("Unknown ARM architecture version: %q", arch.ArchVariant)) panic(fmt.Sprintf("Unknown ARM architecture version: %q", arch.ArchVariant))
} }