[PATCH] D109803: Extract LC_CODE_SIGNATURE related implementation out of LLD

Nuri Amari via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 15 15:55:33 PDT 2021


nuriamari added inline comments.


================
Comment at: lld/MachO/SyntheticSections.cpp:1149
     : LinkEditSection(segment_names::linkEdit, section_names::codeSignature) {
-  align = 16; // required by libstuff
+  align = object::CodeSignatureSection::Align; // required by libstuff
   // FIXME: Consider using finalOutput instead of outputFile.
----------------
thevinster wrote:
> Any specific reason for not namespacing object? :)
If I namespace object, there is a collision between the `CodeSignatureSection` defined in `SyntheticSections.h` and the desired definition in `MachO.h`.


================
Comment at: lld/MachO/SyntheticSections.cpp:1169
 
 void CodeSignatureSection::writeTo(uint8_t *buf) const {
+  // The entire code section including header is written
----------------
thevinster wrote:
> It seems redundant to have both writeTo and writeHashes now that it's combined. Comment makes since in the context of this diff but it doesn't make too much sense outside of the context unless people are referring to this diff. Personally, I would rename all places that were using writeHashes to writeTo and get rid of writeHashes completely from this class (unless there other issues preventing this)
The base class requires `writeTo` to be defined and writeTo can't cleanly be used to write the hashes since they can only be written once everything else in the binary is written.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109803/new/

https://reviews.llvm.org/D109803



More information about the llvm-commits mailing list