-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Description
- Version: master
- Platform: Windows
- Subsystem: build, deps
As per #31311 (comment) it looks like gyp ignores cflags on Windows when generating for Visual Studio (msvs) so the following from our gyp files for OpenSSL are currently ignored:
node/deps/openssl/openssl_common.gypi
Lines 32 to 34 in be46a72
| 'cflags': [ | |
| '-W3', '-wd4090', '-Gs0', '-GF', '-Gy', '-nologo','/O2', | |
| ], |
These settings appear to mirror those in OpenSSL's own build configuration:
| CFLAGS => "/W3 /wd4090 /nologo", |
node/deps/openssl/openssl/Configurations/10-main.conf
Lines 1242 to 1252 in be055d1
| CFLAGS => add(picker(debug => '/Od', | |
| release => '/O2')), | |
| cflags => add(picker(default => '/Gs0 /GF /Gy', | |
| debug => | |
| sub { | |
| ($disabled{shared} ? "" : "/MDd"); | |
| }, | |
| release => | |
| sub { | |
| ($disabled{shared} ? "" : "/MD"); | |
| })), |
In practice we appear to be getting most of these via settings in our common.gypi. For the ones we aren't explicitly setting I don't know enough about Windows for the -Gs0 case to know if this is an issue we want to address (cc @nodejs/platform-windows).
Options we already set
-W3
from
Line 229 in f4797ff
| 'WarningLevel': 3, # /W3 |
-GF
from
Line 226 in fe05818
| 'StringPooling': 'true', # pool string literals |
-Gy
from
Line 196 in be46a72
| 'EnableFunctionLevelLinking': 'true', |
-nologo
from
Line 227 in fe05818
| 'SuppressStartupBanner': 'true', |
Options we don't currently explicitly set
-wd4090
being addressed by #31311
-Gs0
I don't know if there's a good reason that OpenSSL sets this. The MSDN docs says
/Gs0 initiates stack probes for every function call that requires storage for local variables. This can have a negative impact on performance.
/O2
We currently set
Line 201 in fe05818
| 'Optimization': 3, # /Ox, full optimization |
/Ox:
The /Ox compiler option enables the /O compiler options that favor speed. The /Ox compiler option does not include the additional /GF (Eliminate Duplicate Strings) and /Gy (Enable Function-Level Linking) options enabled by /O1 or /O2 (Minimize Size, Maximize Speed).
but we switch on /GF and /Gy via StringPooling and EnableFunctionLevelLinking above so this works out?