diff options
author | prabhukr <prabhukr@google.com> | 2023-11-27 20:35:50 +0000 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-11-27 20:35:50 +0000 |
commit | afac8b29114e86e78a1e38d3360ffcef50eaf2f7 (patch) | |
tree | 274aeefc58a6010933edd43fb9c13d847ded3832 /pw_build | |
parent | 9d2d05aa5bd9d36ad15814db82289ae62340f0b4 (diff) | |
download | pigweed-afac8b29114e86e78a1e38d3360ffcef50eaf2f7.tar.gz |
pw_toolchain/arm_clang: Reduce binary size
Update size optimization flags for Clang toolchain built artifacts.
Bug: b/254541584
Docs: N/A
Change-Id: Ic4ad573709f687fc4ba052608256247cf2293726
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/169576
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Prabhu Karthikeyan Rajasekaran <prabhukr@google.com>
Diffstat (limited to 'pw_build')
-rw-r--r-- | pw_build/BUILD.gn | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/pw_build/BUILD.gn b/pw_build/BUILD.gn index 55b0f8305..0a373022e 100644 --- a/pw_build/BUILD.gn +++ b/pw_build/BUILD.gn @@ -65,9 +65,34 @@ config("optimize_size") { ldflags = cflags } +config("enable_clang_mlinliner") { + cflags = [ + # Enable ML inliner. + "-mllvm", + "-enable-ml-inliner=release", + ] +} + +config("enable_clang_gvn_sink_hoist") { + cflags = [ + # Enable GVN sink/hoist. + "-mllvm", + "-enable-gvn-sink=1", + "-mllvm", + "-enable-gvn-hoist=1", + ] +} + config("optimize_size_clang") { cflags = [ "-Oz" ] - ldflags = cflags + ldflags = [ + # Identical Code Folding optimization + "-Wl,--icf=all", + + # LLD does not recognize `Oz` which is a compiler front-end flag. + "-Wl,-O2", + ] + ldflags += cflags } # Standard compiler flags to reduce output binary size. @@ -77,6 +102,7 @@ config("reduced_size") { "-fno-exceptions", "-ffunction-sections", "-fdata-sections", + "-fomit-frame-pointer", ] cflags_cc = [ "-fno-rtti" ] |