From f193079101394fcb284d2aa30a3948b63d5a846e Mon Sep 17 00:00:00 2001 From: Adeel Date: Fri, 20 Mar 2020 13:18:03 +0200 Subject: [PATCH] Remove skip-strip internal implementation --- eng/native/build-commons.sh | 1 - eng/native/functions.cmake | 99 ++++++++----------- .../src/debug/createdump/CMakeLists.txt | 2 +- src/coreclr/src/dlls/clretwrc/CMakeLists.txt | 2 +- src/coreclr/src/dlls/dbgshim/CMakeLists.txt | 2 +- src/coreclr/src/dlls/mscordac/CMakeLists.txt | 2 +- src/coreclr/src/dlls/mscordbi/CMakeLists.txt | 2 +- .../src/dlls/mscoree/coreclr/CMakeLists.txt | 2 +- src/coreclr/src/dlls/mscorrc/CMakeLists.txt | 2 +- src/coreclr/src/jit/standalone/CMakeLists.txt | 2 +- .../lttngprovider/CMakeLists.txt | 2 +- src/coreclr/src/tools/crossgen/CMakeLists.txt | 2 +- 12 files changed, 52 insertions(+), 68 deletions(-) diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index c65f99a936b6a..6cc187e7ab2bb 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -337,7 +337,6 @@ while :; do ;; stripsymbols|-stripsymbols) - __CMakeArgs="-DSTRIP_SYMBOLS=true $__CMakeArgs" ;; verbose|-verbose) diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index d68cd5235e4cb..af297cb90080a 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -250,62 +250,52 @@ function(target_precompile_header) endif(MSVC) endfunction() -function(strip_symbols targetName outputFilename skipStrip) +function(strip_symbols targetName outputFilename) if (CLR_CMAKE_HOST_UNIX) - if (STRIP_SYMBOLS) - set(strip_source_file $) - - if (CMAKE_SYSTEM_NAME STREQUAL Darwin) - set(strip_destination_file ${strip_source_file}.dwarf) - - if(NOT ${skipStrip}) - # Ensure that dsymutil and strip are present - find_program(DSYMUTIL dsymutil) - if (DSYMUTIL STREQUAL "DSYMUTIL-NOTFOUND") - message(FATAL_ERROR "dsymutil not found") - endif() - - find_program(STRIP strip) - if (STRIP STREQUAL "STRIP-NOTFOUND") - message(FATAL_ERROR "strip not found") - endif() - - add_custom_command( - TARGET ${targetName} - POST_BUILD - VERBATIM - COMMAND ${DSYMUTIL} --flat --minimize ${strip_source_file} - COMMAND ${STRIP} -S ${strip_source_file} - COMMENT Stripping symbols from ${strip_source_file} into file ${strip_destination_file} - ) - endif() - else (CMAKE_SYSTEM_NAME STREQUAL Darwin) - set(strip_destination_file ${strip_source_file}.dbg) - - if(NOT ${skipStrip}) - add_custom_command( - TARGET ${targetName} - POST_BUILD - VERBATIM - COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${strip_source_file} ${strip_destination_file} - COMMAND ${CMAKE_OBJCOPY} --strip-debug ${strip_source_file} - COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${strip_destination_file} ${strip_source_file} - COMMENT Stripping symbols from ${strip_source_file} into file ${strip_destination_file} - ) - endif() - endif (CMAKE_SYSTEM_NAME STREQUAL Darwin) + set(strip_source_file $) + + if (CMAKE_SYSTEM_NAME STREQUAL Darwin) + set(strip_destination_file ${strip_source_file}.dwarf) - set(${outputFilename} ${strip_destination_file} PARENT_SCOPE) - endif (STRIP_SYMBOLS) + # Ensure that dsymutil and strip are present + find_program(DSYMUTIL dsymutil) + if (DSYMUTIL STREQUAL "DSYMUTIL-NOTFOUND") + message(FATAL_ERROR "dsymutil not found") + endif() + + find_program(STRIP strip) + if (STRIP STREQUAL "STRIP-NOTFOUND") + message(FATAL_ERROR "strip not found") + endif() + + add_custom_command( + TARGET ${targetName} + POST_BUILD + VERBATIM + COMMAND ${DSYMUTIL} --flat --minimize ${strip_source_file} + COMMAND ${STRIP} -S ${strip_source_file} + COMMENT Stripping symbols from ${strip_source_file} into file ${strip_destination_file} + ) + else (CMAKE_SYSTEM_NAME STREQUAL Darwin) + set(strip_destination_file ${strip_source_file}.dbg) + + add_custom_command( + TARGET ${targetName} + POST_BUILD + VERBATIM + COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${strip_source_file} ${strip_destination_file} + COMMAND ${CMAKE_OBJCOPY} --strip-debug ${strip_source_file} + COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${strip_destination_file} ${strip_source_file} + COMMENT Stripping symbols from ${strip_source_file} into file ${strip_destination_file} + ) + endif (CMAKE_SYSTEM_NAME STREQUAL Darwin) + + set(${outputFilename} ${strip_destination_file} PARENT_SCOPE) endif(CLR_CMAKE_HOST_UNIX) endfunction() function(install_symbols targetName destination_path) - install_symbols_with_skip(${targetName} ${destination_path} NO) -endfunction() - -function(install_symbols_with_skip targetName destination_path skipStrip) - strip_symbols(${targetName} strip_destination_file ${skipStrip}) + strip_symbols(${targetName} strip_destination_file) if(CLR_CMAKE_TARGET_WIN32) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${targetName}.pdb DESTINATION ${destination_path}/PDB) @@ -314,9 +304,8 @@ function(install_symbols_with_skip targetName destination_path skipStrip) endif() endfunction() -# install_clr(TARGETS TARGETS targetName [targetName2 ...] [DESTINATION destination] [SKIP_STRIP]) +# install_clr(TARGETS TARGETS targetName [targetName2 ...] [DESTINATION destination]) function(install_clr) - set(options SKIP_STRIP) set(oneValueArgs DESTINATION) set(multiValueArgs TARGETS) cmake_parse_arguments(PARSE_ARGV 0 INSTALL_CLR "${options}" "${oneValueArgs}" "${multiValueArgs}") @@ -332,11 +321,7 @@ function(install_clr) foreach(targetName ${INSTALL_CLR_TARGETS}) list(FIND CLR_CROSS_COMPONENTS_LIST ${targetName} INDEX) if (NOT DEFINED CLR_CROSS_COMPONENTS_LIST OR NOT ${INDEX} EQUAL -1) - if("${INSTALL_CLR_SKIP_STRIP}" STREQUAL "") - set(INSTALL_CLR_SKIP_STRIP FALSE) - endif() - - install_symbols_with_skip(${targetName} ${INSTALL_CLR_DESTINATION} ${INSTALL_CLR_SKIP_STRIP}) + install_symbols(${targetName} ${INSTALL_CLR_DESTINATION}) # We don't need to install the export libraries for our DLLs # since they won't be directly linked against. diff --git a/src/coreclr/src/debug/createdump/CMakeLists.txt b/src/coreclr/src/debug/createdump/CMakeLists.txt index e110566cb5088..d29eda513855f 100644 --- a/src/coreclr/src/debug/createdump/CMakeLists.txt +++ b/src/coreclr/src/debug/createdump/CMakeLists.txt @@ -52,4 +52,4 @@ target_link_libraries(createdump add_dependencies(createdump mscordaccore) install_clr(TARGETS createdump) -install_clr(TARGETS createdump DESTINATION sharedFramework SKIP_STRIP) +install_clr(TARGETS createdump DESTINATION sharedFramework) diff --git a/src/coreclr/src/dlls/clretwrc/CMakeLists.txt b/src/coreclr/src/dlls/clretwrc/CMakeLists.txt index 771dc494eed51..7ef540fa3c827 100644 --- a/src/coreclr/src/dlls/clretwrc/CMakeLists.txt +++ b/src/coreclr/src/dlls/clretwrc/CMakeLists.txt @@ -21,6 +21,6 @@ add_library_clr(clretwrc SHARED # add the install targets install_clr(TARGETS clretwrc) -install_clr(TARGETS clretwrc DESTINATION sharedFramework SKIP_STRIP) +install_clr(TARGETS clretwrc DESTINATION sharedFramework) add_dependencies(clretwrc eventing_headers) diff --git a/src/coreclr/src/dlls/dbgshim/CMakeLists.txt b/src/coreclr/src/dlls/dbgshim/CMakeLists.txt index 5367d774f371c..52c1f76b92fd8 100644 --- a/src/coreclr/src/dlls/dbgshim/CMakeLists.txt +++ b/src/coreclr/src/dlls/dbgshim/CMakeLists.txt @@ -84,4 +84,4 @@ target_link_libraries(dbgshim ${DBGSHIM_LIBRARIES}) # add the install targets install_clr(TARGETS dbgshim) -install_clr(TARGETS dbgshim DESTINATION sharedFramework SKIP_STRIP) +install_clr(TARGETS dbgshim DESTINATION sharedFramework) diff --git a/src/coreclr/src/dlls/mscordac/CMakeLists.txt b/src/coreclr/src/dlls/mscordac/CMakeLists.txt index f1fe14ce38686..aa3c6e815471a 100644 --- a/src/coreclr/src/dlls/mscordac/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscordac/CMakeLists.txt @@ -189,7 +189,7 @@ target_link_libraries(mscordaccore PRIVATE ${COREDAC_LIBRARIES}) # add the install targets install_clr(TARGETS mscordaccore) -install_clr(TARGETS mscordaccore DESTINATION sharedFramework SKIP_STRIP) +install_clr(TARGETS mscordaccore DESTINATION sharedFramework) if(CLR_CMAKE_HOST_WIN32) set(LONG_NAME_HOST_ARCH ${CLR_CMAKE_HOST_ARCH}) diff --git a/src/coreclr/src/dlls/mscordbi/CMakeLists.txt b/src/coreclr/src/dlls/mscordbi/CMakeLists.txt index 304d7761e618b..073ea9d7016aa 100644 --- a/src/coreclr/src/dlls/mscordbi/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscordbi/CMakeLists.txt @@ -119,4 +119,4 @@ endif(CLR_CMAKE_HOST_WIN32) # add the install targets install_clr(TARGETS mscordbi) -install_clr(TARGETS mscordbi DESTINATION sharedFramework SKIP_STRIP) +install_clr(TARGETS mscordbi DESTINATION sharedFramework) diff --git a/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt b/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt index 0517bb50df321..8b5365f49a1b1 100644 --- a/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt @@ -214,7 +214,7 @@ endif(CLR_CMAKE_TARGET_WIN32) # add the install targets install_clr(TARGETS coreclr) -install_clr(TARGETS coreclr DESTINATION sharedFramework SKIP_STRIP) +install_clr(TARGETS coreclr DESTINATION sharedFramework) # Enable profile guided optimization add_pgo(coreclr) diff --git a/src/coreclr/src/dlls/mscorrc/CMakeLists.txt b/src/coreclr/src/dlls/mscorrc/CMakeLists.txt index d61e9ae9fb7c6..ab6a5a231094d 100644 --- a/src/coreclr/src/dlls/mscorrc/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscorrc/CMakeLists.txt @@ -16,7 +16,7 @@ if(CLR_CMAKE_HOST_WIN32) ) install_clr(TARGETS mscorrc) - install_clr(TARGETS mscorrc DESTINATION sharedFramework SKIP_STRIP) + install_clr(TARGETS mscorrc DESTINATION sharedFramework) else() build_resources(${CMAKE_CURRENT_SOURCE_DIR}/include.rc mscorrc TARGET_CPP_FILE) diff --git a/src/coreclr/src/jit/standalone/CMakeLists.txt b/src/coreclr/src/jit/standalone/CMakeLists.txt index b5cb1bc28fe22..fa10b2ab591e7 100644 --- a/src/coreclr/src/jit/standalone/CMakeLists.txt +++ b/src/coreclr/src/jit/standalone/CMakeLists.txt @@ -11,7 +11,7 @@ endif(FEATURE_READYTORUN) add_jit(clrjit) # add the install targets -install_clr(TARGETS clrjit DESTINATION sharedFramework SKIP_STRIP) +install_clr(TARGETS clrjit DESTINATION sharedFramework) # Enable profile guided optimization add_pgo(clrjit) diff --git a/src/coreclr/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt b/src/coreclr/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt index 346630302eb21..874a457db2879 100644 --- a/src/coreclr/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt +++ b/src/coreclr/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt @@ -72,4 +72,4 @@ set_target_properties(coreclrtraceptprovider PROPERTIES LINKER_LANGUAGE CXX) _install(TARGETS eventprovider DESTINATION lib) # Install the static coreclrtraceptprovider library install_clr(TARGETS coreclrtraceptprovider) -install_clr(TARGETS coreclrtraceptprovider DESTINATION sharedFramework SKIP_STRIP) +install_clr(TARGETS coreclrtraceptprovider DESTINATION sharedFramework) diff --git a/src/coreclr/src/tools/crossgen/CMakeLists.txt b/src/coreclr/src/tools/crossgen/CMakeLists.txt index 32130c9a9cc16..f8cd5b0bf12de 100644 --- a/src/coreclr/src/tools/crossgen/CMakeLists.txt +++ b/src/coreclr/src/tools/crossgen/CMakeLists.txt @@ -82,4 +82,4 @@ add_subdirectory(../../vm/crossgen ../../vm/crossgen) # add the install targets install_clr(TARGETS crossgen) -install_clr(TARGETS crossgen DESTINATION sharedFramework SKIP_STRIP) +install_clr(TARGETS crossgen DESTINATION sharedFramework)