xref: /llvm-project/llvm/test/tools/gold/X86/thinlto_object_suffix_replace.ll (revision 9ba5740ba56c23aedc05b70bf8028dd3cad82a83)
10c6a4ff8STeresa Johnson; Test to make sure the thinlto-object-suffix-replace option is handled
20c6a4ff8STeresa Johnson; correctly.
30c6a4ff8STeresa Johnson
40c6a4ff8STeresa Johnson; Generate bitcode file with summary, as well as a minimized bitcode without
50c6a4ff8STeresa Johnson; the debug metadata for the thin link.
60c6a4ff8STeresa Johnson; RUN: opt -thinlto-bc %s -thin-link-bitcode-file=%t1.thinlink.bc -o %t1.o
70c6a4ff8STeresa Johnson
80c6a4ff8STeresa Johnson; First perform the thin link on the normal bitcode file, and save the
90c6a4ff8STeresa Johnson; resulting index.
103efcfaddSEugene Leviant; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \
110c6a4ff8STeresa Johnson; RUN:    -m elf_x86_64 \
120c6a4ff8STeresa Johnson; RUN:    --plugin-opt=thinlto \
130c6a4ff8STeresa Johnson; RUN:    --plugin-opt=thinlto-index-only \
140c6a4ff8STeresa Johnson; RUN:    -shared %t1.o -o %t3
150c6a4ff8STeresa Johnson; RUN: cp %t1.o.thinlto.bc %t1.o.thinlto.bc.orig
160c6a4ff8STeresa Johnson
170c6a4ff8STeresa Johnson; Next perform the thin link on the minimized bitcode file, and compare dump
180c6a4ff8STeresa Johnson; of the resulting index to the above dump to ensure they are identical.
190c6a4ff8STeresa Johnson; RUN: rm -f %t1.o.thinlto.bc
200c6a4ff8STeresa Johnson; Make sure it isn't inadvertently using the regular bitcode file.
210c6a4ff8STeresa Johnson; RUN: rm -f %t1.o
223efcfaddSEugene Leviant; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \
230c6a4ff8STeresa Johnson; RUN:    -m elf_x86_64 \
240c6a4ff8STeresa Johnson; RUN:    --plugin-opt=thinlto \
250c6a4ff8STeresa Johnson; RUN:    --plugin-opt=thinlto-index-only \
260c6a4ff8STeresa Johnson; RUN:    --plugin-opt=thinlto-object-suffix-replace=".thinlink.bc;.o" \
270c6a4ff8STeresa Johnson; RUN:    -shared %t1.thinlink.bc -o %t3
280c6a4ff8STeresa Johnson; RUN: diff %t1.o.thinlto.bc.orig %t1.o.thinlto.bc
290c6a4ff8STeresa Johnson
30*9ba5740bSFangrui Song; If filename does not end with old suffix, no suffix change should occur,
31*9ba5740bSFangrui Song; so ".thinlto.bc" will simply be appended to the input file name.
32*9ba5740bSFangrui Song; RUN: rm -f %t1.thinlink.bc.thinlto.bc
33*9ba5740bSFangrui Song; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \
34*9ba5740bSFangrui Song; RUN:    -m elf_x86_64 \
35*9ba5740bSFangrui Song; RUN:    --plugin-opt=thinlto \
36*9ba5740bSFangrui Song; RUN:    --plugin-opt=thinlto-index-only \
37*9ba5740bSFangrui Song; RUN:    --plugin-opt=thinlto-object-suffix-replace=".abc;.o" \
38*9ba5740bSFangrui Song; RUN:    -shared %t1.thinlink.bc -o /dev/null
39*9ba5740bSFangrui Song; RUN: ls %t1.thinlink.bc.thinlto.bc
40*9ba5740bSFangrui Song
410c6a4ff8STeresa Johnsontarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
420c6a4ff8STeresa Johnsontarget triple = "x86_64-unknown-linux-gnu"
430c6a4ff8STeresa Johnson
440c6a4ff8STeresa Johnsondefine void @f() {
450c6a4ff8STeresa Johnsonentry:
460c6a4ff8STeresa Johnson  ret void
470c6a4ff8STeresa Johnson}
480c6a4ff8STeresa Johnson
490c6a4ff8STeresa Johnson!llvm.dbg.cu = !{}
500c6a4ff8STeresa Johnson
510c6a4ff8STeresa Johnson!1 = !{i32 2, !"Debug Info Version", i32 3}
520c6a4ff8STeresa Johnson!llvm.module.flags = !{!1}
53