diff --git a/pkgs/development/tools/mold/default.nix b/pkgs/development/tools/mold/default.nix index 2cbc016a2933..530fbb1666c7 100644 --- a/pkgs/development/tools/mold/default.nix +++ b/pkgs/development/tools/mold/default.nix @@ -11,6 +11,8 @@ , zstd , buildPackages +, clangStdenv +, gccStdenv , hello , mold , mold-wrapped @@ -21,13 +23,13 @@ stdenv.mkDerivation rec { pname = "mold"; - version = "2.2.0"; + version = "2.3.0"; src = fetchFromGitHub { owner = "rui314"; repo = "mold"; rev = "v${version}"; - hash = "sha256-ePX80hzzIzSJdGUX96GyxYWcdbXxXyuyNQqj5RDSkKU="; + hash = "sha256-TgDGAYdJjqGQradB7UJlV2emvG7q4F9ctzPaGRUgvxU="; }; nativeBuildInputs = [ @@ -89,11 +91,13 @@ stdenv.mkDerivation rec { in { version = testers.testVersion { package = mold; }; + } // lib.optionalAttrs stdenv.isLinux { + adapter-gcc = helloTest "adapter-gcc" (hello.override (old: { stdenv = useMoldLinker gccStdenv; })); + adapter-llvm = helloTest "adapter-llvm" (hello.override (old: { stdenv = useMoldLinker clangStdenv; })); wrapped = helloTest "wrapped" (hello.overrideAttrs (previousAttrs: { nativeBuildInputs = (previousAttrs.nativeBuildInputs or [ ]) ++ [ mold-wrapped ]; NIX_CFLAGS_LINK = toString (previousAttrs.NIX_CFLAGS_LINK or "") + " -fuse-ld=mold"; })); - adapter = helloTest "adapter" (hello.override (old: { stdenv = useMoldLinker old.stdenv; })); }; }; diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index 1024bf2ce4d8..f7d7053c77a9 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -197,16 +197,10 @@ rec { ''; }; in stdenv.override (old: { - cc = stdenv.cc.override { - inherit bintools; - }; - allowedRequisites = - (lib.optional (stdenv.allowedRequisites or null != null) stdenv.allowedRequisites) - ++ [ bintools pkgs.mold ] - # need to `outputSpecified = false` to make getLib work - ++ (builtins.map (p: lib.getLib (p // { outputSpecified = false; })) pkgs.mold.buildInputs); - # gcc >12.1.0 supports '-fuse-ld=mold' - # the wrap ld above in bintools supports gcc <12.1.0 and shouldn't harm >12.1.0 + allowedRequisites = null; + cc = stdenv.cc.override { inherit bintools; }; + # gcc >12.1.0 supports '-fuse-ld=mold' + # the wrap ld above in bintools supports gcc <12.1.0 and shouldn't harm >12.1.0 # https://github.com/rui314/mold#how-to-use } // lib.optionalAttrs (stdenv.cc.isClang || (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12")) { mkDerivationFromStdenv = extendMkDerivationArgs old (args: {