2 ; RUN: rm -rf %t; split-file %s %t
3 ; RUN: llc -filetype=obj %t/foo1.ll -o %t/foo1.o
4 ; RUN: llc -filetype=obj %t/foo2.ll -o %t/foo2.o
5 ; RUN: llvm-ar rcs %t/libfoo2.a %t/foo2.o
6 ; RUN: llc -filetype=obj %t/foo3.ll -o %t/foo3.o
7 ; RUN: llvm-ar rcs %t/libfoo3.a %t/foo3.o
9 ; RUN: llc -filetype=obj %t/zoo2.ll -o %t/zoo2.o
10 ; RUN: llvm-ar rcs %t/libzoo2.a %t/zoo2.o
11 ; RUN: llc -filetype=obj %t/zoo3.ll -o %t/zoo3.o
12 ; RUN: llvm-ar rcs %t/libzoo3.a %t/zoo3.o
14 ; RUN: llc -filetype=obj %t/bar1.ll -o %t/bar1.o
15 ; RUN: llc -filetype=obj %t/bar2.ll -o %t/bar2.o
16 ; RUN: llvm-ar rcs %t/libbar2.a %t/bar2.o
17 ; RUN: llc -filetype=obj %t/bar3.ll -o %t/bar3.o
18 ; RUN: llvm-ar rcs %t/libbar3.a %t/bar3.o
20 ; RUN: %lld -dylib -lSystem -L%t %t/foo1.o %t/bar1.o -o %t/order.out
21 ; RUN: llvm-objdump --no-leading-addr --no-show-raw-insn -d %t/order.out | FileCheck %s
23 ; We want to process input object files first
24 ; before any lc-linker options are actually resolved.
25 ; The lc-linker options are recursively processed.
27 ; The following shows a chain of auto linker options,
28 ; starting with foo1.o and bar1.o:
30 ; foo1.o -> libfoo2.a(foo2.o) -> libfoo3.a(foo3.o)
32 ; -> libzoo2.a(zoo2.o) -> libzoo3.a(zoo3.o)
33 ; bar1.o -> libbar2.a(bar2.o) -> libbar3.a(bar3.o)
45 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
46 target triple = "x86_64-apple-macosx10.15.0"
50 !llvm.linker.options = !{!0, !1}
53 %call = call i32 @foo2()
54 %call2 = call i32 @zoo2()
55 %add = add nsw i32 %call, %call2
63 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
64 target triple = "x86_64-apple-macosx10.15.0"
67 !llvm.linker.options = !{!0}
70 %call = call i32 @foo3()
71 %add = add nsw i32 %call, 2
78 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
79 target triple = "x86_64-apple-macosx10.15.0"
86 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
87 target triple = "x86_64-apple-macosx10.15.0"
90 !llvm.linker.options = !{!0}
93 %call = call i32 @zoo3()
94 %add = add nsw i32 %call, 2
101 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
102 target triple = "x86_64-apple-macosx10.15.0"
109 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
110 target triple = "x86_64-apple-macosx10.15.0"
113 !llvm.linker.options = !{!0}
116 %call = call i32 @bar2()
117 %add = add nsw i32 %call, 10
124 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
125 target triple = "x86_64-apple-macosx10.15.0"
128 !llvm.linker.options = !{!0}
131 %call = call i32 @bar3()
132 %add = add nsw i32 %call, 200
139 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
140 target triple = "x86_64-apple-macosx10.15.0"