diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/servo/command_base.py | 2 | ||||
-rw-r--r-- | python/servo/platform/base.py | 5 | ||||
-rw-r--r-- | python/servo/platform/linux.py | 11 |
3 files changed, 16 insertions, 2 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 0b51070b4f3..81dca475a66 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -498,7 +498,7 @@ class CommandBase(object): # TODO(mrobinson): Gradually turn this on for more platforms, when support stabilizes. # See https://github.com/rust-lang/rust/issues/39915 if not self.cross_compile_target and effective_target == "x86_64-unknown-linux-gnu": - env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -Zgcc-ld=lld" + env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + servo.platform.get().linker_flag() if not (self.config["build"]["ccache"] == ""): env['CCACHE'] = self.config["build"]["ccache"] diff --git a/python/servo/platform/base.py b/python/servo/platform/base.py index a1bce7e3bb8..7fde2b60c97 100644 --- a/python/servo/platform/base.py +++ b/python/servo/platform/base.py @@ -67,7 +67,10 @@ class Base: def library_path_variable_name(self): raise NotImplementedError("Do not know how to set library path for platform.") - def executable_suffix(self): + def linker_flag(self) -> str: + return "" + + def executable_suffix(self) -> str: return "" def _platform_bootstrap(self, _force: bool) -> bool: diff --git a/python/servo/platform/linux.py b/python/servo/platform/linux.py index e49154d8ff2..a5d0ea6bce2 100644 --- a/python/servo/platform/linux.py +++ b/python/servo/platform/linux.py @@ -127,6 +127,17 @@ class Linux(Base): installed_something |= self._platform_bootstrap_gstreamer(force) return installed_something + def linker_flag(self) -> str: + # the rust-lld binary downloaded by rustup + # doesn't respect NIX_LDFLAGS and also needs + # other patches to work correctly. Use system + # version of lld for now. See + # https://github.com/NixOS/nixpkgs/issues/220717 + if self.distro.lower() == 'nixos': + return '-C link-arg=-fuse-ld=lld' + else: + return '-Zgcc-ld=lld' + def install_non_gstreamer_dependencies(self, force: bool) -> bool: install = False pkgs = [] |