2015-11-21 07:35:26 +08:00
|
|
|
// Copyright 2015 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2016-07-30 04:44:28 +08:00
|
|
|
package config
|
2015-01-31 09:27:36 +08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"strings"
|
|
|
|
|
2016-05-19 06:37:25 +08:00
|
|
|
"android/soong/android"
|
2015-01-31 09:27:36 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2015-11-24 08:11:30 +08:00
|
|
|
armToolchainCflags = []string{
|
|
|
|
"-mthumb-interwork",
|
2016-05-19 13:52:25 +08:00
|
|
|
"-msoft-float",
|
2015-11-24 08:11:30 +08:00
|
|
|
}
|
|
|
|
|
2017-11-18 08:10:01 +08:00
|
|
|
armCflags = []string{
|
|
|
|
"-fomit-frame-pointer",
|
|
|
|
}
|
2015-01-31 09:27:36 +08:00
|
|
|
|
2017-11-07 05:59:48 +08:00
|
|
|
armCppflags = []string{}
|
2015-01-31 09:27:36 +08:00
|
|
|
|
|
|
|
armLdflags = []string{
|
2015-03-17 07:12:05 +08:00
|
|
|
"-Wl,--icf=safe",
|
2015-01-31 09:27:36 +08:00
|
|
|
"-Wl,--hash-style=gnu",
|
2017-06-27 10:22:02 +08:00
|
|
|
"-Wl,-m,armelf",
|
2015-01-31 09:27:36 +08:00
|
|
|
}
|
|
|
|
|
2018-04-04 02:33:34 +08:00
|
|
|
armLldflags = ClangFilterUnknownLldflags(armLdflags)
|
|
|
|
|
2015-01-31 09:27:36 +08:00
|
|
|
armArmCflags = []string{
|
|
|
|
"-fstrict-aliasing",
|
|
|
|
}
|
|
|
|
|
|
|
|
armThumbCflags = []string{
|
|
|
|
"-mthumb",
|
|
|
|
"-Os",
|
|
|
|
}
|
|
|
|
|
2018-10-08 12:06:36 +08:00
|
|
|
armClangArchVariantCflags = map[string][]string{
|
2019-02-20 05:53:01 +08:00
|
|
|
"armv7-a": []string{
|
|
|
|
"-march=armv7-a",
|
|
|
|
"-mfloat-abi=softfp",
|
|
|
|
"-mfpu=vfpv3-d16",
|
|
|
|
},
|
2015-01-31 09:27:36 +08:00
|
|
|
"armv7-a-neon": []string{
|
2017-10-05 18:28:57 +08:00
|
|
|
"-march=armv7-a",
|
2015-01-31 09:27:36 +08:00
|
|
|
"-mfloat-abi=softfp",
|
|
|
|
"-mfpu=neon",
|
|
|
|
},
|
2017-08-23 18:57:17 +08:00
|
|
|
"armv8-a": []string{
|
|
|
|
"-march=armv8-a",
|
|
|
|
"-mfloat-abi=softfp",
|
|
|
|
"-mfpu=neon-fp-armv8",
|
|
|
|
},
|
2018-10-31 15:26:32 +08:00
|
|
|
"armv8-2a": []string{
|
|
|
|
"-march=armv8.2-a",
|
|
|
|
"-mfloat-abi=softfp",
|
|
|
|
"-mfpu=neon-fp-armv8",
|
|
|
|
},
|
2015-01-31 09:27:36 +08:00
|
|
|
}
|
|
|
|
|
2018-10-08 12:06:36 +08:00
|
|
|
armClangCpuVariantCflags = map[string][]string{
|
2015-01-31 09:27:36 +08:00
|
|
|
"cortex-a7": []string{
|
|
|
|
"-mcpu=cortex-a7",
|
2017-04-07 10:25:34 +08:00
|
|
|
"-mfpu=neon-vfpv4",
|
2016-03-30 06:47:08 +08:00
|
|
|
// Fake an ARM compiler flag as these processors support LPAE which GCC/clang
|
|
|
|
// don't advertise.
|
|
|
|
// TODO This is a hack and we need to add it for each processor that supports LPAE until some
|
|
|
|
// better solution comes around. See Bug 27340895
|
|
|
|
"-D__ARM_FEATURE_LPAE=1",
|
2015-01-31 09:27:36 +08:00
|
|
|
},
|
|
|
|
"cortex-a8": []string{
|
|
|
|
"-mcpu=cortex-a8",
|
|
|
|
},
|
|
|
|
"cortex-a15": []string{
|
|
|
|
"-mcpu=cortex-a15",
|
2017-04-07 08:47:23 +08:00
|
|
|
"-mfpu=neon-vfpv4",
|
2015-01-31 09:27:36 +08:00
|
|
|
// Fake an ARM compiler flag as these processors support LPAE which GCC/clang
|
|
|
|
// don't advertise.
|
2016-03-30 06:47:08 +08:00
|
|
|
// TODO This is a hack and we need to add it for each processor that supports LPAE until some
|
|
|
|
// better solution comes around. See Bug 27340895
|
2015-01-31 09:27:36 +08:00
|
|
|
"-D__ARM_FEATURE_LPAE=1",
|
|
|
|
},
|
2017-05-09 03:08:40 +08:00
|
|
|
"cortex-a53": []string{
|
|
|
|
"-mcpu=cortex-a53",
|
|
|
|
"-mfpu=neon-fp-armv8",
|
|
|
|
// Fake an ARM compiler flag as these processors support LPAE which GCC/clang
|
|
|
|
// don't advertise.
|
|
|
|
// TODO This is a hack and we need to add it for each processor that supports LPAE until some
|
|
|
|
// better solution comes around. See Bug 27340895
|
|
|
|
"-D__ARM_FEATURE_LPAE=1",
|
|
|
|
},
|
2018-04-24 09:15:25 +08:00
|
|
|
"cortex-a55": []string{
|
2018-06-16 06:46:11 +08:00
|
|
|
"-mcpu=cortex-a55",
|
2018-04-24 09:15:25 +08:00
|
|
|
"-mfpu=neon-fp-armv8",
|
|
|
|
// Fake an ARM compiler flag as these processors support LPAE which GCC/clang
|
|
|
|
// don't advertise.
|
|
|
|
// TODO This is a hack and we need to add it for each processor that supports LPAE until some
|
|
|
|
// better solution comes around. See Bug 27340895
|
|
|
|
"-D__ARM_FEATURE_LPAE=1",
|
|
|
|
},
|
|
|
|
"cortex-a75": []string{
|
2018-06-16 06:46:11 +08:00
|
|
|
"-mcpu=cortex-a55",
|
2018-04-24 09:15:25 +08:00
|
|
|
"-mfpu=neon-fp-armv8",
|
|
|
|
// Fake an ARM compiler flag as these processors support LPAE which GCC/clang
|
|
|
|
// don't advertise.
|
|
|
|
// TODO This is a hack and we need to add it for each processor that supports LPAE until some
|
|
|
|
// better solution comes around. See Bug 27340895
|
|
|
|
"-D__ARM_FEATURE_LPAE=1",
|
|
|
|
},
|
2018-10-10 05:27:28 +08:00
|
|
|
"cortex-a76": []string{
|
|
|
|
"-mcpu=cortex-a55",
|
|
|
|
"-mfpu=neon-fp-armv8",
|
|
|
|
// Fake an ARM compiler flag as these processors support LPAE which GCC/clang
|
|
|
|
// don't advertise.
|
|
|
|
// TODO This is a hack and we need to add it for each processor that supports LPAE until some
|
|
|
|
// better solution comes around. See Bug 27340895
|
|
|
|
"-D__ARM_FEATURE_LPAE=1",
|
|
|
|
},
|
2016-05-10 04:39:58 +08:00
|
|
|
"krait": []string{
|
2018-10-08 12:06:36 +08:00
|
|
|
"-mcpu=krait",
|
2017-04-07 08:38:26 +08:00
|
|
|
"-mfpu=neon-vfpv4",
|
2016-05-10 04:39:58 +08:00
|
|
|
// Fake an ARM compiler flag as these processors support LPAE which GCC/clang
|
|
|
|
// don't advertise.
|
|
|
|
// TODO This is a hack and we need to add it for each processor that supports LPAE until some
|
|
|
|
// better solution comes around. See Bug 27340895
|
|
|
|
"-D__ARM_FEATURE_LPAE=1",
|
|
|
|
},
|
2016-08-20 06:14:56 +08:00
|
|
|
"kryo": []string{
|
2017-11-21 14:29:58 +08:00
|
|
|
// Use cortex-a53 because the GNU assembler doesn't recognize -mcpu=kryo
|
|
|
|
// even though clang does.
|
|
|
|
"-mcpu=cortex-a53",
|
2017-04-07 08:28:05 +08:00
|
|
|
"-mfpu=neon-fp-armv8",
|
2016-08-20 06:14:56 +08:00
|
|
|
// Fake an ARM compiler flag as these processors support LPAE which GCC/clang
|
|
|
|
// don't advertise.
|
|
|
|
// TODO This is a hack and we need to add it for each processor that supports LPAE until some
|
|
|
|
// better solution comes around. See Bug 27340895
|
|
|
|
"-D__ARM_FEATURE_LPAE=1",
|
|
|
|
},
|
2018-11-15 23:21:51 +08:00
|
|
|
"kryo385": []string{
|
|
|
|
// Use cortex-a53 because kryo385 is not supported in GCC/clang.
|
|
|
|
"-mcpu=cortex-a53",
|
|
|
|
// Fake an ARM compiler flag as these processors support LPAE which GCC/clang
|
|
|
|
// don't advertise.
|
|
|
|
// TODO This is a hack and we need to add it for each processor that supports LPAE until some
|
|
|
|
// better solution comes around. See Bug 27340895
|
|
|
|
"-D__ARM_FEATURE_LPAE=1",
|
|
|
|
},
|
2015-01-31 09:27:36 +08:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2015-12-08 04:30:44 +08:00
|
|
|
const (
|
|
|
|
armGccVersion = "4.9"
|
|
|
|
)
|
|
|
|
|
2015-01-31 09:27:36 +08:00
|
|
|
func init() {
|
2015-12-08 04:30:44 +08:00
|
|
|
pctx.StaticVariable("armGccVersion", armGccVersion)
|
2015-01-31 09:27:36 +08:00
|
|
|
|
2016-07-30 04:44:28 +08:00
|
|
|
pctx.SourcePathVariable("ArmGccRoot",
|
2015-07-14 15:39:06 +08:00
|
|
|
"prebuilts/gcc/${HostPrebuiltTag}/arm/arm-linux-androideabi-${armGccVersion}")
|
2015-01-31 09:27:36 +08:00
|
|
|
|
2016-07-30 04:44:28 +08:00
|
|
|
pctx.StaticVariable("ArmLdflags", strings.Join(armLdflags, " "))
|
2018-04-04 02:33:34 +08:00
|
|
|
pctx.StaticVariable("ArmLldflags", strings.Join(armLldflags, " "))
|
2017-10-13 00:07:53 +08:00
|
|
|
pctx.StaticVariable("ArmIncludeFlags", bionicHeaders("arm"))
|
2015-01-31 09:27:36 +08:00
|
|
|
|
|
|
|
// Clang cflags
|
2016-07-30 04:44:28 +08:00
|
|
|
pctx.StaticVariable("ArmToolchainClangCflags", strings.Join(ClangFilterUnknownCflags(armToolchainCflags), " "))
|
|
|
|
pctx.StaticVariable("ArmClangCflags", strings.Join(ClangFilterUnknownCflags(armCflags), " "))
|
|
|
|
pctx.StaticVariable("ArmClangLdflags", strings.Join(ClangFilterUnknownCflags(armLdflags), " "))
|
2018-04-04 02:33:34 +08:00
|
|
|
pctx.StaticVariable("ArmClangLldflags", strings.Join(ClangFilterUnknownCflags(armLldflags), " "))
|
2016-07-30 04:44:28 +08:00
|
|
|
pctx.StaticVariable("ArmClangCppflags", strings.Join(ClangFilterUnknownCflags(armCppflags), " "))
|
2015-01-31 09:27:36 +08:00
|
|
|
|
2015-11-04 06:27:00 +08:00
|
|
|
// Clang ARM vs. Thumb instruction set cflags
|
2016-07-30 04:44:28 +08:00
|
|
|
pctx.StaticVariable("ArmClangArmCflags", strings.Join(ClangFilterUnknownCflags(armArmCflags), " "))
|
|
|
|
pctx.StaticVariable("ArmClangThumbCflags", strings.Join(ClangFilterUnknownCflags(armThumbCflags), " "))
|
2015-11-04 06:27:00 +08:00
|
|
|
|
2016-01-15 07:17:19 +08:00
|
|
|
// Clang arch variant cflags
|
2019-02-20 05:53:01 +08:00
|
|
|
pctx.StaticVariable("ArmClangArmv7ACflags",
|
|
|
|
strings.Join(armClangArchVariantCflags["armv7-a"], " "))
|
2016-07-30 04:44:28 +08:00
|
|
|
pctx.StaticVariable("ArmClangArmv7ANeonCflags",
|
2015-01-31 09:27:36 +08:00
|
|
|
strings.Join(armClangArchVariantCflags["armv7-a-neon"], " "))
|
2017-08-23 18:57:17 +08:00
|
|
|
pctx.StaticVariable("ArmClangArmv8ACflags",
|
|
|
|
strings.Join(armClangArchVariantCflags["armv8-a"], " "))
|
2018-10-31 15:26:32 +08:00
|
|
|
pctx.StaticVariable("ArmClangArmv82ACflags",
|
|
|
|
strings.Join(armClangArchVariantCflags["armv8-2a"], " "))
|
2015-01-31 09:27:36 +08:00
|
|
|
|
|
|
|
// Clang cpu variant cflags
|
2016-07-30 04:44:28 +08:00
|
|
|
pctx.StaticVariable("ArmClangGenericCflags",
|
2016-01-15 07:17:19 +08:00
|
|
|
strings.Join(armClangCpuVariantCflags[""], " "))
|
2016-07-30 04:44:28 +08:00
|
|
|
pctx.StaticVariable("ArmClangCortexA7Cflags",
|
2015-01-31 09:27:36 +08:00
|
|
|
strings.Join(armClangCpuVariantCflags["cortex-a7"], " "))
|
2016-07-30 04:44:28 +08:00
|
|
|
pctx.StaticVariable("ArmClangCortexA8Cflags",
|
2015-01-31 09:27:36 +08:00
|
|
|
strings.Join(armClangCpuVariantCflags["cortex-a8"], " "))
|
2016-07-30 04:44:28 +08:00
|
|
|
pctx.StaticVariable("ArmClangCortexA15Cflags",
|
2015-01-31 09:27:36 +08:00
|
|
|
strings.Join(armClangCpuVariantCflags["cortex-a15"], " "))
|
2017-05-09 03:08:40 +08:00
|
|
|
pctx.StaticVariable("ArmClangCortexA53Cflags",
|
|
|
|
strings.Join(armClangCpuVariantCflags["cortex-a53"], " "))
|
2018-04-24 09:15:25 +08:00
|
|
|
pctx.StaticVariable("ArmClangCortexA55Cflags",
|
|
|
|
strings.Join(armClangCpuVariantCflags["cortex-a55"], " "))
|
2016-07-30 04:44:28 +08:00
|
|
|
pctx.StaticVariable("ArmClangKraitCflags",
|
2015-01-31 09:27:36 +08:00
|
|
|
strings.Join(armClangCpuVariantCflags["krait"], " "))
|
2016-08-20 06:14:56 +08:00
|
|
|
pctx.StaticVariable("ArmClangKryoCflags",
|
|
|
|
strings.Join(armClangCpuVariantCflags["kryo"], " "))
|
2015-01-31 09:27:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
var (
|
|
|
|
armClangArchVariantCflagsVar = map[string]string{
|
2019-02-20 05:53:01 +08:00
|
|
|
"armv7-a": "${config.ArmClangArmv7ACflags}",
|
2016-07-30 04:44:28 +08:00
|
|
|
"armv7-a-neon": "${config.ArmClangArmv7ANeonCflags}",
|
2017-08-23 18:57:17 +08:00
|
|
|
"armv8-a": "${config.ArmClangArmv8ACflags}",
|
2018-11-15 23:21:51 +08:00
|
|
|
"armv8-2a": "${config.ArmClangArmv82ACflags}",
|
2015-01-31 09:27:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
armClangCpuVariantCflagsVar = map[string]string{
|
2016-07-30 04:44:28 +08:00
|
|
|
"": "${config.ArmClangGenericCflags}",
|
|
|
|
"cortex-a7": "${config.ArmClangCortexA7Cflags}",
|
|
|
|
"cortex-a8": "${config.ArmClangCortexA8Cflags}",
|
|
|
|
"cortex-a15": "${config.ArmClangCortexA15Cflags}",
|
2017-05-09 03:08:40 +08:00
|
|
|
"cortex-a53": "${config.ArmClangCortexA53Cflags}",
|
|
|
|
"cortex-a53.a57": "${config.ArmClangCortexA53Cflags}",
|
2018-04-24 09:15:25 +08:00
|
|
|
"cortex-a55": "${config.ArmClangCortexA55Cflags}",
|
2018-09-25 07:33:45 +08:00
|
|
|
"cortex-a72": "${config.ArmClangCortexA53Cflags}",
|
2017-05-09 03:08:40 +08:00
|
|
|
"cortex-a73": "${config.ArmClangCortexA53Cflags}",
|
2018-04-24 09:15:25 +08:00
|
|
|
"cortex-a75": "${config.ArmClangCortexA55Cflags}",
|
2016-07-30 04:44:28 +08:00
|
|
|
"krait": "${config.ArmClangKraitCflags}",
|
2016-08-20 06:14:56 +08:00
|
|
|
"kryo": "${config.ArmClangKryoCflags}",
|
2018-11-15 23:21:51 +08:00
|
|
|
"kryo385": "${config.ArmClangCortexA53Cflags}",
|
2017-07-24 06:14:55 +08:00
|
|
|
"exynos-m1": "${config.ArmClangCortexA53Cflags}",
|
2017-07-21 08:07:47 +08:00
|
|
|
"exynos-m2": "${config.ArmClangCortexA53Cflags}",
|
2015-01-31 09:27:36 +08:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
type toolchainArm struct {
|
|
|
|
toolchain32Bit
|
2018-10-08 12:06:36 +08:00
|
|
|
ldflags string
|
|
|
|
lldflags string
|
|
|
|
toolchainClangCflags string
|
2015-01-31 09:27:36 +08:00
|
|
|
}
|
|
|
|
|
2015-03-19 14:38:50 +08:00
|
|
|
func (t *toolchainArm) Name() string {
|
|
|
|
return "arm"
|
|
|
|
}
|
|
|
|
|
2015-01-31 09:27:36 +08:00
|
|
|
func (t *toolchainArm) GccRoot() string {
|
2016-07-30 04:44:28 +08:00
|
|
|
return "${config.ArmGccRoot}"
|
2015-01-31 09:27:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainArm) GccTriple() string {
|
2016-07-21 05:44:26 +08:00
|
|
|
return "arm-linux-androideabi"
|
2015-01-31 09:27:36 +08:00
|
|
|
}
|
|
|
|
|
2015-03-19 14:38:50 +08:00
|
|
|
func (t *toolchainArm) GccVersion() string {
|
2015-12-08 04:30:44 +08:00
|
|
|
return armGccVersion
|
2015-03-19 14:38:50 +08:00
|
|
|
}
|
|
|
|
|
2015-01-31 09:27:36 +08:00
|
|
|
func (t *toolchainArm) IncludeFlags() string {
|
2016-07-30 04:44:28 +08:00
|
|
|
return "${config.ArmIncludeFlags}"
|
2015-01-31 09:27:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainArm) ClangTriple() string {
|
2018-03-16 09:44:57 +08:00
|
|
|
// http://b/72619014 work around llvm LTO bug.
|
|
|
|
return "armv7a-linux-androideabi"
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainArm) ndkTriple() string {
|
|
|
|
// Use current NDK include path, while ClangTriple is changed.
|
2016-07-21 05:44:26 +08:00
|
|
|
return t.GccTriple()
|
2015-01-31 09:27:36 +08:00
|
|
|
}
|
|
|
|
|
2015-11-24 08:11:30 +08:00
|
|
|
func (t *toolchainArm) ToolchainClangCflags() string {
|
|
|
|
return t.toolchainClangCflags
|
|
|
|
}
|
|
|
|
|
2015-01-31 09:27:36 +08:00
|
|
|
func (t *toolchainArm) ClangCflags() string {
|
2016-07-30 04:44:28 +08:00
|
|
|
return "${config.ArmClangCflags}"
|
2015-01-31 09:27:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainArm) ClangCppflags() string {
|
2016-07-30 04:44:28 +08:00
|
|
|
return "${config.ArmClangCppflags}"
|
2015-01-31 09:27:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *toolchainArm) ClangLdflags() string {
|
|
|
|
return t.ldflags
|
|
|
|
}
|
|
|
|
|
2018-04-04 02:33:34 +08:00
|
|
|
func (t *toolchainArm) ClangLldflags() string {
|
|
|
|
return t.lldflags // TODO: handle V8 cases
|
|
|
|
}
|
|
|
|
|
2015-11-04 06:27:00 +08:00
|
|
|
func (t *toolchainArm) ClangInstructionSetFlags(isa string) (string, error) {
|
|
|
|
switch isa {
|
|
|
|
case "arm":
|
2016-07-30 04:44:28 +08:00
|
|
|
return "${config.ArmClangArmCflags}", nil
|
2015-11-04 06:27:00 +08:00
|
|
|
case "thumb", "":
|
2016-07-30 04:44:28 +08:00
|
|
|
return "${config.ArmClangThumbCflags}", nil
|
2015-11-04 06:27:00 +08:00
|
|
|
default:
|
|
|
|
return t.toolchainBase.ClangInstructionSetFlags(isa)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-01 05:27:44 +08:00
|
|
|
func (toolchainArm) LibclangRuntimeLibraryArch() string {
|
2016-08-16 05:18:24 +08:00
|
|
|
return "arm"
|
2016-01-07 06:41:07 +08:00
|
|
|
}
|
|
|
|
|
2016-05-19 06:37:25 +08:00
|
|
|
func armToolchainFactory(arch android.Arch) Toolchain {
|
2015-04-29 04:15:59 +08:00
|
|
|
var fixCortexA8 string
|
2016-01-15 07:17:19 +08:00
|
|
|
toolchainClangCflags := make([]string, 2, 3)
|
|
|
|
|
2016-07-30 04:44:28 +08:00
|
|
|
toolchainClangCflags[0] = "${config.ArmToolchainClangCflags}"
|
2016-01-15 07:17:19 +08:00
|
|
|
toolchainClangCflags[1] = armClangArchVariantCflagsVar[arch.ArchVariant]
|
|
|
|
|
2017-08-23 18:57:17 +08:00
|
|
|
toolchainClangCflags = append(toolchainClangCflags,
|
|
|
|
variantOrDefault(armClangCpuVariantCflagsVar, arch.CpuVariant))
|
|
|
|
|
2016-01-15 07:17:19 +08:00
|
|
|
switch arch.ArchVariant {
|
|
|
|
case "armv7-a-neon":
|
|
|
|
switch arch.CpuVariant {
|
|
|
|
case "cortex-a8", "":
|
|
|
|
// Generic ARM might be a Cortex A8 -- better safe than sorry
|
|
|
|
fixCortexA8 = "-Wl,--fix-cortex-a8"
|
|
|
|
default:
|
|
|
|
fixCortexA8 = "-Wl,--no-fix-cortex-a8"
|
|
|
|
}
|
2019-02-20 05:53:01 +08:00
|
|
|
case "armv7-a":
|
|
|
|
fixCortexA8 = "-Wl,--fix-cortex-a8"
|
2018-10-31 15:26:32 +08:00
|
|
|
case "armv8-a", "armv8-2a":
|
|
|
|
// Nothing extra for armv8-a/armv8-2a
|
2015-04-29 04:15:59 +08:00
|
|
|
default:
|
2016-01-15 07:17:19 +08:00
|
|
|
panic(fmt.Sprintf("Unknown ARM architecture version: %q", arch.ArchVariant))
|
2015-04-29 04:15:59 +08:00
|
|
|
}
|
|
|
|
|
2015-01-31 09:27:36 +08:00
|
|
|
return &toolchainArm{
|
|
|
|
ldflags: strings.Join([]string{
|
2016-07-30 04:44:28 +08:00
|
|
|
"${config.ArmLdflags}",
|
2015-04-29 04:15:59 +08:00
|
|
|
fixCortexA8,
|
2015-01-31 09:27:36 +08:00
|
|
|
}, " "),
|
2018-04-04 02:33:34 +08:00
|
|
|
lldflags: "${config.ArmLldflags}",
|
2016-01-15 07:17:19 +08:00
|
|
|
toolchainClangCflags: strings.Join(toolchainClangCflags, " "),
|
2015-01-31 09:27:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2016-06-02 08:09:44 +08:00
|
|
|
registerToolchainFactory(android.Android, android.Arm, armToolchainFactory)
|
2015-01-31 09:27:36 +08:00
|
|
|
}
|