Tweak flags to improve size/speed for posix I noticed the GN cipd binary was ~7M instead of the ~1-2M it ought to be, so update to strip the release binary. Additionally, turn on -flto since we build with clang anyway, which makes generation of the Chrome ninja files about 5% faster on my Linux box. Change-Id: Ib389b20e6729a74b922fc7a3ce5b4412a3972de9 Reviewed-on: https://gn-review.googlesource.com/1820 Reviewed-by: Brett Wilson <brettw@chromium.org> Commit-Queue: Scott Graham <scottmg@chromium.org>
diff --git a/build/gen.py b/build/gen.py index 9f43290..26e23ad 100755 --- a/build/gen.py +++ b/build/gen.py
@@ -156,10 +156,10 @@ ld = os.environ.get('LD', 'link.exe') ar = os.environ.get('AR', 'lib.exe') else: - cc = os.environ.get('CC', 'cc') - cxx = os.environ.get('CXX', 'c++') + cc = os.environ.get('CC', 'clang') + cxx = os.environ.get('CXX', 'clang++') ld = cxx - ar = os.environ.get('AR', 'ar') + ar = os.environ.get('AR', 'llvm-ar') cflags = os.environ.get('CFLAGS', '').split() cflags_cc = os.environ.get('CXXFLAGS', '').split() @@ -172,20 +172,17 @@ if options.debug: cflags.extend(['-O0', '-g']) else: - # The linux::ppc64 BE binary doesn't "work" when - # optimization level is set to 2 (0 works fine). - # Note that the current bootstrap script has no way to detect host_cpu. - # This can be easily fixed once we start building using a GN binary, - # as the optimization flag can then just be set using the - # logic inside //build/toolchain. - cflags.extend(['-O2', '-g0']) + cflags.extend(['-O3', '-flto']) + ldflags.append('-Wl,-S' if is_mac else '-Wl,-strip-all') + ldflags.append('-flto') cflags.extend([ '-D_FILE_OFFSET_BITS=64', '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS', '-pthread', '-pipe', - '-fno-exceptions' + '-fno-exceptions', + '-fno-rtti', ]) cflags_cc.extend(['-std=c++14', '-Wno-c++11-narrowing']) elif is_win: