[PATCH] D109972: Regenerate LC_CODE_SIGNATURE during llvm-objcopy operations

Nuri Amari via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 17 09:33:39 PDT 2021


nuriamari created this revision.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a reviewer: rupprecht.
Herald added a reviewer: jhenderson.
Herald added a subscriber: abrachet.
nuriamari updated this revision to Diff 373249.
nuriamari added a comment.
nuriamari added reviewers: int3, drodriguez.
nuriamari published this revision for review.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.

Fix variable name style, clarify CHECK prefix


Prior to this change, if a LC_CODE_SIGNATURE load command
was included in the binary passed to llvm-objcopy, the command and
associated section were simply copied and included verbatim in the
new binary. If rest of the binary was modified at all, this results
in an invalid Mach-O file. This change regenerates the signature
rather than copying it.

The code_signature_lc.test test was modified to include the yaml
representation of a small signed MachO executable in order to
effectively test the signature generation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109972

Files:
  llvm/test/tools/llvm-objcopy/MachO/Inputs/code-signature-check.py
  llvm/test/tools/llvm-objcopy/MachO/code_signature_lc.test
  llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp
  llvm/tools/llvm-objcopy/MachO/MachOLayoutBuilder.h
  llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
  llvm/tools/llvm-objcopy/MachO/MachOReader.cpp
  llvm/tools/llvm-objcopy/MachO/MachOWriter.cpp
  llvm/tools/llvm-objcopy/MachO/MachOWriter.h
  llvm/tools/llvm-objcopy/MachO/Object.cpp
  llvm/tools/llvm-objcopy/MachO/Object.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109972.373249.patch
Type: text/x-patch
Size: 18940 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210917/805a3a37/attachment.bin>


More information about the llvm-commits mailing list