diff options
author | Brad King <brad.king@kitware.com> | 2023-03-28 21:28:44 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-03-30 11:14:07 (GMT) |
commit | ac2562afb3fda621854f4c3a470e36f10cf507b3 (patch) | |
tree | 24cd798259a802ddd9aa1925ff09ff5ae7efe2f3 /Modules/CMakeFindBinUtils.cmake | |
parent | f4b8176447699ba82c2bf7baf2d609d0d6e3259b (diff) | |
download | CMake-ac2562afb3fda621854f4c3a470e36f10cf507b3.zip CMake-ac2562afb3fda621854f4c3a470e36f10cf507b3.tar.gz CMake-ac2562afb3fda621854f4c3a470e36f10cf507b3.tar.bz2 |
BinUtils: Avoid llvm-strip on Apple platforms
Since commit cf82300a63 (BinUtils: Clarify search logic and make it more
consistent, 2021-05-27, v3.21.0-rc1~119^2~2) we prefer `llvm-strip` over
`strip` when using Clang. However, `llvm-strip` seems to produce
unusable binaries in cases involving chained fixups. Prefer Apple's
`strip` over `llvm-strip` on `APPLE` platforms.
We still need to consider `llvm-strip` as a fallback as explained for
`llvm-ar` by commit fee36b7a78 (BinUtils: Restore llvm-ar fallback on
Apple platforms, 2022-03-15, v3.23.0-rc4~12^2).
Issue: #24601
Diffstat (limited to 'Modules/CMakeFindBinUtils.cmake')
-rw-r--r-- | Modules/CMakeFindBinUtils.cmake | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 190117c..10e8ff3 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -186,7 +186,15 @@ else() list(PREPEND _CMAKE_RANLIB_NAMES "llvm-ranlib") if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}" VERSION_GREATER_EQUAL 11) # llvm-strip versions prior to 11 require additional flags we do not yet add. - list(PREPEND _CMAKE_STRIP_NAMES "llvm-strip") + if(APPLE) + # llvm-strip does not seem to support chained fixup format correctly. + # FIXME(#23333): We still need to consider 'llvm-strip' as a fallback + # because the 'APPLE' definition may be based on the host in this context, + # and a cross-compiling toolchain may not have 'strip'. + list(APPEND _CMAKE_STRIP_NAMES "llvm-strip") + else() + list(PREPEND _CMAKE_STRIP_NAMES "llvm-strip") + endif() endif() list(PREPEND _CMAKE_NM_NAMES "llvm-nm") if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}" VERSION_GREATER_EQUAL 9) |