Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 17d4074

Browse filesBrowse files
huseyinacacak-janeaaduh95
authored andcommitted
win,build: add option to enable Control Flow Guard
PR-URL: #56605 Fixes: #42100 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
1 parent 4af2f7f commit 17d4074
Copy full SHA for 17d4074

File tree

Expand file treeCollapse file tree

3 files changed

+21
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+21
-0
lines changed
Open diff view settings
Collapse file

‎common.gypi‎

Copy file name to clipboardExpand all lines: common.gypi
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
'clang%': 0,
2929
'error_on_warn%': 'false',
3030
'suppress_all_error_on_warn%': 'false',
31+
'control_flow_guard%': 'false',
3132

3233
'openssl_product': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)',
3334
'openssl_no_asm%': 0,
@@ -310,6 +311,11 @@
310311
'/Zm2000',
311312
],
312313
}],
314+
['control_flow_guard=="true"', {
315+
'AdditionalOptions': [
316+
'/guard:cf', # Control Flow Guard
317+
],
318+
}],
313319
],
314320
'BufferSecurityCheck': 'true',
315321
'DebugInformationFormat': 1, # /Z7 embed info in .obj files
@@ -336,6 +342,11 @@
336342
['target_arch=="arm64"', {
337343
'TargetMachine' : 0, # NotSet. MACHINE:ARM64 is inferred from the input files.
338344
}],
345+
['control_flow_guard=="true"', {
346+
'AdditionalOptions': [
347+
'/guard:cf', # Control Flow Guard
348+
],
349+
}],
339350
],
340351
'GenerateDebugInformation': 'true',
341352
'SuppressStartupBanner': 'true',
Collapse file

‎configure.py‎

Copy file name to clipboardExpand all lines: configure.py
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,12 @@
819819
default=None,
820820
help='do not install the bundled Corepack')
821821

822+
parser.add_argument('--control-flow-guard',
823+
action='store_true',
824+
dest='enable_cfg',
825+
default=None,
826+
help='enable Control Flow Guard (CFG)')
827+
822828
# Dummy option for backwards compatibility
823829
parser.add_argument('--without-report',
824830
action='store_true',
@@ -1443,6 +1449,7 @@ def configure_node(o):
14431449
o['variables']['node_prefix'] = options.prefix
14441450
o['variables']['node_install_npm'] = b(not options.without_npm)
14451451
o['variables']['node_install_corepack'] = b(not options.without_corepack)
1452+
o['variables']['control_flow_guard'] = b(options.enable_cfg)
14461453
o['variables']['node_use_amaro'] = b(not options.without_amaro)
14471454
o['variables']['debug_node'] = b(options.debug_node)
14481455
o['default_configuration'] = 'Debug' if options.debug else 'Release'
Collapse file

‎vcbuild.bat‎

Copy file name to clipboardExpand all lines: vcbuild.bat
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ set no_shared_roheap=
7272
set doc=
7373
set extra_msbuild_args=
7474
set compile_commands=
75+
set cfg=
7576
set exit_code=0
7677

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

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

214217
if "%target_arch%"=="x86" (
215218
echo "32-bit Windows builds are not supported anymore."

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.