aboutsummaryrefslogtreecommitdiffstats
path: root/cc/config
diff options
context:
space:
mode:
authorYi Kong <yikong@google.com>2019-03-19 20:05:05 -0700
committerYi Kong <yikong@google.com>2019-03-20 10:40:44 -0700
commit7e8b47b31353c9657b95a7b9a0c898632a5d7129 (patch)
treee5c48ffb33ecf911e05ba209acc85726ebd2bd73 /cc/config
parentcecf06a088b08c8d4ccb4d22be42548840aacdae (diff)
downloadbuild_soong-7e8b47b31353c9657b95a7b9a0c898632a5d7129.tar.gz
build_soong-7e8b47b31353c9657b95a7b9a0c898632a5d7129.tar.bz2
build_soong-7e8b47b31353c9657b95a7b9a0c898632a5d7129.zip
Add -faddrsig to ClangExtraCflags
Emit address-significance table which allows linker to perform safe ICF. Clang does not emit the table by default on Android since NDK still uses GNU binutils. With the flag, binary size is decreased. For Marlin: -fno-addrsig -faddrsig diff /system/bin 28012K 27108K -3.33% /system/lib 88220K 86964K -1.44% /system/lib64 151936K 148108K -2.58% Test: m checkbuild Bug: 128940110 Change-Id: I99511f038a6d4b88b5c849a0f8943c24731ab6ea Merged-In: I99511f038a6d4b88b5c849a0f8943c24731ab6ea (cherry picked from commit a32b5e6a6bcf3d4c8120401f39cbeffd5efb7656)
Diffstat (limited to 'cc/config')
-rw-r--r--cc/config/clang.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/cc/config/clang.go b/cc/config/clang.go
index 08c638d0..75b8f93b 100644
--- a/cc/config/clang.go
+++ b/cc/config/clang.go
@@ -97,6 +97,10 @@ func init() {
pctx.StaticVariable("ClangExtraCflags", strings.Join([]string{
"-D__compiler_offsetof=__builtin_offsetof",
+ // Emit address-significance table which allows linker to perform safe ICF. Clang does
+ // not emit the table by default on Android since NDK still uses GNU binutils.
+ "-faddrsig",
+
// Make implicit fallthrough an error in the future.
"-Wimplicit-fallthrough",
"-Wno-error=implicit-fallthrough",