Skip to content

Commit 2aeb3b4

Browse files
committed
Merge pull request #2616 from sergiy-k/stackprotector
Enable the stack-protector compiler option for all coreclr code on Unix.
2 parents 3e46941 + 3017009 commit 2aeb3b4

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,13 @@ if (CLR_CMAKE_PLATFORM_UNIX)
308308
#-fms-compatibility Enable full Microsoft Visual C++ compatibility
309309
#-fms-extensions Accept some non-standard constructs supported by the Microsoft compiler
310310

311+
if(CLR_CMAKE_PLATFORM_DARWIN)
312+
# We cannot enable "stack-protector-strong" on OS X due to a bug in clang compiler (current version 7.0.2)
313+
add_compile_options(-fstack-protector)
314+
else()
315+
add_compile_options(-fstack-protector-strong)
316+
endif(CLR_CMAKE_PLATFORM_DARWIN)
317+
311318
# set the CLANG sanitizer flags for debug build
312319
if(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED)
313320
# obtain settings from running enablesanitizers.sh

src/pal/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ include_directories(${COREPAL_SOURCE_DIR}/../inc)
88

99
add_compile_options(-gdwarf-3)
1010
add_compile_options(-fexceptions)
11-
add_compile_options(-fstack-protector-all)
1211

1312
add_subdirectory(src)
1413
add_subdirectory(tests)

0 commit comments

Comments
 (0)