From 413d9e2f4135219dd8ffa82d743ed9302dbc0ca0 Mon Sep 17 00:00:00 2001 From: machenbach Date: Tue, 10 May 2016 05:08:14 -0700 Subject: [PATCH] Revert of [build] Use -O2 on linux by default (patchset #1 id:1 of https://codereview.chromium.org/1963693004/ ) Reason for revert: Causes regressions. Original issue's description: > [build] Use -O2 on linux by default > > This switches O2 -> O3 to match chromium's configuration. > > This makes the difference between gn and gyp a bit smaller > before switching. > > BUG=chromium:474921 > LOG=n > > Committed: https://crrev.com/a37ab71e343b8cc24df05868b941a49e0c271376 > Cr-Commit-Position: refs/heads/master@{#36124} TBR=jochen@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=chromium:474921 Review-Url: https://codereview.chromium.org/1958253004 Cr-Commit-Position: refs/heads/master@{#36135} --- gypfiles/toolchain.gypi | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/gypfiles/toolchain.gypi b/gypfiles/toolchain.gypi index bb016e72a2..ee6cd20067 100644 --- a/gypfiles/toolchain.gypi +++ b/gypfiles/toolchain.gypi @@ -1183,13 +1183,23 @@ 'cflags!': [ '-O0', '-O1', - '-O3', '-Os', ], 'cflags': [ '-fdata-sections', '-ffunction-sections', - '-O2', + ], + 'conditions': [ + # TODO(crbug.com/272548): Avoid -O3 in NaCl + # Don't use -O3 with sanitizers. + ['nacl_target_arch=="none" and asan==0 and msan==0 and lsan==0 \ + and tsan==0 and ubsan==0 and ubsan_vptr==0', { + 'cflags': ['-O3'], + 'cflags!': ['-O2'], + }, { + 'cflags': ['-O2'], + 'cflags!': ['-O3'], + }], ], }], ['OS=="mac"', { @@ -1291,14 +1301,24 @@ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \ or OS=="aix"', { 'cflags!': [ - '-O3', '-Os', ], 'cflags': [ '-fdata-sections', '-ffunction-sections', '<(wno_array_bounds)', - '-O2', + ], + 'conditions': [ + # TODO(crbug.com/272548): Avoid -O3 in NaCl + # Don't use -O3 with sanitizers. + ['nacl_target_arch=="none" and asan==0 and msan==0 and lsan==0 \ + and tsan==0 and ubsan==0 and ubsan_vptr==0', { + 'cflags': ['-O3'], + 'cflags!': ['-O2'], + }, { + 'cflags': ['-O2'], + 'cflags!': ['-O3'], + }], ], }], ['OS=="android"', {