diff --git a/pkgs/build-support/rust/hooks/default.nix b/pkgs/build-support/rust/hooks/default.nix index 1499380e728b..9f27a44480a9 100644 --- a/pkgs/build-support/rust/hooks/default.nix +++ b/pkgs/build-support/rust/hooks/default.nix @@ -91,13 +91,21 @@ lib.optionalString (stdenv.hostPlatform.config != stdenv.targetPlatform.config) '' [target."${stdenv.targetPlatform.rust.rustcTarget}"] "linker" = "${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}cc" - "rustflags" = [ "-C", "target-feature=${ - if pkgsTargetTarget.stdenv.targetPlatform.isStatic then "+" else "-" - }crt-static" ] + "rustflags" = [ ${ + lib.concatStringsSep ", " ( + [ + ''"-Ctarget-feature=${if stdenv.targetPlatform.isStatic then "+" else "-"}crt-static"'' + ] + ++ lib.optional (!stdenv.targetPlatform.isx86_32) ''"-Cforce-frame-pointers=yes"'' + ) + } ] '' + '' [target."${stdenv.hostPlatform.rust.rustcTarget}"] "linker" = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc" + "rustflags" = [ ${ + lib.optionalString (!stdenv.hostPlatform.isx86_32) ''"-Cforce-frame-pointers=yes"'' + } ] ''; };