diff options
author | apnadkarni <apnmbx-wits@yahoo.com> | 2017-09-19 12:10:25 (GMT) |
---|---|---|
committer | apnadkarni <apnmbx-wits@yahoo.com> | 2017-09-19 12:10:25 (GMT) |
commit | f9b29197a24a30de1008382550f6aa8b1d1b5c60 (patch) | |
tree | f0035b414adfae4848827bdb705565eeac2a78f2 | |
parent | 8ac88896a6fc546841af33b100a4821667c2cd44 (diff) | |
download | tcl-f9b29197a24a30de1008382550f6aa8b1d1b5c60.zip tcl-f9b29197a24a30de1008382550f6aa8b1d1b5c60.tar.gz tcl-f9b29197a24a30de1008382550f6aa8b1d1b5c60.tar.bz2 |
Remove /Gs which enables _chkstk on *every* function call. The normal default
behaviour (without the option) checks only local variable space exceeds
page size. This is what Microsoft recommends.
Also moved -O2 to rules.vc file so as to keep all optimization flags
in one location.
Removed optimizations switches subsumed by -O2.
-rw-r--r-- | win/makefile.vc | 2 | ||||
-rw-r--r-- | win/rules.vc | 36 |
2 files changed, 22 insertions, 16 deletions
diff --git a/win/makefile.vc b/win/makefile.vc index ada08cc..cb6d92c 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -470,7 +470,7 @@ PKGSDIR = $(ROOT)\pkgs !if !$(DEBUG)
!if $(OPTIMIZING)
### This cranks the optimization level to maximize speed
-cdebug = -O2 $(OPTIMIZATIONS)
+cdebug = $(OPTIMIZATIONS)
!else
cdebug =
!endif
diff --git a/win/rules.vc b/win/rules.vc index 4a3ae26..3f3d077 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -113,42 +113,46 @@ CFG_ENCODING = \"cp1252\" #----------------------------------------------------------
### test for optimizations
-!if [nmakehlp -c -Ot]
+# /O2 optimization includes /Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy as per
+# documentation. Note we do NOT want /Gs as that inserts a _chkstk
+# stack probe at *every* function entry, not just those with more than
+# a page of stack allocation resulting in a performance hit. However,
+# /O2 documentation is misleading as its stack probes are simply the
+# default page size locals allocation probes and not what is implied
+# by an explicit /Gs option.
+
+!if [nmakehlp -c -O2]
!message *** Compiler has 'Optimizations'
OPTIMIZING = 1
+OPTIMIZATIONS = -O2
!else
!message *** Compiler does not have 'Optimizations'
OPTIMIZING = 0
+OPTIMIZATIONS =
!endif
-OPTIMIZATIONS =
-
-!if [nmakehlp -c -Ot]
-OPTIMIZATIONS = $(OPTIMIZATIONS) -Ot
-!endif
-
-!if [nmakehlp -c -Oi]
-OPTIMIZATIONS = $(OPTIMIZATIONS) -Oi
-!endif
+# -Op improves float consistency. Note only needed for older compilers
+# Newer compilers do not need or support this option.
!if [nmakehlp -c -Op]
OPTIMIZATIONS = $(OPTIMIZATIONS) -Op
!endif
+# Strict floating point semantics - present in newer compilers in lieu of -Op
!if [nmakehlp -c -fp:strict]
OPTIMIZATIONS = $(OPTIMIZATIONS) -fp:strict
!endif
-!if [nmakehlp -c -Gs]
-OPTIMIZATIONS = $(OPTIMIZATIONS) -Gs
-!endif
-
+# Checks for buffer overflows in local arrays
!if [nmakehlp -c -GS]
OPTIMIZATIONS = $(OPTIMIZATIONS) -GS
!endif
+# Link time optimization. Note that this option (potentially) makes generated libraries
+# only usable by the specific VC++ version that created it. Requires /LTCG linker option
!if [nmakehlp -c -GL]
OPTIMIZATIONS = $(OPTIMIZATIONS) -GL
+CC_GL_OPT_ENABLED = 1
!endif
DEBUGFLAGS =
@@ -208,8 +212,10 @@ ALIGN98_HACK = 0 LINKERFLAGS =
+!ifdef CC_GL_OPT_ENABLED
!if [nmakehlp -l -ltcg $(LINKER_TESTFLAGS)]
-LINKERFLAGS =-ltcg
+LINKERFLAGS = $(LINKERFLAGS) -ltcg
+!endif
!endif
#----------------------------------------------------------
|