[PATCH] D89418: [lld-macho] Implement LC_UUID

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 14 12:24:47 PDT 2020


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

Apple devtools use this to locate the dSYM files for a given
binary.

The UUID is computed based on an MD5 hash of the binary's contents. In order to
hash the contents, we must first write them, but LC_UUID itself must be part of
the written contents in order for all the offsets to be calculated correctly.
We resolve this circular paradox by first writing an LC_UUID with an all-zero
UUID, then updating the UUID with its real value later.

I'm not sure there's a good way to test that the value of the UUID is
"as expected", so I've just checked that it's present.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89418

Files:
  lld/MachO/Writer.cpp
  lld/test/MachO/headerpad.s
  lld/test/MachO/load-commands.s
  lld/test/MachO/local-got.s
  lld/test/MachO/relocations.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89418.298212.patch
Type: text/x-patch
Size: 7106 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201014/fe7b9554/attachment.bin>


More information about the llvm-commits mailing list