Skip to content

Commit

Permalink
[ELF] --reproduce should include lto sample profile
Browse files Browse the repository at this point in the history
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D84569
  • Loading branch information
christycylee authored and WenleiHe committed Jul 28, 2020
1 parent 0c64233 commit bd4757c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lld/ELF/Driver.cpp
Expand Up @@ -495,6 +495,9 @@ void LinkerDriver::main(ArrayRef<const char *> argsArr) {
tar = std::move(*errOrWriter);
tar->append("response.txt", createResponseFile(args));
tar->append("version.txt", getLLDVersion() + "\n");
StringRef ltoSampleProfile = args.getLastArgValue(OPT_lto_sample_profile);
if (!ltoSampleProfile.empty())
readFile(ltoSampleProfile);
} else {
error("--reproduce: " + toString(errOrWriter.takeError()));
}
Expand Down
10 changes: 10 additions & 0 deletions lld/test/ELF/reproduce-lto.s
@@ -0,0 +1,10 @@
# REQUIRES: x86

# RUN: rm -rf %t.dir
# RUN: mkdir -p %t.dir/build1
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.dir/build1/foo.o
# RUN: echo > %t.dir/build1/empty_profile.txt
# RUN: cd %t.dir
# RUN: ld.lld build1/foo.o -o /dev/null --reproduce repro1.tar --lto-sample-profile=%t.dir/build1/empty_profile.txt
# RUN: tar tvf repro1.tar | FileCheck %s
# CHECK: repro1/{{.*}}/empty_profile.txt

0 comments on commit bd4757c

Please sign in to comment.