[PATCH] D103643: [lld/mac] Add test coverage for --reproduce + -flat_namespace
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 3 12:30:17 PDT 2021
thakis created this revision.
thakis added a reviewer: lld-macho.
Herald added a reviewer: gkm.
Herald added a project: lld-macho.
thakis requested review of this revision.
Works fine already, now it has a test too.
https://reviews.llvm.org/D103643
Files:
lld/test/MachO/flat-namespace.s
Index: lld/test/MachO/flat-namespace.s
===================================================================
--- lld/test/MachO/flat-namespace.s
+++ lld/test/MachO/flat-namespace.s
@@ -12,10 +12,10 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/main.o %t/main.s
-# With flat_namespace, the linker automatically looks in foo.dylib and
-# bar.dylib too, but it doesn't add a LC_LOAD_DYLIB for it.
-# RUN: %lld -flat_namespace -lSystem %t/main.o %t/baz.dylib -o %t/out -t | \
-# RUN: FileCheck --check-prefix=T %s
+## With flat_namespace, the linker automatically looks in foo.dylib and
+## bar.dylib too, but it doesn't add a LC_LOAD_DYLIB for it.
+# RUN: %lld -flat_namespace -lSystem %t/main.o %t/baz.dylib -o %t/out -t \
+# RUN: --reproduce %t/repro.tar | FileCheck --check-prefix=T %s
## FIXME: The `bar.dylib` line should use `T-NEXT`, but on Windows we load
## libSystem.tbd with different slash styles and end up loading it twice
## for that reason.
@@ -29,6 +29,10 @@
# RUN: | FileCheck --check-prefix=FLAT %s
# RUN: llvm-nm -m %t/out | FileCheck --check-prefix=FLATSYM %s
# RUN: llvm-readobj --syms %t/out | FileCheck --check-prefix=FLATSYM-READOBJ %s
+# RUN: tar -tf %t/repro.tar | FileCheck -DPATH='%:t.dir' --check-prefix=REPRO %s
+# RUN: tar -C %t -xf %t/repro.tar repro/response.txt
+# RUN: FileCheck --implicit-check-not=dylib --check-prefix=RESPONSE %s \
+# RUN: < %t/repro/response.txt
# HEADERBITS-NOT: NOUNDEFS
# HEADERBITS-NOT: TWOLEVEL
@@ -43,15 +47,23 @@
# FLAT-DAG: __DATA __la_symbol_ptr 0x{{[0-9a-f]*}} flat-namespace _baz
# FLAT-DAG: __DATA __la_symbol_ptr 0x{{[0-9a-f]*}} flat-namespace _foo
-# No "(dynamically looked up)" because llvm-nm -m doesn't print that
-# for files without MH_TWOLEVEL for some reason.
+## No "(dynamically looked up)" because llvm-nm -m doesn't print that
+## for files without MH_TWOLEVEL for some reason.
# FLATSYM: (undefined) external _bar
# FLATSYM: (undefined) external _baz
# FLATSYM: (undefined) external _foo
-# ...but `llvm-readobj --syms` does, so verify we put the right thing there.
+## ...but `llvm-readobj --syms` does, so verify we put the right thing there.
# FLATSYM-READOBJ: Flags [ (0xFE00)
+## All 3 .dylibs should be in a --reproduce archive.
+# REPRO: baz.dylib
+# REPRO: bar.dylib
+# REPRO: foo.dylib
+
+## ...but only baz.dylib should be in the response file:
+# RESPONSE: baz.dylib
+
# Undefined symbols should still cause errors by default.
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos \
# RUN: -o %t/main-with-undef.o %t/main-with-undef.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103643.349645.patch
Type: text/x-patch
Size: 2605 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210603/fe8438f2/attachment.bin>
More information about the llvm-commits
mailing list