xref: /llvm-project/lld/test/MachO/t.s (revision 3d5e5066f1af50ea622d136e9543aedae178c8e5)
1# REQUIRES: x86
2# RUN: rm -rf %t; split-file %s %t
3
4# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/foo.o %t/foo.s
5# RUN: %lld -dylib -o %t/libfoo.dylib %t/foo.o
6
7# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/bar.o %t/bar.s
8# RUN: llvm-ar csr  %t/bar.a %t/bar.o
9
10# RUN: llvm-as %t/baz.ll -o %t/baz.o
11
12# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/main.o %t/main.s
13
14# RUN: %lld %t/main.o %t/baz.o %t/bar.a %t/libfoo.dylib -lSystem -o /dev/null -t | FileCheck -DPATH='%t' %s
15
16# CHECK-DAG: bar.a(bar.o)
17# CHECK-DAG: [[PATH]]/main.o
18# CHECK-DAG: [[PATH]]/baz.o
19# CHECK-DAG: [[PATH]]/libfoo.dylib
20# CHECK-DAG: {{.*}}/usr/lib{{[/\\]}}libSystem.tbd
21
22#--- foo.s
23.globl __Z3foo
24__Z3foo:
25  ret
26
27#--- bar.s
28.globl _bar
29_bar:
30  callq __Z3foo
31  ret
32
33#--- baz.ll
34
35target triple = "x86_64-apple-macosx10.15.0"
36target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
37
38define void @baz() {
39  ret void
40}
41
42#--- main.s
43.globl _main
44_main:
45  callq _bar
46  callq __Z3foo
47  callq _baz
48  ret
49