From 7477f5b387c2a492cc29ddd30a0d3d0b0a6a9952 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 25 Mar 2014 06:44:54 +0100 Subject: [PATCH] fix disabling PGO for extensions, rel bug #65715 --- ext/opcache/config.w32 | 5 ++--- win32/build/config.w32 | 2 -- win32/build/confutils.js | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ext/opcache/config.w32 b/ext/opcache/config.w32 index 280ce228c6..af160b207c 100644 --- a/ext/opcache/config.w32 +++ b/ext/opcache/config.w32 @@ -1,9 +1,8 @@ ARG_ENABLE("opcache", "whether to enable Zend OPcache support", "yes"); -if (PHP_OPCACHE != "no") { +var PHP_OPCACHE_PGO = false; - PHP_PGI = "no"; // workaround - PHP_PGO = "no"; // workaround +if (PHP_OPCACHE != "no") { EXTENSION('opcache', "\ ZendAccelerator.c \ diff --git a/win32/build/config.w32 b/win32/build/config.w32 index dba2d10648..569907baf5 100644 --- a/win32/build/config.w32 +++ b/win32/build/config.w32 @@ -255,12 +255,10 @@ if (PHP_DEBUG == "yes" && PHP_ZTS == "yes") { // CFLAGS, LDFLAGS and BUILD_DIR are defined // Add compiler and link flags if PGO options are selected if (PHP_DEBUG != "yes" && PHP_PGI == "yes") { - ADD_FLAG('DLL_LDFLAGS', "/LTCG:PGINSTRUMENT"); ADD_FLAG("STATIC_EXT_CFLAGS", "/GL /O2"); DEFINE("PGOPGD_DIR", "$(BUILD_DIR)"); } else if (PHP_DEBUG != "yes" && PHP_PGO != "no") { - ADD_FLAG('DLL_LDFLAGS', "/LTCG:PGUPDATE"); ADD_FLAG("STATIC_EXT_CFLAGS", "/GL /O2"); DEFINE("PGOPGD_DIR", ((PHP_PGO.length == 0 || PHP_PGO == "yes") ? "$(BUILD_DIR)" : PHP_PGO)); } diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 490f864573..136b3bb024 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -1228,6 +1228,8 @@ function ADD_EXTENSION_DEP(extname, dependson, optional) return true; } +var static_pgo_enabled = false; + function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir) { var objs = null; @@ -1318,6 +1320,19 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir) ADD_FLAG("STATIC_EXT_LIBS", "$(LIBS_" + EXT + ")"); ADD_FLAG("STATIC_EXT_LDFLAGS", "$(LDFLAGS_" + EXT + ")"); ADD_FLAG("STATIC_EXT_CFLAGS", "$(CFLAGS_" + EXT + ")"); + if (is_pgo_desired(extname) && (PHP_PGI == "yes" || PHP_PGO != "no")) { + if (!static_pgo_enabled) { + if (PHP_DEBUG != "yes" && PHP_PGI == "yes") { + ADD_FLAG('STATIC_EXT_LDFLAGS', "/LTCG:PGINSTRUMENT"); + } + else if (PHP_DEBUG != "yes" && PHP_PGO != "no") { + ADD_FLAG('STATIC_EXT_LDFLAGS', "/LTCG:PGUPDATE"); + } + + ADD_FLAG("STATIC_EXT_CFLAGS", "/GL /O2"); + static_pgo_enabled = true; + } + } /* find the header that declares the module pointer, * so we can include it in internal_functions.c */ -- 2.40.0