Debian Codegraph @

lld/test/COFF/dtlto/options.test

raw
1 REQUIRES: x86
2
3 ## Test that DTLTO-specific options are handled correctly.
4
5 RUN: rm -rf %t && split-file %s %t && cd %t
6
7 RUN: opt -thinlto-bc foo.ll -o foo.obj
8
9 ## Not specifying a value for -thinlto-remote-compiler should result in an
10 ## error if -thinlto-distributor is specified.
11 RUN: not lld-link /entry:foo /subsystem:console foo.obj /out:my.exe \
12 RUN: -thinlto-distributor:fake.exe 2>&1 | FileCheck %s --check-prefix=COMPILER
13 RUN: lld-link /entry:foo /subsystem:console foo.obj /out:my.exe
14
15 ## Specifying an empty value for -thinlto-remote-compiler should result in an
16 ## error if -thinlto-distributor is specified.
17 RUN: not lld-link /entry:foo /subsystem:console foo.obj /out:my.exe \
18 RUN: -thinlto-distributor:fake.exe \
19 RUN: -thinlto-remote-compiler:"" 2>&1 | FileCheck %s --check-prefix=COMPILER
20 RUN: lld-link /entry:foo /subsystem:console foo.obj /out:my.exe \
21 RUN: -thinlto-remote-compiler:""
22
23 COMPILER: error: A value must be specified for /thinlto-remote-compiler if /thinlto-distributor is specified.
24
25 ## Test that DTLTO options are passed correctly to the distributor and
26 ## remote compiler.
27 ## Note: validate.py does not perform any compilation. Instead, it validates the
28 ## received JSON, pretty-prints the JSON and the supplied arguments, and then
29 ## exits with an error. This allows FileCheck directives to verify the
30 ## distributor inputs.
31 RUN: not lld-link /entry:foo /subsystem:console foo.obj /out:my.exe \
32 RUN: -thinlto-distributor:%python \
33 RUN: -thinlto-distributor-arg:%llvm_src_root/utils/dtlto/validate.py \
34 RUN: -thinlto-distributor-arg:darg1=10 \
35 RUN: -thinlto-distributor-arg:darg2=20 \
36 RUN: -thinlto-remote-compiler:my_clang.exe \
37 RUN: -thinlto-remote-compiler-arg:carg1=20 \
38 RUN: -thinlto-remote-compiler-arg:carg2=30 2>&1 | FileCheck %s
39
40 CHECK: distributor_args=['darg1=10', 'darg2=20']
41
42 CHECK: "linker_output": "my.exe"
43
44 CHECK: "my_clang.exe"
45 CHECK: "carg1=20"
46 CHECK: "carg2=30"
47
48 CHECK: error: DTLTO backend compilation: cannot open native object file:
49
50 #--- foo.ll
51 target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
52 target triple = "x86_64-pc-windows-msvc"
53
54 define void @foo() {
55 ret void
56 }