brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.5 KiB · a0af949 Raw
109 lines · plain
1;; Copied from ELF/lto/thinlto-index-only.ll2;; First ensure that the ThinLTO handling in lld handles3;; bitcode without summary sections gracefully and generates index file.4; RUN: rm -rf %t && mkdir %t && cd %t5; RUN: mkdir d6; RUN: llvm-as %s -o 1.o7; RUN: llvm-as %p/Inputs/thinlto.ll -o d/2.o8; RUN: wasm-ld --thinlto-emit-index-files -shared 1.o d/2.o -o 39; RUN: ls d/2.o.thinlto.bc10; RUN: ls 311; RUN: wasm-ld -shared 1.o d/2.o -o 312; RUN: llvm-nm 3 | FileCheck %s --check-prefix=NM13 14;; Basic ThinLTO tests.15; RUN: opt -module-summary %s -o 1.o16; RUN: opt -module-summary %p/Inputs/thinlto.ll -o d/2.o17; RUN: opt -module-summary %p/Inputs/thinlto_empty.ll -o 3.o18; RUN: cp 3.o 4.o19 20;; Ensure lld generates an index and also a binary if requested.21; RUN: wasm-ld --thinlto-emit-index-files -shared 1.o --start-lib d/2.o 3.o --end-lib 4.o -o 422; RUN: ls 423; RUN: llvm-bcanalyzer -dump 1.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND124; RUN: llvm-bcanalyzer -dump d/2.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND225; RUN: llvm-dis < 3.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND326; RUN: llvm-dis < 4.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND427 28; IMPORTS1: d/2.o29 30;; Ensure lld generates an index and not a binary if both emit-index and index-only are present.31; RUN: wasm-ld --thinlto-emit-index-files --thinlto-index-only -shared 1.o d/2.o -o 532; RUN: not ls 533 34;; Test that LLD generates an empty index even for lazy object file that is not added to link.35;; Test that LLD also generates empty imports file with the --thinlto-emit-imports-files option.36; RUN: rm -f 1.o.thinlto.bc 1.o.imports37; RUN: wasm-ld --thinlto-emit-index-files -shared d/2.o --start-lib 1.o --end-lib \38; RUN: --thinlto-emit-imports-files -o 739; RUN: ls 740; RUN: ls 1.o.thinlto.bc41; RUN: ls 1.o.imports42 43;; Ensure LLD generates an empty index for each bitcode file even if all bitcode files are lazy.44; RUN: rm -f 1.o.thinlto.bc45; RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-linux /dev/null -o dummy.o46; RUN: wasm-ld --thinlto-emit-index-files -shared dummy.o --start-lib 1.o --end-lib -o 847; RUN: ls 848; RUN: ls 1.o.thinlto.bc49 50;; Test that LLD errors out when run with suffix replacement, or prefix replacement51; RUN: not wasm-ld --thinlto-emit-index-files -shared d/2.o --start-lib 1.o --end-lib \52; RUN: --thinlto-prefix-replace="abc;xyz" 2>&1 | FileCheck %s --check-prefix=ERR153; ERR1: --thinlto-prefix-replace is not supported with --thinlto-emit-index-files54 55; RUN: not wasm-ld --thinlto-emit-index-files -shared d/2.o --start-lib 1.o --end-lib \56; RUN: --thinlto-object-suffix-replace="abc;xyz" 2>&1 | FileCheck %s --check-prefix=ERR257; ERR2: --thinlto-object-suffix-replace is not supported with --thinlto-emit-index-files58 59;; But not when passed with index only as well60; RUN: wasm-ld --thinlto-emit-index-files -shared d/2.o --start-lib 1.o --end-lib \61; RUN: --thinlto-prefix-replace="abc;xyz" --thinlto-index-only62 63; RUN: wasm-ld --thinlto-emit-index-files -shared d/2.o --start-lib 1.o --end-lib \64; RUN: --thinlto-object-suffix-replace="abc;xyz" --thinlto-index-only65 66; NM: T f67 68;; The backend index for this module contains summaries from itself and69;; Inputs/thinlto.ll, as it imports from the latter.70; BACKEND1: <MODULE_STRTAB_BLOCK71; BACKEND1-NEXT: <ENTRY {{.*}} record string = '1.o'72; BACKEND1-NEXT: <ENTRY {{.*}} record string = 'd/2.o'73; BACKEND1-NEXT: </MODULE_STRTAB_BLOCK74; BACKEND1: <GLOBALVAL_SUMMARY_BLOCK75; BACKEND1: <VERSION76; BACKEND1: <FLAGS77; BACKEND1: <VALUE_GUID {{.*}} op0={{1|2}} {{op1=3060885059 op2=1207956914|op1=3432075125 op2=3712786831}}78; BACKEND1: <VALUE_GUID {{.*}} op0={{1|2}} {{op1=3060885059 op2=1207956914|op1=3432075125 op2=3712786831}}79; BACKEND1: <COMBINED80; BACKEND1: <COMBINED81; BACKEND1: </GLOBALVAL_SUMMARY_BLOCK82 83;; The backend index for Input/thinlto.ll contains summaries from itself only,84;; as it does not import anything.85; BACKEND2: <MODULE_STRTAB_BLOCK86; BACKEND2-NEXT: <ENTRY {{.*}} record string = 'd/2.o'87; BACKEND2-NEXT: </MODULE_STRTAB_BLOCK88; BACKEND2-NEXT: <GLOBALVAL_SUMMARY_BLOCK89; BACKEND2-NEXT: <VERSION90; BACKEND2-NEXT: <FLAGS91; BACKEND2-NEXT: <VALUE_GUID {{.*}} op0=1 op1=3060885059 op2=120795691492; BACKEND2-NEXT: <COMBINED93; BACKEND2-NEXT: </GLOBALVAL_SUMMARY_BLOCK94 95; BACKEND3: ^0 = flags:96 97; BACKEND4: ^0 = module: (path: "4.o", hash: (0, 0, 0, 0, 0))98 99target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20"100target triple = "wasm32-unknown-unknown"101 102declare void @g(...)103 104define void @f() {105entry:106  call void (...) @g()107  ret void108}109