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
path: root/eng
diff options
context:
space:
mode:
authorAdeel Mujahid <adeelbm@outlook.com>2020-03-10 03:08:21 +0300
committerGitHub <noreply@github.com>2020-03-10 03:08:21 +0300
commit253a0b4fb3fd1ae1860f121d9260eaae94ded701 (patch)
treef4d64b1383d9012cc1c21c0dc053952ad5efddd2 /eng
parent1e04f68b1b97bf36e4f1fc75ea23b9d156c19920 (diff)
Consolidate objcopy detection (#33342)
Diffstat (limited to 'eng')
-rw-r--r--eng/native/configureplatform.cmake1
-rw-r--r--eng/native/configuretools.cmake27
-rw-r--r--eng/native/functions.cmake6
3 files changed, 13 insertions, 21 deletions
diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake
index 29f4f85436b..b1e82b1c3b0 100644
--- a/eng/native/configureplatform.cmake
+++ b/eng/native/configureplatform.cmake
@@ -1,4 +1,5 @@
include(CheckPIESupported)
+include(${CMAKE_CURRENT_LIST_DIR}/functions.cmake)
#----------------------------------------
# Detect and set platform variable names
diff --git a/eng/native/configuretools.cmake b/eng/native/configuretools.cmake
index df32fb27862..0a2f797dbdf 100644
--- a/eng/native/configuretools.cmake
+++ b/eng/native/configuretools.cmake
@@ -30,6 +30,7 @@ if(NOT WIN32)
NAMES
"${TOOLSET_PREFIX}${exec}${CLR_CMAKE_COMPILER_FILE_NAME_VERSION}"
"${TOOLSET_PREFIX}${exec}")
+
if (EXEC_LOCATION_${exec} STREQUAL "EXEC_LOCATION_${exec}-NOTFOUND")
message(FATAL_ERROR "Unable to find toolchain executable for: ${exec}.")
endif()
@@ -40,30 +41,20 @@ if(NOT WIN32)
locate_toolchain_exec(link CMAKE_LINKER)
locate_toolchain_exec(nm CMAKE_NM)
- if(NOT APPLE)
- locate_toolchain_exec(objdump CMAKE_OBJDUMP)
- endif()
-
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
- locate_toolchain_exec(objcopy CMAKE_OBJCOPY)
locate_toolchain_exec(ranlib CMAKE_RANLIB)
endif()
- if (NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
- if (CMAKE_CROSSCOMPILING AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
- if (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l OR CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm)
- find_program(OBJCOPY ${TOOLCHAIN}-objcopy)
- elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
- find_program(OBJCOPY objcopy)
- else()
- clr_unknown_arch()
- endif()
+ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
+ locate_toolchain_exec(objdump CMAKE_OBJDUMP)
+
+ if(CMAKE_CROSSCOMPILING AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD AND (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l OR
+ CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm))
+ set(TOOLSET_PREFIX "${TOOLCHAIN}-")
else()
- find_program(OBJCOPY objcopy)
+ set(TOOLSET_PREFIX "")
endif()
- if (OBJCOPY STREQUAL "OBJCOPY-NOTFOUND")
- message(FATAL_ERROR "objcopy not found")
- endif()
+ locate_toolchain_exec(objcopy CMAKE_OBJCOPY)
endif()
endif()
diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake
index f11c56c8283..aa2c9411ab6 100644
--- a/eng/native/functions.cmake
+++ b/eng/native/functions.cmake
@@ -276,9 +276,9 @@ function(strip_symbols targetName outputFilename skipStrip)
TARGET ${targetName}
POST_BUILD
VERBATIM
- COMMAND ${OBJCOPY} --only-keep-debug ${strip_source_file} ${strip_destination_file}
- COMMAND ${OBJCOPY} --strip-debug ${strip_source_file}
- COMMAND ${OBJCOPY} --add-gnu-debuglink=${strip_destination_file} ${strip_source_file}
+ 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()