From 6751d9898be671d253d6f7b0806cd4b10daaaf85 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 31 Jan 2011 13:24:04 +0000 Subject: Enabled global optimisation in release build winmain : GetEnvironmentStrings return should be freed with FreeEnvironmentStrings --- freetype/freetype.vcxproj | 8 ++++++-- libwinmain/winmain.c | 13 ++++++++----- makefile.before | 7 ++++--- openssl/util/mk1mf.pl | 8 ++++++++ openssl/util/pl/VC-32.pl | 25 +++++++++++++++---------- pthreads/Makefile | 6 +++--- 6 files changed, 44 insertions(+), 23 deletions(-) diff --git a/freetype/freetype.vcxproj b/freetype/freetype.vcxproj index 45113e5d4..d0475e50c 100644 --- a/freetype/freetype.vcxproj +++ b/freetype/freetype.vcxproj @@ -109,8 +109,8 @@ - MaxSpeed - OnlyExplicitInline + Full + AnySuitable ..\freetype\include\;%(AdditionalIncludeDirectories) NDEBUG;WIN32;_LIB;FT_FLAT_COMPILE;%(PreprocessorDefinitions) true @@ -121,6 +121,10 @@ Level3 true 4996;%(DisableSpecificWarnings) + true + Speed + true + true NDEBUG;%(PreprocessorDefinitions) diff --git a/libwinmain/winmain.c b/libwinmain/winmain.c index 126c19da4..4e5886397 100644 --- a/libwinmain/winmain.c +++ b/libwinmain/winmain.c @@ -74,6 +74,7 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL char *pProgramName; char **penv; int Ret; + LPTCH pEnvStrings; hInstance=hInstance; nCmdShow=nCmdShow; @@ -132,20 +133,22 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL } { - LPTCH pEnvStrings=GetEnvironmentStrings(); + LPTCH pTmp=GetEnvironmentStrings(); int NrEnv=0; + pEnvStrings=pTmp; penv=malloc(sizeof(*penv)); - while (*pEnvStrings) + while (*pTmp) { penv=realloc(penv,(NrEnv+2)*sizeof(*penv)); - penv[NrEnv++]=pEnvStrings; - while (*pEnvStrings) pEnvStrings++; - pEnvStrings++; + penv[NrEnv++]=pTmp; + while (*pTmp) pTmp++; + pTmp++; } penv[NrEnv]=NULL; } Ret = main(argc,argv,penv); free(penv); + FreeEnvironmentStrings(pEnvStrings); return Ret; } diff --git a/makefile.before b/makefile.before index 6b064306a..e613eb603 100644 --- a/makefile.before +++ b/makefile.before @@ -17,7 +17,7 @@ NOT=$(if $(findstring 0,$(1)),1,0) CC ?= cl /nologo CPP ?= $(CC) -CCFLAGS += -c -GF #-Wall +CCFLAGS += -c -GF -Gy #-Wall #CCFLAGS += -wd4996 -wd4738 LINK ?= link /nologo @@ -50,11 +50,12 @@ OBJDIR ?= obj\$(OBJDIRPREFIX)debug DEFINES += _DEBUG DEBUG RCFLAGS += -d "_DEBUG" else -CCFLAGS += -MD -O2 -Ob2 -Oi -Ox -Oy -Ot -Zi +CCFLAGS += -MD -O2 -Ob2 -Oi -Ox -Oy -Ot -Zi -GL DEFINES += NDEBUG -LINKFLAGS += /OPT:REF /OPT:ICF /DEBUG +LINKFLAGS += /OPT:REF /OPT:ICF /DEBUG /LTCG:STATUS OBJDIR ?= obj\$(OBJDIRPREFIX)release RCFLAGS += -d "NDEBUG" +AR += /LTCG endif diff --git a/openssl/util/mk1mf.pl b/openssl/util/mk1mf.pl index d969618ac..2526c86f8 100644 --- a/openssl/util/mk1mf.pl +++ b/openssl/util/mk1mf.pl @@ -501,7 +501,11 @@ EX_LIBS=$ex_libs SRC_D=$src_dir LINK=$link +!ifdef DEBUG +LFLAGS=$lflagsd +!else LFLAGS=$lflags +!endif RSC=$rsc # The output directory for the header files @@ -513,7 +517,11 @@ CP=$cp RM=$rm RANLIB=$ranlib MKDIR=$mkdir +!ifdef DEBUG +MKLIB=$bin_dir$mklibd +!else MKLIB=$bin_dir$mklib +!endif MLFLAGS=$mlflags ASM=$bin_dir$asm diff --git a/openssl/util/pl/VC-32.pl b/openssl/util/pl/VC-32.pl index b59d51fc7..99e748cad 100644 --- a/openssl/util/pl/VC-32.pl +++ b/openssl/util/pl/VC-32.pl @@ -37,7 +37,8 @@ if ($FLAVOR =~ /WIN64/) $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib $opt_cflags=$f.' /Ox'; $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG'; - $lflags="/nologo /subsystem:console /opt:ref"; + $lflags="/NOLOGO /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG:STATUS"; + $lflagsd="/NOLOGO /SUBSYSTEM:CONSOLE"; *::perlasm_compile_target = sub { my ($target,$source,$bname)=@_; @@ -109,7 +110,8 @@ elsif ($FLAVOR =~ /CE/) $base_cflags.=' -I$(PORTSDK_LIBPATH)/../../include' if (defined($ENV{'PORTSDK_LIBPATH'})); $opt_cflags=' /MC /O1i'; # optimize for space, but with intrinsics... $dbg_clfags=' /MC /Od -DDEBUG -D_DEBUG'; - $lflags="/nologo /opt:ref $wcelflag"; + $lflags="/NOLOGO /OPT:REF /OPT:ICF /LTCG:STATUS $wcelflag"; + $lflagsd="/NOLOGO $wcelflag"; } else # Win32 { @@ -117,9 +119,10 @@ else # Win32 my $f = ' /MD'; $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib - $opt_cflags=$f.' /O2 /Ob2 /Oi /Ox /Oy /Ot'; - $dbg_cflags=$f.'d /RTCc /RTC1 /Od /GS /GR /Zi'; - $lflags="/nologo /subsystem:console /opt:ref"; + $opt_cflags=$f.' /O2 /Ob2 /Oi /Ox /Oy /Ot /GL /Gy /GF /Zi'; + $dbg_cflags=$f.'d /RTCc /RTC1 /Od /GS /GR /Gy /GF /Zi'; + $lflags="/NOLOGO /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG:STATUS"; + $lflagsd="/NOLOGO /SUBSYSTEM:CONSOLE"; } $mlflags=''; @@ -142,7 +145,8 @@ else # generate symbols.pdb unconditionally $app_cflag.=" /Zi /Fd\$(TMP_D)/app"; $lib_cflag.=" /Zi /Fd\$(TMP_D)/lib"; -$lflags.=" /debug"; +$lflags.=" /DEBUG"; +$lflagsd.=" /DEBUG"; $obj='.obj'; $asm_suffix='.asm'; @@ -174,7 +178,8 @@ else $cdflags.=" -DOPENSSL_SYSNAME_WINNT -DUNICODE -D_UNICODE"; # static library stuff -$mklib='lib /nologo'; +$mklib='lib /nologo /LTCG'; +$mklibd='lib /nologo'; $ranlib=''; $plib=""; $libp=".lib"; @@ -234,7 +239,7 @@ if (!$no_asm) if ($shlib && $FLAVOR !~ /CE/) { - $mlflags.=" $lflags /dll"; + $mlflags.=" $lflags /DLL"; $lib_cflag.=" -D_WINDLL"; # # Engage Applink... @@ -263,8 +268,8 @@ ___ } elsif ($shlib && $FLAVOR =~ /CE/) { - $mlflags.=" $lflags /dll"; - $lflags.=' /entry:mainCRTstartup' if(defined($ENV{'PORTSDK_LIBPATH'})); + $mlflags.=" $lflags /DLL"; + $lflags.=' /ENTRY:mainCRTstartup' if(defined($ENV{'PORTSDK_LIBPATH'})); $lib_cflag.=" -D_WINDLL -D_DLL"; } diff --git a/pthreads/Makefile b/pthreads/Makefile index eca5a6d00..0ec9f10ab 100644 --- a/pthreads/Makefile +++ b/pthreads/Makefile @@ -24,12 +24,12 @@ INLINED_STAMPS = pthreadVCE$(DLL_VER).stamp pthreadVSE$(DLL_VER).stamp pthreadVC STATIC_STAMPS = pthreadVCE$(DLL_VER).static pthreadVSE$(DLL_VER).static pthreadVC$(DLL_VER).static \ pthreadVCE$(DLL_VERD).static pthreadVSE$(DLL_VERD).static pthreadVC$(DLL_VERD).static -OPTIM = /O2 /Ob2 /MD +OPTIM = /O2 /Ob2 /Oi /Ox /Oy /Ot /MD /GL OPTIMD = /MDd -CFLAGS = /W3 /nologo /I. /D_WIN32_WINNT=0x400 /DHAVE_CONFIG_H +CFLAGS = /W3 /nologo /Gy /GF /Zi /I. /D_WIN32_WINNT=0x400 /DHAVE_CONFIG_H -CFLAGSD = /Zi $(CFLAGS) +CFLAGSD = $(CFLAGS) # Uncomment this if config.h defines RETAIN_WSALASTERROR #XLIBS = wsock32.lib -- cgit v1.2.3