Make ICF an option in gen.py Previously, ICF was enabled unconditionally for all release builds but this is causing issue when using ld.bfd as a linker because ICF is not supported there, so we make it an option which can be enabled as needed. Change-Id: Id648184d932457f3481339ed265d9ad133ce3c98 Reviewed-on: https://gn-review.googlesource.com/2320 Reviewed-by: Thomas Anderson <thomasanderson@chromium.org> Reviewed-by: Brett Wilson <brettw@chromium.org> Commit-Queue: Brett Wilson <brettw@chromium.org>
diff --git a/build/gen.py b/build/gen.py index 7dfdae8..fce8fb1 100755 --- a/build/gen.py +++ b/build/gen.py
@@ -33,6 +33,8 @@ help='Do a debug build. Defaults to release build.') parser.add_option('--use-lto', action='store_true', help='Enable the use of LTO') + parser.add_option('--use-icf', action='store_true', + help='Enable the use of Identical Code Folding') parser.add_option('--no-sysroot', action='store_true', help='(Linux only) Do not build with the Debian sysroot.') parser.add_option('--no-last-commit-position', action='store_true', @@ -270,7 +272,7 @@ # Omit all symbol information from the output file. ldflags.append('-Wl,-S' if is_mac else '-Wl,-strip-all') # Enable identical code-folding. - if is_linux: + if options.use_icf: ldflags.append('-Wl,--icf=all') cflags.extend([