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

win,build: add option to enable cfg #56605

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
'clang%': 0,
'error_on_warn%': 'false',
'suppress_all_error_on_warn%': 'false',
'control_flow_guard%': 'false',

'openssl_product': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)',
'openssl_no_asm%': 0,
Expand Down Expand Up @@ -310,6 +311,11 @@
'/Zm2000',
],
}],
['control_flow_guard=="true"', {
'AdditionalOptions': [
'/guard:cf', # Control Flow Guard
],
}],
],
'BufferSecurityCheck': 'true',
'DebugInformationFormat': 1, # /Z7 embed info in .obj files
Expand All @@ -336,6 +342,11 @@
['target_arch=="arm64"', {
'TargetMachine' : 0, # NotSet. MACHINE:ARM64 is inferred from the input files.
}],
['control_flow_guard=="true"', {
'AdditionalOptions': [
'/guard:cf', # Control Flow Guard
],
}],
],
'GenerateDebugInformation': 'true',
'SuppressStartupBanner': 'true',
Expand Down
7 changes: 7 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,12 @@
default=None,
help='do not install the bundled Corepack')

parser.add_argument('--control-flow-guard',
action='store_true',
dest='enable_cfg',
default=None,
help='enable Control Flow Guard (CFG)')

# Dummy option for backwards compatibility
parser.add_argument('--without-report',
action='store_true',
Expand Down Expand Up @@ -1443,6 +1449,7 @@ def configure_node(o):
o['variables']['node_prefix'] = options.prefix
o['variables']['node_install_npm'] = b(not options.without_npm)
o['variables']['node_install_corepack'] = b(not options.without_corepack)
o['variables']['control_flow_guard'] = b(options.enable_cfg)
o['variables']['node_use_amaro'] = b(not options.without_amaro)
o['variables']['debug_node'] = b(options.debug_node)
o['default_configuration'] = 'Debug' if options.debug else 'Release'
Expand Down
3 changes: 3 additions & 0 deletions vcbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ set no_shared_roheap=
set doc=
set extra_msbuild_args=
set compile_commands=
set cfg=
set exit_code=0

:next-arg
Expand Down Expand Up @@ -150,6 +151,7 @@ if /i "%1"=="no-shared-roheap" set no_shared_roheap=1&goto arg-ok
if /i "%1"=="doc" set doc=1&goto arg-ok
if /i "%1"=="binlog" set extra_msbuild_args=/binaryLogger:out\%config%\node.binlog&goto arg-ok
if /i "%1"=="compile-commands" set compile_commands=1&goto arg-ok
if /i "%1"=="cfg" set cfg=1&goto arg-ok

echo Error: invalid command line option `%1`.
exit /b 1
Expand Down Expand Up @@ -210,6 +212,7 @@ if defined no_shared_roheap set configure_flags=%configure_flags% --disable-shar
if defined DEBUG_HELPER set configure_flags=%configure_flags% --verbose
if defined ccache_path set configure_flags=%configure_flags% --use-ccache-win
if defined compile_commands set configure_flags=%configure_flags% -C
if defined cfg set configure_flags=%configure_flags% --control-flow-guard

if "%target_arch%"=="x86" (
echo "32-bit Windows builds are not supported anymore."
Expand Down
Loading