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.obj
9
10; First perform the thin link on the normal bitcode file, and save the
11; resulting index.
12; RUN: lld-link -thinlto-index-only -entry:main %t1.obj -out:%t3.exe
13; RUN: cp %t1.obj.thinlto.bc %t1.obj.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.obj.thinlto.bc
18; Make sure it isn't inadvertently using the regular bitcode file.
19; RUN: rm -f %t1.obj
20; RUN: lld-link -entry:main -thinlto-index-only \
21; RUN:     -thinlto-object-suffix-replace:".thinlink.bc;.obj" \
22; RUN:     %t1.thinlink.bc -out:%t3.exe
23; RUN: diff %t1.obj.thinlto.bc.orig %t1.obj.thinlto.bc
24
25; Ensure lld generates error if suffix replace option not in 'old;new' format.
26; RUN: rm -f %t1.obj.thinlto.bc
27; RUN: not lld-link -entry:main -thinlto-index-only \
28; RUN: -thinlto-object-suffix-replace:"abc:def" %t1.thinlink.bc \
29; RUN: -out:%t3.exe 2>&1 | FileCheck %s --check-prefix=ERR1
30; ERR1: -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: lld-link -entry:main -thinlto-index-only \
36; RUN: -thinlto-object-suffix-replace:".abc;.obj" %t1.thinlink.bc -out:%t3.exe
37; RUN: ls %t1.thinlink.bc.thinlto.bc
38
39target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
40target triple = "x86_64-pc-windows-msvc19.0.24215"
41
42define void @main() {
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