[lld] 070af48 - [lld-macho][nfc] Decouple tapi-link.s test from libSystem
Jez Ng via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 3 16:49:07 PST 2022
Author: Jez Ng
Date: 2022-03-03T19:48:59-05:00
New Revision: 070af48d13713493b43661515101bad532146d24
URL: https://github.com/llvm/llvm-project/commit/070af48d13713493b43661515101bad532146d24
DIFF: https://github.com/llvm/llvm-project/commit/070af48d13713493b43661515101bad532146d24.diff
LOG: [lld-macho][nfc] Decouple tapi-link.s test from libSystem
If we fix https://github.com/llvm/llvm-project/issues/54184, we will end
up including libSystem in every %lld invocation, which would break
tapi-link.s as it assumes that libSystem isn't directly linked (instead
it goes through libReexportSystem).
Let's remove this unnecessary coupling, as well as use `split-file`
instead of having a separate file under `Inputs`.
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D120939
Added:
Modified:
lld/test/MachO/tapi-link.s
Removed:
lld/test/MachO/Inputs/libReexportSystem.tbd
################################################################################
diff --git a/lld/test/MachO/Inputs/libReexportSystem.tbd b/lld/test/MachO/Inputs/libReexportSystem.tbd
deleted file mode 100644
index dd857493f441d..0000000000000
--- a/lld/test/MachO/Inputs/libReexportSystem.tbd
+++ /dev/null
@@ -1,9 +0,0 @@
---- !tapi-tbd-v3
-archs: [ i386, x86_64 ]
-uuids: [ 'i386: 00000000-0000-0000-0000-000000000000', 'x86_64: 00000000-0000-0000-0000-000000000001' ]
-platform: macosx
-install-name: '/usr/lib/libReexportSystem.dylib'
-exports:
- - archs: [ i386, x86_64 ]
- re-exports: [ '/usr/lib/libSystem.dylib' ]
-...
diff --git a/lld/test/MachO/tapi-link.s b/lld/test/MachO/tapi-link.s
index e46871a5b271d..2a09eee17bbf6 100644
--- a/lld/test/MachO/tapi-link.s
+++ b/lld/test/MachO/tapi-link.s
@@ -7,17 +7,13 @@
# RUN: %lld -o %t/test -lSystem -lc++ -framework CoreFoundation %t/libNested.tbd %t/test.o
# RUN: llvm-objdump --bind --no-show-raw-insn -d -r %t/test | FileCheck %s
-## libReexportSystem.tbd tests that we can reference symbols from a dylib,
-## re-exported by a top-level tapi document, which itself is re-exported by
-## another top-level tapi document.
-# RUN: %lld -o %t/with-reexport %S/Inputs/libReexportSystem.tbd -lc++ -framework CoreFoundation %t/libNested.tbd %t/test.o
+## libReexportSystem.tbd tests that we can reference symbols from a 2nd-level
+## tapi document, re-exported by a top-level tapi document, which itself is
+## re-exported by another top-level tapi document.
+# RUN: %lld -o %t/with-reexport -lSystem -L%t %t/libReexportNested.tbd -lc++ -framework CoreFoundation %t/test.o
# RUN: llvm-objdump --bind --no-show-raw-insn -d -r %t/with-reexport | FileCheck %s
-# CHECK: Disassembly of section __TEXT,__text:
-# CHECK: movq {{.*}} ## 0x[[ADDR:[0-9a-f]+]]
-
# CHECK: Bind table:
-# CHECK-DAG: __DATA_CONST __got 0x[[ADDR]] pointer 0 libSystem ___nan
# CHECK-DAG: __DATA __data {{.*}} pointer 0 CoreFoundation _OBJC_CLASS_$_NSObject
# CHECK-DAG: __DATA __data {{.*}} pointer 0 CoreFoundation _OBJC_METACLASS_$_NSObject
# CHECK-DAG: __DATA __data {{.*}} pointer 0 CoreFoundation _OBJC_IVAR_$_NSConstantArray._count
@@ -28,14 +24,7 @@
# RUN: llvm-otool -l %t/test | FileCheck --check-prefix=LOAD %s
# RUN: llvm-otool -l %t/with-reexport | \
-# RUN: FileCheck --check-prefixes=LOAD-REEXPORT,LOAD %s
-
-# LOAD-REEXPORT: cmd LC_LOAD_DYLIB
-# LOAD-REEXPORT-NEXT: cmdsize
-# LOAD-REEXPORT-NEXT: name /usr/lib/libReexportSystem.dylib
-# LOAD-REEXPORT-NEXT: time stamp
-# LOAD-REEXPORT-NEXT: current version 1.0.0
-# LOAD-REEXPORT-NEXT: compatibility version
+# RUN: FileCheck --check-prefixes=LOAD,LOAD-REEXPORT %s
# LOAD: cmd LC_LOAD_DYLIB
# LOAD-NEXT: cmdsize
@@ -44,13 +33,18 @@
# LOAD-NEXT: current version 1.1.1
# LOAD-NEXT: compatibility version
+# LOAD-REEXPORT: cmd LC_LOAD_DYLIB
+# LOAD-REEXPORT-NEXT: cmdsize
+# LOAD-REEXPORT-NEXT: name /usr/lib/libReexportNested.dylib
+# LOAD-REEXPORT-NEXT: time stamp
+# LOAD-REEXPORT-NEXT: current version 1.0.0
+# LOAD-REEXPORT-NEXT: compatibility version
+
#--- test.s
.section __TEXT,__text
.global _main
_main:
-## This symbol is defined in an inner TAPI document within libSystem.tbd.
- movq ___nan at GOTPCREL(%rip), %rax
ret
.data
@@ -58,6 +52,7 @@ _main:
.quad _OBJC_METACLASS_$_NSObject
.quad _OBJC_IVAR_$_NSConstantArray._count
.quad _OBJC_EHTYPE_$_NSException
+## This symbol is defined in an inner TAPI document within libNested.tbd.
.quad _deeply_nested
## This symbol is defined in libc++abi.tbd, but we are linking test.o against
@@ -94,3 +89,14 @@ exports:
- archs: [ x86_64 ]
symbols: [ _deeply_nested ]
...
+
+#--- libReexportNested.tbd
+--- !tapi-tbd-v3
+archs: [ i386, x86_64 ]
+uuids: [ 'i386: 00000000-0000-0000-0000-000000000000', 'x86_64: 00000000-0000-0000-0000-000000000001' ]
+platform: macosx
+install-name: '/usr/lib/libReexportNested.dylib'
+exports:
+ - archs: [ i386, x86_64 ]
+ re-exports: [ 'libNested.dylib' ]
+...
More information about the llvm-commits
mailing list