diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index e7fcf173c6026..bba00f0adbec0 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -334,7 +334,7 @@ stdenvNoCC.mkDerivation { hardening_unsupported_flags+=" pic" '' - + optionalString (targetPlatform.isAvr || targetPlatform.isWindows) '' + + optionalString (targetPlatform.isAvr || targetPlatform.isWindows || targetPlatform.isWasi) '' hardening_unsupported_flags+=" relro bindnow" '' diff --git a/pkgs/build-support/rust/lib/default.nix b/pkgs/build-support/rust/lib/default.nix index e09f913bfbd39..777bcb21fd181 100644 --- a/pkgs/build-support/rust/lib/default.nix +++ b/pkgs/build-support/rust/lib/default.nix @@ -23,8 +23,10 @@ rec { ccForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"; cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"; - linkerForHost = if shouldUseLLD stdenv.targetPlatform - && !stdenv.cc.bintools.isLLVM + # For wasi: Rust recognizes "clang" or "gcc" as compilers, but not "cc" as in ccForHost. + # So it defaults to expecting lld and passes arguments accordingly. + linkerForHost = if stdenv.targetPlatform.isWasi + || (shouldUseLLD stdenv.targetPlatform && !stdenv.cc.bintools.isLLVM) then "${pkgsBuildHost.llvmPackages.bintools}/bin/${stdenv.cc.targetPrefix}ld.lld" else ccForHost;