Skip to content

Commit 24c1660

Browse files
committed
[cmake] Unconditionally set the force flag when codesigning
The Darwin linker now defaults to ad hoc signing binaries when targeting Apple Silicon. This creates a problem when configuring targets that must be built with entitlements: we either need to add -Wl,-no_adhoc_codesign when building the target, or sign with the force flag set to allow replacing a pre-existing signature. Unconditionally force-signing is the more convenient solution. This doesn't require a ld64 version check, and it's a much less invasive cmake change. Patch by Fred Riss! rdar://70237254 Differential Revision: https://reviews.llvm.org/D89343
1 parent 7fafaa0 commit 24c1660

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/cmake/modules/AddLLVM.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,9 +2026,10 @@ function(llvm_codesign name)
20262026
set(ARG_BUNDLE_PATH $<TARGET_FILE:${name}>)
20272027
endif()
20282028

2029-
if(ARG_FORCE)
2030-
set(force_flag "-f")
2031-
endif()
2029+
# ld64 now always codesigns the binaries it creates. Apply the force arg
2030+
# unconditionally so that we can - for example - add entitlements to the
2031+
# targets that need it.
2032+
set(force_flag "-f")
20322033

20332034
add_custom_command(
20342035
TARGET ${name} POST_BUILD

0 commit comments

Comments
 (0)