xref: /llvm-project/lld/test/MachO/thinlto-obj-path.ll (revision aa0883b59ae17e5465906dad51b5561b5292a28d)
1*aa0883b5SNico Weber; REQUIRES: x86
2*aa0883b5SNico Weber; RUN: rm -rf %t; split-file %s %t
3*aa0883b5SNico Weber
4*aa0883b5SNico Weber; RUN: opt -module-summary %t/f.ll -o %t1.o
5*aa0883b5SNico Weber; RUN: opt -module-summary %t/g.ll -o %t2.o
6*aa0883b5SNico Weber
7*aa0883b5SNico Weber;; Test to ensure that thinlto-index-only with obj-path creates the file.
8*aa0883b5SNico Weber; RUN: rm -rf %t4
9*aa0883b5SNico Weber; RUN: %lld --thinlto-index-only -object_path_lto %t4 -dylib %t1.o %t2.o -o /dev/null
10*aa0883b5SNico Weber; RUN: llvm-readobj -h %t4/0.x86_64.lto.o | FileCheck %s
11*aa0883b5SNico Weber; RUN: llvm-nm %t4/0.x86_64.lto.o 2>&1 | FileCheck --check-prefix=NM %s
12*aa0883b5SNico Weber; RUN: llvm-readobj -h %t4/0.x86_64.lto.o | FileCheck %s
13*aa0883b5SNico Weber
14*aa0883b5SNico Weber;; Ensure lld emits empty combined module if specific obj-path.
15*aa0883b5SNico Weber; RUN: rm -fr %t.dir/objpath && mkdir -p %t.dir/objpath
16*aa0883b5SNico Weber; RUN: %lld -object_path_lto %t4.o -dylib %t1.o %t2.o -o %t.dir/objpath/a.out -save-temps
17*aa0883b5SNico Weber; RUN: ls %t.dir/objpath/a.out*.lto.* | count 3
18*aa0883b5SNico Weber
19*aa0883b5SNico Weber;; Ensure lld does not emit empty combined module in default.
20*aa0883b5SNico Weber; RUN: rm -fr %t.dir/objpath && mkdir -p %t.dir/objpath
21*aa0883b5SNico Weber; RUN: %lld -dylib %t1.o %t2.o -o %t.dir/objpath/a.out -save-temps
22*aa0883b5SNico Weber; RUN: ls %t.dir/objpath/a.out*.lto.* | count 2
23*aa0883b5SNico Weber
24*aa0883b5SNico Weber; NM: no symbols
25*aa0883b5SNico Weber; CHECK: Format: Mach-O 64-bit x86-64
26*aa0883b5SNico Weber
27*aa0883b5SNico Weber;--- f.ll
28*aa0883b5SNico Webertarget datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
29*aa0883b5SNico Webertarget triple = "x86_64-apple-darwin"
30*aa0883b5SNico Weber
31*aa0883b5SNico Weberdeclare void @g(...)
32*aa0883b5SNico Weber
33*aa0883b5SNico Weberdefine void @f() {
34*aa0883b5SNico Weberentry:
35*aa0883b5SNico Weber  call void (...) @g()
36*aa0883b5SNico Weber  ret void
37*aa0883b5SNico Weber}
38*aa0883b5SNico Weber
39*aa0883b5SNico Weber;--- g.ll
40*aa0883b5SNico Webertarget datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
41*aa0883b5SNico Webertarget triple = "x86_64-apple-darwin"
42*aa0883b5SNico Weber
43*aa0883b5SNico Weberdefine void @g() {
44*aa0883b5SNico Weberentry:
45*aa0883b5SNico Weber  ret void
46*aa0883b5SNico Weber}
47