diff options
author | Gaurav Khanna <gkhanna@microsoft.com> | 2016-02-03 21:51:05 -0800 |
---|---|---|
committer | Gaurav Khanna <gkhanna@microsoft.com> | 2016-02-03 21:51:05 -0800 |
commit | e36834bdee7d14edc404428ec7c6eed661b78f5a (patch) | |
tree | 31f5d61d1664e2ed73d481b8b5c0eb1ef622015d | |
parent | 1b0d7b9db6361dd426f395ea54b4e15d1e0f2cab (diff) | |
parent | 10b1866801537e6bd51fb08feb4b786a54c48254 (diff) | |
download | coreclr-e36834bdee7d14edc404428ec7c6eed661b78f5a.tar.gz coreclr-e36834bdee7d14edc404428ec7c6eed661b78f5a.tar.bz2 coreclr-e36834bdee7d14edc404428ec7c6eed661b78f5a.zip |
Merge pull request #3016 from gkhanna79/CFG
Support for Control Flow Guard
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | Documentation/building/windows-instructions.md | 6 | ||||
-rw-r--r-- | build.cmd | 12 | ||||
-rw-r--r-- | src/dlls/clretwrc/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/dlls/mscorrc/CMakeLists.txt | 3 |
5 files changed, 16 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1859ac2083..8d0aee8dd9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -430,6 +430,13 @@ if (WIN32) add_compile_options($<$<CONFIG:Debug>:/homeparams>) # Force parameters passed in registers to be written to the stack endif (CLR_CMAKE_PLATFORM_ARCH_AMD64) + if(NOT CLR_CMAKE_PLATFORM_ARCH_ARM64) + # enable control-flow-guard support for native components for non-Arm64 builds + add_compile_options(/guard:cf) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /guard:cf") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /guard:cf") + endif (NOT CLR_CMAKE_PLATFORM_ARCH_ARM64) + # Linker flags # # Disable the following line for UNIX altjit on Windows diff --git a/Documentation/building/windows-instructions.md b/Documentation/building/windows-instructions.md index 0278010dbc..28fd3ecc81 100644 --- a/Documentation/building/windows-instructions.md +++ b/Documentation/building/windows-instructions.md @@ -13,16 +13,10 @@ Visual Studio Visual Studio must be installed. Supported versions: -- [Visual Studio Community 2013](http://go.microsoft.com/fwlink/?LinkId=517284) - **Free** for Open Source development! -- [Visual Studio 2013 Update 3](http://www.visualstudio.com/downloads/download-visual-studio-vs) or later (Pro, Premium, Ultimate) - [Visual Studio 2015](https://www.visualstudio.com/downloads/visual-studio-2015-downloads-vs) (Community, Professional, Enterprise) Visual Studio Express is not supported. -**Known Issues** - -The DIA SDK gets incorrectly installed when VS 2013 is installed after VS 2012. To [workaround this issue](http://support.microsoft.com/kb/3035999), copy `%program files (x86)%\Microsoft Visual Studio 11.0\DIA SDK` to `%program files (x86)%\Microsoft Visual Studio 12.0\DIA SDK`. You can then build CoreCLR. - CMake ----- @@ -29,7 +29,6 @@ set __BuildOS=Windows_NT :: Default to highest Visual Studio version available set __VSVersion=vs2015 -if defined VS120COMNTOOLS set __VSVersion=vs2013 if defined VS140COMNTOOLS set __VSVersion=vs2015 :: Define a prefix for most output progress messages that come from this script. That makes @@ -218,7 +217,6 @@ for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy RemoteSigned "& :CheckVS set __VSProductVersion= -if /i "%__VSVersion%" == "vs2013" set __VSProductVersion=120 if /i "%__VSVersion%" == "vs2015" set __VSProductVersion=140 :: Check presence of VS @@ -232,11 +230,6 @@ if not exist "%__VSToolsRoot%\..\IDE\devenv.exe" goto NoVS if not exist "%__VSToolsRoot%\..\..\VC\vcvarsall.bat" goto NoVS if not exist "%__VSToolsRoot%\VsDevCmd.bat" goto NoVS -if /i "%__VSVersion%" =="vs2015" goto MSBuild14 -set _msbuildexe="%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild.exe" -if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\12.0\Bin\MSBuild.exe" -if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe" -goto :CheckMSBuild14 :MSBuild14 set _msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe" set UseRoslynCompiler=true @@ -608,8 +601,7 @@ echo. echo./? -? /h -h /help -help: view this message. echo Build architecture: one of x64, x86, arm, arm64 ^(default: x64^). echo Build type: one of Debug, Checked, Release ^(default: Debug^). -echo Visual Studio version: one of VS2013 or VS2015 to force using a particular -echo Visual Studio version ^(default: VS2015^). +echo Visual Studio version: ^(default: VS2015^). echo clean: force a clean build ^(default is to perform an incremental build^). echo docrossgen: do a crossgen build of mscorlib. echo msbuildargs ... : all arguments following this tag will be passed directly to msbuild. @@ -641,7 +633,7 @@ echo -- builds x64 and x86 architectures, Checked and Release build types exit /b 1 :NoVS -echo Visual Studio 2013+ ^(Community is free^) is a prerequisite to build this repository. +echo Visual Studio 2015+ ^(Community is free^) is a prerequisite to build this repository. echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md#prerequisites exit /b 1 diff --git a/src/dlls/clretwrc/CMakeLists.txt b/src/dlls/clretwrc/CMakeLists.txt index 61fbfb85b7..36205b5fe1 100644 --- a/src/dlls/clretwrc/CMakeLists.txt +++ b/src/dlls/clretwrc/CMakeLists.txt @@ -6,6 +6,10 @@ if(WIN32) string(REPLACE "/LTCG" "" CMAKE_STATIC_LINKER_FLAGS_RELEASE ${CMAKE_STATIC_LINKER_FLAGS_RELEASE}) string(REPLACE "/LTCG" "" CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO}) string(REPLACE "/LTCG" "" CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO ${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO}) + + # remove /guard:cf from resource-only libraries + string(REPLACE "/guard:cf" "" CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS}) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NOENTRY") endif(WIN32) diff --git a/src/dlls/mscorrc/CMakeLists.txt b/src/dlls/mscorrc/CMakeLists.txt index a55269b43f..8f67988a23 100644 --- a/src/dlls/mscorrc/CMakeLists.txt +++ b/src/dlls/mscorrc/CMakeLists.txt @@ -4,6 +4,9 @@ if(WIN32) # remove /ltcg from resource-only libraries string(REPLACE "/LTCG" "" CMAKE_SHARED_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}) string(REPLACE "/LTCG" "" CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO}) + + # remove /guard:cf from resource-only libraries + string(REPLACE "/guard:cf" "" CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS}) endif(WIN32) if(CLR_CMAKE_PLATFORM_UNIX) |