From b6f26e11e9a17e9a334b035ba0d7f9de5ac49b64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=B6=98=EC=84=9D/Developer=20Experience=20Lab?= =?UTF-8?q?=28S/W=EC=84=BC=ED=84=B0=29/Senior=20Engineer/=EC=82=BC?= =?UTF-8?q?=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Thu, 24 Aug 2017 07:28:09 +0900 Subject: [PATCH 12/29] Add -pie to linker option (#16) There have been no -pie linker option. This patch adds -pie linker option into crossgen, ildasm, ilasm, and corerun, coreconsole --- src/coreclr/hosts/unixcoreconsole/CMakeLists.txt | 2 ++ src/coreclr/hosts/unixcorerun/CMakeLists.txt | 2 ++ src/ilasm/CMakeLists.txt | 2 ++ src/ildasm/exe/CMakeLists.txt | 1 + src/tools/crossgen/CMakeLists.txt | 1 + 5 files changed, 8 insertions(+) diff --git a/src/coreclr/hosts/unixcoreconsole/CMakeLists.txt b/src/coreclr/hosts/unixcoreconsole/CMakeLists.txt index 2daeaab..15d6d38 100644 --- a/src/coreclr/hosts/unixcoreconsole/CMakeLists.txt +++ b/src/coreclr/hosts/unixcoreconsole/CMakeLists.txt @@ -31,4 +31,6 @@ if(NOT CLR_CMAKE_PLATFORM_ANDROID) ) endif() +set_target_properties(coreconsole PROPERTIES LINK_FLAGS -pie) + install_clr(coreconsole) diff --git a/src/coreclr/hosts/unixcorerun/CMakeLists.txt b/src/coreclr/hosts/unixcorerun/CMakeLists.txt index 07beaae..85499c8 100644 --- a/src/coreclr/hosts/unixcorerun/CMakeLists.txt +++ b/src/coreclr/hosts/unixcorerun/CMakeLists.txt @@ -32,4 +32,6 @@ if(NOT CLR_CMAKE_PLATFORM_ANDROID) ) endif() +set_target_properties(corerun PROPERTIES LINK_FLAGS -pie) + install_clr(corerun) diff --git a/src/ilasm/CMakeLists.txt b/src/ilasm/CMakeLists.txt index 9e99d02..5668d1f 100644 --- a/src/ilasm/CMakeLists.txt +++ b/src/ilasm/CMakeLists.txt @@ -64,6 +64,8 @@ if(CLR_CMAKE_PLATFORM_UNIX) palrt ) + set_target_properties(ilasm PROPERTIES LINK_FLAGS -pie) + # FreeBSD and NetBSD implement dlopen(3) in libc if(NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD AND NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD) target_link_libraries(ilasm diff --git a/src/ildasm/exe/CMakeLists.txt b/src/ildasm/exe/CMakeLists.txt index bf09be5..cfd5db0 100644 --- a/src/ildasm/exe/CMakeLists.txt +++ b/src/ildasm/exe/CMakeLists.txt @@ -54,6 +54,7 @@ if(CLR_CMAKE_PLATFORM_UNIX) coreclrpal palrt ) + set_target_properties(ildasm PROPERTIES LINK_FLAGS -pie) # FreeBSD and NetBSD implement dlopen(3) in libc if(NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD AND NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD) diff --git a/src/tools/crossgen/CMakeLists.txt b/src/tools/crossgen/CMakeLists.txt index 3b9c5ba..b8e9cf7 100644 --- a/src/tools/crossgen/CMakeLists.txt +++ b/src/tools/crossgen/CMakeLists.txt @@ -50,6 +50,7 @@ if(CLR_CMAKE_PLATFORM_UNIX) coreclrpal palrt ) + set_target_properties(crossgen PROPERTIES LINK_FLAGS -pie) else() target_link_libraries(crossgen advapi32 -- 2.7.4