[PATCH] D101182: [lld/mac] Support more flags for --reproduce
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 23 09:53:54 PDT 2021
thakis created this revision.
thakis added a reviewer: lld-macho.
Herald added a reviewer: int3.
Herald added a project: lld-macho.
thakis requested review of this revision.
I went through the callers of `readFile()` and `addFile()` in Driver.cpp
and checked that the options that use them all get rewritten in the
--reproduce response file. -(un)exported_symbols_list and -bundle_loader
weren't, so add them.
Also spruce up the test for reproduce a bit and actually try linking
with the exptracted repro archive.
Motivated by the response file in PR50098 complaining abou the
-exported_symbols_list path being wrong :)
https://reviews.llvm.org/D101182
Files:
lld/MachO/DriverUtils.cpp
lld/test/MachO/reproduce.s
Index: lld/test/MachO/reproduce.s
===================================================================
--- lld/test/MachO/reproduce.s
+++ lld/test/MachO/reproduce.s
@@ -3,14 +3,23 @@
# 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: echo '_main' > %t.dir/main.exports
# 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: %lld -platform_version macos 10.10.0 11.0 \
+# RUN: -exported_symbols_list main.exports \
+# RUN: build1/foo.o -o bar --reproduce repro1.tar
-# RUN: tar xf repro1.tar repro1/response.txt repro1/version.txt
+# RUN: tar tf repro1.tar | FileCheck --check-prefix=LIST %s
+# LIST: response.txt
+# LIST: main.exports
+# LIST: foo.o
+
+# RUN: tar xf repro1.tar
+# RUN: cmp build1/foo.o repro1/%:t.dir/build1/foo.o
+# RUN: diff main.exports repro1/%:t.dir/main.exports
# RUN: FileCheck %s --check-prefix=RSP1 < repro1/response.txt
# RSP1: {{^}}-platform_version macos 10.10.0 11.0{{$}}
+# RSP1-NEXT: -exported_symbols_list
# RSP1-NOT: {{^}}repro1{{[/\\]}}
# RSP1-NEXT: {{[/\\]}}foo.o
# RSP1-NEXT: -o bar
@@ -19,19 +28,21 @@
# RUN: FileCheck %s --check-prefix=VERSION < repro1/version.txt
# VERSION: LLD
+# RUN: cd repro1; %lld @response.txt
+
# 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: tar xf repro2.tar
+# RUN: cmp %t.dir/build2/foo.o repro2/%:t.dir/build2/foo.o
# RUN: FileCheck %s --check-prefix=RSP2 < repro2/response.txt
# RSP2-NOT: {{^}}repro2{{[/\\]}}
# RSP2: {{[/\\]}}foo.o
+# RUN: cd repro2; %lld @response.txt
+
.globl _main
_main:
ret
Index: lld/MachO/DriverUtils.cpp
===================================================================
--- lld/MachO/DriverUtils.cpp
+++ lld/MachO/DriverUtils.cpp
@@ -140,12 +140,15 @@
for (StringRef path : args::getLines(*buffer))
os << quote(rewritePath(path)) << "\n";
break;
- case OPT_force_load:
- case OPT_rpath:
- case OPT_syslibroot:
case OPT_F:
case OPT_L:
+ case OPT_bundle_loader:
+ case OPT_exported_symbols_list:
+ case OPT_force_load:
case OPT_order_file:
+ case OPT_rpath:
+ case OPT_syslibroot:
+ case OPT_unexported_symbols_list:
os << arg->getSpelling() << " " << quote(rewritePath(arg->getValue()))
<< "\n";
break;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101182.340090.patch
Type: text/x-patch
Size: 2934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210423/36c4d71c/attachment.bin>
More information about the llvm-commits
mailing list