[lld] 5b8db12 - [ELF] Rewriting the path of sample profile file for --reproduce response.txt

Hongtao Yu via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 9 00:01:04 PST 2021


Author: Hongtao Yu
Date: 2021-02-09T00:00:16-08:00
New Revision: 5b8db127a30f583c5437579c8a9412d07745f2b1

URL: https://github.com/llvm/llvm-project/commit/5b8db127a30f583c5437579c8a9412d07745f2b1
DIFF: https://github.com/llvm/llvm-project/commit/5b8db127a30f583c5437579c8a9412d07745f2b1.diff

LOG: [ELF] Rewriting the path of sample profile file for --reproduce response.txt

Rewritting the path of the sample profile file in response.txt to be relative to the repro tar.

Reviewed By: MaskRay

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

Added: 
    

Modified: 
    lld/ELF/DriverUtils.cpp
    lld/test/ELF/reproduce-lto.s

Removed: 
    


################################################################################
diff  --git a/lld/ELF/DriverUtils.cpp b/lld/ELF/DriverUtils.cpp
index fd649808c060..a3fc522c708c 100644
--- a/lld/ELF/DriverUtils.cpp
+++ b/lld/ELF/DriverUtils.cpp
@@ -186,6 +186,9 @@ std::string elf::createResponseFile(const opt::InputArgList &args) {
       // Strip directories to prevent the issue.
       os << "-o " << quote(path::filename(arg->getValue())) << "\n";
       break;
+    case OPT_lto_sample_profile:
+      os << arg->getSpelling() << quote(rewritePath(arg->getValue())) << "\n";
+      break;
     case OPT_call_graph_ordering_file:
     case OPT_dynamic_list:
     case OPT_just_symbols:

diff  --git a/lld/test/ELF/reproduce-lto.s b/lld/test/ELF/reproduce-lto.s
index 36838f21388e..2e673fdcc32c 100644
--- a/lld/test/ELF/reproduce-lto.s
+++ b/lld/test/ELF/reproduce-lto.s
@@ -10,8 +10,13 @@
 # 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 --implicit-check-not={{.}}
+# RUN: tar xvf repro1.tar &> %t2
+# RUN: cat repro1/response.txt >> %t2
+# RUN: FileCheck %s --check-prefix=RSP < %t2
 
 # CHECK-DAG: {{.*}} repro1/{{.*}}/empty_profile.txt
 # CHECK-DAG: {{.*}} repro1/response.txt
 # CHECK-DAG: {{.*}} repro1/version.txt
 # CHECK-DAG: {{.*}} repro1/{{.*}}/foo.o
+# RSP:       repro1/[[PATH:.*]]/empty_profile.txt
+# RSP:       --lto-sample-profile=[[PATH]]/empty_profile.txt


        


More information about the llvm-commits mailing list