[PATCH] D82437: [ELF] Add --dependency-file option

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 24 01:02:13 PDT 2020


phosek created this revision.
phosek added reviewers: ruiu, MaskRay.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
phosek added a comment.
phosek updated this revision to Diff 272925.

This is an updated version of D65430 <https://reviews.llvm.org/D65430> which matches the feature implemented by ld and gold in https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=f37b21b481a7804a13c5806098c19b6119288ba4. I'm happy to abandon this change in favor of D65430 <https://reviews.llvm.org/D65430> if @ruiu wants to go ahead with his change.


Clang and GCC have a feature (-MD flag) to create a dependency file
in a format that build systems such as Make or Ninja can read, which
specifies all the additional inputs such .h files.

This change introduces the same functionality to lld bringing it to
feature parity with ld and gold which gained this feature recently.
With this change, you can emit the dependency file from the linker
by --dependency-file=<path> to lld.

The implementation corresponds to -MD -MP compiler flag where the
generated dependency file also includes phony targets which works
around the errors where the dependency is removed. This matches the
format used by ld and gold.

Fixes PR42806


https://reviews.llvm.org/D82437

Files:
  lld/ELF/Config.h
  lld/ELF/Driver.cpp
  lld/ELF/InputFiles.cpp
  lld/ELF/Options.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82437.272925.patch
Type: text/x-patch
Size: 5495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200624/72d90bbe/attachment-0001.bin>


More information about the llvm-commits mailing list