| 1 |
; RUN: rm -f ptr.o.thinlto.bc |
| 2 |
; RUN: rm -f ptr.o.imports |
| 3 |
|
| 4 |
; First generate bitcode with a module summary index for each file |
| 5 |
; RUN: opt -module-summary %s -o %t1.o |
| 6 |
; RUN: opt -module-summary %p/Inputs/thinlto_emit_linked_objects2.ll -o %t2.o |
| 7 |
; RUN: opt %p/Inputs/thinlto_emit_linked_objects3.ll -o %t3.o |
| 8 |
|
| 9 |
; Next do the ThinLink step, specifying thinlto-index-only so that the gold |
| 10 |
; plugin exits after generating individual indexes. The objects the linker |
| 11 |
; decided to include in the link should be emitted into the file specified |
| 12 |
; after 'thinlto-index-only='. In this version of the test, only %t1.o will |
| 13 |
; be included in the link, and not %t2.o since it is within |
| 14 |
; 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-lib |
| 24 |
|
| 25 |
; Ensure that the expected output files are created, even for the file |
| 26 |
; the linker decided not to include in the link. |
| 27 |
; RUN: ls %t1.o.thinlto.bc |
| 28 |
; RUN: ls %t2.o.thinlto.bc |
| 29 |
; RUN: ls %t3.o.thinlto.bc |
| 30 |
; RUN: ls %t1.o.imports |
| 31 |
; RUN: ls %t2.o.imports |
| 32 |
; RUN: ls %t3.o.imports |
| 33 |
|
| 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-BC1 |
| 37 |
; CHECK-BC1: <GLOBALVAL_SUMMARY_BLOCK |
| 38 |
; CHECK-BC1: <FLAGS op0=[[#]]/> |
| 39 |
; CHECK-BC1: </GLOBALVAL_SUMMARY_BLOCK |
| 40 |
|
| 41 |
; Nothing interesting in the corresponding object file, so |
| 42 |
; "SkipModuleByDistributedBackend" flag (0x2) should be set. |
| 43 |
; RUN: llvm-bcanalyzer --dump %t2.o.thinlto.bc | FileCheck %s -check-prefixes=CHECK-BC2 |
| 44 |
; CHECK-BC2: <GLOBALVAL_SUMMARY_BLOCK |
| 45 |
; CHECK-BC2: <FLAGS op0=2/> |
| 46 |
; CHECK-BC2: </GLOBALVAL_SUMMARY_BLOCK |
| 47 |
|
| 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-BC3 |
| 50 |
; CHECK-BC3: Unexpected end of file |
| 51 |
|
| 52 |
; RUN: cat %t.index | FileCheck %s |
| 53 |
; CHECK: thinlto_emit_linked_objects.ll.tmp1.o |
| 54 |
; CHECK-NOT: thinlto_emit_linked_objects.ll.tmp2.o |
| 55 |
; CHECK-NOT: thinlto_emit_linked_objects.ll.tmp3.o |
| 56 |
|
| 57 |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 58 |
target triple = "x86_64-unknown-linux-gnu" |
| 59 |
|
| 60 |
define i32 @main() { |
| 61 |
entry: |
| 62 |
ret i32 0 |
| 63 |
} |