From ca5f44c79a1f967621a8505867684146cc1a9305 Mon Sep 17 00:00:00 2001 From: bernhard-b Date: Thu, 24 Jul 2014 21:59:42 +0200 Subject: [PATCH 1/2] Whole program optimization for intel-win,msvc,gcc --- src/tools/builtin.jam | 2 ++ src/tools/gcc.jam | 4 ++++ src/tools/intel-win.jam | 2 ++ src/tools/msvc.jam | 4 ++++ 4 files changed, 12 insertions(+) diff --git a/src/tools/builtin.jam b/src/tools/builtin.jam index d62680afd9..c21a9c551b 100644 --- a/src/tools/builtin.jam +++ b/src/tools/builtin.jam @@ -115,6 +115,8 @@ feature.feature inlining : off on full : propagated ; feature.feature threading : single multi : propagated ; feature.feature rtti : on off : propagated ; feature.feature exception-handling : on off : propagated ; +feature.feature link-time-optimization : off on : propagated ; +feature.feature whole-program-optimization : off on : incidental propagated ; # Whether there is support for asynchronous EH (e.g. catching SEGVs). feature.feature asynch-exceptions : off on : propagated ; diff --git a/src/tools/gcc.jam b/src/tools/gcc.jam index 599e20ff7c..8d55960b32 100644 --- a/src/tools/gcc.jam +++ b/src/tools/gcc.jam @@ -385,6 +385,10 @@ toolset.flags gcc.compile OPTIONS on : -pg ; toolset.flags gcc.compile.c++ OPTIONS off : -fno-rtti ; toolset.flags gcc.compile.c++ OPTIONS off : -fno-exceptions ; +toolset.flags gcc.compile OPTIONS on : -flto ; +toolset.flags gcc.link OPTIONS on : -flto ; + + rule setup-fpic ( targets * : sources * : properties * ) { local link = [ feature.get-values link : $(properties) ] ; diff --git a/src/tools/intel-win.jam b/src/tools/intel-win.jam index 81e43dacd9..c3592271ac 100644 --- a/src/tools/intel-win.jam +++ b/src/tools/intel-win.jam @@ -347,6 +347,8 @@ local rule configure-really ( version ? : command * : options * : compatibility # happy when compiler produces not the file it was asked for. # The option below stops this behaviour. toolset.flags intel-win CFLAGS : -Qpchi- ; + toolset.flags intel-win.compile CFLAGS on : /Qipo ; + toolset.flags intel-win.link LINKFLAGS on : /qipo ; if ! $(compatibility) { diff --git a/src/tools/msvc.jam b/src/tools/msvc.jam index ead320fc29..036436ee9b 100644 --- a/src/tools/msvc.jam +++ b/src/tools/msvc.jam @@ -276,6 +276,10 @@ rule configure-version-specific ( toolset : version : conditions ) toolset.flags $(toolset).link LINKFLAGS $(conditions)/$(.cpu-arch-ia64) : /MACHINE:IA64 ; toolset.flags $(toolset).link LINKFLAGS $(conditions)/$(.cpu-arch-arm) : /MACHINE:ARM ; + toolset.flags $(toolset).compile CFLAGS $(conditions)/on : /GL ; + toolset.flags $(toolset).link LINKFLAGS $(conditions)/on : /LTCG ; + + # Make sure that manifest will be generated even if there is no # dependencies to put there. toolset.flags $(toolset).link LINKFLAGS $(conditions) : /MANIFEST ; From 7a4d2832db668143ba6f502769273c9cd628fbbb Mon Sep 17 00:00:00 2001 From: bernhard-b Date: Mon, 28 Jul 2014 16:00:40 +0200 Subject: [PATCH 2/2] Don't inherit msvc whole-program-optimization flags in intel-win --- src/tools/intel-win.jam | 2 +- src/tools/msvc.jam | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tools/intel-win.jam b/src/tools/intel-win.jam index c3592271ac..24c43a5b9d 100644 --- a/src/tools/intel-win.jam +++ b/src/tools/intel-win.jam @@ -20,7 +20,7 @@ import path ; feature.extend-subfeature toolset intel : platform : win ; toolset.inherit-generators intel-win intel win : msvc ; -toolset.inherit-flags intel-win : msvc : : YLOPTION ; +toolset.inherit-flags intel-win : msvc : on on : YLOPTION ; toolset.inherit-rules intel-win : msvc ; # Override default do-nothing generators. diff --git a/src/tools/msvc.jam b/src/tools/msvc.jam index 036436ee9b..0875750b75 100644 --- a/src/tools/msvc.jam +++ b/src/tools/msvc.jam @@ -276,10 +276,6 @@ rule configure-version-specific ( toolset : version : conditions ) toolset.flags $(toolset).link LINKFLAGS $(conditions)/$(.cpu-arch-ia64) : /MACHINE:IA64 ; toolset.flags $(toolset).link LINKFLAGS $(conditions)/$(.cpu-arch-arm) : /MACHINE:ARM ; - toolset.flags $(toolset).compile CFLAGS $(conditions)/on : /GL ; - toolset.flags $(toolset).link LINKFLAGS $(conditions)/on : /LTCG ; - - # Make sure that manifest will be generated even if there is no # dependencies to put there. toolset.flags $(toolset).link LINKFLAGS $(conditions) : /MANIFEST ; @@ -1350,6 +1346,8 @@ local rule register-toolset-really ( ) toolset.flags msvc.compile CFLAGS speed : /O2 ; toolset.flags msvc.compile CFLAGS space : /O1 ; + toolset.flags msvc.compile CFLAGS on : /GL ; + toolset.flags msvc.compile CFLAGS $(.cpu-arch-ia64)/$(.cpu-type-itanium) : /G1 ; toolset.flags msvc.compile CFLAGS $(.cpu-arch-ia64)/$(.cpu-type-itanium2) : /G2 ; @@ -1411,6 +1409,8 @@ local rule register-toolset-really ( ) # The linker disables the default optimizations when using /DEBUG so we # have to enable them manually for release builds with debug symbols. toolset.flags msvc LINKFLAGS on/off : /OPT:REF,ICF ; + + toolset.flags msvc.link LINKFLAGS on : /LTCG ; toolset.flags msvc LINKFLAGS console : /subsystem:console ; toolset.flags msvc LINKFLAGS gui : /subsystem:windows ;