Index: gypfiles/toolchain.gypi |
diff --git a/gypfiles/toolchain.gypi b/gypfiles/toolchain.gypi |
index bb016e72a28c402edbed71272a5284682edc2406..ee6cd20067554e4b8bdb80916765d4acabaa1875 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"', { |