From 692c9b459d6de7f6b4bb41361d6206598167ee05 Mon Sep 17 00:00:00 2001 From: Antoine Viallon Date: Sun, 10 Apr 2022 22:34:18 +0200 Subject: [PATCH] [Packages] Improve compile options and document them --- packages.nix | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/packages.nix b/packages.nix index f468202..ba715f1 100644 --- a/packages.nix +++ b/packages.nix @@ -24,19 +24,35 @@ in compileFlags = mkOption { default = [ "-O3" "-march=${generalCfg.cpuArch}" "-mtune=${generalCfg.cpuTune}" - "-feliminate-unused-debug-types" "--param=ssp-buffer-size=32" - # "-Wl,--copy-dt-needed-entries-m64-fasynchronous-unwind-tables" - "-fasynchronous-unwind-tables" - "-fno-semantic-interposition" + "-feliminate-unused-debug-types" + "--param=ssp-buffer-size=32" + + "-fno-asynchronous-unwind-tables" + + # Fat LTO objects are object files that contain both the intermediate language and the object code. This makes them usable for both LTO linking and normal linking. + "-flto=auto" # Use -flto=auto to use GNU make’s job server, if available, or otherwise fall back to autodetection of the number of CPU threads present in your system. "-ffat-lto-objects" + + # Math optimizations leading to loss of precision "-fno-signed-zeros" "-fno-trapping-math" "-fassociative-math" - "-fexceptions" + + # Perform loop distribution of patterns that can be code generated with calls to a library (activated at O3 and more) "-ftree-loop-distribute-patterns" + "-Wl,-sort-common" + + # The compiler assumes that if interposition happens for functions the overwriting function will have precisely the same semantics (and side effects) "-fno-semantic-interposition" + + # Perform interprocedural pointer analysis and interprocedural modification and reference analysis. This option can cause excessive memory and compile-time usage on large compilation units. "-fipa-pta" + + + "-fdevirtualize-speculatively" + + # Stream extra information needed for aggressive devirtualization when running the link-time optimizer in local transformation mode. "-fdevirtualize-at-ltrans" ]; example = [ "-O2" "-mavx" ];