[PATCH] D84718: [lld-macho] Make __LINKEDIT sections contiguous

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 27 18:11:33 PDT 2020


int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

codesign (or more specifically libstuff) checks that each section in
__LINKEDIT ends where the next one starts -- no gaps are permitted. This
diff achieves it by aligning every section's start and end points to
WordSize.

Remarks: ld64 appears to satisfy the constraint by adding padding bytes
when generating the __LINKEDIT data, e.g. by emitting BIND_OPCODE_DONE
(which is a 0x0 byte) repeatedly. I think the approach this diff takes
is a bit more elegant, but I'm not sure if it's too restrictive. In
particular, it assumes padding always uses the zero byte. But we can
revisit this later.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84718

Files:
  lld/MachO/SyntheticSections.cpp
  lld/MachO/SyntheticSections.h
  lld/MachO/Writer.cpp
  lld/test/MachO/linkedit-contiguity.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84718.281094.patch
Type: text/x-patch
Size: 7424 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200728/1a2bd6d0/attachment.bin>


More information about the llvm-commits mailing list