• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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; Also check that this works without the --plugin-opt= prefix.
25; RUN: ld.lld --thinlto-index-only \
26; RUN: --thinlto-object-suffix-replace=".thinlink.bc;.o" \
27; RUN: -shared %t1.thinlink.bc -o %t3
28; RUN: diff %t1.o.thinlto.bc.orig %t1.o.thinlto.bc
29
30; Ensure lld generates error if object suffix replace option does not have 'old;new' format
31; RUN: rm -f %t1.o.thinlto.bc
32; RUN: not ld.lld --plugin-opt=thinlto-index-only \
33; RUN: --plugin-opt=thinlto-object-suffix-replace="abc:def" -shared %t1.thinlink.bc \
34; RUN: -o %t3 2>&1 | FileCheck %s --check-prefix=ERR1
35; ERR1: --plugin-opt=thinlto-object-suffix-replace= expects 'old;new' format, but got abc:def
36
37; If filename does not end with old suffix, no suffix change should occur,
38; so ".thinlto.bc" will simply be appended to the input file name.
39; RUN: rm -f %t1.thinlink.bc.thinlto.bc
40; RUN: ld.lld --plugin-opt=thinlto-index-only \
41; RUN: --plugin-opt=thinlto-object-suffix-replace=".abc;.o" -shared %t1.thinlink.bc -o /dev/null
42; RUN: ls %t1.thinlink.bc.thinlto.bc
43
44target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
45target triple = "x86_64-unknown-linux-gnu"
46
47define void @f() {
48entry:
49  ret void
50}
51
52!llvm.dbg.cu = !{}
53
54!1 = !{i32 2, !"Debug Info Version", i32 3}
55!llvm.module.flags = !{!1}
56