Enable identical code folding link option This further reduces the final binary size from 2016216 to 1901528 on Linux. This changes C/C++ semantics and might be incompatible with third-party code that relies on function pointers comparison, but that's not the case for GN. Change-Id: I38e74da3e3e3e2895ef4bda2036e48117cdafe5d Reviewed-on: https://gn-review.googlesource.com/2240 Commit-Queue: Petr Hosek <phosek@google.com> Reviewed-by: Brett Wilson <brettw@chromium.org>
diff --git a/build/gen.py b/build/gen.py index 3e1630a..7dfdae8 100755 --- a/build/gen.py +++ b/build/gen.py
@@ -269,6 +269,9 @@ ldflags.append('-Wl,-dead_strip' if is_mac else '-Wl,--gc-sections') # 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: + ldflags.append('-Wl,--icf=all') cflags.extend([ '-D_FILE_OFFSET_BITS=64',