Skip to content

Commit 2f55056

Browse files
bdashMark Rowe
andauthored
[compiler-rt] Don't explicitly ad-hoc code sign dylibs if using Apple's new linker (#88323)
Apple's new linker reports itself as ld rather than ld64 and does not match the version detection regex. Invert the logic to look only for older versions of ld64. This ensures the runtime dylibs are left with a linker-generated code signature that tools such as `strip` will preserve. Co-authored-by: Mark Rowe <[email protected]>
1 parent 43d0891 commit 2f55056

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

compiler-rt/cmake/Modules/AddCompilerRT.cmake

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,11 +405,14 @@ function(add_compiler_rt_runtime name type)
405405
if (HAD_ERROR)
406406
message(FATAL_ERROR "${CMAKE_LINKER} failed with status ${HAD_ERROR}")
407407
endif()
408-
set(NEED_EXPLICIT_ADHOC_CODESIGN 1)
408+
set(NEED_EXPLICIT_ADHOC_CODESIGN 0)
409+
# Apple introduced a new linker by default in Xcode 15. This linker reports itself as ld
410+
# rather than ld64 and does not match this version regex. That's ok since it never needs
411+
# the explicit ad-hoc code signature.
409412
if ("${LD_V_OUTPUT}" MATCHES ".*ld64-([0-9.]+).*")
410413
string(REGEX REPLACE ".*ld64-([0-9.]+).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT})
411-
if (HOST_LINK_VERSION VERSION_GREATER_EQUAL 609)
412-
set(NEED_EXPLICIT_ADHOC_CODESIGN 0)
414+
if (HOST_LINK_VERSION VERSION_LESS 609)
415+
set(NEED_EXPLICIT_ADHOC_CODESIGN 1)
413416
endif()
414417
endif()
415418
if (NEED_EXPLICIT_ADHOC_CODESIGN)

0 commit comments

Comments
 (0)