diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 7f24c1153d2d..4758411773b4 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -801,8 +801,15 @@ stdenvNoCC.mkDerivation { export hardening_unsupported_flags="${concatStringsSep " " ccHardeningUnsupportedFlags}" '' + # Do not prevent omission of framepointers on x86 32bit due to the small + # number of general purpose registers. Keeping EBP available provides + # non-trivial performance benefits. + + optionalString (!targetPlatform.isx86_32) '' + echo " -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer " >> $out/nix-support/cc-cflags-before + '' + # For clang, this is handled in add-clang-cc-cflags-before.sh - + lib.optionalString (!isClang && machineFlags != [ ]) '' + + optionalString (!isClang && machineFlags != [ ]) '' printf "%s\n" ${lib.escapeShellArgs machineFlags} >> $out/nix-support/cc-cflags-before ''