60 lines · plain
1; REQUIRES: x86, non-root-user2 3; Generate summary sections and test lld handling.4; RUN: opt -module-summary %s -o %t1.obj5; RUN: opt -module-summary %p/Inputs/thinlto.ll -o %t2.obj6 7; Include a file with an empty module summary index, to ensure that the expected8; output files are created regardless, for a distributed build system.9; RUN: opt -module-summary %p/Inputs/thinlto-empty.ll -o %t3.obj10 11; Ensure lld generates imports files if requested for distributed backends.12; RUN: rm -f %t3.obj.imports %t3.obj.thinlto.bc13; RUN: lld-link -entry:main -thinlto-index-only \14; RUN: -thinlto-emit-imports-files %t1.obj %t2.obj %t3.obj -out:%t4.exe15 16; The imports file for this module contains the bitcode file for17; Inputs/thinlto.ll18; RUN: cat %t1.obj.imports | count 119; RUN: cat %t1.obj.imports | FileCheck %s --check-prefix=IMPORTS120; IMPORTS1: thinlto-emit-imports.ll.tmp2.obj21 22; The imports file for Input/thinlto.ll is empty as it does not import anything.23; RUN: cat %t2.obj.imports | count 024 25; The imports file for Input/thinlto_empty.ll is empty but should exist.26; RUN: cat %t3.obj.imports | count 027 28; The index file should be created even for the input with an empty summary.29; RUN: ls %t3.obj.thinlto.bc30 31; Ensure lld generates error if unable to write to imports file.32; RUN: rm -f %t3.obj.imports33; RUN: touch %t3.obj.imports34; RUN: chmod 400 %t3.obj.imports35; RUN: not lld-link -entry:main -thinlto-index-only \36; RUN: -thinlto-emit-imports-files %t1.obj %t2.obj %t3.obj \37; RUN: -out:%t4.exe 2>&1 | FileCheck -DMSG=%errc_EACCES %s --check-prefix=ERR38; ERR: 'cannot open {{.*}}3.obj.imports': [[MSG]]39 40; Ensure lld doesn't generate import files when thinlto-index-only is not enabled41; RUN: rm -f %t1.obj.imports42; RUN: rm -f %t2.obj.imports43; RUN: rm -f %t3.obj.imports44; RUN: lld-link -entry:main -thinlto-emit-imports-files \45; RUN: %t1.obj %t2.obj %t3.obj -out:%t4.exe46; RUN: not ls %t1.obj.imports47; RUN: not ls %t2.obj.imports48; RUN: not ls %t3.obj.imports49 50target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"51target triple = "x86_64-pc-windows-msvc19.0.24215"52 53declare void @g(...)54 55define void @main() {56entry:57 call void (...) @g()58 ret void59}60