diff options
author | Armando Montanez <montanez.armando.l@gmail.com> | 2022-03-25 19:17:06 -0700 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-03-26 19:31:46 +0000 |
commit | 8b33bb97aeaf5ec8c6b32bf5903922fa58a7d0e3 (patch) | |
tree | 828a82df58a412d48d0ce3255fc629879d7c8766 | |
parent | 194c5e100619fbbd1e3ace7347aaa647c39e143f (diff) | |
download | pigweed-8b33bb97aeaf5ec8c6b32bf5903922fa58a7d0e3.tar.gz |
pw_toolchain: Move --gc-sections
Moves the --gc-sections and -dead_strip flags from
generate_toolchain.gni to a pw_build config so it lives alongside
similar size-reduction flags.
Change-Id: Ie4a51a9357a41ecd997eba28bfa78ddf43471b72
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/89146
Pigweed-Auto-Submit: Armando Montanez <amontanez@google.com>
Reviewed-by: Anthony DiGirolamo <tonymd@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
-rw-r--r-- | pw_build/BUILD.gn | 8 | ||||
-rw-r--r-- | pw_toolchain/generate_toolchain.gni | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/pw_build/BUILD.gn b/pw_build/BUILD.gn index a6d0cd7de..1a74c2bad 100644 --- a/pw_build/BUILD.gn +++ b/pw_build/BUILD.gn @@ -70,6 +70,14 @@ config("reduced_size") { "-fdata-sections", ] cflags_cc = [ "-fno-rtti" ] + + if (current_os == "mac" || current_os == "ios") { + # Delete unreferenced sections. Helpful with -ffunction-sections. + ldflags = [ "-Wl,-dead_strip" ] + } else { + # Delete unreferenced sections. Helpful with -ffunction-sections. + ldflags = [ "-Wl,--gc-sections" ] + } } config("strict_warnings") { diff --git a/pw_toolchain/generate_toolchain.gni b/pw_toolchain/generate_toolchain.gni index ce925bedd..db057c24d 100644 --- a/pw_toolchain/generate_toolchain.gni +++ b/pw_toolchain/generate_toolchain.gni @@ -251,17 +251,11 @@ template("generate_toolchain") { _link_flags += [ # Output a map file that shows symbols and their location. "-Wl,-map,$_link_mapfile", - - # Delete unreferenced sections. Helpful with -ffunction-sections. - "-Wl,-dead_strip", ] } else { _link_flags += [ # Output a map file that shows symbols and their location. "-Wl,-Map,$_link_mapfile", - - # Delete unreferenced sections. Helpful with -ffunction-sections. - "-Wl,--gc-sections", ] } |