111 lines · plain
1; REQUIRES: x862 3;; Mostly copied/updated from thinlto-index-only.ll4;; First ensure that the ThinLTO handling in lld handles5;; bitcode without summary sections gracefully and generates index file.6; RUN: rm -rf %t && mkdir %t && cd %t7; RUN: mkdir d8; RUN: llvm-as %s -o 1.o9; RUN: llvm-as %p/Inputs/thinlto.ll -o d/2.o10; RUN: ld.lld --thinlto-emit-index-files -shared 1.o d/2.o -o 311; RUN: ls d/2.o.thinlto.bc12; RUN: ls 313; RUN: ld.lld -shared 1.o d/2.o -o 314; RUN: llvm-nm 3 | FileCheck %s --check-prefix=NM15 16;; Basic ThinLTO tests.17; RUN: opt -module-summary %s -o 1.o18; RUN: opt -module-summary %p/Inputs/thinlto.ll -o d/2.o19; RUN: opt -module-summary %p/Inputs/thinlto_empty.ll -o 3.o20; RUN: cp 3.o 4.o21 22;; Ensure lld generates an index and also a binary if requested.23; RUN: ld.lld --thinlto-emit-index-files -shared 1.o --start-lib d/2.o 3.o --end-lib 4.o -o 424; RUN: ls 425; RUN: llvm-bcanalyzer -dump 1.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND126; RUN: llvm-bcanalyzer -dump d/2.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND227; RUN: llvm-dis < 3.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND328; RUN: llvm-dis < 4.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND429 30; IMPORTS1: d/2.o31 32;; Ensure lld generates an index and not a binary if both emit-index and index-only are present.33; RUN: ld.lld --thinlto-emit-index-files --thinlto-index-only -shared 1.o d/2.o -o 534; RUN: not ls 535 36;; Test that LLD generates an empty index even for lazy object file that is not added to link.37;; Test that LLD also generates empty imports file with the --thinlto-emit-imports-files option.38; RUN: rm -f 1.o.thinlto.bc 1.o.imports39; RUN: ld.lld --thinlto-emit-index-files -shared d/2.o --start-lib 1.o --end-lib \40; RUN: --thinlto-emit-imports-files -o 741; RUN: ls 742; RUN: ls 1.o.thinlto.bc43; RUN: ls 1.o.imports44 45;; Ensure LLD generates an empty index for each bitcode file even if all bitcode files are lazy.46; RUN: rm -f 1.o.thinlto.bc47; RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux-gnu /dev/null -o dummy.o48; RUN: ld.lld --thinlto-emit-index-files -shared dummy.o --start-lib 1.o --end-lib -o 849; RUN: ls 850; RUN: ls 1.o.thinlto.bc51 52;; Test that LLD errors out when run with suffix replacement, or prefix replacement53; RUN: not ld.lld --thinlto-emit-index-files -shared d/2.o --start-lib 1.o --end-lib \54; RUN: --thinlto-prefix-replace="abc;xyz" 2>&1 | FileCheck %s --check-prefix=ERR155; ERR1: --thinlto-prefix-replace is not supported with --thinlto-emit-index-files56 57; RUN: not ld.lld --thinlto-emit-index-files -shared d/2.o --start-lib 1.o --end-lib \58; RUN: --thinlto-object-suffix-replace="abc;xyz" 2>&1 | FileCheck %s --check-prefix=ERR259; ERR2: --thinlto-object-suffix-replace is not supported with --thinlto-emit-index-files60 61;; But not when passed with index only as well62; RUN: ld.lld --thinlto-emit-index-files -shared d/2.o --start-lib 1.o --end-lib \63; RUN: --thinlto-prefix-replace="abc;xyz" --thinlto-index-only64 65; RUN: ld.lld --thinlto-emit-index-files -shared d/2.o --start-lib 1.o --end-lib \66; RUN: --thinlto-object-suffix-replace="abc;xyz" --thinlto-index-only67 68; NM: T f69 70;; The backend index for this module contains summaries from itself and71;; Inputs/thinlto.ll, as it imports from the latter.72; BACKEND1: <MODULE_STRTAB_BLOCK73; BACKEND1-NEXT: <ENTRY {{.*}} record string = '1.o'74; BACKEND1-NEXT: <ENTRY {{.*}} record string = 'd/2.o'75; BACKEND1-NEXT: </MODULE_STRTAB_BLOCK76; BACKEND1: <GLOBALVAL_SUMMARY_BLOCK77; BACKEND1: <VERSION78; BACKEND1: <FLAGS79; BACKEND1: <VALUE_GUID {{.*}} op0={{1|2}} {{op1=3060885059 op2=1207956914|op1=3432075125 op2=3712786831}}80; BACKEND1: <VALUE_GUID {{.*}} op0={{1|2}} {{op1=3060885059 op2=1207956914|op1=3432075125 op2=3712786831}}81; BACKEND1: <COMBINED82; BACKEND1: <COMBINED83; BACKEND1: </GLOBALVAL_SUMMARY_BLOCK84 85;; The backend index for Input/thinlto.ll contains summaries from itself only,86;; as it does not import anything.87; BACKEND2: <MODULE_STRTAB_BLOCK88; BACKEND2-NEXT: <ENTRY {{.*}} record string = 'd/2.o'89; BACKEND2-NEXT: </MODULE_STRTAB_BLOCK90; BACKEND2-NEXT: <GLOBALVAL_SUMMARY_BLOCK91; BACKEND2-NEXT: <VERSION92; BACKEND2-NEXT: <FLAGS93; BACKEND2-NEXT: <VALUE_GUID {{.*}} op0=1 op1=3060885059 op2=120795691494; BACKEND2-NEXT: <COMBINED95; BACKEND2-NEXT: </GLOBALVAL_SUMMARY_BLOCK96 97; BACKEND3: ^0 = flags:98 99; BACKEND4: ^0 = module: (path: "4.o", hash: (0, 0, 0, 0, 0))100 101target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"102target triple = "x86_64-unknown-linux-gnu"103 104declare void @g(...)105 106define void @f() {107entry:108 call void (...) @g()109 ret void110}111