[lld] dde41c6 - [ELF] --reproduce: strip directories for --print-archive-stats= and --why-extract=
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 1 22:06:52 PDT 2022
Author: Fangrui Song
Date: 2022-08-01T22:06:46-07:00
New Revision: dde41c6c560b67165c7ac884815cd50fdce446f8
URL: https://github.com/llvm/llvm-project/commit/dde41c6c560b67165c7ac884815cd50fdce446f8
DIFF: https://github.com/llvm/llvm-project/commit/dde41c6c560b67165c7ac884815cd50fdce446f8.diff
LOG: [ELF] --reproduce: strip directories for --print-archive-stats= and --why-extract=
Similar to -o and -Map.
Added:
Modified:
lld/ELF/DriverUtils.cpp
lld/test/ELF/reproduce.s
Removed:
################################################################################
diff --git a/lld/ELF/DriverUtils.cpp b/lld/ELF/DriverUtils.cpp
index 150755f38181e..42ab5c0e526f7 100644
--- a/lld/ELF/DriverUtils.cpp
+++ b/lld/ELF/DriverUtils.cpp
@@ -170,12 +170,16 @@ std::string elf::createResponseFile(const opt::InputArgList &args) {
break;
case OPT_o:
case OPT_Map:
+ case OPT_print_archive_stats:
+ case OPT_why_extract:
// 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 << arg->getSpelling() << ' ' << quote(path::filename(arg->getValue()))
- << "\n";
+ os << arg->getSpelling();
+ if (arg->getOption().getRenderStyle() == opt::Option::RenderSeparateStyle)
+ os << ' ';
+ os << quote(path::filename(arg->getValue())) << '\n';
break;
case OPT_lto_sample_profile:
os << arg->getSpelling() << quote(rewritePath(arg->getValue())) << "\n";
diff --git a/lld/test/ELF/reproduce.s b/lld/test/ELF/reproduce.s
index 4a0fe0328e9a4..314c08b4f7cdd 100644
--- a/lld/test/ELF/reproduce.s
+++ b/lld/test/ELF/reproduce.s
@@ -74,10 +74,13 @@
## 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 -Map build4/a/b/c/map -shared --as-needed --reproduce=repro4.tar
+# RUN: ld.lld build1/foo.o -o build4/a/b/c/bar -Map build4/map --print-archive-stats=build4/stats \
+# RUN: --why-extract=build4/why -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
+# RSP4-NEXT: -Map map
+# RSP4-NEXT: --print-archive-stats=stats
+# RSP4-NEXT: --why-extract=why
.globl _start
_start:
More information about the llvm-commits
mailing list