3 ; RUN: rm -rf %t.dir && mkdir %t.dir && cd %t.dir
5 ; RUN: llvm-as %s -o ./dir1/main.o
6 ; RUN: llvm-as %p/Inputs/thinlto.ll -o ./dir1/unused.o
7 ; RUN: llvm-as %p/Inputs/thin1.ll -o ./dir1/thin.o
8 ; RUN: llvm-as %p/Inputs/thin2.ll -o ./dir2/thin.o
9 ; RUN: llvm-ar crT ./dir2/lib.a dir1/unused.o dir1/thin.o dir2/thin.o
11 ;; For a thin archive referencing object files in a different directory,
12 ;; emit index files (lib.a($member at $offset).thinlto.bc) in the directory
13 ;; containing the archive, even in the lazy case. The information about the
14 ;; referenced member's directory is lost.
15 ; RUN: ld.lld --thinlto-emit-index-files ./dir2/lib.a ./dir1/main.o -o c --save-temps
16 ; RUN: ls ./dir2 | FileCheck %s --check-prefix CHECK-UNUSED
18 ; CHECK-UNUSED: lib.a(unused.o at {{[1-9][0-9]+}})
20 ;; Index files emitted from object files in a thin archive should have the
21 ;; offset in the archive specified to avoid collisions
22 ; RUN: FileCheck %s < c.resolution.txt --check-prefix CHECK-COLLISION
24 ; CHECK-COLLISION: dir1/main.o
25 ; CHECK-COLLISION: dir2/lib.a(thin.o at {{[1-9][0-9]+}})
26 ; CHECK-COLLISION-NEXT: -r=./dir2/lib.a(thin.o at {{[1-9][0-9]+}}),blah,pl
27 ; CHECK-COLLISION: dir2/lib.a(thin.o at {{[1-9][0-9]+}})
28 ; CHECK-COLLISION-NEXT: -r=./dir2/lib.a(thin.o at {{[1-9][0-9]+}}),foo,pl
31 ; RUN: rm -rf ./dir1/*.thinlto.bc
32 ; RUN: rm -rf ./dir2/*.thinlto.bc
33 ;; Empty index files for unused files in thin archives should still be emitted
34 ;; in the same format when using --whole-archive
35 ; RUN: ld.lld --thinlto-emit-index-files --whole-archive ./dir2/lib.a ./dir1/main.o -o d
36 ; RUN: ls ./dir2 | FileCheck %s --check-prefix CHECK-UNUSED
38 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
39 target triple = "x86_64-unknown-linux-gnu"
41 declare i32 @blah(i32 %meh)
42 declare i32 @foo(i32 %goo)
44 define void @_start() {