cargoSetupHook: Force frame pointers for !isx86_32

We did this for C in #399014 but not Rust. Add
-Cforce-frame-pointers=yes to rustflags in cargoSetupHook
This commit is contained in:
dramforever 2025-06-28 23:50:36 +08:00 committed by Alyssa Ross
parent e87e319c8e
commit e05a1a15ac

View File

@ -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"''
} ]
'';
};