mirror of
https://github.com/NixOS/nix
synced 2025-07-07 18:31:49 +02:00
Merge pull request #12814 from silvanshade/link-with-mold
Use mold instead of GNU ld for faster builds
This commit is contained in:
commit
fadd86011f
2 changed files with 13 additions and 14 deletions
|
@ -159,13 +159,6 @@ let
|
||||||
];
|
];
|
||||||
separateDebugInfo = !stdenv.hostPlatform.isStatic;
|
separateDebugInfo = !stdenv.hostPlatform.isStatic;
|
||||||
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
|
hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie";
|
||||||
env =
|
|
||||||
prevAttrs.env or { }
|
|
||||||
// lib.optionalAttrs (
|
|
||||||
stdenv.isLinux
|
|
||||||
&& !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")
|
|
||||||
&& !(stdenv.hostPlatform.useLLVM or false)
|
|
||||||
) { LDFLAGS = "-fuse-ld=gold"; };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mesonLibraryLayer = finalAttrs: prevAttrs: {
|
mesonLibraryLayer = finalAttrs: prevAttrs: {
|
||||||
|
|
|
@ -71,12 +71,17 @@ pkgs.nixComponents.nix-util.overrideAttrs (
|
||||||
# We use this shell with the local checkout, not unpackPhase.
|
# We use this shell with the local checkout, not unpackPhase.
|
||||||
src = null;
|
src = null;
|
||||||
|
|
||||||
env = {
|
env =
|
||||||
# For `make format`, to work without installing pre-commit
|
{
|
||||||
_NIX_PRE_COMMIT_HOOKS_CONFIG = "${(pkgs.formats.yaml { }).generate "pre-commit-config.yaml"
|
# For `make format`, to work without installing pre-commit
|
||||||
modular.pre-commit.settings.rawConfig
|
_NIX_PRE_COMMIT_HOOKS_CONFIG = "${(pkgs.formats.yaml { }).generate "pre-commit-config.yaml"
|
||||||
}";
|
modular.pre-commit.settings.rawConfig
|
||||||
};
|
}";
|
||||||
|
}
|
||||||
|
// lib.optionalAttrs stdenv.hostPlatform.isLinux {
|
||||||
|
CC_LD = "mold";
|
||||||
|
CXX_LD = "mold";
|
||||||
|
};
|
||||||
|
|
||||||
mesonFlags =
|
mesonFlags =
|
||||||
map (transformFlag "libutil") (ignoreCrossFile pkgs.nixComponents.nix-util.mesonFlags)
|
map (transformFlag "libutil") (ignoreCrossFile pkgs.nixComponents.nix-util.mesonFlags)
|
||||||
|
@ -119,7 +124,8 @@ pkgs.nixComponents.nix-util.overrideAttrs (
|
||||||
++ lib.optional (stdenv.cc.isClang && !stdenv.buildPlatform.isDarwin) pkgs.buildPackages.bear
|
++ lib.optional (stdenv.cc.isClang && !stdenv.buildPlatform.isDarwin) pkgs.buildPackages.bear
|
||||||
++ lib.optional (stdenv.cc.isClang && stdenv.hostPlatform == stdenv.buildPlatform) (
|
++ lib.optional (stdenv.cc.isClang && stdenv.hostPlatform == stdenv.buildPlatform) (
|
||||||
lib.hiPrio pkgs.buildPackages.clang-tools
|
lib.hiPrio pkgs.buildPackages.clang-tools
|
||||||
);
|
)
|
||||||
|
++ lib.optional stdenv.hostPlatform.isLinux pkgs.buildPackages.mold-wrapped;
|
||||||
|
|
||||||
buildInputs =
|
buildInputs =
|
||||||
attrs.buildInputs or [ ]
|
attrs.buildInputs or [ ]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue