Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 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. Differential Revision: https://reviews.llvm.org/D92274
- Loading branch information
Showing
9 changed files
with
136 additions
and
3 deletions.
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
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,37 @@ | ||
# REQUIRES: x86 | ||
|
||
# RUN: rm -rf %t.dir | ||
# RUN: mkdir -p %t.dir/build1 | ||
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %s -o %t.dir/build1/foo.o | ||
# RUN: cd %t.dir | ||
# RUN: %lld -platform_version macos 10.10.0 11.0 build1/foo.o -o bar --reproduce repro1.tar | ||
# RUN: tar xOf repro1.tar repro1/%:t.dir/build1/foo.o > build1-foo.o | ||
# RUN: cmp build1/foo.o build1-foo.o | ||
|
||
# RUN: tar xf repro1.tar repro1/response.txt repro1/version.txt | ||
# RUN: FileCheck %s --check-prefix=RSP1 < repro1/response.txt | ||
# RSP1: {{^}}-platform_version macos 10.10.0 11.0{{$}} | ||
# RSP1-NOT: {{^}}repro1{{[/\\]}} | ||
# RSP1-NEXT: {{[/\\]}}foo.o | ||
# RSP1-NEXT: -o bar | ||
# RSP1-NOT: --reproduce | ||
|
||
# RUN: FileCheck %s --check-prefix=VERSION < repro1/version.txt | ||
# VERSION: LLD | ||
|
||
# RUN: mkdir -p %t.dir/build2/a/b/c | ||
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %s -o %t.dir/build2/foo.o | ||
# RUN: cd %t.dir/build2/a/b/c | ||
# RUN: echo ./../../../foo.o > %t.dir/build2/filelist | ||
# RUN: env LLD_REPRODUCE=repro2.tar %lld -filelist %t.dir/build2/filelist -o /dev/null | ||
# RUN: tar xOf repro2.tar repro2/%:t.dir/build2/foo.o > build2-foo.o | ||
# RUN: cmp %t.dir/build2/foo.o build2-foo.o | ||
|
||
# RUN: tar xf repro2.tar repro2/response.txt repro2/version.txt | ||
# RUN: FileCheck %s --check-prefix=RSP2 < repro2/response.txt | ||
# RSP2-NOT: {{^}}repro2{{[/\\]}} | ||
# RSP2: {{[/\\]}}foo.o | ||
|
||
.globl _main | ||
_main: | ||
ret |