Previous patch is wrong, I did a mistake in name ;)
Martin
On 03/27/2014 09:52 AM, Martin Liška wrote:
On 03/25/2014 09:50 PM, Jan Hubicka wrote:
Hello,
I've been compiling Chromium with LTO and I noticed that WPA
stream_out forks and do parallel:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02621.html.
I am unable to fit in 16GB memory: ld uses about 8GB and lto1 about
6GB. When WPA start to fork, memory consumption increases so that
lto1 is killed. I would appreciate an --param option to disable this
WPA fork. The number of forks is taken from build system (-flto=9)
which is fine for ltrans phase, because LD releases aforementioned
8GB.
What do you think about that?
I can take a look - our measurements suggested that the WPA memory will
be later dominated by ltrans. Perhaps Chromium does something that
makes
WPA to explode that would be interesting to analyze. I did not managed
to get through Chromium LTO build process recently (ninja builds are not
my friends), can you send me the instructions?
Honza
Thanks,
Martin
There are instructions how can one build chromium with LTO:
1) install depot-tools and export PATH variable according to guide:
http://www.chromium.org/developers/how-tos/install-depot-tools
2) Checkout source code: gclient sync; cd src
3) Apply patch (enables system gold linker and disables LTO for a
sandbox that uses top-level asm)
4) which ld should point to ld.gold
5) unsure that ld.bfd points to ld.bfd
6) run: build/gyp_chromium -Dwerror=
7) ninja -C out/Release chrome -jX
If there are any problems, follow:
https://code.google.com/p/chromium/wiki/LinuxBuildInstructions
Martin
diff --git a/build/common.gypi b/build/common.gypi
index 72eb96d9..4c2235a 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -3110,12 +3110,14 @@
# can be removed at link time with --gc-sections.
'-fdata-sections',
'-ffunction-sections',
+ '-flto=9 -fno-fat-lto-objects',
],
'ldflags': [
# Specifically tell the linker to perform optimizations.
# See http://lwn.net/Articles/192624/ .
'-Wl,-O1',
'-Wl,--as-needed',
+ '-flto=9 -fno-fat-lto-objects',
],
'conditions' : [
['no_gc_sections==0', {
@@ -3328,7 +3330,7 @@
'ldflags': [
# As long as -fuse-ld=gold doesn't work, add a dummy directory
# with an 'ld' that redirects to gold, so that clang uses gold.
- '-B<(PRODUCT_DIR)/../../build/android/arm-linux-androideabi-gold',
+ # '-B<(PRODUCT_DIR)/../../build/android/arm-linux-androideabi-gold',
],
}],
['asan==1', {
@@ -3716,7 +3718,7 @@
# unspecified what the cwd is when running the compiler,
# so the normal gyp path-munging fails us. This hack
# gets the right path.
- '-B<!(cd <(DEPTH) && pwd -P)/third_party/gold',
+ # '-B<!(cd <(DEPTH) && pwd -P)/third_party/gold',
],
}],
],
diff --git a/components/nacl.gyp b/components/nacl.gyp
index b979f00..abe0597 100644
--- a/components/nacl.gyp
+++ b/components/nacl.gyp
@@ -193,6 +193,7 @@
# of nacl_helper.
'IN_NACL_HELPER=1',
],
+ 'ldflags': [ '-flto-partition=none' ],
'sources': [
'nacl/loader/nacl_helper_linux.cc',
'nacl/loader/nacl_helper_linux.h',
diff --git a/sandbox/linux/sandbox_linux.gypi b/sandbox/linux/sandbox_linux.gypi
index 59c61ff..56deeb3 100644
--- a/sandbox/linux/sandbox_linux.gypi
+++ b/sandbox/linux/sandbox_linux.gypi
@@ -20,6 +20,8 @@
],
},
'target_defaults': {
+ 'cflags!': ['-flto=9 -fno-fat-lto-objects'],
+ 'ldflags!': ['-flto=9 -fno-fat-lto-objects'],
'target_conditions': [
# All linux/ files will automatically be excluded on Android
# so make sure we re-include them explicitly.