Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler options for building OpenSSL dependency on Windows #31330

Closed
richardlau opened this issue Jan 12, 2020 · 2 comments
Closed

compiler options for building OpenSSL dependency on Windows #31330

richardlau opened this issue Jan 12, 2020 · 2 comments
Labels
build Issues and PRs related to build files or the CI. openssl Issues and PRs related to the OpenSSL dependency. windows Issues and PRs related to the Windows platform.

Comments

@richardlau
Copy link
Member

richardlau commented Jan 12, 2020

  • 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:

'cflags': [
'-W3', '-wd4090', '-Gs0', '-GF', '-Gy', '-nologo','/O2',
],

These settings appear to mirror those in OpenSSL's own build configuration:

CFLAGS => "/W3 /wd4090 /nologo",

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

'WarningLevel': 3, # /W3
(refs: VCCLCompilerTool.WarningLevel Property)

-GF

from

'StringPooling': 'true', # pool string literals
(refs: VCCLCompilerTool.StringPooling Property)

-Gy

from

'EnableFunctionLevelLinking': 'true',
(refs: VCCLCompilerTool.EnableFunctionLevelLinking Property)

-nologo

from

'SuppressStartupBanner': 'true',
(refs: VCCLCompilerTool.SuppressStartupBanner Property)

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

'Optimization': 3, # /Ox, full optimization
(refs: VCCLCompilerTool.Optimization Property) which maps 3 to /Ox and /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?

@richardlau richardlau added build Issues and PRs related to build files or the CI. openssl Issues and PRs related to the OpenSSL dependency. windows Issues and PRs related to the Windows platform. labels Jan 12, 2020
@jasnell
Copy link
Member

jasnell commented Jun 25, 2020

Ping @richardlau ... any progress on this?

@richardlau
Copy link
Member Author

¯\_(ツ)_/¯ I still don't know if we should be setting the compiler options that OpenSSL uses but we do not.

Let's close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. openssl Issues and PRs related to the OpenSSL dependency. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

2 participants