2 ; RUN: rm -rf %t; split-file %s %t
4 ; RUN: llc -filetype=obj %t/q.ll -o %t/q.o
5 ; RUN: llvm-ar cru %t/libq.a %t/q.o
7 ; RUN: llc -filetype=obj %t/f.ll -o %t/f.nolto.o
8 ; RUN: opt --thinlto-bc %t/f.ll -o %t/f.thinlto.o
9 ; RUN: opt %t/f.ll -o %t/f.lto.o
11 ; RUN: llc -filetype=obj %t/b.ll -o %t/b.nolto.o
12 ; RUN: opt --thinlto-bc %t/b.ll -o %t/b.thinlto.o
13 ; RUN: opt %t/b.ll -o %t/b.lto.o
16 ; RUN: %lld -dylib -lSystem -L%t %t/f.nolto.o %t/b.nolto.o -o %t/nolto-nolto.out
17 ; RUN: llvm-objdump --syms %t/nolto-nolto.out | FileCheck %s
20 ; RUN: %lld -dylib -lSystem -L%t %t/f.nolto.o %t/b.thinlto.o -o %t/nolto-thinlto.out
21 ; RUN: llvm-objdump --syms %t/nolto-thinlto.out | FileCheck %s
24 ; RUN: %lld -dylib -lSystem -L%t %t/f.thinlto.o %t/b.nolto.o -o %t/thinlto-nolto.out
25 ; RUN: llvm-objdump --syms %t/thinlto-nolto.out | FileCheck %s
28 ; RUN: %lld -dylib -lSystem -L%t %t/f.nolto.o %t/b.lto.o -o %t/nolto-lto.out
29 ; RUN: llvm-objdump --syms %t/nolto-lto.out | FileCheck %s
32 ; RUN: %lld -dylib -lSystem -L%t %t/f.lto.o %t/b.nolto.o -o %t/lto-nolto.out
33 ; RUN: llvm-objdump --syms %t/lto-nolto.out | FileCheck %s
36 ; RUN: %lld -dylib -lSystem -L%t %t/f.lto.o %t/b.thinlto.o -o %t/lto-thinlto.out
37 ; RUN: llvm-objdump --syms %t/lto-thinlto.out | FileCheck %s
40 ; RUN: %lld -dylib -lSystem -L%t %t/f.thinlto.o %t/b.lto.o -o %t/thinlto-lto.out
41 ; RUN: llvm-objdump --syms %t/thinlto-lto.out | FileCheck %s
43 ; We expect to resolve _weak1 from f.ll and _weak2 from b.ll as per the input order.
44 ; As _weak2 from q.ll pulled in via LC_LINKER_OPTION is processed
45 ; in the second pass, it won't prevail due to _weak2 from b.ll.
47 ; CHECK: w O __TEXT,f _weak1
48 ; CHECK: w O __TEXT,b _weak2
51 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
52 target triple = "x86_64-apple-macosx10.15.0"
54 define i32 @weak2() section "__TEXT,q" {
59 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
60 target triple = "x86_64-apple-macosx10.15.0"
63 !llvm.linker.options = !{!0}
65 define weak i32 @weak1() section "__TEXT,f" {
66 %call = call i32 @weak2()
67 %add = add nsw i32 %call, 1
71 declare i32 @weak2(...)
74 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
75 target triple = "x86_64-apple-macosx10.15.0"
77 define weak i32 @weak1() section "__TEXT,b" {
81 define weak i32 @weak2() section "__TEXT,b" {