Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
5 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# REQUIRES: x86 | ||
# RUN: mkdir -p %t | ||
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t/foo.o | ||
# RUN: llvm-mc -filetype=obj -triple=x86_64 /dev/null -o "%t/bar baz.o" | ||
# RUN: llvm-mc -filetype=obj -triple=x86_64 /dev/null -o "%t/#quux$.o" | ||
# RUN: ld.lld -o %t/foo.exe %t/foo.o %t/"bar baz.o" "%t/#quux$.o" --dependency-file=%t/foo.d | ||
# RUN: FileCheck --match-full-lines -DFILE=%t %s < %t/foo.d | ||
|
||
# CHECK: [[FILE]]{{/|\\\\}}foo.exe: \ | ||
# CHECK-NEXT: [[FILE]]{{/|\\\\}}foo.o \ | ||
# CHECK-NEXT: [[FILE]]{{/|\\\\}}bar\ baz.o \ | ||
# CHECK-NEXT: [[FILE]]{{/|\\\\}}\#quux$$.o | ||
# CHECK-EMPTY: | ||
# CHECK-NEXT: [[FILE]]{{/|\\\\}}foo.o: | ||
# CHECK-EMPTY: | ||
# CHECK-NEXT: [[FILE]]{{/|\\\\}}bar\ baz.o: | ||
# CHECK-EMPTY: | ||
# CHECK-NEXT: [[FILE]]{{/|\\\\}}\#quux$$.o: | ||
|
||
.global _start | ||
_start: |