xref: /llvm-project/lld/test/COFF/lto-obj-path.ll (revision 84be92d26fcb1ddad533c0c614a79a81c59f795d)
1; REQUIRES: x86
2
3; Test to ensure that thinlto-index-only with lto-obj-path creates
4; the native object file.
5; RUN: rm -rf %t.dir/objpath && mkdir -p %t.dir/objpath
6; RUN: opt -module-summary %s -o %t.dir/objpath/t1.obj
7; RUN: opt -module-summary %p/Inputs/thinlto.ll -o %t.dir/objpath/t2.obj
8; RUN: rm -f %t.dir/objpath/t4.obj
9; RUN: lld-link -thinlto-index-only -lto-obj-path:%t.dir/objpath/t4.obj \
10; RUN:     -out:%t.dir/objpath/t3.exe -entry:main %t.dir/objpath/t1.obj \
11; RUN:     %t.dir/objpath/t2.obj
12; RUN: llvm-readobj -h %t.dir/objpath/t4.obj | FileCheck %s
13; RUN: llvm-nm %t.dir/objpath/t4.obj 2>&1 | FileCheck %s -check-prefix=SYMBOLS
14; RUN: llvm-nm %t.dir/objpath/t4.obj 2>&1 | count 1
15
16;; Ensure lld emits empty combined module if specific obj-path.
17; RUN: lld-link /out:%t.dir/objpath/a.exe -lto-obj-path:%t.dir/objpath/t4.obj \
18; RUN:     -entry:main %t.dir/objpath/t1.obj %t.dir/objpath/t2.obj -lldsavetemps
19; RUN: ls %t.dir/objpath/a.exe.lto.obj
20; RUN: ls %t.dir/objpath/a.exe.lto.t1.obj
21; RUN: ls %t.dir/objpath/a.exe.lto.t2.obj
22
23;; Ensure lld does not emit empty combined module in default.
24; RUN: rm %t.dir/objpath/a.exe.lto.*
25; RUN: lld-link /out:%t.dir/objpath/a.exe \
26; RUN:     -entry:main %t.dir/objpath/t1.obj %t.dir/objpath/t2.obj -lldsavetemps
27; RUN: ls %t.dir/objpath/a.exe.lto.t1.obj
28; RUN: ls %t.dir/objpath/a.exe.lto.t2.obj
29; RUN: not ls %t.dir/objpath/a.exe.lto.obj
30
31; CHECK: Format: COFF-x86-64
32; SYMBOLS: @feat.00
33
34target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
35target triple = "x86_64-pc-windows-msvc19.0.24215"
36
37declare void @g(...)
38
39define void @main() {
40  call void (...) @g()
41  ret void
42}
43