HomePhabricator

[ELF] Add --dependency-file option

Authored by phosek on Jun 23 2020, 8:00 PM.

Description

[ELF] Add --dependency-file option

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.
See https://sourceware.org/bugzilla/show_bug.cgi?id=22843 for more
details and discussion.

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

Differential Revision: https://reviews.llvm.org/D82437

Details

Committed
phosekAug 3 2020, 4:59 PM
Differential Revision
D82437: [ELF] Add --dependency-file option
Parents
rG1beb00db1f51: Fix use-after-scope in 7209f83112db caught by the sanitizer bots
Branches
Unknown
Tags
Unknown