52 lines · plain
1; REQUIRES: x862; RUN: rm -rf %t && mkdir %t && cd %t3; RUN: mkdir -p old/subdir4; RUN: opt -module-summary %s -o old/subdir/1.o5; RUN: opt -module-summary %p/Inputs/thinlto.ll -o old/subdir/2.o6; RUN: opt -module-summary %p/Inputs/thinlto_empty.ll -o old/3.o7 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/null10; RUN: ls old/subdir/1.o.thinlto.bc11; RUN: ls old/subdir/2.o.thinlto.bc12; RUN: ls old/3.o.thinlto.bc13; RUN: FileCheck --match-full-lines --check-prefix=CHECK-NO-REPLACE %s < 1.txt14; CHECK-NO-REPLACE: old/subdir/1.o15; CHECK-NO-REPLACE-NEXT: old/subdir/2.o16; CHECK-NO-REPLACE-NEXT: old/3.o17 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/null20; RUN: ls new/subdir/1.o.thinlto.bc21; RUN: ls new/subdir/2.o.thinlto.bc22; RUN: ls new/3.o.thinlto.bc23; RUN: FileCheck --match-full-lines --check-prefix=CHECK-REPLACE-PREFIX %s < 2.txt24; CHECK-REPLACE-PREFIX: new/subdir/1.o25; CHECK-REPLACE-PREFIX-NEXT: new/subdir/2.o26; CHECK-REPLACE-PREFIX-NEXT: new/3.o27 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/null30; RUN: ls new/subdir/1.o.thinlto.bc31; RUN: ls new/subdir/2.o.thinlto.bc32; RUN: ls new/3.o.thinlto.bc33; RUN: FileCheck --match-full-lines --check-prefix=CHECK-REPLACE-OBJECT-PREFIX %s < 3.txt34; CHECK-REPLACE-OBJECT-PREFIX: obj/subdir/1.o35; CHECK-REPLACE-OBJECT-PREFIX-NEXT: obj/subdir/2.o36; CHECK-REPLACE-OBJECT-PREFIX-NEXT: obj/3.o37 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=ERROR40; 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 void51}52