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

Fix setting /guard:cf for tests #130

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions API/hermes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
# Generate PDBs
set(compile_flags "${compile_flags} /Zi")

# Security flags
set(compile_flags "${compile_flags} /guard:cf /Qspectre /sdl /ZH:SHA_256")

set(link_flags_debug "/DEBUG")
# Use /OPT:NOICF because hermes associates function pointer with its name.
# The optimization that merges functions with the same body breaks that code.
Expand Down
3 changes: 3 additions & 0 deletions API/inspector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ set(compile_flags "${compile_flags} /GR")
# Generate PDBs
set(compile_flags "${compile_flags} /Zi")

# Security flags
set(compile_flags "${compile_flags} /guard:cf /Qspectre /sdl /ZH:SHA_256")

set(link_flags_debug "/DEBUG")
set(link_flags_release "/DEBUG;/OPT:REF;/OPT:ICF;/INCREMENTAL:NO")
if(CMAKE_VS_PLATFORM_NAME MATCHES "^(x64|x86|Win32)$")
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ endif()
# - npm/package.json
# - hermes-engine.podspec
project(Hermes
VERSION 0.71.0.20220908
VERSION 0.71.0.20220909
LANGUAGES C CXX)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")
Expand Down
6 changes: 4 additions & 2 deletions cmake/modules/Hermes.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ function(hermes_update_compile_flags name)
endif ()
endif ()

if (MSVC)
set(flags "${flags} /guard:cf /Qspectre /sdl /ZH:SHA_256")
endif()

if (update_src_props)
foreach (fn ${sources})
get_filename_component(suf ${fn} EXT)
Expand Down Expand Up @@ -281,8 +285,6 @@ if (MSVC)
# Note: Security warnings need to be fixed / baselined to be sdl clean - 4146, 4244 and 4267 (currently disabled)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DYNAMICBASE /guard:cf")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DYNAMICBASE /guard:cf")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /guard:cf /Qspectre /sdl /ZH:SHA_256")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /guard:cf /Qspectre /sdl /ZH:SHA_256")

# Tell MSVC to use the Unicode version of the Win32 APIs instead of ANSI.
# add_definitions(
Expand Down
2 changes: 1 addition & 1 deletion npm/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.71.0.20220908",
"version": "0.71.0.20220909",
"scripts": {
"unpack-builds": "node unpack-builds.js",
"unpack-builds-dev": "node unpack-builds.js --dev",
Expand Down