[PATCH] D92274: [lld/mac] Add --reproduce option

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 28 19:45:08 PST 2020


thakis created this revision.
thakis added a reviewer: int3.
Herald added a reviewer: MaskRay.
Herald added a subscriber: dang.
thakis requested review of this revision.

This adds support for ld.lld's --reproduce / lld-link's /reproduce:
flag to the MachO port. This flag can be added to a link command
to make the link write a tar file containing all inputs to the link
and a response file containing the link command. This can be used
to reproduce the link on another machine, which is useful for sharing
bug report inputs or performance test loads.

Since the linker is usually called through the clang driver and
adding linker flags can be a bit cumbersome, setting the env var
`LLD_REPRODUCE=foo.tar` triggers the feature as well.

The file response.txt in the archive can be used with
`ld64.lld.darwinnew $(cat response.txt)` as long as the contents are
smaller than the command-line limit, or with `ld64.lld.darwinnew
@response.txt` once D92149 <https://reviews.llvm.org/D92149> is in.

The support in this patch is sufficient to create a tar file for
Chromium's base_unittests that can link after unpacking on a different
machine.


https://reviews.llvm.org/D92274

Files:
  lld/Common/Reproduce.cpp
  lld/MachO/Driver.cpp
  lld/MachO/Driver.h
  lld/MachO/DriverUtils.cpp
  lld/MachO/InputFiles.cpp
  lld/MachO/InputFiles.h
  lld/MachO/Options.td
  lld/test/MachO/reproduce.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92274.308197.patch
Type: text/x-patch
Size: 9231 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201129/f5d90258/attachment-0001.bin>


More information about the llvm-commits mailing list