From 96426f220e8965eea7b402f0635e054b68ed40b6 Mon Sep 17 00:00:00 2001 From: Woongsuk Cho Date: Mon, 16 Mar 2020 10:48:34 +0900 Subject: [Tizen] Add "-pie" option to "ilasm, ildasm" to avoid ASLR violation To apply -pie option to "ilasm, ildasm", mscorpe, unixcoreclrloader should be built with -fPIC option --- src/dlls/mscorpe/CMakeLists.txt | 4 ++++ src/ilasm/CMakeLists.txt | 2 ++ src/ildasm/exe/CMakeLists.txt | 2 ++ src/ildasm/unixcoreclrloader/CMakeLists.txt | 4 ++++ 4 files changed, 12 insertions(+) diff --git a/src/dlls/mscorpe/CMakeLists.txt b/src/dlls/mscorpe/CMakeLists.txt index eb8489cdb6..2afe3e9106 100644 --- a/src/dlls/mscorpe/CMakeLists.txt +++ b/src/dlls/mscorpe/CMakeLists.txt @@ -2,6 +2,10 @@ project(mscorpe) add_definitions(-DFEATURE_CORECLR) +if(CLR_CMAKE_PLATFORM_UNIX) + add_compile_options(-fPIC) +endif(CLR_CMAKE_PLATFORM_UNIX) + set(MSCORPE_SOURCES iceefilegen.cpp ceefilegenwriter.cpp diff --git a/src/ilasm/CMakeLists.txt b/src/ilasm/CMakeLists.txt index 6117030dcc..cf983797dc 100644 --- a/src/ilasm/CMakeLists.txt +++ b/src/ilasm/CMakeLists.txt @@ -62,6 +62,8 @@ _add_executable(ilasm ${ILASM_RESOURCES} ) +set_target_properties(ilasm PROPERTIES LINK_FLAGS -pie) + set(ILASM_LINK_LIBRARIES utilcodestaticnohost mscorpe diff --git a/src/ildasm/exe/CMakeLists.txt b/src/ildasm/exe/CMakeLists.txt index 196f2395b7..05dec6e1e3 100644 --- a/src/ildasm/exe/CMakeLists.txt +++ b/src/ildasm/exe/CMakeLists.txt @@ -54,6 +54,8 @@ _add_executable(ildasm ${ILDASM_RESOURCES} ) +set_target_properties(ildasm PROPERTIES LINK_FLAGS -pie) + set(ILDASM_LINK_LIBRARIES utilcodestaticnohost mdhotdata_full diff --git a/src/ildasm/unixcoreclrloader/CMakeLists.txt b/src/ildasm/unixcoreclrloader/CMakeLists.txt index 6a3916b961..596e58325a 100644 --- a/src/ildasm/unixcoreclrloader/CMakeLists.txt +++ b/src/ildasm/unixcoreclrloader/CMakeLists.txt @@ -1,5 +1,9 @@ project(unixcoreclrloader) +if(CLR_CMAKE_PLATFORM_UNIX) + add_compile_options(-fPIC) +endif(CLR_CMAKE_PLATFORM_UNIX) + include_directories(${CMAKE_SOURCE_DIR}/src/coreclr/hosts/unixcoreruncommon) add_library(unixcoreclrloader STATIC -- cgit v1.2.3