xref: /llvm-project/lld/test/MachO/framework.s (revision bbe6f51b726f9d4265df4407736772dd68ac6f98)
1# REQUIRES: x86, shell
2# RUN: rm -rf %t; split-file %s %t
3# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/foo.s -o %t/foo.o
4# RUN: mkdir -p %t/Foo.framework/Versions/A
5# RUN: %lld -dylib -install_name %t/Foo.framework/Versions/A/Foo %t/foo.o -o %t/Foo.framework/Versions/A/Foo
6# RUN: %lld -dylib -install_name %t/Foo.framework/Versions/A/Foobar %t/foo.o -o %t/Foo.framework/Versions/A/Foobar
7# RUN: ln -sf A %t/Foo.framework/Versions/Current
8# RUN: ln -sf Versions/Current/Foo %t/Foo.framework/Foo
9
10# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o
11# RUN: %lld -lSystem -F%t -framework Foo %t/test.o -o %t/test
12# RUN: llvm-objdump --macho --lazy-bind %t/test | FileCheck %s --check-prefix=NOSUFFIX
13# NOSUFFIX: __DATA __la_symbol_ptr 0x{{[0-9a-f]*}} {{.*}}Foo _foo
14
15# RUN: %lld -lSystem -F%t -framework Foo,baz %t/test.o -o %t/test-wrong-suffix
16# RUN: llvm-objdump --macho --lazy-bind %t/test-wrong-suffix | FileCheck %s --check-prefix=NOSUFFIX
17
18# RUN: %lld -lSystem -F%t -framework Foo,bar %t/test.o -o %t/test-suffix
19# RUN: llvm-objdump --macho --lazy-bind %t/test-suffix | FileCheck %s --check-prefix=SUFFIX
20# SUFFIX: __DATA __la_symbol_ptr 0x{{[0-9a-f]*}} {{.*}}Foobar _foo
21
22#--- foo.s
23.globl _foo
24_foo:
25  ret
26
27#--- test.s
28.globl _main
29.text
30_main:
31  sub $8, %rsp # 16-byte-align the stack; dyld checks for this
32  callq _foo
33  mov $0, %rax
34  add $8, %rsp
35  ret
36