summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2019-08-23 15:03:01 (GMT)
committer이형주/Common Platform Lab(SR)/Staff Engineer/삼성전자 <leee.lee@samsung.com>2020-04-15 22:36:05 (GMT)
commit4feb5cbcbeea277f7addb372b3c632e89f9ed1ae (patch)
tree1fa7f1dc31867a3872c7df4b46b970150da3f299 /src
parent9df87a133b0f29f4932f38b7307c87d09ab80d5d (diff)
downloadcoreclr-4feb5cbcbeea277f7addb372b3c632e89f9ed1ae.zip
coreclr-4feb5cbcbeea277f7addb372b3c632e89f9ed1ae.tar.gz
coreclr-4feb5cbcbeea277f7addb372b3c632e89f9ed1ae.tar.bz2
* Fix PIE options We were missing passing the -pie linker option. That means that while we were compiling our code as position independent, the executables (not shared libraries) were not marked as position independent and ASLR was not applied to them. They were always loaded to fixed addresses. This change adds the missing -pie option and also replaces all the individual settings of -fPIE / -fPIC on the targets we build by a centralized setting of CMAKE_POSITION_INDEPENDENT_CODE variable that causes cmake to add the appropriate compiler options everywhere. * Fix native parts of coreclr tests build The native parts of the tests are not built using the root CMakeLists.txt so I am moving enabling the position independent code to configurecompiler.cmake Change-Id: Ieafff8984ec23e5fdb00fb0c2fb017e53afbce88
Diffstat (limited to 'src')
-rw-r--r--src/binder/CMakeLists.txt4
-rw-r--r--src/classlibnative/bcltype/CMakeLists.txt4
-rw-r--r--src/classlibnative/float/CMakeLists.txt4
-rw-r--r--src/coreclr/hosts/osxbundlerun/CMakeLists.txt2
-rw-r--r--src/coreclr/hosts/unixcoreconsole/CMakeLists.txt2
-rw-r--r--src/coreclr/hosts/unixcorerun/CMakeLists.txt2
-rw-r--r--src/coreclr/hosts/unixcoreruncommon/CMakeLists.txt2
-rw-r--r--src/corefx/System.Globalization.Native/CMakeLists.txt2
-rw-r--r--src/debug/daccess/CMakeLists.txt1
-rw-r--r--src/debug/dbgutil/CMakeLists.txt4
-rw-r--r--src/debug/debug-pal/CMakeLists.txt1
-rw-r--r--src/debug/di/CMakeLists.txt1
-rw-r--r--src/debug/ee/CMakeLists.txt4
-rw-r--r--src/debug/ee/wks/CMakeLists.txt2
-rw-r--r--src/debug/ildbsymlib/CMakeLists.txt4
-rw-r--r--src/debug/shim/CMakeLists.txt4
-rw-r--r--src/dlls/dbgshim/CMakeLists.txt2
-rw-r--r--src/dlls/mscordac/CMakeLists.txt4
-rw-r--r--src/dlls/mscorrc/CMakeLists.txt4
-rw-r--r--src/gc/CMakeLists.txt1
-rw-r--r--src/gc/unix/CMakeLists.txt1
-rw-r--r--src/gcinfo/CMakeLists.txt4
-rw-r--r--src/ilasm/CMakeLists.txt4
-rw-r--r--src/ildasm/exe/CMakeLists.txt1
-rw-r--r--src/inc/CMakeLists.txt1
-rw-r--r--src/jit/dll/CMakeLists.txt2
-rw-r--r--src/md/ceefilegen/CMakeLists.txt4
-rw-r--r--src/md/compiler/CMakeLists.txt4
-rw-r--r--src/md/datasource/CMakeLists.txt4
-rw-r--r--src/md/enc/CMakeLists.txt4
-rw-r--r--src/md/hotdata/CMakeLists.txt4
-rw-r--r--src/md/runtime/CMakeLists.txt4
-rw-r--r--src/md/winmd/CMakeLists.txt4
-rw-r--r--src/nativeresources/CMakeLists.txt2
-rw-r--r--src/pal/src/CMakeLists.txt2
-rw-r--r--src/pal/src/eventprovider/lttngprovider/CMakeLists.txt2
-rw-r--r--src/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt1
-rw-r--r--src/palrt/CMakeLists.txt2
-rw-r--r--src/strongname/api/CMakeLists.txt4
-rw-r--r--src/tools/crossgen/CMakeLists.txt1
-rw-r--r--src/unwinder/CMakeLists.txt4
-rw-r--r--src/utilcode/CMakeLists.txt4
-rw-r--r--src/vm/CMakeLists.txt4
43 files changed, 0 insertions, 121 deletions
diff --git a/src/binder/CMakeLists.txt b/src/binder/CMakeLists.txt
index d92bec6..07f6c15 100644
--- a/src/binder/CMakeLists.txt
+++ b/src/binder/CMakeLists.txt
@@ -91,9 +91,5 @@ endif(WIN32)
convert_to_absolute_path(BINDER_SOURCES ${BINDER_SOURCES})
convert_to_absolute_path(BINDER_CROSSGEN_SOURCES ${BINDER_CROSSGEN_SOURCES})
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
add_subdirectory(v3binder)
add_subdirectory(v3binder_crossgen)
diff --git a/src/classlibnative/bcltype/CMakeLists.txt b/src/classlibnative/bcltype/CMakeLists.txt
index 843d7e8..67d1ad2 100644
--- a/src/classlibnative/bcltype/CMakeLists.txt
+++ b/src/classlibnative/bcltype/CMakeLists.txt
@@ -11,10 +11,6 @@ set(BCLTYPE_SOURCES
variant.cpp
)
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
add_library_clr(bcltype
STATIC
${BCLTYPE_SOURCES}
diff --git a/src/classlibnative/float/CMakeLists.txt b/src/classlibnative/float/CMakeLists.txt
index bf173fe..44d40c9 100644
--- a/src/classlibnative/float/CMakeLists.txt
+++ b/src/classlibnative/float/CMakeLists.txt
@@ -7,10 +7,6 @@ set(FLOAT_SOURCES
floatsingle.cpp
)
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
add_library_clr(comfloat_wks
STATIC
${FLOAT_SOURCES}
diff --git a/src/coreclr/hosts/osxbundlerun/CMakeLists.txt b/src/coreclr/hosts/osxbundlerun/CMakeLists.txt
index 8af173f..802c589 100644
--- a/src/coreclr/hosts/osxbundlerun/CMakeLists.txt
+++ b/src/coreclr/hosts/osxbundlerun/CMakeLists.txt
@@ -2,8 +2,6 @@ project(osxbundlerun)
include_directories(../unixcoreruncommon)
-add_compile_options(-fPIE)
-
set(CORERUN_SOURCES
osxbundlerun.cpp
)
diff --git a/src/coreclr/hosts/unixcoreconsole/CMakeLists.txt b/src/coreclr/hosts/unixcoreconsole/CMakeLists.txt
index 2daeaab..6e337b6 100644
--- a/src/coreclr/hosts/unixcoreconsole/CMakeLists.txt
+++ b/src/coreclr/hosts/unixcoreconsole/CMakeLists.txt
@@ -2,8 +2,6 @@ project(unixcoreconsole)
include_directories(../unixcoreruncommon)
-add_compile_options(-fPIE)
-
set(CORECONSOLE_SOURCES
coreconsole.cpp
)
diff --git a/src/coreclr/hosts/unixcorerun/CMakeLists.txt b/src/coreclr/hosts/unixcorerun/CMakeLists.txt
index 07beaae..5ee10b8 100644
--- a/src/coreclr/hosts/unixcorerun/CMakeLists.txt
+++ b/src/coreclr/hosts/unixcorerun/CMakeLists.txt
@@ -2,8 +2,6 @@ project(unixcorerun)
include_directories(../unixcoreruncommon)
-add_compile_options(-fPIE)
-
set(CORERUN_SOURCES
corerun.cpp
)
diff --git a/src/coreclr/hosts/unixcoreruncommon/CMakeLists.txt b/src/coreclr/hosts/unixcoreruncommon/CMakeLists.txt
index 93a5bbf..c859b0a 100644
--- a/src/coreclr/hosts/unixcoreruncommon/CMakeLists.txt
+++ b/src/coreclr/hosts/unixcoreruncommon/CMakeLists.txt
@@ -1,7 +1,5 @@
project(unixcoreruncommon)
-add_compile_options(-fPIC)
-
set(CMAKE_INCLUDE_CURRENT_DIR ON)
include(configure.cmake)
diff --git a/src/corefx/System.Globalization.Native/CMakeLists.txt b/src/corefx/System.Globalization.Native/CMakeLists.txt
index 1d4c946..86709d7 100644
--- a/src/corefx/System.Globalization.Native/CMakeLists.txt
+++ b/src/corefx/System.Globalization.Native/CMakeLists.txt
@@ -37,8 +37,6 @@ endif()
include(configure.cmake)
-add_compile_options(-fPIC)
-
set(NATIVEGLOBALIZATION_SOURCES
pal_calendarData.c
pal_casing.c
diff --git a/src/debug/daccess/CMakeLists.txt b/src/debug/daccess/CMakeLists.txt
index 0e8ccfe..241a629 100644
--- a/src/debug/daccess/CMakeLists.txt
+++ b/src/debug/daccess/CMakeLists.txt
@@ -11,7 +11,6 @@ include_directories(${CLR_DIR}/src/gcdump)
if(CLR_CMAKE_PLATFORM_UNIX)
include_directories(${GENERATED_INCLUDE_DIR})
- add_compile_options(-fPIC)
endif(CLR_CMAKE_PLATFORM_UNIX)
set(DACCESS_SOURCES
diff --git a/src/debug/dbgutil/CMakeLists.txt b/src/debug/dbgutil/CMakeLists.txt
index 1c0d49a..6c43b5c 100644
--- a/src/debug/dbgutil/CMakeLists.txt
+++ b/src/debug/dbgutil/CMakeLists.txt
@@ -9,8 +9,4 @@ set(DBGUTIL_SOURCES
dbgutil.cpp
)
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
add_library_clr(dbgutil STATIC ${DBGUTIL_SOURCES})
diff --git a/src/debug/debug-pal/CMakeLists.txt b/src/debug/debug-pal/CMakeLists.txt
index 59ed63e..cea36b7 100644
--- a/src/debug/debug-pal/CMakeLists.txt
+++ b/src/debug/debug-pal/CMakeLists.txt
@@ -16,7 +16,6 @@ if(WIN32)
endif(WIN32)
if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
add_definitions(-DFEATURE_PAL)
add_definitions(-DPAL_IMPLEMENTATION)
diff --git a/src/debug/di/CMakeLists.txt b/src/debug/di/CMakeLists.txt
index f0a9d41..1c34eac 100644
--- a/src/debug/di/CMakeLists.txt
+++ b/src/debug/di/CMakeLists.txt
@@ -89,7 +89,6 @@ if(WIN32)
set(CORDBDI_SOURCES_ASM_FILE ${CMAKE_CURRENT_BINARY_DIR}/${name}.obj)
endif()
elseif(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_ARM)
set(CORDBDI_SOURCES_ASM_FILE
diff --git a/src/debug/ee/CMakeLists.txt b/src/debug/ee/CMakeLists.txt
index 11a6702..383ab24 100644
--- a/src/debug/ee/CMakeLists.txt
+++ b/src/debug/ee/CMakeLists.txt
@@ -6,10 +6,6 @@ include_directories(BEFORE ${VM_DIR})
include_directories(BEFORE ${VM_DIR}/${ARCH_SOURCES_DIR})
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR})
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
set(CORDBEE_SOURCES_DAC_AND_WKS
controller.cpp
debugger.cpp
diff --git a/src/debug/ee/wks/CMakeLists.txt b/src/debug/ee/wks/CMakeLists.txt
index c6a4bcc..6a1a47c 100644
--- a/src/debug/ee/wks/CMakeLists.txt
+++ b/src/debug/ee/wks/CMakeLists.txt
@@ -54,8 +54,6 @@ if (WIN32)
else ()
- add_compile_options(-fPIC)
-
if(CLR_CMAKE_PLATFORM_ARCH_AMD64 OR CLR_CMAKE_PLATFORM_ARCH_ARM OR CLR_CMAKE_PLATFORM_ARCH_ARM64 OR CLR_CMAKE_PLATFORM_ARCH_I386)
add_library_clr(cordbee_wks ${CORDBEE_SOURCES_WKS} ../${ARCH_SOURCES_DIR}/dbghelpers.S)
else()
diff --git a/src/debug/ildbsymlib/CMakeLists.txt b/src/debug/ildbsymlib/CMakeLists.txt
index 1bd1096..cf72a0e 100644
--- a/src/debug/ildbsymlib/CMakeLists.txt
+++ b/src/debug/ildbsymlib/CMakeLists.txt
@@ -10,9 +10,5 @@ set( ILDBSYMLIB_SOURCES
symwrite.cpp
)
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
add_library_clr(ildbsymlib ${ILDBSYMLIB_SOURCES})
diff --git a/src/debug/shim/CMakeLists.txt b/src/debug/shim/CMakeLists.txt
index 8720eb7..28b7f62 100644
--- a/src/debug/shim/CMakeLists.txt
+++ b/src/debug/shim/CMakeLists.txt
@@ -4,10 +4,6 @@ if(WIN32)
add_definitions(-DHOST_IS_WINDOWS_OS)
endif(WIN32)
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
set(DEBUGSHIM_SOURCES
debugshim.cpp
)
diff --git a/src/dlls/dbgshim/CMakeLists.txt b/src/dlls/dbgshim/CMakeLists.txt
index 7e6ae61..ca4556b 100644
--- a/src/dlls/dbgshim/CMakeLists.txt
+++ b/src/dlls/dbgshim/CMakeLists.txt
@@ -41,8 +41,6 @@ endif(CLR_CMAKE_PLATFORM_DARWIN)
add_library_clr(dbgshim SHARED ${DBGSHIM_SOURCES})
if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-
add_custom_target(dbgshim_exports DEPENDS ${EXPORTS_FILE})
add_dependencies(dbgshim dbgshim_exports)
diff --git a/src/dlls/mscordac/CMakeLists.txt b/src/dlls/mscordac/CMakeLists.txt
index e065eba..df8d615 100644
--- a/src/dlls/mscordac/CMakeLists.txt
+++ b/src/dlls/mscordac/CMakeLists.txt
@@ -1,10 +1,6 @@
include(${CLR_DIR}/dac.cmake)
add_definitions(-DFEATURE_NO_HOST)
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
set(CLR_DAC_SOURCES
)
diff --git a/src/dlls/mscorrc/CMakeLists.txt b/src/dlls/mscorrc/CMakeLists.txt
index 8f67988..366ace4 100644
--- a/src/dlls/mscorrc/CMakeLists.txt
+++ b/src/dlls/mscorrc/CMakeLists.txt
@@ -9,10 +9,6 @@ if(WIN32)
string(REPLACE "/guard:cf" "" CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS})
endif(WIN32)
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
add_subdirectory(full)
# Only add the small version of the resources if the platform is Windows.
diff --git a/src/gc/CMakeLists.txt b/src/gc/CMakeLists.txt
index ab9f3a0..17a774c 100644
--- a/src/gc/CMakeLists.txt
+++ b/src/gc/CMakeLists.txt
@@ -97,7 +97,6 @@ target_link_libraries(clrgc ${GC_LINK_LIBRARIES})
install_clr(clrgc)
if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
# dprintf causes many warnings (https://github.com/dotnet/coreclr/issues/13367)
add_compile_options(-Wno-format)
endif(CLR_CMAKE_PLATFORM_UNIX)
diff --git a/src/gc/unix/CMakeLists.txt b/src/gc/unix/CMakeLists.txt
index fbb94fd..7c6e627 100644
--- a/src/gc/unix/CMakeLists.txt
+++ b/src/gc/unix/CMakeLists.txt
@@ -1,5 +1,4 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)
-add_compile_options(-fPIC)
include_directories("../env")
include(configure.cmake)
diff --git a/src/gcinfo/CMakeLists.txt b/src/gcinfo/CMakeLists.txt
index 79c4f48..c9c60db 100644
--- a/src/gcinfo/CMakeLists.txt
+++ b/src/gcinfo/CMakeLists.txt
@@ -16,10 +16,6 @@ endif(CLR_CMAKE_TARGET_ARCH_I386)
convert_to_absolute_path(GCINFO_SOURCES ${GCINFO_SOURCES})
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
add_subdirectory(lib)
add_subdirectory(crossgen)
diff --git a/src/ilasm/CMakeLists.txt b/src/ilasm/CMakeLists.txt
index 6117030..46850fa 100644
--- a/src/ilasm/CMakeLists.txt
+++ b/src/ilasm/CMakeLists.txt
@@ -10,10 +10,6 @@ add_definitions(-DFEATURE_CORECLR)
include_directories(.)
include_directories(../ildasm/unixcoreclrloader)
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIE)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
set(ILASM_SOURCES
assem.cpp
writer.cpp
diff --git a/src/ildasm/exe/CMakeLists.txt b/src/ildasm/exe/CMakeLists.txt
index 196f239..a8ca1df 100644
--- a/src/ildasm/exe/CMakeLists.txt
+++ b/src/ildasm/exe/CMakeLists.txt
@@ -10,7 +10,6 @@ add_definitions(-DFEATURE_CORECLR)
include_directories(..)
if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIE)
include_directories(../unixcoreclrloader)
build_resources(${CMAKE_CURRENT_SOURCE_DIR}/../dasm.rc dasm_rc TARGET_CPP_FILE)
diff --git a/src/inc/CMakeLists.txt b/src/inc/CMakeLists.txt
index c38d595..a6692ee 100644
--- a/src/inc/CMakeLists.txt
+++ b/src/inc/CMakeLists.txt
@@ -62,7 +62,6 @@ foreach(IDL_SOURCE IN LISTS CORGUIDS_IDL_SOURCES)
list(APPEND CORGUIDS_SOURCES ${C_SOURCE})
endforeach(IDL_SOURCE)
-add_compile_options(-fPIC)
endif(WIN32)
if(FEATURE_JIT_PITCHING)
diff --git a/src/jit/dll/CMakeLists.txt b/src/jit/dll/CMakeLists.txt
index 9e930de..624e357 100644
--- a/src/jit/dll/CMakeLists.txt
+++ b/src/jit/dll/CMakeLists.txt
@@ -3,8 +3,6 @@ project(ClrJit)
set_source_files_properties(${JIT_EXPORTS_FILE} PROPERTIES GENERATED TRUE)
if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-
add_library_clr(clrjit_static
STATIC
${SHARED_LIB_SOURCES}
diff --git a/src/md/ceefilegen/CMakeLists.txt b/src/md/ceefilegen/CMakeLists.txt
index 7170fac..57d4cb6 100644
--- a/src/md/ceefilegen/CMakeLists.txt
+++ b/src/md/ceefilegen/CMakeLists.txt
@@ -21,10 +21,6 @@ set(CEEFILEGEN_HEADERS
../../inc/utilcode.h
)
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
add_precompiled_header(stdafx.h stdafx.cpp CEEFILEGEN_SOURCES)
if (WIN32)
diff --git a/src/md/compiler/CMakeLists.txt b/src/md/compiler/CMakeLists.txt
index 5000f1b..260731d 100644
--- a/src/md/compiler/CMakeLists.txt
+++ b/src/md/compiler/CMakeLists.txt
@@ -51,10 +51,6 @@ set(MDCOMPILER_HEADERS
convert_to_absolute_path(MDCOMPILER_SOURCES ${MDCOMPILER_SOURCES})
convert_to_absolute_path(MDCOMPILER_HEADERS ${MDCOMPILER_HEADERS})
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
add_subdirectory(dac)
add_subdirectory(wks)
add_subdirectory(dbi)
diff --git a/src/md/datasource/CMakeLists.txt b/src/md/datasource/CMakeLists.txt
index 489ef34..3aaa00a 100644
--- a/src/md/datasource/CMakeLists.txt
+++ b/src/md/datasource/CMakeLists.txt
@@ -1,7 +1,3 @@
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
set(MDDATASOURCE_SOURCES
api.cpp
datatargetreader.cpp
diff --git a/src/md/enc/CMakeLists.txt b/src/md/enc/CMakeLists.txt
index 32d640a..2f1398d 100644
--- a/src/md/enc/CMakeLists.txt
+++ b/src/md/enc/CMakeLists.txt
@@ -44,10 +44,6 @@ endif(WIN32)
convert_to_absolute_path(MDRUNTIMERW_HEADERS ${MDRUNTIMERW_HEADERS})
convert_to_absolute_path(MDRUNTIMERW_SOURCES ${MDRUNTIMERW_SOURCES})
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
add_subdirectory(dac)
add_subdirectory(wks)
add_subdirectory(dbi)
diff --git a/src/md/hotdata/CMakeLists.txt b/src/md/hotdata/CMakeLists.txt
index 600da6a..92a16cc 100644
--- a/src/md/hotdata/CMakeLists.txt
+++ b/src/md/hotdata/CMakeLists.txt
@@ -25,10 +25,6 @@ set(MDHOTDATA_HEADERS
convert_to_absolute_path(MDHOTDATA_HEADERS ${MDHOTDATA_HEADERS})
convert_to_absolute_path(MDHOTDATA_SOURCES ${MDHOTDATA_SOURCES})
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
add_subdirectory(dac)
add_subdirectory(full)
add_subdirectory(crossgen)
diff --git a/src/md/runtime/CMakeLists.txt b/src/md/runtime/CMakeLists.txt
index 1111bdb..fc817b1 100644
--- a/src/md/runtime/CMakeLists.txt
+++ b/src/md/runtime/CMakeLists.txt
@@ -41,10 +41,6 @@ set(MDRUNTIME_HEADERS
convert_to_absolute_path(MDRUNTIME_HEADERS ${MDRUNTIME_HEADERS})
convert_to_absolute_path(MDRUNTIME_SOURCES ${MDRUNTIME_SOURCES})
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
add_subdirectory(dac)
add_subdirectory(wks)
add_subdirectory(dbi)
diff --git a/src/md/winmd/CMakeLists.txt b/src/md/winmd/CMakeLists.txt
index 31dbbbf..567a975 100644
--- a/src/md/winmd/CMakeLists.txt
+++ b/src/md/winmd/CMakeLists.txt
@@ -20,10 +20,6 @@ set(MDWINMD_HEADERS
convert_to_absolute_path(MDWINMD_HEADERS ${MDWINMD_HEADERS})
convert_to_absolute_path(MDWINMD_SOURCES ${MDWINMD_SOURCES})
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
add_subdirectory(dac)
add_subdirectory(wks)
if(WIN32)
diff --git a/src/nativeresources/CMakeLists.txt b/src/nativeresources/CMakeLists.txt
index e73a0d2..947a914 100644
--- a/src/nativeresources/CMakeLists.txt
+++ b/src/nativeresources/CMakeLists.txt
@@ -1,7 +1,5 @@
project(nativeresourcestring)
-add_compile_options(-fPIC)
-
add_library_clr(nativeresourcestring
STATIC
resourcestring.cpp
diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt
index 3bc1dc8..683eda0 100644
--- a/src/pal/src/CMakeLists.txt
+++ b/src/pal/src/CMakeLists.txt
@@ -9,8 +9,6 @@ if(NOT DEFINED ENV{ROOTFS_DIR})
include_directories(SYSTEM /usr/local/include)
endif()
-add_compile_options(-fPIC)
-
if(NOT CLR_CMAKE_USE_SYSTEM_LIBUNWIND)
include_directories(libunwind/include)
include_directories(libunwind/include/tdep)
diff --git a/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt b/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt
index b5bf8e8..1f49aef 100644
--- a/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt
+++ b/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt
@@ -46,8 +46,6 @@ add_library(eventprovider
eventproviderhelpers.cpp
)
-add_compile_options(-fPIC)
-
add_library(coreclrtraceptprovider
SHARED
${TRACEPOINT_PROVIDER_SOURCES}
diff --git a/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt b/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt
index 4a3abc2..685ac2e 100644
--- a/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt
+++ b/src/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt
@@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 2.8.12.2)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
add_definitions(-DFEATURE_ENABLE_HARDWARE_EXCEPTIONS)
endif(CLR_CMAKE_PLATFORM_UNIX)
diff --git a/src/palrt/CMakeLists.txt b/src/palrt/CMakeLists.txt
index d9f7b94..77fdc67 100644
--- a/src/palrt/CMakeLists.txt
+++ b/src/palrt/CMakeLists.txt
@@ -12,8 +12,6 @@ set(PALRT_SOURCES
variant.cpp
)
-add_compile_options(-fPIC)
-
add_library_clr(palrt
STATIC
${PALRT_SOURCES}
diff --git a/src/strongname/api/CMakeLists.txt b/src/strongname/api/CMakeLists.txt
index 4efcdb9..6e596d8 100644
--- a/src/strongname/api/CMakeLists.txt
+++ b/src/strongname/api/CMakeLists.txt
@@ -17,10 +17,6 @@ set(STRONGNAME_SOURCES
convert_to_absolute_path(STRONGNAME_SOURCES ${STRONGNAME_SOURCES})
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
add_subdirectory(dac)
add_subdirectory(wks)
add_subdirectory(crossgen)
diff --git a/src/tools/crossgen/CMakeLists.txt b/src/tools/crossgen/CMakeLists.txt
index 6b96f83..10ff481 100644
--- a/src/tools/crossgen/CMakeLists.txt
+++ b/src/tools/crossgen/CMakeLists.txt
@@ -14,7 +14,6 @@ if(WIN32)
endif()
if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIE)
add_definitions(-DNO_NGENPDB)
endif(CLR_CMAKE_PLATFORM_UNIX)
diff --git a/src/unwinder/CMakeLists.txt b/src/unwinder/CMakeLists.txt
index 5cd7bae..9a5d782 100644
--- a/src/unwinder/CMakeLists.txt
+++ b/src/unwinder/CMakeLists.txt
@@ -19,10 +19,6 @@ list(APPEND UNWINDER_SOURCES
convert_to_absolute_path(UNWINDER_SOURCES ${UNWINDER_SOURCES})
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
if(CLR_CMAKE_PLATFORM_UNIX)
add_subdirectory(wks)
endif(CLR_CMAKE_PLATFORM_UNIX)
diff --git a/src/utilcode/CMakeLists.txt b/src/utilcode/CMakeLists.txt
index 4e5f73f..785d1d7 100644
--- a/src/utilcode/CMakeLists.txt
+++ b/src/utilcode/CMakeLists.txt
@@ -108,10 +108,6 @@ convert_to_absolute_path(UTILCODE_DAC_SOURCES ${UTILCODE_DAC_SOURCES})
convert_to_absolute_path(UTILCODE_CROSSGEN_SOURCES ${UTILCODE_CROSSGEN_SOURCES})
convert_to_absolute_path(UTILCODE_STATICNOHOST_SOURCES ${UTILCODE_STATICNOHOST_SOURCES})
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
add_subdirectory(dac)
add_subdirectory(dyncrt)
add_subdirectory(staticnohost)
diff --git a/src/vm/CMakeLists.txt b/src/vm/CMakeLists.txt
index 10f8d34..7d887c1 100644
--- a/src/vm/CMakeLists.txt
+++ b/src/vm/CMakeLists.txt
@@ -21,10 +21,6 @@ else()
endif(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED)
endif(CMAKE_CONFIGURATION_TYPES)
-if(CLR_CMAKE_PLATFORM_UNIX)
- add_compile_options(-fPIC)
-endif(CLR_CMAKE_PLATFORM_UNIX)
-
if(FEATURE_GDBJIT)
set(VM_SOURCES_GDBJIT
gdbjit.cpp