[PATCH] D89343: [cmake] Unconditionally set the force flag when codesigning

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 13 14:29:08 PDT 2020


vsk created this revision.
vsk added reviewers: kastiglione, JDevlieghere, friss.
Herald added a subscriber: mgorny.
Herald added a project: LLVM.
vsk requested review of this revision.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89343

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -2026,9 +2026,10 @@
       set(ARG_BUNDLE_PATH $<TARGET_FILE:${name}>)
     endif()
 
-    if(ARG_FORCE)
-      set(force_flag "-f")
-    endif()
+    # ld64 now always codesigns the binaries it creates. Apply the force arg
+    # unconditionally so that we can - for example - add entitlements to the
+    # targets that need it.
+    set(force_flag "-f")
 
     add_custom_command(
       TARGET ${name} POST_BUILD


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89343.297961.patch
Type: text/x-patch
Size: 602 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201013/a9eef0a9/attachment.bin>


More information about the llvm-commits mailing list