@@ -1249,16 +1249,12 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir)
1249
1249
if ( PHP_DEBUG != "yes" && PHP_PGI == "yes" ) {
1250
1250
ADD_FLAG ( 'CFLAGS_' + SAPI , "/GL /O2" ) ;
1251
1251
ADD_FLAG ( 'LDFLAGS_' + SAPI , "/LTCG /GENPROFILE" ) ;
1252
- if ( VCVERS >= 1914 ) {
1253
- ADD_FLAG ( 'LDFLAGS_' + SAPI , "/d2:-FuncCache1" ) ;
1254
- }
1252
+ ADD_FLAG ( 'LDFLAGS_' + SAPI , "/d2:-FuncCache1" ) ;
1255
1253
}
1256
1254
else if ( PHP_DEBUG != "yes" && PHP_PGO != "no" ) {
1257
1255
ADD_FLAG ( 'CFLAGS_' + SAPI , "/GL /O2" ) ;
1258
1256
ADD_FLAG ( 'LDFLAGS_' + SAPI , "/LTCG /USEPROFILE" ) ;
1259
- if ( VCVERS >= 1914 ) {
1260
- ADD_FLAG ( 'LDFLAGS_' + SAPI , "/d2:-FuncCache1" ) ;
1261
- }
1257
+ ADD_FLAG ( 'LDFLAGS_' + SAPI , "/d2:-FuncCache1" ) ;
1262
1258
}
1263
1259
1264
1260
ldflags += " /PGD:$(PGOPGD_DIR)\\" + makefiletarget . substring ( 0 , makefiletarget . indexOf ( "." ) ) + ".pgd" ;
@@ -1461,15 +1457,11 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
1461
1457
// Add compiler and link flags if PGO options are selected
1462
1458
if ( PHP_DEBUG != "yes" && PHP_PGI == "yes" ) {
1463
1459
ADD_FLAG ( 'LDFLAGS_' + EXT , "/LTCG /GENPROFILE" ) ;
1464
- if ( VCVERS >= 1914 ) {
1465
- ADD_FLAG ( 'LDFLAGS_' + EXT , "/d2:-FuncCache1" ) ;
1466
- }
1460
+ ADD_FLAG ( 'LDFLAGS_' + EXT , "/d2:-FuncCache1" ) ;
1467
1461
}
1468
1462
else if ( PHP_DEBUG != "yes" && PHP_PGO != "no" ) {
1469
1463
ADD_FLAG ( 'LDFLAGS_' + EXT , "/LTCG /USEPROFILE" ) ;
1470
- if ( VCVERS >= 1914 ) {
1471
- ADD_FLAG ( 'LDFLAGS_' + EXT , "/d2:-FuncCache1" ) ;
1472
- }
1464
+ ADD_FLAG ( 'LDFLAGS_' + EXT , "/d2:-FuncCache1" ) ;
1473
1465
}
1474
1466
1475
1467
ADD_FLAG ( 'CFLAGS_' + EXT , "/GL /O2" ) ;
@@ -3064,7 +3056,9 @@ function toolset_get_compiler_version()
3064
3056
3065
3057
if ( VS_TOOLSET ) {
3066
3058
version = probe_binary ( PHP_CL ) . substr ( 0 , 5 ) . replace ( '.' , '' ) ;
3067
-
3059
+ if ( version < 1920 ) {
3060
+ ERROR ( "Building with MSC_VER " + version + " is no longer supported" ) ;
3061
+ }
3068
3062
return version ;
3069
3063
} else if ( CLANG_TOOLSET ) {
3070
3064
var command = 'cmd /c ""' + PHP_CL + '" -v"' ;
@@ -3106,7 +3100,7 @@ function toolset_get_compiler_name(short)
3106
3100
version = probe_binary ( PHP_CL ) . substr ( 0 , 5 ) . replace ( '.' , '' ) ;
3107
3101
3108
3102
if ( version >= 1950 ) {
3109
- return name ;
3103
+ // skip
3110
3104
} else if ( version >= 1930 ) {
3111
3105
name = short ? "VS17" : "Visual C++ 2022" ;
3112
3106
} else if ( version >= 1920 ) {
@@ -3117,20 +3111,14 @@ function toolset_get_compiler_name(short)
3117
3111
When new versions are introduced, adapt also checks in
3118
3112
php_win32_image_compatible(), if needed. */
3119
3113
name = short ? "VS16" : "Visual C++ 2019" ;
3120
- } else if ( version >= 1910 ) {
3121
- name = short ? "VC15" : "Visual C++ 2017" ;
3122
- } else if ( version >= 1900 ) {
3123
- name = short ? "VC14" : "Visual C++ 2015" ;
3124
- } else {
3125
- ERROR ( "Unsupported Visual C++ compiler " + version ) ;
3126
3114
}
3127
3115
3128
3116
return name ;
3129
3117
} else if ( CLANG_TOOLSET || ICC_TOOLSET ) {
3130
3118
var command = 'cmd /c ""' + PHP_CL + '" -v"' ;
3131
3119
var full = execute ( command + '" 2>&1"' ) ;
3132
3120
3133
- return full . split ( / \n / ) [ 0 ] . replace ( / \s / g, ' ' ) ;
3121
+ ERROR ( full . split ( / \n / ) [ 0 ] . replace ( / \s / g, ' ' ) ) ;
3134
3122
}
3135
3123
3136
3124
WARNING ( "Unsupported toolset" ) ;
@@ -3272,47 +3260,25 @@ function toolset_setup_common_cflags()
3272
3260
ADD_FLAG ( 'CFLAGS' , ' /RTC1 ' ) ;
3273
3261
} else {
3274
3262
if ( PHP_DEBUG == "no" && PHP_SECURITY_FLAGS == "yes" ) {
3275
- /* Mitigations for CVE-2017-5753.
3276
- TODO backport for all supported VS versions when they release it. */
3277
- if ( VCVERS >= 1912 ) {
3278
- var subver1912 = probe_binary ( PHP_CL ) . substr ( 6 ) ;
3279
- if ( VCVERS >= 1913 || 1912 == VCVERS && subver1912 >= 25835 ) {
3280
- ADD_FLAG ( 'CFLAGS' , "/Qspectre" ) ;
3281
- } else {
3282
- /* Undocumented. */
3283
- ADD_FLAG ( 'CFLAGS' , "/d2guardspecload" ) ;
3284
- }
3285
- } else if ( 1900 == VCVERS ) {
3286
- var subver1900 = probe_binary ( PHP_CL ) . substr ( 6 ) ;
3287
- if ( subver1900 >= 24241 ) {
3288
- ADD_FLAG ( 'CFLAGS' , "/Qspectre" ) ;
3289
- }
3290
- }
3263
+ /* Mitigations for CVE-2017-5753. */
3264
+ ADD_FLAG ( 'CFLAGS' , "/Qspectre" ) ;
3291
3265
}
3292
- if ( VCVERS >= 1900 ) {
3293
- if ( PHP_SECURITY_FLAGS == "yes" ) {
3294
- ADD_FLAG ( 'CFLAGS' , "/guard:cf" ) ;
3295
- }
3266
+ if ( PHP_SECURITY_FLAGS == "yes" ) {
3267
+ ADD_FLAG ( 'CFLAGS' , "/guard:cf" ) ;
3296
3268
}
3297
- if ( VCVERS >= 1800 ) {
3298
- if ( PHP_PGI != "yes" && PHP_PGO != "yes" ) {
3299
- ADD_FLAG ( 'CFLAGS' , "/Zc:inline" ) ;
3300
- }
3301
- /* We enable /opt:icf only with the debug pack, so /Gw only makes sense there, too. */
3302
- if ( PHP_DEBUG_PACK == "yes" ) {
3303
- ADD_FLAG ( 'CFLAGS' , "/Gw" ) ;
3304
- }
3269
+ if ( PHP_PGI != "yes" && PHP_PGO != "yes" ) {
3270
+ ADD_FLAG ( 'CFLAGS' , "/Zc:inline" ) ;
3271
+ }
3272
+ /* We enable /opt:icf only with the debug pack, so /Gw only makes sense there, too. */
3273
+ if ( PHP_DEBUG_PACK == "yes" ) {
3274
+ ADD_FLAG ( 'CFLAGS' , "/Gw" ) ;
3305
3275
}
3306
3276
}
3307
3277
3308
- if ( VCVERS >= 1914 ) {
3309
- /* This is only in effect for CXX sources, __cplusplus is not defined in C sources. */
3310
- ADD_FLAG ( "CFLAGS" , "/Zc:__cplusplus" ) ;
3311
- }
3278
+ /* This is only in effect for CXX sources, __cplusplus is not defined in C sources. */
3279
+ ADD_FLAG ( "CFLAGS" , "/Zc:__cplusplus" ) ;
3312
3280
3313
- if ( VCVERS >= 1914 ) {
3314
- ADD_FLAG ( "CFLAGS" , "/d2FuncCache1" ) ;
3315
- }
3281
+ ADD_FLAG ( "CFLAGS" , "/d2FuncCache1" ) ;
3316
3282
3317
3283
if ( VCVERS >= 1930 ) {
3318
3284
ADD_FLAG ( "CFLAGS" , "/Zc:preprocessor" ) ;
@@ -3438,10 +3404,8 @@ function toolset_setup_common_ldlags()
3438
3404
ADD_FLAG ( "PHP_LDFLAGS" , "/nodefaultlib:libcmt" ) ;
3439
3405
3440
3406
if ( VS_TOOLSET ) {
3441
- if ( VCVERS >= 1900 ) {
3442
- if ( PHP_SECURITY_FLAGS == "yes" ) {
3443
- ADD_FLAG ( 'LDFLAGS' , "/GUARD:CF" ) ;
3444
- }
3407
+ if ( PHP_SECURITY_FLAGS == "yes" ) {
3408
+ ADD_FLAG ( 'LDFLAGS' , "/GUARD:CF" ) ;
3445
3409
}
3446
3410
if ( PHP_VS_LINK_COMPAT != "no" ) {
3447
3411
// Allow compatible IL versions, do not require an exact match.
@@ -3612,13 +3576,8 @@ function add_extra_dirs()
3612
3576
for ( i = 0 ; i < path . length ; i ++ ) {
3613
3577
f = FSO . GetAbsolutePathName ( path [ i ] ) ;
3614
3578
if ( FSO . FolderExists ( f ) ) {
3615
- if ( VS_TOOLSET && VCVERS <= 1200 && f . indexOf ( " " ) >= 0 ) {
3616
- ADD_FLAG ( "LDFLAGS" , '/libpath:"\\"' + f + '\\"" ' ) ;
3617
- ADD_FLAG ( "ARFLAGS" , '/libpath:"\\"' + f + '\\"" ' ) ;
3618
- } else {
3619
- ADD_FLAG ( "LDFLAGS" , '/libpath:"' + f + '" ' ) ;
3620
- ADD_FLAG ( "ARFLAGS" , '/libpath:"' + f + '" ' ) ;
3621
- }
3579
+ ADD_FLAG ( "LDFLAGS" , '/libpath:"' + f + '" ' ) ;
3580
+ ADD_FLAG ( "ARFLAGS" , '/libpath:"' + f + '" ' ) ;
3622
3581
}
3623
3582
}
3624
3583
}
0 commit comments