Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(942)

Unified Diff: build/common.gypi

Issue 646873004: Add Link-Time Optimizations support for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/increase_size_for_speed.gypi ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/common.gypi
diff --git a/build/common.gypi b/build/common.gypi
index 0ad62ee597ca1d822e84d13ac99d0e0b126abc16..e0726b4097849bb691eb3c0672d03fbf4f6a4b98 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -637,6 +637,16 @@
# compiler. Always do this by default.
'host_clang%': 1,
+ # Variables to control Link-Time Optimizations (LTO).
+ # Note: the variables must *not* be enabled at the same time.
+ # In this case LTO would 'merge' the optimization flags
+ # at link-time which would lead to all code be optimized with -O2.
+ # Enable LTO on the code compiled with -Os.
+ # See crbug.com/407544
+ 'use_lto%': 0,
+ # Enable LTO on code compiled with -O2.
+ 'use_lto_o2%': 0,
+
'conditions': [
# A flag for POSIX platforms
['OS=="win"', {
@@ -1185,6 +1195,8 @@
'proprietary_codecs%': '<(proprietary_codecs)',
'use_goma%': '<(use_goma)',
'gomadir%': '<(gomadir)',
+ 'use_lto%': '<(use_lto)',
+ 'use_lto_o2%': '<(use_lto_o2)',
'video_hole%': '<(video_hole)',
'enable_load_completion_hacks%': '<(enable_load_completion_hacks)',
'support_pre_M6_history_database%': '<(support_pre_M6_history_database)',
@@ -2313,6 +2325,11 @@
}, {
'use_seccomp_bpf%': 0,
}],
+ # Set component build with LTO until all tests pass.
+ # This also reduces link time.
+ ['use_lto==1', {
+ 'component%': "shared_library",
+ }],
],
# older history files use fts2 instead of fts3
@@ -3755,6 +3772,13 @@
'cflags': [
'-march=<(arm_arch)',
],
+ 'conditions': [
+ ['use_lto==1 or use_lto_o2==1', {
+ 'ldflags': [
+ '-march=<(arm_arch)',
+ ],
+ }],
+ ],
}],
['clang==1 and OS!="android"', {
'cflags': [
@@ -3767,21 +3791,49 @@
'cflags': [
'-mtune=<(arm_tune)',
],
+ 'conditions': [
+ ['use_lto==1 or use_lto_o2==1', {
+ 'ldflags': [
+ '-mtune=<(arm_tune)',
+ ],
+ }],
+ ],
}],
['arm_fpu!=""', {
'cflags': [
'-mfpu=<(arm_fpu)',
],
+ 'conditions': [
+ ['use_lto==1 or use_lto_o2==1', {
+ 'ldflags': [
+ '-mfpu=<(arm_fpu)',
+ ],
+ }],
+ ],
}],
['arm_float_abi!=""', {
'cflags': [
'-mfloat-abi=<(arm_float_abi)',
],
+ 'conditions': [
+ ['use_lto==1 or use_lto_o2==1', {
+ 'ldflags': [
+ '-mfloat-abi=<(arm_float_abi)',
+ ],
+ }],
+ ],
}],
['arm_thumb==1', {
'cflags': [
'-mthumb',
],
+ 'conditions': [
+ ['use_lto==1 or use_lto_o2==1', {
+ 'ldflags': [
+ '-mthumb',
+ ],
+ }],
+ ],
}],
['OS=="android"', {
# Most of the following flags are derived from what Android
@@ -5685,6 +5737,29 @@
['CXX.host_wrapper', '<(gomadir)/gomacc'],
],
}],
+ ['use_lto==1', {
+ 'target_defaults': {
+ 'target_conditions': [
+ ['_toolset=="target"', {
+ 'cflags': [
+ '-flto',
+ '-ffat-lto-objects',
+ ],
+ }],
+ ],
+ },
+ }],
+ ['use_lto==1 or use_lto_o2==1', {
+ 'target_defaults': {
+ 'target_conditions': [
+ ['_toolset=="target"', {
+ 'ldflags': [
+ '-flto=32',
+ ],
+ }],
+ ],
+ },
+ }],
],
'xcode_settings': {
# DON'T ADD ANYTHING NEW TO THIS BLOCK UNLESS YOU REALLY REALLY NEED IT!
« no previous file with comments | « build/android/increase_size_for_speed.gypi ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698