This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Streamline code signing for debugserver #2
AbandonedPublic

Authored by sgraenitz on Nov 28 2018, 10:36 AM.

Details

Reviewers
None
Summary

The first patch had to be reverted as I missed a few details. This review continues from https://reviews.llvm.org/D54476 and I will add the required fixes.

Change log:

  • Use llvm_codesign to sign debugserver with entitlements.
  • Set global LLVM_CODESIGNING_IDENTITY from LLDB_CODESIGN_IDENTITY (if given).
  • Pass through ENTITLEMENTS from add_lldb_executable to add_llvm_executable.
  • Handle reconfigurations correctly.

We have a lot of cases, make them explicit:

(1) build and sign debugserver, if all conditions apply:

  • LLDB_NO_DEBUGSERVER=OFF (default)
  • On Darwin: LLDB_USE_SYSTEM_DEBUGSERVER=OFF (default)
  • On Darwin: LLVM_CODESIGNING_IDENTITY == lldb_codesign

(2) use system debugserver, if on Darwin and any of:

  • LLDB_USE_SYSTEM_DEBUGSERVER=ON and found on system (explicit case)
  • LLVM_CODESIGNING_IDENTITY != lldb_codesign and found on system (fallback case)

(3) debugserver will not be available, in case of:

  • LLDB_NO_DEBUGSERVER=ON
  • On Darwin: LLVM_CODESIGNING_IDENTITY != lldb_codesign and not found on system

(4) error state, in case of:

  • LLDB_USE_SYSTEM_DEBUGSERVER=ON and not found on system
  • LLDB_USE_SYSTEM_DEBUGSERVER=ON and LLDB_NO_DEBUGSERVER=ON

Event Timeline

sgraenitz created this revision.Nov 28 2018, 10:36 AM

Fix target directory for debugserver: it must not be LLVM_TOOLS_BINARY_DIR but LLVM_RUNTIME_OUTPUT_INTDIR. It's a difference in standalone builds of LLDB. LLVM_TOOLS_BINARY_DIR was wrong here as it points to the binary directory in the detached LLVM build tree. It should make no difference for in-tree builds.

The default identity for code signing must be lldb_codesign. Also remove the comment to deprecate LLDB_CODESIGN_IDENTITY in favor of LLVM_CODESIGNING_IDENTITY.

Move code sign settings to LLDBConfig.cmake + polishing

sgraenitz abandoned this revision.Nov 28 2018, 11:27 AM