Skip to content

Commit

Permalink
Make the use of gold linker configurable
Browse files Browse the repository at this point in the history
Currently, ld.gold is always used for linking if found on the
system. There are some cases however when one may want to opt out
from using it. This patch adds the boolean field `rustc-with-gold`
to the `[tools]` section of `.servobuild`, which if set false,
disables the use of ld.gold.
  • Loading branch information
akosthekiss committed Sep 8, 2015
1 parent ef8a145 commit 9afa930
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/servo/command_base.py
Expand Up @@ -101,6 +101,7 @@ def resolverelative(category, key):
if not self.config["tools"]["system-cargo"]:
self.config["tools"]["cargo-root"] = path.join(
context.sharedir, "cargo", self.cargo_build_id())
self.config["tools"].setdefault("rustc-with-gold", True)

self.config.setdefault("build", {})
self.config["build"].setdefault("android", False)
Expand Down Expand Up @@ -308,8 +309,9 @@ def build_env(self, gonk=False, hosts_file_path=None):

env['RUSTDOC'] = path.join(self.context.topdir, 'etc', 'rustdoc-with-private')

if subprocess.call(['which', 'ld.gold'], stdout=PIPE, stderr=PIPE) == 0:
env['RUSTC'] = path.join(self.context.topdir, 'etc', 'rustc-with-gold')
if self.config["tools"]["rustc-with-gold"]:
if subprocess.call(['which', 'ld.gold'], stdout=PIPE, stderr=PIPE) == 0:
env['RUSTC'] = path.join(self.context.topdir, 'etc', 'rustc-with-gold')

return env

Expand Down
4 changes: 4 additions & 0 deletions servobuild.example
Expand Up @@ -23,6 +23,10 @@ system-rust = false
system-cargo = false
#cargo-root = "/path/to/cargo"

# If rustc-with-gold is true, will try to find and use gold linker with rustc.
# Defaults to true
rustc-with-gold = true

[build]
# Set "mode = dev" or use `mach build --dev` to build the project with warning.
# or Set "mode = release" or use `mach build --release` for optimized build.
Expand Down

0 comments on commit 9afa930

Please sign in to comment.