xref: /llvm-project/llvm/test/tools/gold/X86/thinlto_emit_linked_objects.ll (revision 3efcfadde4cebf768f56b22a432185eb9502ea41)
1; First generate bitcode with a module summary index for each file
2; RUN: opt -module-summary %s -o %t.o
3; RUN: opt -module-summary %p/Inputs/thinlto_emit_linked_objects.ll -o %t2.o
4
5; Next do the ThinLink step, specifying thinlto-index-only so that the gold
6; plugin exits after generating individual indexes. The objects the linker
7; decided to include in the link should be emitted into the file specified
8; after 'thinlto-index-only='. Note that in this test both files should
9; be included in the link, but in a case where there was an object in
10; a library that had no strongly referenced symbols, that file would not
11; be included in the link and listed in the emitted file. However, this
12; requires gold version 1.12.
13; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \
14; RUN:    --plugin-opt=thinlto \
15; RUN:    --plugin-opt=thinlto-index-only=%t3 \
16; RUN:    -o %t5 \
17; RUN:    %t.o \
18; RUN:    --start-lib %t2.o --end-lib
19
20; RUN: cat %t3 | FileCheck %s
21; CHECK: thinlto_emit_linked_objects.ll.tmp.o
22; CHECK: thinlto_emit_linked_objects.ll.tmp2.o
23
24target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
25target triple = "x86_64-unknown-linux-gnu"
26
27define i32 @main() {
28entry:
29  call void (...) @foo()
30  ret i32 0
31}
32
33declare void @foo(...)
34