cc-wrapper: enable frame pointers by default.
Allow easy system-level profiling with e.g. Linux perf or bpf(trace). Profiling applications in NixOS is quite expensive due to the size of closures of basic but widely-used libraries. Full-system profiling is even harder as it effectively requires re-compiling the world with ~0 caching. By enabling it by default, we make this trivially possible (except for the packages that explicitly specify -fomit-frame-pointers, of course) Make an exception for 32bit x86 since it only has 8 general purpose registers. Frame pointers are enabled by default in Fedora, Ubuntu, and Arch Linux.
This commit is contained in:
committed by
Alyssa Ross
parent
da136a6f42
commit
c3afdec4e8
@@ -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
|
||||
''
|
||||
|
||||
|
||||
Reference in New Issue
Block a user