[PATCH] D130681: [ELF] Strip directories for -Map when emitting reproducer rsp

Alex Brachet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 29 09:18:22 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7baf1db3923c: [ELF] Strip directories for -Map when emitting reproducer rsp (authored by abrachet).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130681/new/

https://reviews.llvm.org/D130681

Files:
  lld/ELF/DriverUtils.cpp
  lld/test/ELF/reproduce.s


Index: lld/test/ELF/reproduce.s
===================================================================
--- lld/test/ELF/reproduce.s
+++ lld/test/ELF/reproduce.s
@@ -74,9 +74,10 @@
 ## Check that directory path is stripped from -o <file-path>
 # RUN: mkdir -p %t.dir/build4/a/b/c
 # RUN: cd %t.dir
-# RUN: ld.lld build1/foo.o -o build4/a/b/c/bar -shared --as-needed --reproduce=repro4.tar
+# RUN: ld.lld build1/foo.o -o build4/a/b/c/bar -Map build4/a/b/c/map -shared --as-needed --reproduce=repro4.tar
 # RUN: tar xOf repro4.tar repro4/response.txt | FileCheck %s --check-prefix=RSP4
 # RSP4: -o bar
+# RSP4: -Map map
 
 .globl _start
 _start:
Index: lld/ELF/DriverUtils.cpp
===================================================================
--- lld/ELF/DriverUtils.cpp
+++ lld/ELF/DriverUtils.cpp
@@ -169,11 +169,13 @@
       os << quote(rewritePath(arg->getValue())) << "\n";
       break;
     case OPT_o:
-      // If -o path contains directories, "lld @response.txt" will likely
-      // fail because the archive we are creating doesn't contain empty
+    case OPT_Map:
+      // If an output path contains directories, "lld @response.txt" will
+      // likely fail because the archive we are creating doesn't contain empty
       // directories for the output path (-o doesn't create directories).
       // Strip directories to prevent the issue.
-      os << "-o " << quote(path::filename(arg->getValue())) << "\n";
+      os << arg->getSpelling() << ' ' << quote(path::filename(arg->getValue()))
+         << "\n";
       break;
     case OPT_lto_sample_profile:
       os << arg->getSpelling() << quote(rewritePath(arg->getValue())) << "\n";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130681.448658.patch
Type: text/x-patch
Size: 1651 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220729/2d5896bf/attachment.bin>


More information about the llvm-commits mailing list