Debian Codegraph @

cross-project-tests/dtlto/link-savetemps.test

raw
1 REQUIRES: lld-link
2
3 # Test that DTLTO temporary files are "best-effort" cleaned up unless
4 # --save-temps is specified. We use archives in this test as the handling for
5 # archives requires a superset of the temporary files used for object inputs.
6
7 RUN: rm -rf %t && split-file %s %t && cd %t
8
9 RUN: %clang --target=x86_64-pc-windows-msvc -O2 t1.c -flto=thin -c
10
11 RUN: lld-link /lib /out:t.lib t1.o
12
13 DEFINE: %{tdir} = dummy-to-make-lit-work
14 DEFINE: %{dtlto} = mkdir %{tdir} && \
15 DEFINE: lld-link /subsystem:console /machine:x64 /out:%{tdir}/my.exe \
16 DEFINE: /wholearchive:t.lib \
17 DEFINE: -thinlto-distributor:%python \
18 DEFINE: -thinlto-distributor-arg:%llvm_src_root/utils/dtlto/local.py \
19 DEFINE: -thinlto-remote-compiler:%clang
20
21 # Check that temporary files are removed normally.
22 REDEFINE: %{tdir} = empty
23 RUN: %{dtlto}
24 RUN: ls %{tdir} | sort | FileCheck %s --check-prefixes=BOOKEND,ELF
25
26 # Check that --save-temps preserves temporary files.
27 REDEFINE: %{tdir} = savetemps
28 RUN: %{dtlto} /lldsavetemps
29 RUN: ls %{tdir} | sort | FileCheck %s --check-prefixes=BOOKEND,TEMPS,ELF,OTHER
30
31 # No files are expected before.
32 BOOKEND-NOT: {{.}}
33 TEMPS: {{^}}my.[[#PID:]].dist-file.json{{$}}
34 ELF: {{^}}my.exe{{$}}
35 OTHER: {{^}}my.exe.resolution.txt{{$}}
36 # Filename composition: <archive><member><member offset>.<task>.<pid>.<task>.<pid>.native.o.
37 TEMPS: {{^}}t.libt1.o[[#T1_OFFSET:]].1.[[#%X,HEXPID:]].1.[[#PID]].native.o{{$}}
38 TEMPS: {{^}}t.libt1.o[[#T1_OFFSET]].1.[[#%X,HEXPID]].1.[[#PID]].native.o.thinlto.bc{{$}}
39 TEMPS: {{^}}t.libt1.o[[#T1_OFFSET]].1.[[#%X,HEXPID]].o{{$}}
40 # No files are expected after.
41 BOOKEND-NOT: {{.}}
42
43 #--- t1.c
44 __attribute__((retain)) int mainCRTStartup() { return 0; }