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

Add option to enable spectre mitigation in MSVC #1125

Closed
Closed
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
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ option(LIBRESSL_TESTS "Build tests" ON)
option(ENABLE_ASM "Enable assembly" ON)
option(ENABLE_EXTRATESTS "Enable extra tests that may be unreliable on some platforms" OFF)
option(ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF)
option(ENABLE_SPECTRE_MITIGATION "Enable MSVC Spectre mitigation" OFF)
set(OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE)
set(LIBRESSL_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/LibreSSL" CACHE STRING "Installation directory for the CMake targets")

Expand Down Expand Up @@ -150,6 +151,13 @@ if(MSVC)
add_definitions(-Dinline=__inline)
message(STATUS "Using [${CMAKE_C_COMPILER_ID}] compiler")

if(ENABLE_SPECTRE_MITIGATION)
if(MSVC_VERSION LESS 1912)
message(FATAL_ERROR "Spectre mitigation unavailable before MSVC 2017 15.5")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Qspectre")
endif()

include(TestBigEndian)
TEST_BIG_ENDIAN(HAVE_BIG_ENDIAN)
if(HAVE_BIG_ENDIAN)
Expand Down
Loading