| 1 |
REQUIRES: x86-registered-target,ld.lld,llvm-ar |
| 2 |
|
| 3 |
# Test that DTLTO works with a mixture of FullLTO and ThinLTO bitcode archive members |
| 4 |
# where there is more than one LTO partition. |
| 5 |
|
| 6 |
RUN: rm -rf %t && split-file %s %t && cd %t |
| 7 |
|
| 8 |
RUN: %clang --target=x86_64-linux-gnu -flto -c one.c two.c |
| 9 |
RUN: %clang --target=x86_64-linux-gnu -flto=thin -c three.c |
| 10 |
|
| 11 |
RUN: llvm-ar rc archive.a one.o two.o three.o |
| 12 |
|
| 13 |
# Build with DTLTO. |
| 14 |
RUN: %clang --target=x86_64-linux-gnu -Werror -flto -fuse-ld=lld -nostdlib \ |
| 15 |
RUN: -Wl,--whole-archive archive.a \ |
| 16 |
RUN: -Wl,--thinlto-distributor=%python \ |
| 17 |
RUN: -Wl,--thinlto-distributor-arg=%llvm_src_root/utils/dtlto/local.py \ |
| 18 |
RUN: -Wl,--thinlto-remote-compiler=%clang \ |
| 19 |
RUN: -Wl,--save-temps,--lto-partitions=2 |
| 20 |
|
| 21 |
# Show that the FullLTO modules have been prepared for distribution, this is |
| 22 |
# not optimal but has no functional impact. |
| 23 |
RUN: FileCheck %s --input-file=a.out.resolution.txt |
| 24 |
|
| 25 |
# Filename composition: <archive>(<member> at <offset>).<task>.<pid>.o. |
| 26 |
CHECK: archive.a(one.o at [[#ONE_OFFSET:]]).1.[[#%X,HEXPID:]].o |
| 27 |
CHECK: archive.a(two.o at [[#TWO_OFFSET:]]).2.[[#%X,HEXPID]].o |
| 28 |
CHECK: archive.a(three.o at [[#THREE_OFFSET:]]).3.[[#%X,HEXPID]].o |
| 29 |
|
| 30 |
#--- one.c |
| 31 |
__attribute__((retain)) void one() {} |
| 32 |
|
| 33 |
#--- two.c |
| 34 |
__attribute__((retain)) void two() {} |
| 35 |
|
| 36 |
#--- three.c |
| 37 |
__attribute__((retain)) void three() {} |