1; REQUIRES: x86 2; RUN: rm -rf %t && split-file %s %t 3; RUN: mkdir -p %t/old/subdir 4 5; RUN: opt -module-summary %t/f.ll -o %t/old/subdir/1.o 6; RUN: opt -module-summary %t/g.ll -o %t/old/subdir/2.o 7; RUN: opt -module-summary %t/empty.ll -o %t/old/3.o 8 9;; Ensure lld writes linked files to linked objects file. 10; RUN: %lld --thinlto-index-only=%t/1.txt -dylib %t/old/subdir/1.o %t/old/subdir/2.o %t/old/3.o -o /dev/null 11; RUN: ls %t/old/subdir/1.o.thinlto.bc 12; RUN: ls %t/old/subdir/2.o.thinlto.bc 13; RUN: ls %t/old/3.o.thinlto.bc 14; RUN: FileCheck --check-prefix=CHECK-NO-REPLACE %s < %t/1.txt 15; CHECK-NO-REPLACE: old/subdir/1.o 16; CHECK-NO-REPLACE-NEXT: old/subdir/2.o 17; CHECK-NO-REPLACE-NEXT: old/3.o 18 19;; Check that this also works with thinlto-prefix-replace. 20; RUN: %lld --thinlto-index-only=%t/2.txt --thinlto-prefix-replace="%t/old/;%t/new/" -dylib %t/old/subdir/1.o %t/old/subdir/2.o %t/old/3.o -o /dev/null 21; RUN: ls %t/new/subdir/1.o.thinlto.bc 22; RUN: ls %t/new/subdir/2.o.thinlto.bc 23; RUN: ls %t/new/3.o.thinlto.bc 24; RUN: FileCheck --check-prefix=CHECK-REPLACE-PREFIX %s < %t/2.txt 25; CHECK-REPLACE-PREFIX: new/subdir/1.o 26; CHECK-REPLACE-PREFIX-NEXT: new/subdir/2.o 27; CHECK-REPLACE-PREFIX-NEXT: new/3.o 28 29 30;; Check that this also works with replacing the prefix of linked objects. 31; RUN: %lld --thinlto-index-only=%t/3.txt --thinlto-prefix-replace="%t/old/;%t/new/;%t/obj/" -dylib %t/old/subdir/1.o %t/old/subdir/2.o %t/old/3.o -o /dev/null 32; RUN: ls %t/new/subdir/1.o.thinlto.bc 33; RUN: ls %t/new/subdir/2.o.thinlto.bc 34; RUN: ls %t/new/3.o.thinlto.bc 35; RUN: FileCheck --check-prefix=CHECK-REPLACE-OBJECT-PREFIX %s < %t/3.txt 36; CHECK-REPLACE-OBJECT-PREFIX: obj/subdir/1.o 37; CHECK-REPLACE-OBJECT-PREFIX-NEXT: obj/subdir/2.o 38; CHECK-REPLACE-OBJECT-PREFIX-NEXT: obj/3.o 39 40; Create an error if prefix replace option have 'old;new;obj' format but index file is not set. Ensure that the error is about thinlto-prefix-replace. 41; RUN: not %lld --thinlto-prefix-replace="%t/old/;%t/new/;%t/obj/" -dylib %t/old/subdir/1.o %t/old/subdir/2.o %t/old/3.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERROR 42; ERROR: error: --thinlto-prefix-replace=old_dir;new_dir;obj_dir must be used with --thinlto-index-only= 43 44;--- f.ll 45target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 46target triple = "x86_64-apple-darwin" 47 48declare void @g(...) 49 50define void @f() { 51entry: 52 call void (...) @g() 53 ret void 54} 55 56;--- g.ll 57target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 58target triple = "x86_64-apple-darwin" 59 60define void @g() { 61entry: 62 ret void 63} 64 65;--- empty.ll 66target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 67target triple = "x86_64-apple-darwin" 68