[Python-checkins] bpo-44381: Windows build now allows enabling control flow guard (GH-26645)

zooba webhook-mailer at python.org
Fri Jun 11 16:35:48 EDT 2021


https://github.com/python/cpython/commit/5af56c6f2a0d11df37fed7ecaaf321cf6926ba13
commit: 5af56c6f2a0d11df37fed7ecaaf321cf6926ba13
branch: main
author: Steve Dower <steve.dower at python.org>
committer: zooba <steve.dower at microsoft.com>
date: 2021-06-11T21:35:40+01:00
summary:

bpo-44381: Windows build now allows enabling control flow guard (GH-26645)

files:
A Misc/NEWS.d/next/Build/2021-06-10-18-08-44.bpo-44381.Xpc1iX.rst
M PCbuild/pyproject.props

diff --git a/Misc/NEWS.d/next/Build/2021-06-10-18-08-44.bpo-44381.Xpc1iX.rst b/Misc/NEWS.d/next/Build/2021-06-10-18-08-44.bpo-44381.Xpc1iX.rst
new file mode 100644
index 0000000000000..002112c4b5567
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2021-06-10-18-08-44.bpo-44381.Xpc1iX.rst
@@ -0,0 +1,2 @@
+The Windows build now accepts :envvar:`EnableControlFlowGuard` set to
+``guard`` to enable CFG.
diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props
index 834b27c86d42c..d492b71dfbaa3 100644
--- a/PCbuild/pyproject.props
+++ b/PCbuild/pyproject.props
@@ -44,11 +44,11 @@
       <CompileAs>Default</CompileAs>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <WholeProgramOptimization>true</WholeProgramOptimization>
-      <InlineFunctionExpansion Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">OnlyExplicitInline</InlineFunctionExpansion>
-      <InlineFunctionExpansion Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">OnlyExplicitInline</InlineFunctionExpansion>
+      <ControlFlowGuard Condition="$(EnableControlFlowGuard) != ''">$(EnableControlFlowGuard)</ControlFlowGuard>
       <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
     </ClCompile>
     <ClCompile Condition="$(Configuration) == 'Debug'">
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
       <Optimization>Disabled</Optimization>
       <WholeProgramOptimization>false</WholeProgramOptimization>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>



More information about the Python-checkins mailing list