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..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. @@ -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..0875750b75 100644 --- a/src/tools/msvc.jam +++ b/src/tools/msvc.jam @@ -1346,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 ; @@ -1407,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 ;