mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Drop support for building with MSC_VER < 1920
`MSC_VER` 1920 refers to Visual Studio 2019 RTW 16.0[1], and this should be the bare minimum which we support nowadays. If users use an older Visual Studio version, we fail gracefully during `configure`. [1] <https://learn.microsoft.com/en-us/cpp/overview/compiler-versions?view=msvc-170> Closes GH-15403.
This commit is contained in:
parent
a8df3d1eed
commit
b3d6414b87
@ -1085,6 +1085,9 @@ PHP 8.4 UPGRADE NOTES
|
||||
12. Windows Support
|
||||
========================================
|
||||
|
||||
* Building with Visual Studio now requires at least Visual Studio 2019 (Visual
|
||||
Studio 2022 is recommended, though).
|
||||
|
||||
* Native AVX-512 builds are now supported (--enable-native-intrinsics=avx512).
|
||||
|
||||
========================================
|
||||
|
@ -1249,16 +1249,12 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir)
|
||||
if (PHP_DEBUG != "yes" && PHP_PGI == "yes") {
|
||||
ADD_FLAG('CFLAGS_' + SAPI, "/GL /O2");
|
||||
ADD_FLAG('LDFLAGS_' + SAPI, "/LTCG /GENPROFILE");
|
||||
if (VCVERS >= 1914) {
|
||||
ADD_FLAG('LDFLAGS_' + SAPI, "/d2:-FuncCache1");
|
||||
}
|
||||
ADD_FLAG('LDFLAGS_' + SAPI, "/d2:-FuncCache1");
|
||||
}
|
||||
else if (PHP_DEBUG != "yes" && PHP_PGO != "no") {
|
||||
ADD_FLAG('CFLAGS_' + SAPI, "/GL /O2");
|
||||
ADD_FLAG('LDFLAGS_' + SAPI, "/LTCG /USEPROFILE");
|
||||
if (VCVERS >= 1914) {
|
||||
ADD_FLAG('LDFLAGS_' + SAPI, "/d2:-FuncCache1");
|
||||
}
|
||||
ADD_FLAG('LDFLAGS_' + SAPI, "/d2:-FuncCache1");
|
||||
}
|
||||
|
||||
ldflags += " /PGD:$(PGOPGD_DIR)\\" + makefiletarget.substring(0, makefiletarget.indexOf(".")) + ".pgd";
|
||||
@ -1461,15 +1457,11 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
|
||||
// Add compiler and link flags if PGO options are selected
|
||||
if (PHP_DEBUG != "yes" && PHP_PGI == "yes") {
|
||||
ADD_FLAG('LDFLAGS_' + EXT, "/LTCG /GENPROFILE");
|
||||
if (VCVERS >= 1914) {
|
||||
ADD_FLAG('LDFLAGS_' + EXT, "/d2:-FuncCache1");
|
||||
}
|
||||
ADD_FLAG('LDFLAGS_' + EXT, "/d2:-FuncCache1");
|
||||
}
|
||||
else if (PHP_DEBUG != "yes" && PHP_PGO != "no") {
|
||||
ADD_FLAG('LDFLAGS_' + EXT, "/LTCG /USEPROFILE");
|
||||
if (VCVERS >= 1914) {
|
||||
ADD_FLAG('LDFLAGS_' + EXT, "/d2:-FuncCache1");
|
||||
}
|
||||
ADD_FLAG('LDFLAGS_' + EXT, "/d2:-FuncCache1");
|
||||
}
|
||||
|
||||
ADD_FLAG('CFLAGS_' + EXT, "/GL /O2");
|
||||
@ -3064,7 +3056,9 @@ function toolset_get_compiler_version()
|
||||
|
||||
if (VS_TOOLSET) {
|
||||
version = probe_binary(PHP_CL).substr(0, 5).replace('.', '');
|
||||
|
||||
if (version < 1920) {
|
||||
ERROR("Building with MSC_VER " + version + " is no longer supported");
|
||||
}
|
||||
return version;
|
||||
} else if (CLANG_TOOLSET) {
|
||||
var command = 'cmd /c ""' + PHP_CL + '" -v"';
|
||||
@ -3106,7 +3100,7 @@ function toolset_get_compiler_name(short)
|
||||
version = probe_binary(PHP_CL).substr(0, 5).replace('.', '');
|
||||
|
||||
if (version >= 1950) {
|
||||
return name;
|
||||
// skip
|
||||
} else if (version >= 1930) {
|
||||
name = short ? "VS17" : "Visual C++ 2022";
|
||||
} else if (version >= 1920) {
|
||||
@ -3117,12 +3111,6 @@ function toolset_get_compiler_name(short)
|
||||
When new versions are introduced, adapt also checks in
|
||||
php_win32_image_compatible(), if needed. */
|
||||
name = short ? "VS16" : "Visual C++ 2019";
|
||||
} else if (version >= 1910) {
|
||||
name = short ? "VC15" : "Visual C++ 2017";
|
||||
} else if (version >= 1900) {
|
||||
name = short ? "VC14" : "Visual C++ 2015";
|
||||
} else {
|
||||
ERROR("Unsupported Visual C++ compiler " + version);
|
||||
}
|
||||
|
||||
return name;
|
||||
@ -3130,7 +3118,7 @@ function toolset_get_compiler_name(short)
|
||||
var command = 'cmd /c ""' + PHP_CL + '" -v"';
|
||||
var full = execute(command + '" 2>&1"');
|
||||
|
||||
return full.split(/\n/)[0].replace(/\s/g, ' ');
|
||||
ERROR(full.split(/\n/)[0].replace(/\s/g, ' '));
|
||||
}
|
||||
|
||||
WARNING("Unsupported toolset");
|
||||
@ -3272,47 +3260,25 @@ function toolset_setup_common_cflags()
|
||||
ADD_FLAG('CFLAGS', ' /RTC1 ');
|
||||
} else {
|
||||
if (PHP_DEBUG == "no" && PHP_SECURITY_FLAGS == "yes") {
|
||||
/* Mitigations for CVE-2017-5753.
|
||||
TODO backport for all supported VS versions when they release it. */
|
||||
if (VCVERS >= 1912) {
|
||||
var subver1912 = probe_binary(PHP_CL).substr(6);
|
||||
if (VCVERS >= 1913 || 1912 == VCVERS && subver1912 >= 25835) {
|
||||
ADD_FLAG('CFLAGS', "/Qspectre");
|
||||
} else {
|
||||
/* Undocumented. */
|
||||
ADD_FLAG('CFLAGS', "/d2guardspecload");
|
||||
}
|
||||
} else if (1900 == VCVERS) {
|
||||
var subver1900 = probe_binary(PHP_CL).substr(6);
|
||||
if (subver1900 >= 24241) {
|
||||
ADD_FLAG('CFLAGS', "/Qspectre");
|
||||
}
|
||||
}
|
||||
/* Mitigations for CVE-2017-5753. */
|
||||
ADD_FLAG('CFLAGS', "/Qspectre");
|
||||
}
|
||||
if (VCVERS >= 1900) {
|
||||
if (PHP_SECURITY_FLAGS == "yes") {
|
||||
ADD_FLAG('CFLAGS', "/guard:cf");
|
||||
}
|
||||
if (PHP_SECURITY_FLAGS == "yes") {
|
||||
ADD_FLAG('CFLAGS', "/guard:cf");
|
||||
}
|
||||
if (VCVERS >= 1800) {
|
||||
if (PHP_PGI != "yes" && PHP_PGO != "yes") {
|
||||
ADD_FLAG('CFLAGS', "/Zc:inline");
|
||||
}
|
||||
/* We enable /opt:icf only with the debug pack, so /Gw only makes sense there, too. */
|
||||
if (PHP_DEBUG_PACK == "yes") {
|
||||
ADD_FLAG('CFLAGS', "/Gw");
|
||||
}
|
||||
if (PHP_PGI != "yes" && PHP_PGO != "yes") {
|
||||
ADD_FLAG('CFLAGS', "/Zc:inline");
|
||||
}
|
||||
/* We enable /opt:icf only with the debug pack, so /Gw only makes sense there, too. */
|
||||
if (PHP_DEBUG_PACK == "yes") {
|
||||
ADD_FLAG('CFLAGS', "/Gw");
|
||||
}
|
||||
}
|
||||
|
||||
if (VCVERS >= 1914) {
|
||||
/* This is only in effect for CXX sources, __cplusplus is not defined in C sources. */
|
||||
ADD_FLAG("CFLAGS", "/Zc:__cplusplus");
|
||||
}
|
||||
/* This is only in effect for CXX sources, __cplusplus is not defined in C sources. */
|
||||
ADD_FLAG("CFLAGS", "/Zc:__cplusplus");
|
||||
|
||||
if (VCVERS >= 1914) {
|
||||
ADD_FLAG("CFLAGS", "/d2FuncCache1");
|
||||
}
|
||||
ADD_FLAG("CFLAGS", "/d2FuncCache1");
|
||||
|
||||
if (VCVERS >= 1930) {
|
||||
ADD_FLAG("CFLAGS", "/Zc:preprocessor");
|
||||
@ -3438,10 +3404,8 @@ function toolset_setup_common_ldlags()
|
||||
ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:libcmt");
|
||||
|
||||
if (VS_TOOLSET) {
|
||||
if (VCVERS >= 1900) {
|
||||
if (PHP_SECURITY_FLAGS == "yes") {
|
||||
ADD_FLAG('LDFLAGS', "/GUARD:CF");
|
||||
}
|
||||
if (PHP_SECURITY_FLAGS == "yes") {
|
||||
ADD_FLAG('LDFLAGS', "/GUARD:CF");
|
||||
}
|
||||
if (PHP_VS_LINK_COMPAT != "no") {
|
||||
// Allow compatible IL versions, do not require an exact match.
|
||||
@ -3612,13 +3576,8 @@ function add_extra_dirs()
|
||||
for (i = 0; i < path.length; i++) {
|
||||
f = FSO.GetAbsolutePathName(path[i]);
|
||||
if (FSO.FolderExists(f)) {
|
||||
if (VS_TOOLSET && VCVERS <= 1200 && f.indexOf(" ") >= 0) {
|
||||
ADD_FLAG("LDFLAGS", '/libpath:"\\"' + f + '\\"" ');
|
||||
ADD_FLAG("ARFLAGS", '/libpath:"\\"' + f + '\\"" ');
|
||||
} else {
|
||||
ADD_FLAG("LDFLAGS", '/libpath:"' + f + '" ');
|
||||
ADD_FLAG("ARFLAGS", '/libpath:"' + f + '" ');
|
||||
}
|
||||
ADD_FLAG("LDFLAGS", '/libpath:"' + f + '" ');
|
||||
ADD_FLAG("ARFLAGS", '/libpath:"' + f + '" ');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user