3 # RUN: rm -rf %t; split-file %s %t
4 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/2.s -o %t/2.o
5 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/3.s -o %t/3.o
6 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/main.s -o %t/main.o
8 # RUN: %lld -lSystem -dylib -install_name %t/my_lib.dylib -o %t/mylib.dylib %t/2.o
9 # RUN: %lld -lSystem %t/2.o %t/main.o -o %t/main
10 # RUN: %lld -lSystem -bundle -bundle_loader %t/main -o %t/bundle.bundle %t/3.o %t/mylib.dylib
11 ## Check bundle.bundle to ensure the `my_func` symbol is from executable
12 # RUN: llvm-nm -m %t/bundle.bundle | FileCheck %s --check-prefix BUNDLE
13 # BUNDLE: (undefined) external my_func (from executable)
14 # RUN: llvm-objdump --macho --lazy-bind %t/bundle.bundle | FileCheck %s --check-prefix BUNDLE-OBJ
15 # BUNDLE-OBJ: segment section address dylib symbol
16 # BUNDLE-OBJ: __DATA __la_symbol_ptr 0x{{[0-9a-f]*}} main-executable my_fun
18 # RUN: %lld -lSystem -bundle -bundle_loader %t/main -o %t/bundle2.bundle %t/3.o %t/2.o
19 ## Check bundle.bundle to ensure the `my_func` symbol is not from executable
20 # RUN: llvm-nm -m %t/bundle2.bundle | FileCheck %s --check-prefix BUNDLE2
21 # BUNDLE2: (__TEXT,__text) external my_func
23 # Test that bundle_loader can only be used with MachO bundle output.
24 # RUN: not %lld -lSystem -bundle_loader %t/main -o %t/bundle3.bundle 2>&1 | FileCheck %s --check-prefix ERROR
25 # ERROR: -bundle_loader can only be used with MachO bundle output
28 # my_lib: This contains the exported function
34 # my_user.s: This is the user/caller of the
42 # main.s: dummy exec/main loads the exported function.
43 # This is basically a way to say `my_user` should get
44 # `my_func` from this executable.