Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit ff5bebf

Browse files
Fix platform logic in symbol stripping code.
1 parent 1f07b47 commit ff5bebf

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

CMakeLists.txt

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ if (PYTHON STREQUAL "PYTHON-NOTFOUND")
3232
endif()
3333

3434
# Ensure other tools are present
35-
if(WIN32)
35+
if (WIN32)
3636
enable_language(ASM_MASM)
3737

3838
# Ensure that MC is present
@@ -41,7 +41,7 @@ if(WIN32)
4141
message(FATAL_ERROR "MC not found")
4242
endif()
4343

44-
if(CLR_CMAKE_HOST_ARCH STREQUAL arm64)
44+
if (CLR_CMAKE_HOST_ARCH STREQUAL arm64)
4545
# CMAKE_CXX_COMPILER will default to the compiler installed with
4646
# Visual studio. Overwrite it to the compiler on the path.
4747
# TODO, remove when cmake generator supports Arm64 as a target.
@@ -50,7 +50,8 @@ if(WIN32)
5050
message("Overwriting the CMAKE_CXX_COMPILER.")
5151
message(CMAKE_CXX_COMPILER found:${CMAKE_CXX_COMPILER})
5252
endif()
53-
else()
53+
54+
else (WIN32)
5455
enable_language(ASM)
5556

5657
# Ensure that awk is present
@@ -61,32 +62,35 @@ else()
6162

6263
if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
6364

64-
# Ensure that dsymutil and strip is present
65+
# Ensure that dsymutil and strip are present
6566
find_program(DSYMUTIL dsymutil)
6667
if (DSYMUTIL STREQUAL "DSYMUTIL-NOTFOUND")
6768
message(FATAL_ERROR "dsymutil not found")
6869
endif()
70+
6971
find_program(STRIP strip)
7072
if (STRIP STREQUAL "STRIP-NOTFOUND")
7173
message(FATAL_ERROR "strip not found")
7274
endif()
73-
elseif (CMAKE_SYSTEM_NAME STREQUAL Linux)
75+
76+
else (CMAKE_SYSTEM_NAME STREQUAL Darwin)
77+
7478
# Ensure that objcopy is present
75-
if(DEFINED ENV{CROSSCOMPILE})
76-
if(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
77-
find_program(OBJCOPY ${TOOLCHAIN}-objcopy)
78-
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
79+
if (DEFINED ENV{CROSSCOMPILE})
80+
if (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l OR CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
7981
find_program(OBJCOPY ${TOOLCHAIN}-objcopy)
8082
else()
8183
clr_unknown_arch()
8284
endif()
8385
else()
8486
find_program(OBJCOPY objcopy)
8587
endif()
88+
8689
if (OBJCOPY STREQUAL "OBJCOPY-NOTFOUND")
8790
message(FATAL_ERROR "objcopy not found")
8891
endif()
89-
endif ()
92+
93+
endif (CMAKE_SYSTEM_NAME STREQUAL Darwin)
9094
endif(WIN32)
9195

9296
#----------------------------------------

functions.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,19 @@ function(add_precompiled_header header cppFile targetSources)
9393
endfunction()
9494

9595
function(strip_symbols targetName outputFilename)
96-
if(CLR_CMAKE_PLATFORM_UNIX)
97-
if(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELEASE)
96+
if (CLR_CMAKE_PLATFORM_UNIX)
97+
if (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELEASE)
9898

9999
# On the older version of cmake (2.8.12) used on Ubuntu 14.04 the TARGET_FILE
100100
# generator expression doesn't work correctly returning the wrong path and on
101101
# the newer cmake versions the LOCATION property isn't supported anymore.
102-
if(CMAKE_VERSION VERSION_EQUAL 3.0 OR CMAKE_VERSION VERSION_GREATER 3.0)
102+
if (CMAKE_VERSION VERSION_EQUAL 3.0 OR CMAKE_VERSION VERSION_GREATER 3.0)
103103
set(strip_source_file $<TARGET_FILE:${targetName}>)
104104
else()
105105
get_property(strip_source_file TARGET ${targetName} PROPERTY LOCATION)
106106
endif()
107107

108-
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
108+
if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
109109
set(strip_destination_file ${strip_source_file}.dwarf)
110110

111111
add_custom_command(
@@ -116,7 +116,7 @@ function(strip_symbols targetName outputFilename)
116116
COMMAND ${STRIP} -S ${strip_source_file}
117117
COMMENT Stripping symbols from ${strip_source_file} into file ${strip_destination_file}
118118
)
119-
elseif(CMAKE_SYSTEM_NAME STREQUAL Linux)
119+
else (CMAKE_SYSTEM_NAME STREQUAL Darwin)
120120
set(strip_destination_file ${strip_source_file}.dbg)
121121

122122
add_custom_command(
@@ -128,7 +128,7 @@ function(strip_symbols targetName outputFilename)
128128
COMMAND ${OBJCOPY} --add-gnu-debuglink=${strip_destination_file} ${strip_source_file}
129129
COMMENT Stripping symbols from ${strip_source_file} into file ${strip_destination_file}
130130
)
131-
endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
131+
endif (CMAKE_SYSTEM_NAME STREQUAL Darwin)
132132

133133
set(${outputFilename} ${strip_destination_file} PARENT_SCOPE)
134134
endif(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELEASE)

0 commit comments

Comments
 (0)