Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckLinkerFlag)
include(CheckIPOSupported)

# "configureoptimization.cmake" must be included after CLR_CMAKE_HOST_UNIX has been set.
include(${CMAKE_CURRENT_LIST_DIR}/configureoptimization.cmake)
Expand Down Expand Up @@ -152,6 +153,17 @@ elseif (CLR_CMAKE_HOST_UNIX)
endif()
endif(MSVC)

check_ipo_supported(RESULT result OUTPUT output)
if(result AND NOT CLR_CMAKE_TARGET_APPLE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment about why IPO is disabled on apple platforms?

# Apple does not properly support IPO and need more involved
# way on how to support this. For now, disable it for Apple.
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_DEBUG OFF)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_CHECKED OFF)
else()
message(WARNING "IPO is not supported")
endif()

if (CLR_CMAKE_ENABLE_SANITIZERS)
set (CLR_CMAKE_BUILD_SANITIZERS "")
set (CLR_CMAKE_SANITIZER_RUNTIMES "")
Expand Down Expand Up @@ -889,10 +901,6 @@ if (MSVC)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Gz>)
endif (CLR_CMAKE_HOST_ARCH_I386)

set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_DEBUG OFF)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_CHECKED OFF)

if (CLR_CMAKE_HOST_ARCH_AMD64)
# The generator expression in the following command means that the /homeparams option is added only for debug builds for C and C++ source files
add_compile_options($<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:C,CXX>>:/homeparams>) # Force parameters passed in registers to be written to the stack
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/debug/runtimeinfo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ else()
target_include_directories(cdac_data_descriptor BEFORE PRIVATE ${VM_DIR})
target_include_directories(cdac_data_descriptor BEFORE PRIVATE ${VM_DIR}/${ARCH_SOURCES_DIR})
target_include_directories(cdac_data_descriptor PRIVATE ${CLR_DIR}/interop/inc)
# LTO not supported for cdac, so disable it
set_target_properties(cdac_data_descriptor PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment about why we're disabling IPO here?


set(GENERATED_CDAC_DESCRIPTOR_DIR "${CMAKE_CURRENT_BINARY_DIR}/cdac")
set(CONTRACT_DESCRIPTOR_OUTPUT "${GENERATED_CDAC_DESCRIPTOR_DIR}/contract-descriptor.c")
Expand Down