From 5818b9344f948381377e7edf85dca9a9f8869326 Mon Sep 17 00:00:00 2001 From: Ryo Hashimoto Date: Tue, 23 Mar 2021 15:05:22 +0900 Subject: [PATCH] Enable safe ICF for all devices --icf=safe has been enabled for arm and arm64. Do the same thing for all devices. On bertha_x86_64, this CL makes system.raw.img 4.4MB smaller. Bug: 182446785 Test: build Change-Id: Ifd597cd8496c49b55df269f22e01b1c50dc8f6e8 --- cc/config/arm64_device.go | 7 +++---- cc/config/arm_device.go | 1 - cc/config/global.go | 1 + 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cc/config/arm64_device.go b/cc/config/arm64_device.go index d083d2a0b..864fba100 100644 --- a/cc/config/arm64_device.go +++ b/cc/config/arm64_device.go @@ -46,7 +46,6 @@ var ( arm64Ldflags = []string{ "-Wl,--hash-style=gnu", "-Wl,-z,separate-code", - "-Wl,--icf=safe", } arm64Lldflags = append(ClangFilterUnknownLldflags(arm64Ldflags), @@ -128,10 +127,10 @@ func init() { var ( arm64ClangArchVariantCflagsVar = map[string]string{ - "armv8-a": "${config.Arm64ClangArmv8ACflags}", + "armv8-a": "${config.Arm64ClangArmv8ACflags}", "armv8-a-branchprot": "${config.Arm64ClangArmv8ABranchProtCflags}", - "armv8-2a": "${config.Arm64ClangArmv82ACflags}", - "armv8-2a-dotprod": "${config.Arm64ClangArmv82ADotprodCflags}", + "armv8-2a": "${config.Arm64ClangArmv82ACflags}", + "armv8-2a-dotprod": "${config.Arm64ClangArmv82ADotprodCflags}", } arm64ClangCpuVariantCflagsVar = map[string]string{ diff --git a/cc/config/arm_device.go b/cc/config/arm_device.go index f01c63882..a402f8f7a 100644 --- a/cc/config/arm_device.go +++ b/cc/config/arm_device.go @@ -34,7 +34,6 @@ var ( armCppflags = []string{} armLdflags = []string{ - "-Wl,--icf=safe", "-Wl,--hash-style=gnu", "-Wl,-m,armelf", } diff --git a/cc/config/global.go b/cc/config/global.go index 7e809000a..ed18300c3 100644 --- a/cc/config/global.go +++ b/cc/config/global.go @@ -97,6 +97,7 @@ var ( "-Wl,--exclude-libs,libgcc_stripped.a", "-Wl,--exclude-libs,libunwind_llvm.a", "-Wl,--exclude-libs,libunwind.a", + "-Wl,--icf=safe", } deviceGlobalLldflags = append(ClangFilterUnknownLldflags(deviceGlobalLdflags),