2 ;; Test --lto-obj-path= for regular LTO.
4 ; RUN: rm -rf %t && split-file %s %t && cd %t
6 ; RUN: opt 1.ll -o 1.bc
7 ; RUN: opt 2.ll -o d/2.bc
10 ; RUN: ld.lld --lto-obj-path=objpath.o -shared 1.bc d/2.bc -o 3
11 ; RUN: llvm-nm 3 | FileCheck %s --check-prefix=NM
12 ; RUN: llvm-objdump -d objpath.o | FileCheck %s
13 ; RUN: ls 3* objpath* | count 2
15 ; RUN: rm -f 3 objpath.o
16 ; RUN: ld.lld --thinlto-index-only=3.txt --lto-obj-path=objpath.o -shared 1.bc d/2.bc -o 3
17 ; RUN: llvm-objdump -d objpath.o | FileCheck %s
23 ; CHECK: file format elf64-x86-64
27 ;; Test --lto-obj-path= for ThinLTO.
28 ; RUN: opt -module-summary 1.ll -o 1.bc
29 ; RUN: opt -module-summary 2.ll -o d/2.bc
31 ; RUN: ld.lld --plugin-opt=obj-path=objpath.o -shared 1.bc d/2.bc -o 3
32 ; RUN: llvm-nm 3 | FileCheck %s --check-prefix=NM3
33 ; RUN: llvm-objdump -d objpath.o1 | FileCheck %s --check-prefix=CHECK1
34 ; RUN: llvm-objdump -d objpath.o2 | FileCheck %s --check-prefix=CHECK2
39 ; CHECK1: file format elf64-x86-64
41 ; CHECK1-NEXT: Disassembly of section .text.f:
47 ; CHECK2: file format elf64-x86-64
49 ; CHECK2-NEXT: Disassembly of section .text.g:
55 ;; With --thinlto-index-only, --lto-obj-path= creates just one file.
56 ; RUN: rm -f objpath.o objpath.o1 objpath.o2
57 ; RUN: ld.lld --thinlto-index-only --lto-obj-path=objpath.o -shared 1.bc d/2.bc -o /dev/null
58 ; RUN: llvm-objdump -d objpath.o | FileCheck %s --check-prefix=EMPTY
59 ; RUN: not ls objpath.o1
60 ; RUN: not ls objpath.o2
62 ;; Test --plugin-opt=obj-path=.
63 ; RUN: rm -f objpath.o
64 ; RUN: ld.lld --plugin-opt=thinlto-index-only --plugin-opt=obj-path=objpath.o -shared 1.bc d/2.bc -o /dev/null
65 ; RUN: llvm-objdump -d objpath.o | FileCheck %s --check-prefix=EMPTY
67 ;; Ensure lld emits empty combined module if specific obj-path.
69 ; RUN: ld.lld --plugin-opt=obj-path=objpath.o -shared 1.bc d/2.bc -o obj/out --save-temps
70 ; RUN: ls obj/out.lto.o out.lto.1.o d/out.lto.2.o
72 ;; Ensure lld does not emit empty combined module by default.
73 ; RUN: rm -fr obj && mkdir obj
74 ; RUN: ld.lld -shared 1.bc d/2.bc -o obj/out --save-temps
75 ; RUN: not test -e obj/out.lto.o
77 ; EMPTY: file format elf64-x86-64
81 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
82 target triple = "x86_64-unknown-linux-gnu"
93 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
94 target triple = "x86_64-unknown-linux-gnu"