Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2020-03-30 21:32:48 +0300
committerGitHub <noreply@github.com>2020-03-30 21:32:48 +0300
commitb186c975c02a5ce0b45d86fb99063db127979894 (patch)
tree7d02f34a1b7ab4ad1f96afbb753ac8143361a692 /eng/native/functions.cmake
parent85a3d4eeb4071528ff6b31fcbd0c4e4ca3dad510 (diff)
Fix debug symbol generation (#34154)
* Fix debug symbol generation The debug symbol generation got recently broken. For most of the shared libraries, the debug symbols were stripped twice due to the fact that install_clr for them was invoked twice - once for the default install location and once for the sharedFramework location and the stripping was executed in both of them. First stripping stripped the symbols off the target binary and set so called debuglink in the binary to point to the symbol file. This debuglink includes a crc32 of the dbg symbols file. The second stripping tried to strip symbols from the already stripped binary. That resulted in a small dbg symbols file that didn't actually contain any useful symbols. Moreover, it is not possible to set a debuglink in a binary if it is already set there. So the second attempt failed and the crc was left set to the crc of the previous debug. Thus when debugger loads such a binary, it cannot find the debug symbols file, as the crc doesn't match. And even if it matched, the data would have no value. The fix is to modify install_clr so that it has an extra optional argument to specify the secondary install location and use just one install_clr per target. The function then does the stripping just once and the actual installation once or twice depending on the secondary location argumenbt presence. * Fix libraries and installer * Fix installer placement of lib files
Diffstat (limited to 'eng/native/functions.cmake')
-rw-r--r--eng/native/functions.cmake56
1 files changed, 37 insertions, 19 deletions
diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake
index bd96bc9c599..7824fb6a757 100644
--- a/eng/native/functions.cmake
+++ b/eng/native/functions.cmake
@@ -291,22 +291,35 @@ function(strip_symbols targetName outputFilename)
endif (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS)
set(${outputFilename} ${strip_destination_file} PARENT_SCOPE)
+ else(CLR_CMAKE_HOST_UNIX)
+ set(${outputFilename} ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${targetName}.pdb PARENT_SCOPE)
endif(CLR_CMAKE_HOST_UNIX)
endfunction()
-function(install_symbols targetName destination_path)
- strip_symbols(${targetName} strip_destination_file)
+function(install_with_stripped_symbols targetName kind destination)
+ strip_symbols(${targetName} symbol_file)
+ install_symbols(${symbol_file} ${destination})
+ if ("${kind}" STREQUAL "TARGETS")
+ set(install_source ${targetName})
+ elseif("${kind}" STREQUAL "PROGRAMS")
+ set(install_source $<TARGET_FILE:${targetName}>)
+ else()
+ message(FATAL_ERROR "The `kind` argument has to be either TARGETS or PROGRAMS, ${kind} was provided instead")
+ endif()
+ install(${kind} ${install_source} DESTINATION ${destination})
+endfunction()
+function(install_symbols symbol_file destination_path)
if(CLR_CMAKE_TARGET_WIN32)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${targetName}.pdb DESTINATION ${destination_path}/PDB)
+ install(FILES ${symbol_file} DESTINATION ${destination_path}/PDB)
else()
- install(FILES ${strip_destination_file} DESTINATION ${destination_path})
+ install(FILES ${symbol_file} DESTINATION ${destination_path})
endif()
endfunction()
-# install_clr(TARGETS TARGETS targetName [targetName2 ...] [DESTINATION destination])
+# install_clr(TARGETS TARGETS targetName [targetName2 ...] [ADDITIONAL_DESTINATION destination])
function(install_clr)
- set(oneValueArgs DESTINATION)
+ set(oneValueArgs ADDITIONAL_DESTINATION)
set(multiValueArgs TARGETS)
cmake_parse_arguments(PARSE_ARGV 0 INSTALL_CLR "${options}" "${oneValueArgs}" "${multiValueArgs}")
@@ -314,24 +327,29 @@ function(install_clr)
message(FATAL_ERROR "At least one target must be passed to install_clr(TARGETS )")
endif()
- if ("${INSTALL_CLR_DESTINATION}" STREQUAL "")
- set(INSTALL_CLR_DESTINATION ".")
+ set(destinations ".")
+
+ if (NOT "${INSTALL_CLR_ADDITIONAL_DESTINATION}" STREQUAL "")
+ list(APPEND destinations ${INSTALL_CLR_ADDITIONAL_DESTINATION})
endif()
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)
- 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.
- install(PROGRAMS $<TARGET_FILE:${targetName}> DESTINATION ${INSTALL_CLR_DESTINATION})
-
- if(CLR_CMAKE_PGO_INSTRUMENT)
- if(WIN32)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${targetName}.pgd DESTINATION ${INSTALL_CLR_DESTINATION}/PGD OPTIONAL)
- endif()
- endif()
+ strip_symbols(${targetName} symbol_file)
+
+ foreach(destination in ${destinations})
+ # We don't need to install the export libraries for our DLLs
+ # since they won't be directly linked against.
+ install(PROGRAMS $<TARGET_FILE:${targetName}> DESTINATION ${destination})
+ install_symbols(${symbol_file} ${destination})
+
+ if(CLR_CMAKE_PGO_INSTRUMENT)
+ if(WIN32)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${targetName}.pgd DESTINATION ${destination}/PGD OPTIONAL)
+ endif()
+ endif()
+ endforeach()
endif()
endforeach()
endfunction()