From fb7a53c6cfc8bc2985423a55834507c930537bfc Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Sat, 15 Aug 2015 12:02:06 +0200 Subject: [PATCH] Use the gold linker when available. This shaves 50 seconds off the build time on my machine. --- etc/rustc-with-gold | 4 ++++ python/servo/command_base.py | 3 +++ python/servo/post_build_commands.py | 4 +--- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100755 etc/rustc-with-gold diff --git a/etc/rustc-with-gold b/etc/rustc-with-gold new file mode 100755 index 00000000000..7d2a05bb47c --- /dev/null +++ b/etc/rustc-with-gold @@ -0,0 +1,4 @@ +#!/bin/sh +EXTRA_ARGS="" +which ld.gold > /dev/null 2>&1 && EXTRA_ARGS="-C link-args=-fuse-ld=gold" +rustc $EXTRA_ARGS "$@" diff --git a/python/servo/command_base.py b/python/servo/command_base.py index b712a1d87b3..15f3d28ef0a 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -302,6 +302,9 @@ class CommandBase(object): if hosts_file_path: env['HOST_FILE'] = hosts_file_path + env['RUSTDOC'] = path.join(self.context.topdir, 'etc', 'rustdoc-with-private') + env['RUSTC'] = path.join(self.context.topdir, 'etc', 'rustc-with-gold') + return env def servo_crate(self): diff --git a/python/servo/post_build_commands.py b/python/servo/post_build_commands.py index fbeec5a6193..efa315158f8 100644 --- a/python/servo/post_build_commands.py +++ b/python/servo/post_build_commands.py @@ -156,10 +156,8 @@ class MachCommands(CommandBase): else: copy2(full_name, destination) - env = self.build_env() - env['RUSTDOC'] = '../../etc/rustdoc-with-private' return subprocess.call(["cargo", "doc"] + params, - env=env, cwd=self.servo_crate()) + env=self.build_env(), cwd=self.servo_crate()) @Command('browse-doc', description='Generate documentation and open it in a web browser',