1# REQUIRES: x86 2 3# RUN: split-file %s %t --no-leading-lines 4 5# RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %t/test.s -o %t/test.o 6 7# RUN: %lld -o %t/test -lSystem -lc++ -framework CoreFoundation %t/libNested.tbd %t/test.o 8# RUN: llvm-objdump --bind --no-show-raw-insn -d -r %t/test | FileCheck %s 9 10## libReexportSystem.tbd tests that we can reference symbols from a dylib, 11## re-exported by a top-level tapi document, which itself is re-exported by 12## another top-level tapi document. 13# RUN: %lld -o %t/with-reexport %S/Inputs/libReexportSystem.tbd -lc++ -framework CoreFoundation %t/libNested.tbd %t/test.o 14# RUN: llvm-objdump --bind --no-show-raw-insn -d -r %t/with-reexport | FileCheck %s 15 16# CHECK: Disassembly of section __TEXT,__text: 17# CHECK: movq {{.*}} ## 0x[[ADDR:[0-9a-f]+]] 18 19# CHECK: Bind table: 20# CHECK-DAG: __DATA_CONST __got 0x[[ADDR]] pointer 0 libSystem ___nan 21# CHECK-DAG: __DATA __data {{.*}} pointer 0 CoreFoundation _OBJC_CLASS_$_NSObject 22# CHECK-DAG: __DATA __data {{.*}} pointer 0 CoreFoundation _OBJC_METACLASS_$_NSObject 23# CHECK-DAG: __DATA __data {{.*}} pointer 0 CoreFoundation _OBJC_IVAR_$_NSConstantArray._count 24# CHECK-DAG: __DATA __data {{.*}} pointer 0 CoreFoundation _OBJC_EHTYPE_$_NSException 25# CHECK-DAG: __DATA __data {{.*}} pointer 0 libc++abi ___gxx_personality_v0 26# CHECK-DAG: __DATA __data {{.*}} pointer 0 libNested3 _deeply_nested 27 28# RUN: llvm-otool -l %t/test | FileCheck --check-prefix=LOAD %s 29 30# RUN: llvm-otool -l %t/with-reexport | \ 31# RUN: FileCheck --check-prefixes=LOAD-REEXPORT,LOAD %s 32 33# LOAD-REEXPORT: cmd LC_LOAD_DYLIB 34# LOAD-REEXPORT-NEXT: cmdsize 35# LOAD-REEXPORT-NEXT: name /usr/lib/libReexportSystem.dylib 36# LOAD-REEXPORT-NEXT: time stamp 37# LOAD-REEXPORT-NEXT: current version 1.0.0 38# LOAD-REEXPORT-NEXT: compatibility version 39 40# LOAD: cmd LC_LOAD_DYLIB 41# LOAD-NEXT: cmdsize 42# LOAD-NEXT: name /usr/lib/libSystem.dylib 43# LOAD-NEXT: time stamp 44# LOAD-NEXT: current version 1.1.1 45# LOAD-NEXT: compatibility version 46 47#--- test.s 48.section __TEXT,__text 49.global _main 50 51_main: 52## This symbol is defined in an inner TAPI document within libSystem.tbd. 53 movq ___nan@GOTPCREL(%rip), %rax 54 ret 55 56.data 57 .quad _OBJC_CLASS_$_NSObject 58 .quad _OBJC_METACLASS_$_NSObject 59 .quad _OBJC_IVAR_$_NSConstantArray._count 60 .quad _OBJC_EHTYPE_$_NSException 61 .quad _deeply_nested 62 63## This symbol is defined in libc++abi.tbd, but we are linking test.o against 64## libc++.tbd (which re-exports libc++abi). Linking against this symbol verifies 65## that .tbd file re-exports can refer not just to TAPI documents within the 66## same .tbd file, but to other on-disk files as well. 67 .quad ___gxx_personality_v0 68 69## This tests that we can locate a symbol re-exported by a child of a TAPI 70## document. 71#--- libNested.tbd 72--- !tapi-tbd-v3 73archs: [ x86_64 ] 74uuids: [ 'x86_64: 00000000-0000-0000-0000-000000000000' ] 75platform: macosx 76install-name: '/usr/lib/libNested.dylib' 77exports: 78 - archs: [ x86_64 ] 79 re-exports: [ '/usr/lib/libNested2.dylib' ] 80--- !tapi-tbd-v3 81archs: [ x86_64 ] 82uuids: [ 'x86_64: 00000000-0000-0000-0000-000000000001' ] 83platform: macosx 84install-name: '/usr/lib/libNested2.dylib' 85exports: 86 - archs: [ x86_64 ] 87 re-exports: [ '/usr/lib/libNested3.dylib' ] 88--- !tapi-tbd-v3 89archs: [ x86_64 ] 90uuids: [ 'x86_64: 00000000-0000-0000-0000-000000000002' ] 91platform: macosx 92install-name: '/usr/lib/libNested3.dylib' 93exports: 94 - archs: [ x86_64 ] 95 symbols: [ _deeply_nested ] 96... 97