dotnet3.1/SOURCES/core-setup-hardening-flags.patch
2021-09-09 16:09:23 +00:00

24 lines
1.0 KiB
Diff

diff --git a/src/settings.cmake b/src/settings.cmake
--- a/src/settings.cmake
+++ b/src/settings.cmake
@@ -218,6 +218,8 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Xlinker -Bsymbolic -Bsymbolic-functions")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--build-id=sha1")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pie")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--build-id=sha1")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
add_compile_options(-fstack-protector-strong)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_compile_options(-fstack-protector)
--- a/src/corehost/cli/apphost/CMakeLists.txt
+++ b/src/corehost/cli/apphost/CMakeLists.txt
@@ -50,6 +50,8 @@
add_definitions(-DFEATURE_APPHOST=1)
+set_target_properties("apphost" PROPERTIES LINK_FLAGS -pie)
+
# Disable manifest generation into the file .exe on Windows
if(WIN32)
set_property(TARGET ${PROJECT_NAME} PROPERTY