Index: build/toolchain.gypi |
diff --git a/build/toolchain.gypi b/build/toolchain.gypi |
index a8a3b56ec22a2b761cfff51f95dc393b38000649..2163171d7e55a01f6d79beaa489a87f7f0175a58 100644 |
--- a/build/toolchain.gypi |
+++ b/build/toolchain.gypi |
@@ -277,10 +277,12 @@ |
}], |
], |
}], |
- # Disable LTO for v8 |
- # v8 is optimized for speed, which takes precedence over |
- # size optimization in LTO. |
- ['use_lto==1', { |
+ # Disable GCC LTO for v8 |
+ # v8 is optimized for speed. Because GCC LTO merges flags at link |
+ # time, we disable LTO to prevent any -O2 flags from taking |
+ # precedence over v8's -Os flag. However, LLVM LTO does not work |
+ # this way so we keep LTO enabled under LLVM. |
+ ['clang==0 and use_lto==1', { |
'cflags!': [ |
'-flto', |
'-ffat-lto-objects', |