From 1a6e5c0c15f7981f37a114fa55d9b1dd29ed89ca Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Fri, 18 May 2018 12:27:15 -0700 Subject: [PATCH] Remove cortex-a53 linker workaround for new cpus. Bug: 78133793 Test: Built target with cortex-a53 and verified that the flag is still Test: there. Test: Build target with cortex-a55/cortex-a75 and verified that the flag Test: is not there. Test: Built and booted on a taimen, ran bionic unit tests. Change-Id: Ibd7f497ecf46e5781cd0265463b0782babdf062a Merged-In: Ibd7f497ecf46e5781cd0265463b0782babdf062a (cherry picked from commit a98d721485ca45299d3aff029d80ba218ebd7e9e) --- cc/config/arm64_device.go | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/cc/config/arm64_device.go b/cc/config/arm64_device.go index 73d9e3b65..73cee5cce 100644 --- a/cc/config/arm64_device.go +++ b/cc/config/arm64_device.go @@ -39,7 +39,6 @@ var ( arm64Ldflags = []string{ "-Wl,-m,aarch64_elf64_le_vec", "-Wl,--hash-style=gnu", - "-Wl,--fix-cortex-a53-843419", "-fuse-ld=gold", "-Wl,--icf=safe", } @@ -177,6 +176,8 @@ var ( type toolchainArm64 struct { toolchain64Bit + ldflags string + lldflags string toolchainCflags string toolchainClangCflags string } @@ -210,7 +211,7 @@ func (t *toolchainArm64) Cppflags() string { } func (t *toolchainArm64) Ldflags() string { - return "${config.Arm64Ldflags}" + return t.ldflags } func (t *toolchainArm64) IncludeFlags() string { @@ -230,11 +231,11 @@ func (t *toolchainArm64) ClangCppflags() string { } func (t *toolchainArm64) ClangLdflags() string { - return "${config.Arm64Ldflags}" + return t.ldflags } func (t *toolchainArm64) ClangLldflags() string { - return "${config.Arm64Lldflags}" + return t.lldflags } func (t *toolchainArm64) ToolchainClangCflags() string { @@ -258,7 +259,24 @@ func arm64ToolchainFactory(arch android.Arch) Toolchain { toolchainClangCflags = append(toolchainClangCflags, variantOrDefault(arm64ClangCpuVariantCflagsVar, arch.CpuVariant)) + var extraLdflags string + switch arch.CpuVariant { + case "cortex-a53", "cortex-a73", "kryo", "exynos-m1", "exynos-m2", + // This variant might not need the workaround but leave it + // in the list since it has had the workaround on before. + "denver64": + extraLdflags = "-Wl,--fix-cortex-a53-843419" + } + return &toolchainArm64{ + ldflags: strings.Join([]string{ + "${config.Arm64Ldflags}", + extraLdflags, + }, " "), + lldflags: strings.Join([]string{ + "${config.Arm64Lldflags}", + extraLdflags, + }, " "), toolchainCflags: variantOrDefault(arm64CpuVariantCflagsVar, arch.CpuVariant), toolchainClangCflags: strings.Join(toolchainClangCflags, " "), }