64 lines · plain
1; RUN: rm -f ptr.o.thinlto.bc2; RUN: rm -f ptr.o.imports3 4; First generate bitcode with a module summary index for each file5; RUN: opt -module-summary %s -o %t1.o6; RUN: opt -module-summary %p/Inputs/thinlto_emit_linked_objects2.ll -o %t2.o7; RUN: opt %p/Inputs/thinlto_emit_linked_objects3.ll -o %t3.o8 9; Next do the ThinLink step, specifying thinlto-index-only so that the gold10; plugin exits after generating individual indexes. The objects the linker11; decided to include in the link should be emitted into the file specified12; after 'thinlto-index-only='. In this version of the test, only %t1.o will13; be included in the link, and not %t2.o since it is within14; a library (--start-lib/--end-lib pair) and not strongly referenced.15; Note that the support for detecting this is in gold v1.12.16; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \17; RUN: --plugin-opt=thinlto \18; RUN: --plugin-opt=thinlto-index-only=%t.index \19; RUN: --plugin-opt=thinlto-emit-imports-files \20; RUN: -m elf_x86_64 \21; RUN: -o %t4 \22; RUN: %t1.o %t3.o \23; RUN: --start-lib %t2.o --end-lib24 25; Ensure that the expected output files are created, even for the file26; the linker decided not to include in the link.27; RUN: ls %t1.o.thinlto.bc28; RUN: ls %t2.o.thinlto.bc29; RUN: ls %t3.o.thinlto.bc30; RUN: ls %t1.o.imports31; RUN: ls %t2.o.imports32; RUN: ls %t3.o.imports33 34; Regular *thinlto.bc file. "SkipModuleByDistributedBackend" flag (0x2)35; should not be set.36; RUN: llvm-bcanalyzer --dump %t1.o.thinlto.bc | FileCheck %s -check-prefixes=CHECK-BC137; CHECK-BC1: <GLOBALVAL_SUMMARY_BLOCK38; CHECK-BC1: <FLAGS op0=[[#]]/>39; CHECK-BC1: </GLOBALVAL_SUMMARY_BLOCK40 41; Nothing interesting in the corresponding object file, so42; "SkipModuleByDistributedBackend" flag (0x2) should be set.43; RUN: llvm-bcanalyzer --dump %t2.o.thinlto.bc | FileCheck %s -check-prefixes=CHECK-BC244; CHECK-BC2: <GLOBALVAL_SUMMARY_BLOCK45; CHECK-BC2: <FLAGS op0=2/>46; CHECK-BC2: </GLOBALVAL_SUMMARY_BLOCK47 48; Empty as the corresponding object file is not ThinTLO.49; RUN: not llvm-bcanalyzer --dump %t3.o.thinlto.bc 2>&1 | FileCheck %s -check-prefixes=CHECK-BC350; CHECK-BC3: Unexpected end of file51 52; RUN: cat %t.index | FileCheck %s53; CHECK: thinlto_emit_linked_objects.ll.tmp1.o54; CHECK-NOT: thinlto_emit_linked_objects.ll.tmp2.o55; CHECK-NOT: thinlto_emit_linked_objects.ll.tmp3.o56 57target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"58target triple = "x86_64-unknown-linux-gnu"59 60define i32 @main() {61entry:62 ret i32 063}64