mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 13:40:37 +00:00
win,build: add option to enable Control Flow Guard
PR-URL: https://github.com/nodejs/node/pull/56605 Fixes: https://github.com/nodejs/node/issues/42100 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
This commit is contained in:
parent
365faa7a4f
commit
f161033bd5
11
common.gypi
11
common.gypi
@ -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,
|
||||
@ -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
|
||||
@ -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',
|
||||
|
@ -819,6 +819,12 @@ parser.add_argument('--without-corepack',
|
||||
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',
|
||||
@ -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'
|
||||
|
@ -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
|
||||
@ -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
|
||||
@ -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."
|
||||
|
Loading…
Reference in New Issue
Block a user