brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · fbd8fd6 Raw
94 lines · plain
1REQUIRES: lld-link2 3## Test that a DTLTO link succeeds and outputs the expected set of files4## correctly when thin archives are present.5 6RUN: rm -rf %t && split-file %s %t && cd %t7 8## Compile bitcode. -O2 is required for cross-module importing.9RUN: %clang -O2 --target=x86_64-pc-windows-msvc -flto=thin -c \10RUN:   foo.c bar.c dog.c cat.c start.c11 12## Generate thin archives.13RUN: lld-link /lib /llvmlibthin /out:foo.lib foo.o14## Create this bitcode thin archive in a subdirectory to test the expansion of15## the path to a bitcode file that is referenced using "..", e.g., in this case16## "../bar.o".17RUN: mkdir lib18RUN: lld-link /lib /llvmlibthin /out:lib/bar.lib bar.o19## Create this bitcode thin archive with an absolute path entry containing "..".20RUN: lld-link /lib /llvmlibthin /out:dog.lib %t/lib/../dog.o21RUN: lld-link /lib /llvmlibthin /out:cat.lib cat.o22RUN: lld-link /lib /llvmlibthin /out:start.lib start.o23 24## Link from a different directory to ensure that thin archive member paths are25## resolved correctly relative to the archive locations.26RUN: mkdir %t/out && cd %t/out27RUN: lld-link /subsystem:console /machine:x64 /entry:start /out:my.exe  \28RUN:   %t/foo.lib %t/lib/bar.lib ../start.lib %t/cat.lib \29RUN:   /includeoptional:dog ../dog.lib \30RUN:   -thinlto-distributor:%python \31RUN:   -thinlto-distributor-arg:%llvm_src_root/utils/dtlto/local.py \32RUN:   -thinlto-remote-compiler:%clang \33RUN:   /lldsavetemps34 35## Check that the required output files have been created.36RUN: ls | FileCheck %s --check-prefix=OUTPUTS --implicit-check-not=cat37 38## JSON jobs description.39OUTPUTS-DAG: my.[[PID:[a-zA-Z0-9_]+]].dist-file.json40 41## Individual summary index files.42OUTPUTS-DAG: start.1.[[PID]].native.o.thinlto.bc{{$}}43OUTPUTS-DAG:   dog.2.[[PID]].native.o.thinlto.bc{{$}}44OUTPUTS-DAG:   foo.3.[[PID]].native.o.thinlto.bc{{$}}45OUTPUTS-DAG:   bar.4.[[PID]].native.o.thinlto.bc{{$}}46 47## Native output object files.48OUTPUTS-DAG: start.1.[[PID]].native.o{{$}}49OUTPUTS-DAG:   dog.2.[[PID]].native.o{{$}}50OUTPUTS-DAG:   foo.3.[[PID]].native.o{{$}}51OUTPUTS-DAG:   bar.4.[[PID]].native.o{{$}}52 53 54## It is important that cross-module inlining occurs for this test to show that Clang can55## successfully load the bitcode file dependencies recorded in the summary indices.56## Explicitly check that the expected importing has occurred.57 58RUN: llvm-dis start.1.*.native.o.thinlto.bc -o - | \59RUN:   FileCheck %s --check-prefixes=FOO,BAR,START60 61RUN: llvm-dis dog.2.*.native.o.thinlto.bc -o - | \62RUN:   FileCheck %s --check-prefixes=FOO,BAR,DOG,START63 64RUN: llvm-dis foo.3.*.native.o.thinlto.bc -o - | \65RUN:   FileCheck %s --check-prefixes=FOO,BAR,START66 67RUN: llvm-dis bar.4.*.native.o.thinlto.bc -o - | \68RUN:   FileCheck %s --check-prefixes=FOO,BAR,START69 70FOO-DAG:   foo.o71BAR-DAG:   bar.o72DOG-DAG:   dog.o73START-DAG: start.o74 75 76#--- foo.c77extern int bar(int), start(int);78__attribute__((retain)) int foo(int x) { return x + bar(x) + start(x); }79 80#--- bar.c81extern int foo(int), start(int);82__attribute__((retain)) int bar(int x) { return x + foo(x) + start(x); }83 84#--- dog.c85extern int foo(int), bar(int), start(int);86__attribute__((retain)) int dog(int x) { return x + foo(x) + bar(x) + start(x); }87 88#--- cat.c89__attribute__((retain)) void cat(int x) {}90 91#--- start.c92extern int foo(int), bar(int);93__attribute__((retain)) int start(int x) { return x + foo(x) + bar(x); }94