1; REQUIRES: x86
2
3; Test to make sure the thinlto-object-suffix-replace option is handled
4; correctly.
5
6; Generate bitcode file with summary, as well as a minimized bitcode without
7; the debug metadata for the thin link.
8; RUN: opt -thinlto-bc %s -thin-link-bitcode-file=%t1.thinlink.bc -o %t1.o
9
10; First perform the thin link on the normal bitcode file, and save the
11; resulting index.
12; RUN: ld.lld --plugin-opt=thinlto-index-only -shared %t1.o -o %t3
13; RUN: cp %t1.o.thinlto.bc %t1.o.thinlto.bc.orig
14
15; Next perform the thin link on the minimized bitcode file, and compare dump
16; of the resulting index to the above dump to ensure they are identical.
17; RUN: rm -f %t1.o.thinlto.bc
18; Make sure it isn't inadvertently using the regular bitcode file.
19; RUN: rm -f %t1.o
20; RUN: ld.lld --plugin-opt=thinlto-index-only \
21; RUN: --plugin-opt=thinlto-object-suffix-replace=".thinlink.bc;.o" \
22; RUN: -shared %t1.thinlink.bc -o %t3
23; RUN: diff %t1.o.thinlto.bc.orig %t1.o.thinlto.bc
24
25; Ensure lld generates error if object suffix replace option does not have 'old;new' format
26; RUN: rm -f %t1.o.thinlto.bc
27; RUN: not ld.lld --plugin-opt=thinlto-index-only \
28; RUN: --plugin-opt=thinlto-object-suffix-replace="abc:def" -shared %t1.thinlink.bc \
29; RUN: -o %t3 2>&1 | FileCheck %s --check-prefix=ERR1
30; ERR1: --plugin-opt=thinlto-object-suffix-replace= expects 'old;new' format, but got abc:def
31
32; If filename does not end with old suffix, no suffix change should occur,
33; so ".thinlto.bc" will simply be appended to the input file name.
34; RUN: rm -f %t1.thinlink.bc.thinlto.bc
35; RUN: ld.lld --plugin-opt=thinlto-index-only \
36; RUN: --plugin-opt=thinlto-object-suffix-replace=".abc;.o" -shared %t1.thinlink.bc -o /dev/null
37; RUN: ls %t1.thinlink.bc.thinlto.bc
38
39target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
40target triple = "x86_64-unknown-linux-gnu"
41
42define void @f() {
43entry:
44  ret void
45}
46
47!llvm.dbg.cu = !{}
48
49!1 = !{i32 2, !"Debug Info Version", i32 3}
50!llvm.module.flags = !{!1}
51