+3
−2
Loading
After #400734 we can make useMoldLinker work when cross compiling.
We need the following:
- Need to use pkgs.buildPackages.mold so that we use mold binaries
for the build machine instead of the host.
- Need to create unprefixed ld.mold wrapper because gcc will not look
for a triple-prefixed ld.mold when passing -fuse-ld=mold.
Tested on an aarch64 machine with this change + #400734:
$ nix-build -K --expr 'with import "${./.}" { crossSystem = { config = "x86_64-unknown-linux-gnu"; }; }; hello.override { stdenv = useMoldLinker stdenv; }' && strings result/bin/hello | grep mold
/nix/store/w1yg0am7iyqsgi253h84lsp92178sgfi-hello-x86_64-unknown-linux-gnu-2.12.1
mold 2.37.1 (compatible with GNU ld)