This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Unconditionally set the force flag when codesigning
ClosedPublic

Authored by vsk on Oct 13 2020, 2:29 PM.

Details

Summary

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

Diff Detail

Event Timeline

vsk created this revision.Oct 13 2020, 2:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 13 2020, 2:29 PM
Herald added a subscriber: mgorny. · View Herald Transcript
vsk requested review of this revision.Oct 13 2020, 2:29 PM
kastiglione accepted this revision.Oct 13 2020, 4:40 PM

This doesn't require a ld64 version check, and it's a much less invasive cmake change.

Was there consideration about using an arch check, and only doing this for Apple Silicon targets? I think this is fine too, just wanting to cover the bases.

This revision is now accepted and ready to land.Oct 13 2020, 4:40 PM
vsk added a comment.Oct 13 2020, 4:44 PM

This doesn't require a ld64 version check, and it's a much less invasive cmake change.

Was there consideration about using an arch check, and only doing this for Apple Silicon targets? I think this is fine too, just wanting to cover the bases.

I actually hadn't considered that. We do have <TARGET_FILE:${name}>, so we could conceivably derive the target architecture from there and avoid setting force_flag on Intel. I'm not sure the added complexity is warranted though.

This revision was automatically updated to reflect the committed changes.