1; REQUIRES: x86 2; RUN: rm -rf %t && mkdir %t && cd %t 3; RUN: mkdir -p old/subdir 4; RUN: opt -module-summary %s -o old/subdir/1.o 5; RUN: opt -module-summary %p/Inputs/thinlto.ll -o old/subdir/2.o 6; RUN: opt -module-summary %p/Inputs/thinlto_empty.ll -o old/3.o 7 8;; Ensure lld writes linked files to linked objects file. 9; RUN: ld.lld --thinlto-index-only=1.txt -shared old/subdir/1.o old/subdir/2.o old/3.o -o /dev/null 10; RUN: ls old/subdir/1.o.thinlto.bc 11; RUN: ls old/subdir/2.o.thinlto.bc 12; RUN: ls old/3.o.thinlto.bc 13; RUN: FileCheck --match-full-lines --check-prefix=CHECK-NO-REPLACE %s < 1.txt 14; CHECK-NO-REPLACE: old/subdir/1.o 15; CHECK-NO-REPLACE-NEXT: old/subdir/2.o 16; CHECK-NO-REPLACE-NEXT: old/3.o 17 18;; Check that this also works with thinlto-prefix-replace. 19; RUN: ld.lld --thinlto-index-only=2.txt --thinlto-prefix-replace="old/;new/" -shared old/subdir/1.o old/subdir/2.o old/3.o -o /dev/null 20; RUN: ls new/subdir/1.o.thinlto.bc 21; RUN: ls new/subdir/2.o.thinlto.bc 22; RUN: ls new/3.o.thinlto.bc 23; RUN: FileCheck --match-full-lines --check-prefix=CHECK-REPLACE-PREFIX %s < 2.txt 24; CHECK-REPLACE-PREFIX: new/subdir/1.o 25; CHECK-REPLACE-PREFIX-NEXT: new/subdir/2.o 26; CHECK-REPLACE-PREFIX-NEXT: new/3.o 27 28;; Check that this also works with replacing the prefix of linked objects. 29; RUN: ld.lld --thinlto-index-only=3.txt --thinlto-prefix-replace="old/;new/;obj/" -shared old/subdir/1.o old/subdir/2.o old/3.o -o /dev/null 30; RUN: ls new/subdir/1.o.thinlto.bc 31; RUN: ls new/subdir/2.o.thinlto.bc 32; RUN: ls new/3.o.thinlto.bc 33; RUN: FileCheck --match-full-lines --check-prefix=CHECK-REPLACE-OBJECT-PREFIX %s < 3.txt 34; CHECK-REPLACE-OBJECT-PREFIX: obj/subdir/1.o 35; CHECK-REPLACE-OBJECT-PREFIX-NEXT: obj/subdir/2.o 36; CHECK-REPLACE-OBJECT-PREFIX-NEXT: obj/3.o 37 38; 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. 39; RUN: not ld.lld --thinlto-prefix-replace="old/;new/;obj/" -shared old/subdir/1.o old/subdir/2.o old/3.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERROR 40; ERROR: error: --thinlto-prefix-replace=old_dir;new_dir;obj_dir must be used with --thinlto-index-only= 41 42target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 43target triple = "x86_64-unknown-linux-gnu" 44 45declare void @g(...) 46 47define void @f() { 48entry: 49 call void (...) @g() 50 ret void 51} 52