1; REQUIRES: x86 2 3; RUN: rm -rf %t.dir && mkdir %t.dir && cd %t.dir 4; RUN: mkdir dir1 dir2 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 10 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 17 18; CHECK-UNUSED: lib.a(unused.o at {{[1-9][0-9]+}}) 19 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 23 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 29 30;; Clean up 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 37 38target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 39target triple = "x86_64-unknown-linux-gnu" 40 41declare i32 @blah(i32 %meh) 42declare i32 @foo(i32 %goo) 43 44define void @_start() { 45entry: 46 call i32 @foo(i32 0) 47 call i32 @blah(i32 0) 48 ret void 49} 50